/* ============================================================
 * Boardly Chrome — TopBar (+ SubBar-Stub Sprint 8) — Story 0064a / ADR-0030
 *
 * Reverse-engineered aus .project/design/styles.css Zeilen 127-262.
 * Sprint-7-MVP: TopBar inklusive Brand-Dot, Brand-Fam, Top-Sep, Top-Btns,
 * Avatar-Stack. SubBar (Workspace-Switch + View-Tabs + FilterChip + AiPill)
 * ist Sprint-8-Stretch (Story 0064b) — Selektoren bleiben hier vorbereitet,
 * werden aber Sprint 7 nicht gerendert.
 *
 * Reihenfolge im HTML (App.razor): tokens.css -> shell.css -> chrome.css
 * -> board.css -> card.css -> pages.css.
 *
 * shell.css definiert die Topbar-Box-Klassen (.topbar, .brand, .brand-dot,
 * .brand-fam, .top-sep) bereits Sprint-1-konform; chrome.css ergaenzt nur
 * die Boardly.html-spezifischen Erweiterungen (.top-btn, .avatar-stack,
 * .avatar) und ueberschreibt nichts. Wenn Klassen kollidieren, gewinnt die
 * spaeter geladene Definition (chrome.css) per CSS-Cascade — Boardly.html-
 * Werte sind die kanonischen.
 * ============================================================ */

/* ---------- TopBar — Boardly.html-Werte (ueberschreiben shell.css minimal) ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13.5px;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}

.brand-dot {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: var(--ink);
    display: grid;
    place-items: center;
    color: var(--bg);
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 600;
}

.brand-fam {
    font-size: 11px;
    color: var(--ink-3);
    border-left: 1px solid var(--line-strong);
    padding-left: 10px;
    margin-left: 4px;
    font-family: var(--f-mono);
    letter-spacing: 0.02em;
}

.top-sep {
    flex: 1;
}

/* ---------- Top-Buttons (Boardly.html — Boards/Kalender/Bell/Einladen) ---------- */
.top-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--r-2);
    color: var(--ink-2);
    font-size: 12.5px;
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease);
}

.top-btn:hover {
    background: var(--bg-sunken);
    color: var(--ink);
}

.top-btn.primary {
    background: var(--ink);
    color: var(--bg);
}

.top-btn.primary:hover {
    background: oklch(from var(--ink) calc(l + 0.05) c h);
}

/* ---------- Avatar-Stack ---------- */
.avatar-stack {
    display: flex;
    padding-left: 4px;
}

.avatar-stack .avatar {
    margin-left: -6px;
    border: 2px solid var(--surface);
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-ink);
    letter-spacing: 0.02em;
}

/* ============================================================
 * Sub-Bar — Story 0064b / ADR-0030 (Sprint 8)
 *
 * Reverse-engineered aus .project/design/styles.css Zeilen 177-244.
 * Sprint-8-MVP rendert nur Workspace-Switch + Board-Title; ViewTabs/
 * FilterChip/Search/AvatarStack/AiPill kommen mit Sprint-9-Stories.
 * ============================================================ */
/* UI-Restyle: Toolbar als ZWEI bewusste, stabile Reihen (kein chaotisches Wrappen mehr).
   Reihe 1 = Identitaet + Views + Avatare + Archiv-Toggle + Zusammenfassung (rechts).
   Reihe 2 = Filter (links) + Suche (rechts). Alle Controls 28px → saubere Baseline. */
.subbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    min-width: 0;
}

.subbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Reihen-Slots brechen nicht um; der Spacer schiebt die rechte Gruppe nach rechts. */
.subbar-row > * {
    flex: 0 0 auto;
}

.subbar-spacer {
    flex: 1 1 auto;
    min-width: 8px;
}

/* Identitaet (Workspace + Titel) darf bei wenig Platz schrumpfen statt zu druecken. */
.subbar-row .board-title {
    min-width: 0;
}

