/*
 * Watchlist-Modul (Phase A) — 1:1 nach Bauplan docs/finnavigator_watchlists_v1.html.
 * Präfix wl-. Nur var(--fn-*)-Tokens. Layout-Stabilität: table-layout fixed.
 */

.wl-page {
    display: flex;
    min-height: calc(100vh - 7rem);
    background: var(--fn-bg);
    border: var(--fn-border-width) solid var(--fn-border-strong);
    border-radius: var(--fn-radius-lg);
    overflow: hidden;
    font-family: var(--fn-font);
    color: var(--fn-text);
}

.wl-page .lucide { stroke-width: 1.6; width: 18px; height: 18px; flex: 0 0 auto; }
.wl-page .lucide.small { width: 13px; height: 13px; }

/* ===== Listen-Spalte ===== */
.wl-col-mid {
    width: 280px; flex: 0 0 280px;
    background: var(--fn-bg-muted);
    border-right: var(--fn-border-width) solid var(--fn-border);
    display: flex; flex-direction: column; overflow: hidden;
}
.wl-col-head { padding: 22px 20px 14px; border-bottom: var(--fn-border-width) solid var(--fn-border); }
.wl-col-head h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: var(--fn-font-weight-bold); margin: 0; }
.wl-col-head .wl-ico { display: flex; color: var(--fn-text-secondary); }
.wl-col-head .wl-sub { margin-top: 6px; font-size: 12px; color: var(--fn-text-tertiary); }

.wl-cat-list { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.wl-eyebrow {
    padding: 12px 12px 6px; font-size: 11px; font-weight: var(--fn-font-weight-bold);
    letter-spacing: .12em; text-transform: uppercase; color: var(--fn-text-tertiary);
}
.wl-cat-list > .wl-eyebrow:first-child { padding-top: 2px; }
.wl-cat {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: var(--fn-radius-sm); cursor: pointer; color: var(--fn-text-secondary);
    background: transparent; border: none; width: 100%; text-align: left;
    font-family: var(--fn-font); transition: background .16s, color .16s;
}
.wl-cat .wl-ico { display: flex; color: var(--fn-text-tertiary); }
.wl-cat:hover { background: var(--fn-bg-alt); color: var(--fn-text); }
.wl-cat.wl-active { background: var(--fn-accent-soft); color: var(--fn-text); }
.wl-cat.wl-active .wl-ico { color: var(--fn-primary); }
.wl-cat .wl-label { flex: 1; font-size: 13.5px; font-weight: var(--fn-font-weight-medium); }
.wl-cat .wl-count {
    font-family: var(--fn-font-mono); font-size: 11.5px; color: var(--fn-text-tertiary);
    background: var(--fn-bg); border: var(--fn-border-width) solid var(--fn-border);
    border-radius: var(--fn-radius-pill); padding: 1px 9px; min-width: 26px; text-align: center;
}
.wl-cat.wl-active .wl-count { color: var(--fn-primary); border-color: var(--fn-accent-line); background: var(--fn-accent-soft); }

.wl-col-foot { padding: 12px; border-top: var(--fn-border-width) solid var(--fn-border); }
.wl-btn-newlist {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--fn-font); font-size: 12.5px; font-weight: var(--fn-font-weight-medium);
    color: var(--fn-text-secondary); background: transparent;
    border: var(--fn-border-width) dashed var(--fn-border-strong);
    padding: 9px; border-radius: var(--fn-radius-sm); cursor: pointer;
    transition: color .16s, border-color .16s;
}
.wl-btn-newlist:hover { color: var(--fn-primary); border-color: var(--fn-accent-line); }
.wl-btn-newlist .lucide { width: 14px; height: 14px; }

