/* ==========================================================================
   weekly_report.css  -  Vertriebsreport (auto-befuellt aus CRM/Sage)
   ========================================================================== */

.wreport { max-width: 1400px; }

/* ---- Kopf / Ueberschriften ---- */
.wr-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.wr-h2 { font-size: 1.35rem; font-weight: 600; margin: 0; }
.wr-sub { color: #64748b; margin: 4px 0 0; font-size: .9rem; }
.wr-h3 {
    font-size: 1rem; font-weight: 600; margin: 0 0 4px;
    display: flex; align-items: center; gap: 8px; color: #1e293b; flex-wrap: wrap;
}
.wr-h3 .bi { color: #1F3864; }
.wr-hint { color: #64748b; font-size: .82rem; margin: 0 0 12px; }
.wr-auto-badge {
    font-size: .68rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
    color: #0f766e; background: #ccfbf1; border: 1px solid #99f6e4;
    padding: 2px 8px; border-radius: 999px;
}

.wr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wr-actions-bottom { justify-content: flex-end; margin-top: 12px; }
.wr-editor-title { display: flex; align-items: center; gap: 10px; }
.wr-back { padding: 0; text-decoration: none; font-size: .9rem; }

/* ---- Karten ---- */
.wr-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 18px 20px; margin-bottom: 16px;
}

/* ---- Uebersichtsliste ---- */
.wr-list { display: flex; flex-direction: column; gap: 10px; }
.wr-empty { color: #94a3b8; text-align: center; padding: 40px 10px; }
.wr-list-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px;
}
.wr-list-item:hover { border-color: #cbd5e1; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.wr-li-title { font-weight: 600; color: #1e293b; }
.wr-li-meta { color: #64748b; font-size: .82rem; margin-top: 2px; }
.wr-li-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- Meta-Formular ---- */
.wr-grid-meta {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 16px;
}
.wr-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.wr-field > span { font-size: .78rem; font-weight: 600; color: #475569; }
.wr-field-wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .wr-grid-meta { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .wr-grid-meta { grid-template-columns: 1fr; } }

/* ---- Erzeugen-Leiste ---- */
.wr-genbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 16px; padding-top: 14px; border-top: 1px dashed #e2e8f0;
}
.wr-genhint { color: #64748b; font-size: .84rem; }
.wr-asof {
    color: #475569; font-size: .8rem; font-weight: 500;
    background: #f1f5f9; border-radius: 6px; padding: 4px 10px; margin-left: auto;
}

/* ---- Financial Summary ---- */
.wr-fin-wrap { overflow-x: auto; }
.wr-fin-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 560px; }
.wr-fin-table th, .wr-fin-table td {
    padding: 7px 12px; text-align: right; border-bottom: 1px solid #eef2f7; white-space: nowrap;
}
.wr-fin-table thead th {
    background: #1F3864; color: #fff; font-weight: 600; text-align: right;
}
.wr-fin-table thead th:first-child { border-top-left-radius: 8px; text-align: left; }
.wr-fin-table thead th:last-child { border-top-right-radius: 8px; }
.wr-fin-label { text-align: left !important; font-weight: 500; color: #334155; }
.wr-fin-team { background: #f8fafc; font-weight: 600; }
.wr-fin-calc td { color: #475569; font-style: italic; }
.wr-fin-table .wr-neg { color: #dc2626; }
.wr-fin-input {
    width: 120px; text-align: right; padding: 3px 8px; font-size: .85rem;
    display: inline-block; margin-left: auto;
}

/* ---- Verkaeufer-Bloecke (Pipeline / Visits) ---- */
.wr-repblock {
    border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 14px; overflow: hidden;
}
.wr-repblock-un { border-color: #fcd34d; background: #fffbeb; }
.wr-repblock-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 14px; background: #f8fafc; border-bottom: 1px solid #eef2f7;
}
.wr-repblock-un .wr-repblock-head { background: #fef3c7; border-bottom-color: #fde68a; }
.wr-repblock-name { font-weight: 600; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.wr-repblock-un .wr-repblock-name .bi { color: #d97706; }
.wr-count {
    font-size: .72rem; font-weight: 600; color: #475569;
    background: #e2e8f0; border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.wr-empty-rows { color: #94a3b8; font-size: .84rem; padding: 12px 14px; }

/* ---- Zeilentabellen ---- */
.wr-tablescroll { overflow-x: auto; }
.wr-rowtable { width: 100%; border-collapse: collapse; font-size: .84rem; }
.wr-rowtable th, .wr-rowtable td {
    padding: 6px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; text-align: left;
}
.wr-rowtable thead th {
    background: #f1f5f9; color: #475569; font-weight: 600; font-size: .76rem;
    text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.wr-ro { color: #334155; }
.wr-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wr-onum { display: block; font-size: .72rem; color: #94a3b8; }
.wr-updates-auto { color: #475569; font-size: .8rem; line-height: 1.4; max-width: 340px; }
.wr-comment { min-height: 32px; resize: vertical; }
.wr-w-win { width: 64px; text-align: right; }
.wr-w-date { width: 96px; }
.wr-sec, .wr-assign { min-width: 120px; }

/* ---- Toast ---- */
.wr-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px);
    background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: .88rem; box-shadow: 0 6px 20px rgba(15,23,42,.25);
    opacity: 0; transition: opacity .25s, transform .25s; z-index: 3000;
}
.wr-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.wr-toast-ok { background: #0f766e; }
.wr-toast-err { background: #b91c1c; }

/* ---- Diagnose-Banner (keine Angebote fuer Tochter) ---- */
.wr-diag {
    border: 1px solid #fcd34d; background: #fffbeb; border-radius: 10px;
    padding: 12px 16px; margin-bottom: 16px;
}
.wr-diag-title { font-weight: 600; color: #92400e; display: flex; align-items: center; gap: 8px; }
.wr-diag-body { color: #78350f; font-size: .85rem; margin-top: 6px; line-height: 1.5; }
.wr-diag-hint { color: #a16207; font-style: italic; }

/* ---- Deal-Auswahl (v3) ---- */
.wr-col-incl { width: 44px; text-align: center; }
.wr-incl { cursor: pointer; }
.wr-row-off { opacity: .45; }
.wr-row-off input:not(.wr-incl), .wr-row-off textarea, .wr-row-off select { pointer-events: none; }
.wr-w-val { width: 96px; text-align: right; }
.wr-w-when { width: 110px; }
.wr-badge-man {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
    background: #ede9fe; color: #6d28d9; font-size: .68rem; font-weight: 600; vertical-align: middle;
}

/* ---- Spartenauswahl im Kopf ---- */
.wr-div-picker { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 6px 0 2px; }
.wr-div-opt { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-weight: 400; cursor: pointer; }
.wr-div-opt input { margin: 0; }
.wr-div-opt span { font-size: .85rem; color: var(--text-color); }

/* ---- Verlinkung in die Detailansichten ---- */
.wr-link { color: #1d4ed8; text-decoration: none; font-weight: 500; }
.wr-link:hover { text-decoration: underline; }
.wr-link-sub { color: #64748b; text-decoration: none; }
.wr-link-sub:hover { color: #1d4ed8; text-decoration: underline; }
.wr-row-done .wr-link, .wr-row-done .wr-link-sub { color: inherit; }

/* ---- Datumsangabe an Objekten ---- */
.wr-date { display: block; font-size: .7rem; color: #94a3b8; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---- Erledigte Deals (Bearbeitungsstand im Report) ---- */
.wr-row-done { opacity: .45; }
.wr-row-done td:not(.wr-col-incl) { text-decoration: line-through; text-decoration-color: #cbd5e1; }
.wr-row-done input:not(.wr-done), .wr-row-done textarea, .wr-row-done select { pointer-events: none; }

/* ---- Zuordnungsliste: Filterleiste ---- */
.wr-ua-filter {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.wr-ua-q { flex: 1 1 260px; max-width: 380px; }
.wr-ua-sel { flex: 0 0 auto; width: auto; min-width: 9rem; }
.wr-ua-count { font-size: .78rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.wr-ua-empty { text-align: center; color: var(--text-muted); padding: 18px 0; font-size: .85rem; }
.wr-ua-won {
    display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
    background: #dcfce7; color: #15803d; font-size: .68rem; font-weight: 600; white-space: nowrap;
}
.wr-ua-div {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
    background: #eef2ff; color: #4338ca; font-size: .68rem; font-weight: 600; white-space: nowrap;
}

/* ---- Financial Summary: Personenspalten ---- */
.wr-fin-person { text-align: right; white-space: nowrap; }
.wr-fin-unassigned { color: #92400e; }
#wr-fin-table td.wr-fin-team[data-col]:not([data-col="__team__"]) { color: #475569; }
#wr-fin-table th.wr-fin-person { font-size: .8rem; }
#wr-fin-table { table-layout: auto; }

/* ---- Hitrate im Pipeline-Bedarf ---- */
.wr-hit-wrap { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; }
.wr-hit-input {
    width: 3.4rem; padding: 1px 4px; text-align: right;
    border: 1px solid var(--border-color); border-radius: 4px;
    font-size: .8rem; font-variant-numeric: tabular-nums; background: #fff;
}
.wr-hit-input:focus { outline: none; border-color: #2563eb; }
.wr-hit-pct { font-size: .8rem; color: var(--text-muted); }

/* ---- Uebersteuerter Wechselkurs ---- */
.wr-fx-manual input.wr-fx-rate { border-color: #f59e0b; background: #fffbeb; }
.wr-fx-badge {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
    background: #fef3c7; color: #92400e; font-size: .68rem; font-weight: 600; vertical-align: middle;
}
.wr-fx-reset { padding: 0 4px; color: #b45309; text-decoration: none; }
.wr-fx-reset:hover { color: #92400e; }

/* ---- Besuchsplan (Quelle: Aktivitaeten typ=besuch) ---- */
.wr-w-datecell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.wr-vstatus {
    display: inline-block; padding: 1px 8px; border-radius: 10px;
    font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.wr-vstatus-planned { background: #dbeafe; color: #1d4ed8; }
.wr-vstatus-done    { background: #dcfce7; color: #15803d; }
.wr-badge-legacy {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
    background: #fef3c7; color: #92400e; font-size: .68rem; font-weight: 600; vertical-align: middle;
}
.wr-vnotes { display: block; margin-top: 3px; font-size: .76rem; color: #64748b; line-height: 1.4; }

/* ---- Picker (beendete Deals / Leads / Besuche aufnehmen) ---- */
.wr-picker { position: fixed; inset: 0; z-index: 3200; display: flex; align-items: center; justify-content: center; }
.wr-picker-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.wr-picker-dialog {
    position: relative; z-index: 1; width: min(560px, 92vw); max-height: 82vh;
    background: #fff; border-radius: 12px; box-shadow: 0 18px 50px rgba(15,23,42,.3);
    display: flex; flex-direction: column; overflow: hidden;
}
.wr-picker-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #e2e8f0;
}
.wr-picker-title { font-weight: 600; font-size: 1rem; color: #0f172a; }
.wr-picker-tools { padding: 12px 18px 6px; }
.wr-picker-list { overflow-y: auto; padding: 6px 12px 14px; }
.wr-pick-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 12px; border-radius: 8px; border: 1px solid #eef2f7; margin-top: 6px;
}
.wr-pick-item:hover { background: #f8fafc; }
.wr-pick-main { min-width: 0; }
.wr-pick-name { font-weight: 500; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-pick-meta { font-size: .76rem; color: #94a3b8; margin-top: 2px; }
.wr-pick-tag { font-size: .76rem; color: #0f766e; font-weight: 600; white-space: nowrap; }
.wr-pick-used { opacity: .6; }

/* ---- Waehrung / FX ---- */
.wr-fx { margin: 0 0 14px; }
.wr-fx-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.wr-fx-lbl { font-size: 13px; font-weight: 600; color: #334155; margin: 0; }
.wr-fx-target { width: auto; min-width: 130px; }
.wr-fx-date { font-size: 12px; color: #64748b; }
.wr-fx-rates { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; max-width: 420px; }
.wr-fx-rates-hint { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.wr-fx-table { border-collapse: collapse; }
.wr-fx-table td { padding: 3px 8px 3px 0; vertical-align: middle; }
.wr-fx-pair { font-size: 13px; color: #334155; white-space: nowrap; text-align: right; }
.wr-fx-tgt { font-size: 13px; color: #334155; }
.wr-fx-rate { width: 120px; text-align: right; }
.wr-fin-ccy { font-weight: 600; color: #64748b; font-size: 12px; }
.wr-valwrap { display: flex; align-items: center; gap: 4px; }
.wr-val-ccy { font-size: 12px; color: #64748b; }

/* ---- Unassigned (offene Deals ohne Verkaeufer) ---- */
#wr-unassigned-section .wr-hint { margin-bottom: 8px; }
.wr-ua-table td { vertical-align: middle; }
.wr-ua-seller { min-width: 150px; }
.wr-ua-assign { white-space: nowrap; }