.subbar-views,
.subbar-filters,
.subbar-search,
.subbar-avatars,
.subbar-ai {
    display: inline-flex;
    align-items: center;
}

/* Filter duerfen als Gruppe umbrechen, wenn die Zeile eng wird. */
.subbar-filters {
    flex-wrap: wrap;
    row-gap: 6px;
}

/* UI-Restyle: Archiv-Toggle als 28px-Pill statt grossem td-btn (war der Hoehen-Ausreisser
   in der Toolbar). Compound-Selektor schlaegt .td-btn aus theme-demo.css per Spezifitaet. */
.subbar-archived-lists-toggle.td-btn {
    height: 28px;
    min-height: 28px;
    padding: 0 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.subbar-archived-lists-toggle.td-btn:hover {
    border-color: var(--ink-3);
    color: var(--ink);
    background: var(--surface);
}

.workspace-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 6px;
    border-radius: var(--r-2);
    cursor: pointer;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
}

.workspace-switch:hover {
    background: var(--bg-sunken);
}

.workspace-switch .chev {
    color: var(--ink-3);
    font-size: 10px;
}

.board-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.board-title .sup {
    font-family: var(--f-mono);
    font-size: 10.5px;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.board-title .name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

/* ---------- Top-User (Sprint-1 Auth-Status — bleibt fuer Login/Logout-Kompatibilitaet) ---------- */
.top-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--ink-3);
    font-family: var(--f-mono);
}

.top-user-name {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}

.top-user-action {
    color: var(--ink-2);
    text-decoration: none;
    border-bottom: 1px dotted var(--line-strong);
    padding-bottom: 1px;
    transition: color .15s var(--ease);
}

.top-user-action:hover {
    color: var(--ink);
}

/* Story 0086 — FilterChip (portiert aus .project/design/Boardly.html .filter-chip). */
.filter-chip-wrap {
    position: relative;
    display: inline-block;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    font-size: 12px;
    color: var(--ink-2);
    background: var(--surface);
    cursor: pointer;
    list-style: none;
    user-select: none;
    white-space: nowrap;
}

/* <summary>-Default-Marker entfernen (Chip ist selbst der Trigger). */
.filter-chip::-webkit-details-marker { display: none; }
.filter-chip::marker { content: ""; }

.filter-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.filter-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.filter-chip-count {
    display: inline-grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--accent, #2563eb);
    color: #fff;
}

.filter-chip-caret { font-size: 9px; opacity: .7; }

.filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
}

.filter-menu-item:hover { background: var(--surface-2, rgb(0 0 0 / 4%)); }
.filter-menu-item input { accent-color: var(--ink); }

.filter-menu-empty {
    margin: 0;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--ink-3);
}

.filter-reset {
    height: 28px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    font-size: 12px;
    color: var(--ink-3);
    cursor: pointer;
}

.filter-reset:hover { color: var(--ink); border-color: var(--line-strong); }

.subbar-filters {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* View-Tabs (Story 0098) — Board/Kalender-Umschalter; Pill-Group im Stil der .filter-chip. */
.subbar-views {
    display: inline-flex;
    align-items: center;
}

.view-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
}

.view-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 12px;
    color: var(--ink-3);
    cursor: pointer;
    white-space: nowrap;
}

.view-tab:hover { color: var(--ink); }

.view-tab.active {
    background: var(--ink);
    color: var(--bg);
}

.view-tab-icon { font-size: 12px; line-height: 1; }

/* Story 0087 — Search-Input (portiert aus .project/design/Boardly.html .search). */
.search {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    background: var(--bg-sunken, rgb(0 0 0 / 4%));
    border-radius: var(--r-2, 8px);
    border: 1px solid transparent;
    width: 220px;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}

.search:focus-within { border-color: var(--line-strong); background: var(--surface); }

.search-icon { font-size: 12px; opacity: .7; }

.search-field {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    font-size: 12.5px;
    color: var(--ink);
}

.search-field::placeholder { color: var(--ink-3); }