/* ===== Arbeitsfläche ===== */
.wl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.wl-crumb {
    padding: 14px 28px; border-bottom: var(--fn-border-width) solid var(--fn-border);
    display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fn-text-secondary);
}
.wl-crumb a { color: var(--fn-text-secondary); text-decoration: none; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.wl-crumb a:hover { background: var(--fn-bg-alt); color: var(--fn-text); }
.wl-crumb .wl-sep { color: var(--fn-text-tertiary); font-size: 14px; }
.wl-crumb .wl-here { color: var(--fn-text); padding: 3px 6px; font-weight: var(--fn-font-weight-medium); }

.wl-head {
    padding: 20px 28px; border-bottom: var(--fn-border-width) solid var(--fn-border);
    display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.wl-head-l h1 {
    font-size: 22px; font-weight: var(--fn-font-weight-bold); letter-spacing: -.01em;
    display: flex; align-items: center; gap: 12px; margin: 0 0 6px 0;
}
.wl-head-l h1 .wl-list-ico { display: flex; color: var(--fn-cat-blue); }
.wl-head-l h1 .wl-sym-ex {
    font-family: var(--fn-font-mono); font-size: 13px; font-weight: var(--fn-font-weight-regular);
    color: var(--fn-text-secondary); background: var(--fn-bg-alt);
    border: var(--fn-border-width) solid var(--fn-border); padding: 3px 9px; border-radius: 6px;
}
.wl-kpi-row { display: flex; gap: 22px; flex-wrap: wrap; }
.wl-kpi { display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.wl-kpi .k {
    font-size: 10.5px; font-weight: var(--fn-font-weight-bold); letter-spacing: .10em;
    text-transform: uppercase; color: var(--fn-text-tertiary);
}
.wl-kpi .v { font-family: var(--fn-font-mono); font-size: 15px; color: var(--fn-text); white-space: nowrap; }
.wl-kpi .v.pos { color: var(--fn-success); }
.wl-kpi .v.neg { color: var(--fn-danger); }

.wl-head-r { display: flex; align-items: center; gap: 10px; }
.wl-btn {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
    font-weight: var(--fn-font-weight-medium); color: var(--fn-text-secondary);
    background: transparent; border: var(--fn-border-width) solid var(--fn-border);
    padding: 6px 11px; border-radius: 8px; cursor: pointer; font-family: var(--fn-font);
    transition: background .14s, color .14s, border-color .14s;
}
.wl-btn:hover { background: var(--fn-bg-muted); color: var(--fn-text); border-color: var(--fn-border-strong); }
.wl-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.wl-btn-primary { color: var(--fn-on-primary); background: var(--fn-primary); border-color: var(--fn-primary); }
.wl-btn-primary:hover:not(:disabled) { background: var(--fn-primary-hover); color: var(--fn-on-primary); }
.wl-btn .lucide { width: 13px; height: 13px; }

.wl-content { overflow-y: auto; padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.wl-loading { padding: 28px; color: var(--fn-text-secondary); font-size: 13.5px; }

.wl-panel {
    background: var(--fn-bg-alt); border: var(--fn-border-width) solid var(--fn-border);
    border-radius: var(--fn-radius-lg); overflow: hidden;
}
.wl-panel-h {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: var(--fn-border-width) solid var(--fn-border);
}
.wl-panel-h h3 { font-size: 14px; font-weight: var(--fn-font-weight-bold); display: flex; align-items: center; gap: 9px; margin: 0; }
.wl-panel-h .wl-ico { display: flex; color: var(--fn-text-secondary); }
.wl-eyebrow-inline {
    font-size: 11px; font-weight: var(--fn-font-weight-bold); letter-spacing: .08em;
    text-transform: uppercase; color: var(--fn-text-tertiary); margin-left: 6px;
}
/* Freitext-Suche: geteilt über .fn-search (fn-list.css). */
.wl-actions { display: flex; gap: 8px; }

/* ===== Wertpapier-Tabelle — Doppelzeilen-Layout (Flatex-Vorbild) ===== */
/* table-layout auto + nowrap: jede Zahl steht auf eigener Zeile, „137,54 %" wird nie
   abgeschnitten; bei vielen Gruppen scrollt der Wrapper horizontal statt zu quetschen. */
.wl-items-scroll { overflow-x: auto; }
/* Tabellen-/Stack-/Identitäts-/Delta-Visual kommt aus dem geteilten fn-list.css (Manifest §11).
   Hier nur Watchlist-Spezifika: Spaltenbreiten, Sortier-Buttons, Instrumenttyp-Label. */
table.wl-items th.badge-col { width: 44px; }
table.wl-items th.event-col { min-width: 150px; }
table.wl-items th.marker-col { width: 104px; }

/* Sortier-Buttons: geteilt über .fn-sort (fn-list.css). */

.wl-typ { font-size: 11.5px; color: var(--fn-text-secondary); }
.wl-typ.lever { color: var(--fn-cat-orange); }

/* Marker icons moved to the shared fn-markers.css component (.fn-markers / .fn-marker). */

/* ===== Notiz-Panel ===== */
.wl-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.wl-detail-col { padding: 16px 18px; }
.wl-detail-col + .wl-detail-col { border-left: var(--fn-border-width) solid var(--fn-border); }
.wl-detail-col h4 {
    font-size: 12px; font-weight: var(--fn-font-weight-bold); letter-spacing: .08em;
    text-transform: uppercase; color: var(--fn-text-tertiary);
    margin: 0 0 10px 0; display: flex; align-items: center; gap: 8px;
}
.wl-detail-col h4 .lucide { width: 14px; height: 14px; }
.wl-note-input {
    width: 100%; background: var(--fn-input-bg);
    border: var(--fn-border-width) solid var(--fn-input-border); border-radius: var(--fn-radius-sm);
    color: var(--fn-text); font-family: var(--fn-font); font-size: 13px; line-height: 1.55;
    padding: 12px 14px; resize: vertical;
}
.wl-note-input:focus { outline: none; box-shadow: var(--fn-focus-ring); }
.wl-note-meta { font-size: 11px; color: var(--fn-success); margin-top: 8px; }
.wl-ai-hint {
    border: var(--fn-border-width) solid var(--fn-border); border-left: 3px solid var(--fn-cat-purple);
    background: var(--fn-cat-purple-soft); border-radius: var(--fn-radius-sm);
    padding: 12px 14px; font-size: 12.5px; line-height: 1.55; color: var(--fn-text-secondary);
}

.wl-checkbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--fn-text); text-transform: none; letter-spacing: 0; }

/* Notiz im schwebenden Fenster — Inhalt füllt das Fenster (Resize-Fix),
   Speichern/Abbrechen UNTEN (Niko 05.06.2026). */
.wl-note-host { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.wl-note-actions { justify-content: flex-end; flex: 0 0 auto; }
.wl-note-host .wl-detail-grid {
    border: var(--fn-border-width) solid var(--fn-border); border-radius: var(--fn-radius);
    flex: 1 1 auto; min-height: 0;
    /* Die EINE Grid-Zeile darf nicht über den Rahmen wachsen (implizit waere sie 'auto'):
       lange Notizen scrollen dann IM Editor statt unter Rahmen + Buttons durchzulaufen. */
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
}
.wl-note-grid .wl-detail-col { display: flex; flex-direction: column; min-height: 0; }
.wl-note-editor-col .fn-richtext { flex: 1 1 auto; min-height: 160px; }
.wl-note-grid .wl-ai-hint { flex: 1 1 auto; overflow-y: auto; }

/* ===== Slice 2: Dialoge "Neue Watchlist" + "Wertpapier hinzufuegen" =====
   1:1 nach Bauplan docs/finnavigator_watchlist_add_security_v1.html:
   Standard-Icons oben (Fensterkopf), Aktions-Buttons unten, Inhalt waechst mit. */

.wl-dlg {
    display: flex; flex-direction: column;
    margin: -16px -18px; height: calc(100% + 32px); /* Fensterkoerper-Polster aufheben */
}
.wl-dlg-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding: 16px 18px; display: flex; flex-direction: column; gap: 14px;
}
.wl-dlg-foot {
    flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-top: var(--fn-border-width) solid var(--fn-border);
    background: var(--fn-bg-muted);
}
.wl-dlg-spacer { flex: 1; }
.wl-dlg-count {
    font-size: 12px; color: var(--fn-text-secondary);
    display: inline-flex; align-items: center; gap: 7px;
}
.wl-dlg-count .lucide { width: 14px; height: 14px; color: var(--fn-primary); }
.wl-dlg-status { font-size: 12px; color: var(--fn-success); }
.wl-dlg-error { font-size: 12px; color: var(--fn-danger); }

.wl-field { display: flex; flex-direction: column; gap: 6px; }
.wl-field-label {
    font-size: 10.5px; font-weight: var(--fn-font-weight-bold);
    letter-spacing: .08em; text-transform: uppercase; color: var(--fn-text-tertiary);
}
.wl-input, .wl-select {
    width: 100%; background: var(--fn-input-bg);
    border: var(--fn-border-width) solid var(--fn-input-border); border-radius: 8px;
    color: var(--fn-text); font-family: var(--fn-font); font-size: 13px; padding: 8px 10px;
}
.wl-input:focus, .wl-select:focus { outline: none; box-shadow: var(--fn-focus-ring); }
.wl-hint { font-size: 11.5px; color: var(--fn-text-tertiary); line-height: 1.55; }

/* Katalog-Suche (hervorgehobener Fokus-Rahmen wie im Bauplan) */
.wl-dlg-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--fn-input-bg);
    border: var(--fn-border-width) solid var(--fn-accent-line); border-radius: var(--fn-radius-sm);
    padding: 8px 12px; color: var(--fn-text-tertiary);
    box-shadow: 0 0 0 3px var(--fn-accent-soft);
}
.wl-dlg-search input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--fn-text); font-family: var(--fn-font); font-size: 13px;
}
.wl-dlg-search .lucide { width: 15px; height: 15px; }

