/* ============================= TOKENS ============================= */
:root{
  color-scheme: light;
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Cascadia Mono', ui-monospace, monospace;

  --bg-page: #EFF4F4;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F5F9F8;
  --bg-surface-hover: #EAF1F0;
  --border: rgba(13,34,32,0.11);
  --border-strong: rgba(13,34,32,0.18);
  --text-primary: #0E1E1C;
  --text-secondary: #53635F;
  --text-muted: #869491;
  --text-on-accent: #FFFFFF;

  --accent: #0B7A72;
  --accent-strong: #075E58;
  --accent-soft: rgba(11,122,114,0.10);
  --accent-soft-strong: rgba(11,122,114,0.18);

  --sidebar-bg: #0B211F;
  --sidebar-bg-active: #123531;
  --sidebar-text: #C6D8D4;
  --sidebar-text-dim: #6C8985;
  --sidebar-text-active: #FFFFFF;
  --sidebar-border: rgba(255,255,255,0.08);
  --sidebar-accent: #2FC7B8;

  --shadow-card: 0 1px 2px rgba(14,30,28,0.05), 0 6px 20px rgba(14,30,28,0.06);
  --shadow-drawer: -12px 0 40px rgba(14,30,28,0.14);
  --shadow-modal: 0 30px 70px rgba(14,30,28,0.28);
  --shadow-pop: 0 8px 24px rgba(14,30,28,0.14);

  /* policy type identity — validated categorical set */
  --type-trafik: #2A78D6;
  --type-dask: #EB6834;
  --type-kasko: #4A3AA7;
  --type-saglik: #008300;
  --type-mesuliyet: #E87BA4;

  /* fixed status roles — never repurposed */
  --status-good: #0CA30C;
  --status-good-bg: rgba(12,163,12,0.12);
  --status-warning: #C98500;
  --status-warning-bg: rgba(250,178,25,0.18);
  --status-serious: #D9612F;
  --status-serious-bg: rgba(236,131,90,0.16);
  --status-critical: #D03B3B;
  --status-critical-bg: rgba(208,59,59,0.13);

  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
}