/* native Such-Clear ausblenden — wir haben einen eigenen Clear-Button. */
.search-field::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.search-clear {
    border: 0;
    background: none;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
}

.search-clear:hover { color: var(--ink); }

/* Story 0087 — Match-Highlight im Card-Titel. */
.card-title mark {
    background: var(--accent-soft, #fde68a);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* SubBar — Avatar-Stack (ueberlappende Initialen-Kreise). */
.avatar-stack {
    display: inline-flex;
    align-items: center;
}

.avatar {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--avatar-bg, #64748b);
    border: 2px solid var(--surface);
    box-sizing: border-box;
    flex: 0 0 auto;
}

.avatar + .avatar { margin-left: -8px; }

.avatar-more {
    background: var(--surface-2, #e2e8f0);
    color: var(--ink-2);
    font-size: 9px;
}

/* Sofortiges CSS-Tooltip (statt native title-Verzoegerung). */
.avatar:hover { z-index: 2; }

.avatar[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--ink, #1e293b);
    color: var(--bg, #fff);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    padding: 3px 7px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
}

/* AiPill (Story 0104) — Board-Zusammenfassung "auf einen Blick" (heuristisch, kein LLM).
   Pille im Stil der .filter-chip, aber Akzent-getoent, damit sie sich abhebt; Panel
   im Card-Look (analog .filter-menu). */
.subbar-ai {
    display: inline-flex;
    align-items: center;
}

.ai-pill-wrap {
    position: relative;
    display: inline-block;
}

.ai-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid oklch(from var(--accent) l c h / 0.45);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: oklch(from var(--accent) l c h / 0.10);
    cursor: pointer;
    list-style: none;
    user-select: none;
    white-space: nowrap;
}

/* <summary>-Default-Marker entfernen (Pille ist selbst der Trigger). */
.ai-pill::-webkit-details-marker { display: none; }
.ai-pill::marker { content: ""; }

.ai-pill:hover { background: oklch(from var(--accent) l c h / 0.16); }

.ai-pill-icon { font-size: 13px; }
.ai-pill-caret { font-size: 9px; opacity: .7; }

.ai-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    width: 320px;
    max-width: 90vw;
    max-height: 420px;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgb(0 0 0 / 16%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-panel-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-panel-title {
    font-size: 13px;
    color: var(--ink);
}

.ai-panel-sub {
    font-size: 11px;
    color: var(--ink-3);
}

.ai-panel-empty {
    margin: 0;
    font-size: 13px;
    color: var(--ink-2);
}

.ai-panel-lead {
    margin: 0;
    font-size: 13px;
    color: var(--ink-2);
}

.ai-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--ink-2);
    background: var(--surface-2, rgb(0 0 0 / 4%));
}

.ai-stat b { color: var(--ink); font-weight: 700; }

.ai-stat-warn {
    color: oklch(from var(--accent) l c h);
    background: oklch(from var(--accent) l c h / 0.12);
}

.ai-highlights {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-highlight {
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink-2);
}

/* Notification-Bell (Story 0105) */
.notif-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notif-bell {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink, #1e293b);
    cursor: pointer;
    line-height: 1;
}

.notif-bell:hover {
    background: var(--surface-2, #e2e8f0);
}

.notif-bell-icon {
    font-size: 15px;
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: var(--danger, #ef4444);
    border: 2px solid var(--surface);
    border-radius: 999px;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--surface, #fff);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    z-index: 50;
}

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.notif-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink, #1e293b);
}

.notif-mark-all {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent, #2563eb);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
}

.notif-mark-all:disabled {
    color: var(--ink-2, #94a3b8);
    cursor: default;
}

.notif-empty {
    padding: 18px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--ink-2, #94a3b8);
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.notif-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--surface-2, #f1f5f9);
}

.notif-item.is-unread {
    background: var(--accent-soft, #eff6ff);
}

.notif-item-title {
    font-size: 13px;
    color: var(--ink, #1e293b);
}

.notif-item-time {
    font-size: 11px;
    color: var(--ink-2, #94a3b8);
}