/* Trefferliste */
.wl-dlg-results {
    border: var(--fn-border-width) solid var(--fn-border);
    border-radius: var(--fn-radius-sm); overflow: hidden auto; max-height: 320px;
}
.wl-dlg-table { table-layout: fixed; }
.wl-dlg-table .check-col { width: 40px; }
.wl-dlg-table .source-col { width: 120px; }
.wl-dlg-table tbody tr { cursor: pointer; }
.wl-dlg-table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--fn-primary); }
.wl-dlg-table tr.wl-sel td { background: var(--fn-accent-soft); }
.wl-dlg-table tr.wl-dim td { opacity: .45; cursor: default; }
.wl-already { font-size: 11px; color: var(--fn-text-tertiary); font-style: italic; }

.wl-src-badge {
    font-size: 10.5px; font-weight: var(--fn-font-weight-bold); letter-spacing: .06em;
    text-transform: uppercase; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.wl-src-import {
    color: var(--fn-cat-teal); background: var(--fn-cat-teal-soft);
    border: var(--fn-border-width) solid var(--fn-cat-teal-line, rgba(45, 212, 191, .3));
}
.wl-src-catalog {
    color: var(--fn-cat-purple); background: var(--fn-cat-purple-soft);
    border: var(--fn-border-width) solid var(--fn-cat-purple-line, rgba(167, 139, 250, .3));
}

/* Symbol-Auswahl (Neue Watchlist) */
.wl-icon-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.wl-icon-pick {
    width: 38px; height: 38px; border-radius: var(--fn-radius-sm);
    background: var(--fn-input-bg); border: var(--fn-border-width) solid var(--fn-border);
    color: var(--fn-text-secondary); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .14s, color .14s, border-color .14s;
}
.wl-icon-pick:hover { border-color: var(--fn-border-strong); color: var(--fn-text); }
.wl-icon-pick.active {
    background: var(--fn-accent-soft); border-color: var(--fn-accent-line); color: var(--fn-primary);
}

/* Live-Vorschau: so erscheint die Liste links in der Listen-Spalte */
.wl-live-preview {
    border: 1px dashed var(--fn-border-strong); border-radius: var(--fn-radius-sm);
    padding: 10px 12px; background: var(--fn-bg-muted);
}
.wl-live-preview .wl-eyebrow { margin-bottom: 8px; padding: 0; }
.wl-cat-static { cursor: default; }