@media (prefers-color-scheme: dark){
  :root:where(:not([data-theme="light"])){
    color-scheme: dark;
    --bg-page: #0B1213;
    --bg-surface: #121B1C;
    --bg-surface-2: #182423;
    --bg-surface-hover: #1D2B2A;
    --border: rgba(255,255,255,0.09);
    --border-strong: rgba(255,255,255,0.16);
    --text-primary: #EEF5F3;
    --text-secondary: #A9BDB9;
    --text-muted: #6D8481;
    --text-on-accent: #06201E;

    --accent: #2FC7B8;
    --accent-strong: #57DBCE;
    --accent-soft: rgba(47,199,184,0.14);
    --accent-soft-strong: rgba(47,199,184,0.22);

    --shadow-card: 0 1px 2px rgba(0,0,0,0.35), 0 10px 26px rgba(0,0,0,0.35);
    --shadow-drawer: -12px 0 48px rgba(0,0,0,0.5);
    --shadow-modal: 0 30px 80px rgba(0,0,0,0.6);
    --shadow-pop: 0 10px 28px rgba(0,0,0,0.5);

    --type-trafik: #3987E5;
    --type-dask: #D95926;
    --type-kasko: #9085E9;
    --type-saglik: #008300;
    --type-mesuliyet: #D55181;

    --status-good: #33C13B;
    --status-good-bg: rgba(51,193,59,0.16);
    --status-warning: #FAB219;
    --status-warning-bg: rgba(250,178,25,0.16);
    --status-serious: #EC835A;
    --status-serious-bg: rgba(236,131,90,0.16);
    --status-critical: #E66767;
    --status-critical-bg: rgba(230,103,103,0.16);
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg-page: #0B1213;
  --bg-surface: #121B1C;
  --bg-surface-2: #182423;
  --bg-surface-hover: #1D2B2A;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.16);
  --text-primary: #EEF5F3;
  --text-secondary: #A9BDB9;
  --text-muted: #6D8481;
  --text-on-accent: #06201E;

  --accent: #2FC7B8;
  --accent-strong: #57DBCE;
  --accent-soft: rgba(47,199,184,0.14);
  --accent-soft-strong: rgba(47,199,184,0.22);

  --shadow-card: 0 1px 2px rgba(0,0,0,0.35), 0 10px 26px rgba(0,0,0,0.35);
  --shadow-drawer: -12px 0 48px rgba(0,0,0,0.5);
  --shadow-modal: 0 30px 80px rgba(0,0,0,0.6);
  --shadow-pop: 0 10px 28px rgba(0,0,0,0.5);

  --type-trafik: #3987E5;
  --type-dask: #D95926;
  --type-kasko: #9085E9;
  --type-saglik: #008300;
  --type-mesuliyet: #D55181;

  --status-good: #33C13B;
  --status-good-bg: rgba(51,193,59,0.16);
  --status-warning: #FAB219;
  --status-warning-bg: rgba(250,178,25,0.16);
  --status-serious: #EC835A;
  --status-serious-bg: rgba(236,131,90,0.16);
  --status-critical: #E66767;
  --status-critical-bg: rgba(230,103,103,0.16);
}
:root[data-theme="light"]{ color-scheme: light; }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============================= RESET ============================= */
*,*::before,*::after{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,h2,h3,h4,p{ margin: 0; }
button{ font-family: inherit; }
input,select,textarea{ font-family: inherit; font-size: inherit; color: inherit; }
button, [role="button"], .clickable{ cursor: pointer; }
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg{ display:block; }
.tabular{ font-variant-numeric: tabular-nums; }
.mono{ font-family: var(--font-mono); }

/* ============================= APP SHELL ============================= */
.app-shell{ display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar{
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  padding: var(--sp-4) var(--sp-3);
  gap: var(--sp-5);
  border-right: 1px solid var(--sidebar-border);
  position: sticky; top: 0; height: 100vh;
}
.brand{ display:flex; align-items:center; gap:10px; padding: var(--sp-2) var(--sp-2) 0; }
.brand-mark{ width:32px; height:32px; flex:none; }
.brand-word{ font-family: var(--font-display); font-weight:700; font-size:15.5px; color:#fff; letter-spacing:0.1px; }
.brand-sub{ font-size:10.5px; color: var(--sidebar-text-dim); text-transform:uppercase; letter-spacing:0.09em; margin-top:1px; }

.nav-group{ display:flex; flex-direction:column; gap:2px; }
.nav-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:0.09em; color:var(--sidebar-text-dim); padding: var(--sp-2) var(--sp-3) 6px; }
.nav-item{
  display:flex; align-items:center; gap:11px;
  padding: 9px var(--sp-3); border-radius: var(--radius-sm);
  color: var(--sidebar-text); background: transparent; border: none; text-align:left;
  position: relative; font-size: 13.5px; font-weight:500;
  transition: background .12s ease, color .12s ease;
}
.nav-item svg{ width:18px; height:18px; flex:none; opacity:.9; }
.nav-item:hover{ background: rgba(255,255,255,0.06); color: var(--sidebar-text-active); }
.nav-item.active{ background: var(--sidebar-bg-active); color: var(--sidebar-text-active); }
.nav-item.active::before{
  content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:3px; border-radius:3px;
  background: var(--sidebar-accent);
}
.nav-item .count{
  margin-left:auto; font-family: var(--font-mono); font-size:11px; background: rgba(255,255,255,0.09);
  color:#fff; padding: 1px 6px; border-radius: var(--radius-full);
}
.nav-item.active .count{ background: var(--sidebar-accent); color:#06201E; font-weight:600; }
.nav-item .count.urgent{ background: var(--status-critical); color:#fff; }

.sidebar-spacer{ flex:1; }
.sidebar-foot{ display:flex; flex-direction:column; gap: var(--sp-3); }
.user-card{ display:flex; align-items:center; gap:10px; padding: var(--sp-2) var(--sp-2); border-radius: var(--radius-sm); border:1px solid var(--sidebar-border); }
.avatar{
  width:34px; height:34px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center;
  background: var(--sidebar-accent); color:#06201E; font-family: var(--font-display); font-weight:700; font-size:12.5px;
}
.user-meta{ min-width:0; }
.user-name{ font-size:12.5px; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role{ font-size:10.5px; color: var(--sidebar-text-dim); }

/* ---- main column ---- */
.main-col{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  display:flex; align-items:center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky; top:0; z-index: 20;
}
.topbar-title{ font-family: var(--font-display); font-weight:700; font-size:19px; }
.topbar-sub{ font-size:12px; color: var(--text-muted); margin-top:1px; }
.topbar-spacer{ flex:1; }
.search-box{
  display:flex; align-items:center; gap:8px; width: 300px;
  background: var(--bg-surface-2); border:1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px 12px; color: var(--text-muted);
}
.search-box input{ border:none; background:transparent; outline:none; width:100%; color:var(--text-primary); font-size:13px; }
.search-box svg{ width:16px; height:16px; flex:none; }
.icon-btn{
  width:36px; height:36px; border-radius: var(--radius-md); border:1px solid var(--border); background: var(--bg-surface);
  color: var(--text-secondary); display:flex; align-items:center; justify-content:center; position:relative;
  transition: background .12s ease, border-color .12s ease;
}
.icon-btn svg{ width:17px; height:17px; }
.icon-btn:hover{ background: var(--bg-surface-hover); border-color: var(--border-strong); }
.icon-btn .dot{ position:absolute; top:6px; right:6px; width:7px; height:7px; border-radius:50%; background: var(--status-critical); border:1.5px solid var(--bg-surface); }

.btn{
  display:inline-flex; align-items:center; gap:7px; font-weight:600; font-size:13px;
  padding: 9px 14px; border-radius: var(--radius-md); border:1px solid transparent; white-space:nowrap;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn svg{ width:16px; height:16px; }
.btn-primary{ background: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover{ background: var(--accent-strong); }
.btn-ghost{ background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover{ background: var(--bg-surface-hover); color: var(--text-primary); }
.btn-danger-ghost{ background:transparent; color: var(--status-critical); border-color: var(--border); }
.btn-danger-ghost:hover{ background: var(--status-critical-bg); }
.btn-sm{ padding: 6px 10px; font-size:12px; }
.btn[disabled]{ opacity:.5; pointer-events:none; }
.btn-split{ display:flex; }
.btn-split .btn-primary{ border-radius: var(--radius-md) 0 0 var(--radius-md); border-right:1px solid rgba(255,255,255,0.2); }
.btn-split .btn-primary.chevron{ border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 9px 8px; border-right:none; }

.view{ display:none; padding: var(--sp-5); flex:1; }
.view.active{ display:block; }

/* ---- stat tiles ---- */
.stat-grid{ display:grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.stat-tile{
  background: var(--bg-surface); border:1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-4); box-shadow: var(--shadow-card); position:relative; overflow:hidden;
}
.stat-tile::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--accent); opacity:.7; }
.stat-tile.warn::before{ background: var(--status-warning); }
.stat-label{ font-size:12px; color: var(--text-muted); font-weight:500; }
.stat-value{ font-family: var(--font-display); font-size:27px; font-weight:700; margin-top:6px; }
.stat-delta{ font-size:11.5px; color: var(--text-muted); margin-top:5px; display:flex; align-items:center; gap:4px; }
.stat-delta.up{ color: var(--status-good); }

/* ---- cards ---- */
.card{ background: var(--bg-surface); border:1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.card-head{ display:flex; align-items:center; padding: var(--sp-4) var(--sp-4) var(--sp-3); gap: var(--sp-2); }
.card-title{ font-family: var(--font-display); font-weight:600; font-size:15px; }
.card-head .spacer{ flex:1; }
.card-link{ font-size:12.5px; color: var(--accent); font-weight:600; display:flex; align-items:center; gap:3px; }
.card-link svg{ width:14px; height:14px; }
.card-body{ padding: 0 var(--sp-4) var(--sp-4); }

.row-2col{ display:grid; grid-template-columns: 1.5fr 1fr; gap: var(--sp-4); align-items:stretch; margin-bottom: var(--sp-4); }

/* ---- renewal mini list (dashboard) ---- */
.mini-renewal{ display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--border); }
.mini-renewal:first-child{ border-top:none; }
.type-dot{ width:9px; height:9px; border-radius:50%; flex:none; }
.mini-renewal-main{ min-width:0; flex:1; }
.mini-renewal-name{ font-size:13px; font-weight:600; }
.mini-renewal-sub{ font-size:11.5px; color: var(--text-muted); }
.mini-renewal-date{ font-family:var(--font-mono); font-size:12px; color:var(--text-secondary); text-align:right; }
.mini-renewal-actions{ display:flex; gap:4px; }

/* ---- distribution bars ---- */
.dist-row{ display:grid; grid-template-columns: 84px 1fr 64px; align-items:center; gap:10px; margin-bottom:12px; }
.dist-row:last-child{ margin-bottom:0; }
.dist-label{ font-size:12.5px; font-weight:600; display:flex; align-items:center; gap:7px; }
.dist-track{ height:10px; background: var(--bg-surface-2); border-radius: var(--radius-full); overflow:hidden; }
.dist-fill{ height:100%; border-radius: var(--radius-full); }
.dist-value{ font-family:var(--font-mono); font-size:12px; text-align:right; color:var(--text-secondary); }

/* ---- badges / pills ---- */
.badge{ display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; }
.badge .type-dot{ width:8px; height:8px; }
.pill{
  display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:600;
  padding: 3px 9px; border-radius: var(--radius-full);
}
.pill svg{ width:12px; height:12px; }
.pill-good{ background: var(--status-good-bg); color: var(--text-primary); }
.pill-good svg{ color: var(--status-good); }
.pill-warning{ background: var(--status-warning-bg); color: var(--text-primary); }
.pill-warning svg{ color: var(--status-warning); }
.pill-serious{ background: var(--status-serious-bg); color: var(--text-primary); }
.pill-serious svg{ color: var(--status-serious); }
.pill-critical{ background: var(--status-critical-bg); color: var(--text-primary); }
.pill-critical svg{ color: var(--status-critical); }
.pill-cancelled{ background: var(--bg-surface-2); color: var(--text-muted); }
.pill-cancelled svg{ color: var(--text-muted); }

/* ---- table ---- */
.table-wrap{ overflow-x:auto; }
table{ width:100%; border-collapse: collapse; font-size:13px; }
thead th{
  text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:0.06em; color: var(--text-muted);
  font-weight:600; padding: 10px 14px; border-bottom:1px solid var(--border-strong); white-space:nowrap;
}
tbody td{ padding: 12px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
tbody tr{ transition: background .1s ease; }
tbody tr.clickable:hover{ background: var(--bg-surface-hover); }
td.num, th.num{ text-align:right; }
.cell-name{ font-weight:600; font-size:13px; }
.cell-sub{ font-size:11.5px; color: var(--text-muted); margin-top:1px; }
.name-cell{ display:flex; align-items:center; gap:10px; }
.avatar-sm{
  width:30px; height:30px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center;
  background: var(--accent-soft); color: var(--accent-strong); font-family: var(--font-display); font-weight:700; font-size:11px;
}
.type-cluster{ display:flex; gap:4px; }
.type-cluster .type-dot{ width:8px; height:8px; }
.more-btn{ width:28px; height:28px; border-radius:var(--radius-sm); border:1px solid transparent; color:var(--text-muted); display:flex; align-items:center; justify-content:center; }
.more-btn:hover{ background: var(--bg-surface-hover); color:var(--text-primary); }
.more-btn svg{ width:16px; height:16px; }

/* ---- toolbar / filters ---- */
.toolbar{ display:flex; align-items:center; gap:10px; margin-bottom: var(--sp-4); flex-wrap:wrap; }
.chip-row{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{
  display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; color: var(--text-secondary);
  background: var(--bg-surface); border:1px solid var(--border); padding:7px 12px; border-radius: var(--radius-full);
}
.chip:hover{ border-color: var(--border-strong); }
.chip.active{ background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.chip .type-dot{ width:7px; height:7px; }
.select{
  font-size:12.5px; font-weight:500; color:var(--text-secondary); background: var(--bg-surface);
  border:1px solid var(--border); border-radius: var(--radius-md); padding:8px 10px;
}
.toolbar .search-box{ width: 240px; }

/* ---- empty state ---- */
.empty-state{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; padding: var(--sp-7) var(--sp-4); color:var(--text-muted); }
.empty-state svg{ width:40px; height:40px; opacity:.6; }
.empty-state-title{ font-weight:600; color: var(--text-secondary); font-size:14px; }

/* ---- drawer ---- */
.overlay{ position:fixed; inset:0; background: rgba(6,16,15,0.42); z-index:60; opacity:0; pointer-events:none; transition: opacity .16s ease; }
.overlay.show{ opacity:1; pointer-events:auto; }
.drawer{
  position:fixed; top:0; right:0; bottom:0; width:440px; max-width:92vw; background: var(--bg-surface);
  box-shadow: var(--shadow-drawer); z-index:61; transform: translateX(100%); transition: transform .2s cubic-bezier(.2,.8,.2,1);
  display:flex; flex-direction:column;
}
.drawer.show{ transform: translateX(0); }
.drawer-head{ padding: var(--sp-4) var(--sp-4); border-bottom:1px solid var(--border); display:flex; align-items:flex-start; gap:12px; }
.drawer-head .avatar{ width:44px; height:44px; font-size:15px; background:var(--accent-soft); color:var(--accent-strong); }
.drawer-name{ font-family:var(--font-display); font-weight:700; font-size:17px; }
.drawer-meta{ font-size:12.5px; color: var(--text-muted); margin-top:3px; display:flex; gap:10px; flex-wrap:wrap; }
.drawer-meta span{ display:inline-flex; align-items:center; gap:4px; }
.drawer-meta svg{ width:13px; height:13px; }
.drawer-close{ margin-left:auto; }
.drawer-actions{ display:flex; gap:8px; padding: var(--sp-3) var(--sp-4); border-bottom:1px solid var(--border); }
.drawer-body{ padding: var(--sp-4); overflow-y:auto; flex:1; }
.drawer-section-title{ font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); margin: var(--sp-4) 0 var(--sp-2); }
.drawer-section-title:first-child{ margin-top:0; }
.policy-card{ border:1px solid var(--border); border-radius: var(--radius-md); padding: var(--sp-3); margin-bottom:8px; }
.policy-card-top{ display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.policy-card-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:6px 14px; font-size:12px; }
.policy-card-grid .k{ color:var(--text-muted); }
.policy-card-grid .v{ font-family: var(--font-mono); }
.policy-card-foot{ display:flex; gap:6px; margin-top:10px; }
.note-box{ background: var(--bg-surface-2); border:1px solid var(--border); border-radius: var(--radius-md); padding: var(--sp-3); font-size:13px; color: var(--text-secondary); min-height:60px; }
.note-box:focus{ outline:2px solid var(--accent); }
.timeline-item{ display:flex; gap:10px; padding: 8px 0; }
.timeline-dot{ width:7px; height:7px; border-radius:50%; background: var(--accent); margin-top:6px; flex:none; }
.timeline-text{ font-size:12.5px; }
.timeline-time{ font-size:11px; color:var(--text-muted); font-family: var(--font-mono); }

/* ---- modal ---- */
.modal{
  position:fixed; top:50%; left:50%; transform: translate(-50%,-46%); width:560px; max-width:92vw; max-height:88vh;
  background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); z-index:71;
  display:flex; flex-direction:column; opacity:0; pointer-events:none; transition: opacity .16s ease, transform .18s ease;
}
.modal.show{ opacity:1; pointer-events:auto; transform: translate(-50%,-50%); }
.modal-head{ display:flex; align-items:center; padding: var(--sp-4); border-bottom:1px solid var(--border); }
.modal-title{ font-family: var(--font-display); font-weight:700; font-size:16px; }
.modal-body{ padding: var(--sp-4); overflow-y:auto; }
.modal-foot{ display:flex; justify-content:flex-end; gap:8px; padding: var(--sp-4); border-top:1px solid var(--border); }
.field{ margin-bottom: var(--sp-3); }
.field label{ display:block; font-size:12.5px; font-weight:600; margin-bottom:6px; color: var(--text-secondary); }
.field input, .field select, .field textarea{
  width:100%; padding: 9px 11px; border-radius: var(--radius-sm); border:1px solid var(--border); background: var(--bg-surface);
  color: var(--text-primary);
}
.field input:focus, .field select:focus, .field textarea:focus{ outline:2px solid var(--accent); outline-offset:1px; border-color:transparent; }
.field-help{ font-size:11.5px; color: var(--text-muted); margin-top:5px; }
.field-row{ display:grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.segmented{ display:flex; border:1px solid var(--border); border-radius: var(--radius-md); overflow:hidden; }
.segmented button{ flex:1; padding:9px 6px; background: var(--bg-surface); border:none; border-right:1px solid var(--border); font-size:12.5px; font-weight:600; color:var(--text-secondary); display:flex; align-items:center; justify-content:center; gap:6px; }
.segmented button:last-child{ border-right:none; }
.segmented button.active{ background: var(--accent-soft); color: var(--accent-strong); }
.segmented .type-dot{ width:7px; height:7px; }

/* ---- toast ---- */
.toast-stack{ position:fixed; bottom:20px; right:20px; z-index:90; display:flex; flex-direction:column; gap:8px; }
.toast{
  display:flex; align-items:center; gap:10px; background: var(--sidebar-bg); color:#fff; padding:12px 16px;
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size:13px; font-weight:500;
  transform: translateY(8px); opacity:0; transition: all .18s ease;
}
.toast.show{ transform: translateY(0); opacity:1; }
.toast svg{ width:16px; height:16px; color: var(--sidebar-accent); flex:none; }
.toast-action{ background:none; border:none; color: var(--sidebar-accent); font-weight:700; font-size:12.5px; padding:2px 0 2px 4px; flex:none; }
.toast-action:hover{ text-decoration: underline; }

/* ---- reports ---- */
.trend-chart{ display:flex; align-items:flex-end; gap:6px; height:150px; padding-top:10px; position:relative; }
.trend-bar-wrap{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; position:relative; }
.trend-bar{ width:100%; max-width:26px; border-radius:4px 4px 2px 2px; background: var(--accent-soft-strong); position:relative; transition: background .12s ease; }
.trend-bar.current{ background: var(--accent); }
.trend-bar-wrap:hover .trend-bar{ background: var(--accent); }
.trend-month{ font-size:10.5px; color: var(--text-muted); margin-top:6px; }
.trend-tooltip{
  position:absolute; bottom: calc(100% + 8px); left:50%; transform: translateX(-50%);
  background: var(--sidebar-bg); color:#fff; font-size:11.5px; padding:6px 9px; border-radius:7px; white-space:nowrap;
  opacity:0; pointer-events:none; transition: opacity .1s ease; font-family: var(--font-mono);
}
.trend-bar-wrap:hover .trend-tooltip{ opacity:1; }
.data-disclosure summary{ font-size:12px; color: var(--accent); font-weight:600; cursor:pointer; margin-top:10px; list-style:none; }
.data-disclosure summary::-webkit-details-marker{ display:none; }
.rank-row{ display:flex; align-items:center; gap:10px; padding:9px 0; border-top:1px solid var(--border); }
.rank-row:first-child{ border-top:none; }
.rank-num{ font-family:var(--font-mono); font-size:12px; color:var(--text-muted); width:16px; }

/* ---- auth gate ---- */
.auth-screen{
  position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center;
  background: var(--sidebar-bg);
}
.auth-card{
  width:380px; max-width:92vw; background: var(--bg-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal); padding: var(--sp-6) var(--sp-5);
}
.auth-brand{ display:flex; align-items:center; gap:10px; margin-bottom: var(--sp-5); }
.auth-title{ font-family: var(--font-display); font-weight:700; font-size:17px; }
.auth-sub{ font-size:12.5px; color: var(--text-muted); margin-top:2px; }
.auth-error{ color: var(--status-critical); font-size:12.5px; margin-top:2px; min-height:16px; }
.setup-screen{
  position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center;
  background: var(--sidebar-bg); color:#fff; padding: var(--sp-5);
}
.setup-card{ max-width:560px; }
.setup-card h1{ font-family:var(--font-display); font-size:20px; margin-bottom:10px; }
.setup-card p{ color: var(--sidebar-text); font-size:13.5px; margin-bottom:10px; }
.setup-card code{ background: rgba(255,255,255,0.08); padding:2px 6px; border-radius:5px; font-family:var(--font-mono); font-size:12.5px; }

/* ---- responsive ---- */
@media (max-width: 1180px){
  .stat-grid{ grid-template-columns: repeat(3,1fr); }
  .row-2col{ grid-template-columns: 1fr; }
}
@media (max-width: 1000px){
  .app-shell{ grid-template-columns: 76px 1fr; }
  .brand-word, .brand-sub, .nav-label, .nav-item span, .user-meta, .nav-item .count{ display:none; }
  .nav-item{ justify-content:center; }
  .nav-item.active::before{ left:-9px; }
  .user-card{ justify-content:center; border:none; }
  .search-box{ width:180px; }
}
@media (max-width: 760px){
  .stat-grid{ grid-template-columns: repeat(2,1fr); }
  .search-box{ display:none; }
  .topbar{ padding: var(--sp-3) var(--sp-4); }
  .view{ padding: var(--sp-4); }
}
