/* Outlet Projects Tracker — Shwapno Dashboard System v1 tokens */
:root {
  --brand:#e5202e; --brand-strong:#b5121b;
  --good:#17977a; --good-soft:#0c2f2a;
  --warn:#c08a1e; --warn-soft:#33280d;
  --bad:#e2683a; --bad-soft:#3a2013;
  --info:#58a7c9; --info-soft:#102c37;
  --idle:#6f8992; --idle-soft:#16303a;
  --canvas:#08191f; --rail:#061419; --surface:#0f2830; --surface-2:#14333d; --surface-3:#1b414d;
  --line:#21474f; --line-soft:#16343d;
  --ink:#e8f0f1; --ink-2:#a3bcc2; --ink-3:#7e9aa2;
  --series-1:#e2683a; --series-2:#58a7c9; --series-3:#c08a1e;
  --share-1:#58bdb3; --share-2:#e6a36e;
  --scrim:rgba(4,6,10,.62); --shadow-lg:0 24px 64px rgba(0,0,0,.55);
  --radius:14px; --radius-sm:7px; --radius-chip:4px; --rail-width:268px;
  color-scheme: dark;
}
[data-theme="light"] {
  --brand:#b5121b; --brand-strong:#8f0d15;
  --good:#0e6f59; --good-soft:#dff0eb;
  --warn:#8a6108; --warn-soft:#f8eed8;
  --bad:#b64a1c; --bad-soft:#fbe8de;
  --info:#1c6b87; --info-soft:#e4eff4;
  --idle:#62777f; --idle-soft:#eaeff1;
  --canvas:#e9eeef; --rail:#ffffff; --surface:#ffffff; --surface-2:#f3f7f8; --surface-3:#e7eef0;
  --line:#cfdcdf; --line-soft:#e2eaec;
  --ink:#0c2229; --ink-2:#47646d; --ink-3:#6d888f;
  --series-1:#b64a1c; --series-2:#1c6b87; --series-3:#8a6108;
  --share-1:#21857e; --share-2:#ba6b35;
  --scrim:rgba(19,25,37,.42); --shadow-lg:0 24px 64px rgba(19,25,37,.18);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--canvas); color: var(--ink);
  font: 13px/1.45 "Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  font-variant-numeric: tabular-nums;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
a { color: var(--info); }
.muted { color: var(--ink-3); }
.num { text-align: right; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 26px; }
.login-card h1 { font-size: 21px; font-weight: 650; margin: 14px 0 4px; }
.login-card p { margin: 0 0 20px; color: var(--ink-2); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, .select, textarea.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; min-height: 36px;
}
textarea.input { min-height: 72px; resize: vertical; }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 12px; font-size: 12.5px; }
.form-ok { color: var(--good); background: var(--good-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 12px; font-size: 12.5px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.brand { align-items: center; }
.brand-logo { height: 34px; width: auto; border-radius: 4px; flex-shrink: 0; display: block; }
.brand > span { line-height: 1.25; }
.login-logo { height: 48px; width: auto; border-radius: 6px; display: block; }
.login-card .login-sub { margin: 0 0 14px; font-size: 12px; color: var(--ink-3); }
.brand-mark { width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--rail); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-weight: 550; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--brand); }
.rail-section h2 { font-size: 12px; font-weight: 620; color: var(--ink-2); margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; }
.rail-foot { margin-top: auto; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line-soft); padding-top: 12px; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--canvas); border-bottom: 1px solid var(--line-soft); padding: 14px 26px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; font-weight: 650; }
.scope { color: var(--ink-3); font-size: 12px; }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.btn.menu-btn { display: none; }
.view { padding: 20px 26px 40px; display: grid; gap: 16px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-weight: 560; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--info); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-text { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; }
.btn-block { width: 100%; }
.btn-sm { min-height: 28px; padding: 3px 9px; font-size: 12px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 650; }
.panel-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 12px; }
.panel-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 16px 18px; }
.grid-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grid-halves { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 12px; }
@media (min-width: 1080px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpi-hero { grid-column: span 2; order: -1; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: inset 2px 0 0 var(--accent, var(--info)); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.kpi-value { font-size: 30px; font-weight: 660; letter-spacing: -.03em; line-height: 1.1; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.kpi-sub { font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 8px; font-size: 11.5px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }
.kpi-hero .hero-row { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.kpi-hero .hero-money { font-size: 44px; font-weight: 660; letter-spacing: -.035em; line-height: 1; }
.hero-keys { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
.key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.compbar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.compbar span { display: block; height: 100%; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-chip); font-size: 11px; font-weight: 650; white-space: nowrap; }
.chip-good { color: var(--good); background: var(--good-soft); }
.chip-warn { color: var(--warn); background: var(--warn-soft); }
.chip-bad { color: var(--bad); background: var(--bad-soft); }
.chip-info { color: var(--info); background: var(--info-soft); }
.chip-idle { color: var(--idle); background: var(--idle-soft); }
.chip-new { color: var(--share-1); background: var(--surface-3); }

/* ---------- pipeline ---------- */
.pipeline { display: grid; gap: 10px; }
.pipe-row { display: grid; grid-template-columns: minmax(130px, 1.3fr) minmax(80px, 3fr) 82px 92px; gap: 12px; align-items: center; }
.pipe-name { font-weight: 560; }
.pipe-name small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.track { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; position: relative; }
.track > span { display: block; height: 100%; background: var(--info); border-radius: 999px; }
.track.good > span { background: var(--good); }
.track.warn > span { background: var(--warn); }
.track.bad > span { background: var(--bad); }
.track.idle > span { background: var(--idle); }
.pipe-count { text-align: right; font-weight: 620; }
.pipe-wait { text-align: right; font-size: 11.5px; color: var(--ink-3); }

/* ---------- donut ---------- */
.donut-wrap { display: grid; justify-items: center; gap: 16px; }
.donut { width: 148px; height: 148px; border-radius: 50%; position: relative; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; }
.donut-center b { font-size: 26px; font-weight: 660; }
.donut-center span { font-size: 11px; color: var(--ink-3); }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; width: 100%; font-size: 12px; }
.legend div { display: flex; justify-content: space-between; gap: 6px; }
.legend b { font-weight: 620; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; max-height: 620px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 11.5px; font-weight: 620; color: var(--ink-2); white-space: nowrap; }
th.num, td.num { text-align: right; }
tbody tr:hover { background: var(--surface-2); }
tbody tr[data-outlet] { cursor: pointer; }
#register .sticky-col { min-width: 210px; }
@media (max-width: 640px) { #register .sticky-col { min-width: 160px; } }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; border-right: 1px solid var(--line-soft); }
th.sticky-col { z-index: 3; background: var(--surface-2); }
tbody tr:hover .sticky-col { background: var(--surface-2); }
.cell-primary { font-weight: 620; }
.cell-secondary { font-size: 11px; color: var(--ink-3); }
.sort-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.sort-button .arrow { color: var(--ink-3); }
.sort-button[data-active] .arrow { color: var(--info); }
.steps { display: inline-flex; gap: 3px; vertical-align: middle; }
.steps i { width: 8px; height: 8px; border-radius: 2px; background: var(--surface-3); border: 1px solid var(--line); }
.steps i.on { background: var(--good); border-color: var(--good); }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.mini-progress .track { flex: 1; height: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.pager-nav { display: flex; gap: 8px; align-items: center; }
.empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }

/* ---------- filters ---------- */
.ms { display: grid; gap: 6px; margin-bottom: 10px; }
.ms-label { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.badge { font-size: 10.5px; font-weight: 650; color: var(--info); background: var(--info-soft); border-radius: 999px; padding: 0 6px; }
.ms-btn { width: 100%; justify-content: space-between; font-weight: 500; }
.ms-btn[data-active] { border-color: var(--info); }
.ms-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; display: grid; gap: 6px; }
.ms-tools { display: flex; gap: 10px; font-size: 11.5px; color: var(--ink-3); align-items: center; flex-wrap: wrap; }
.ms-list { max-height: 220px; overflow: auto; display: grid; gap: 1px; }
.ms-opt { display: grid; grid-template-columns: 15px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 5px; cursor: pointer; font-size: 12.5px; }
.ms-opt:hover { background: var(--surface-2); }
.ms-check { width: 15px; height: 15px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-2); display: grid; place-items: center; font-size: 10px; color: var(--canvas); }
.ms-opt[aria-selected="true"] .ms-check { background: var(--info); border-color: var(--info); }
.ms-opt .count { color: var(--ink-3); font-size: 11.5px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; }
.filter-pill button { background: none; border: 0; color: var(--ink-2); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; }
.filter-pill button:hover { color: var(--bad); }

/* ---------- feed ---------- */
.feed { display: grid; }
.feed-item { padding: 11px 18px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 4px; }
.feed-item:last-child { border-bottom: 0; }
.feed-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.feed-top a { color: var(--ink); font-weight: 620; text-decoration: none; cursor: pointer; }
.feed-top a:hover { text-decoration: underline; }
.feed-meta { font-size: 11.5px; color: var(--ink-3); }
.feed-changes { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--ink-2); }
.feed-note { font-size: 12.5px; white-space: pre-wrap; }

/* ---------- drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 60; display: flex; flex-direction: column; }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.drawer-head h2 { font-size: 18px; font-weight: 650; }
.drawer-body { padding: 16px 18px 30px; overflow-y: auto; display: grid; gap: 18px; }
.drawer-body h3 { font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat span { display: block; font-size: 11.5px; color: var(--ink-2); }
.stat b { font-size: 16px; font-weight: 650; }
.stat small { display: block; font-size: 11px; color: var(--ink-3); }
.window { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 8px; }
.window-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.window .track { height: 8px; }
.window-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.checklist { display: grid; gap: 4px; }
.check-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: var(--radius-sm); background: var(--surface-2); }
.check-row input { width: 16px; height: 16px; accent-color: var(--good); }
.check-row small { color: var(--ink-3); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.range-row { display: flex; gap: 10px; align-items: center; }
.range-row input[type="range"] { flex: 1; accent-color: var(--info); }
.range-row .input { width: 76px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--surface-3); border-radius: var(--radius-chip); padding: 3px 8px; font-size: 12px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
details summary { cursor: pointer; font-weight: 600; }
.timeline { display: grid; gap: 0; }
.tl-item { padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; display: grid; gap: 3px; }
.tl-item::before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--info); }
.modal { position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px; }
.modal h2 { font-size: 16px; font-weight: 650; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--canvas); padding: 9px 16px; border-radius: var(--radius-sm); z-index: 80; font-weight: 560; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--rail-width), 86vw); z-index: 55; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .rail.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .grid-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .view { padding: 16px 16px 32px; }
  .grid-halves { grid-template-columns: minmax(0, 1fr); }
  .pipe-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .pipe-row .track { grid-column: 1 / -1; grid-row: 2; }
  .pipe-wait { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-hero .hero-money { font-size: 36px; }
}
/* Sidebar brand: small logo beside a bold title and muted subtitle */
.rail .brand { gap: 10px; padding: 2px 0 4px; }
.rail .brand-logo { height: 30px; border-radius: 3px; }
.rail .brand-title { display: block; white-space: nowrap; letter-spacing: -.01em; font-size: 15px; font-weight: 650; color: var(--ink); line-height: 1.2; }
.rail .brand small { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
/* Clickable league rows */
table.league tbody tr { cursor: pointer; }
table.league tbody tr[aria-pressed="true"] { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--info); }
.modal.modal-wide { width: min(640px, calc(100vw - 32px)); }

/* ===== Sidebar in Claude's style: warm neutral surface, soft rounded items, icons ===== */
:root {
  --rail: #1f1e1d; --rail-ink: #ece9e1; --rail-ink-2: #a6a39a; --rail-line: #34322e;
  --rail-hover: #2a2926; --rail-active: #34322e; --rail-field: #262523;
}
[data-theme="light"] {
  --rail: #f5f4ef; --rail-ink: #2d2b26; --rail-ink-2: #6f6c63; --rail-line: #e3e0d6;
  --rail-hover: #ebe9e2; --rail-active: #e4e1d7; --rail-field: #ffffff;
}
.rail { background: var(--rail); color: var(--rail-ink); border-right: 1px solid var(--rail-line); padding: 14px 12px; gap: 14px; }
.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail .brand { min-width: 0; }
.rail .brand-title { color: var(--rail-ink); }
.rail .brand small { color: var(--rail-ink-2); }
.rail svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--rail-ink-2); cursor: pointer; flex-shrink: 0; }
.rail-icon-btn:hover { background: var(--rail-hover); color: var(--rail-ink); }
.rail-search { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 12px; height: 40px; border: 1px solid var(--rail-line); border-radius: 10px; background: var(--rail-field); color: var(--rail-ink-2); cursor: text; }
.rail-search:focus-within { border-color: var(--rail-ink-2); }
.rail-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--rail-ink); font-size: 14px; }
.rail-search input::placeholder { color: var(--rail-ink-2); }
.rail-search kbd { color: var(--rail-ink-2); background: var(--rail-hover); border-radius: 6px; padding: 5px 7px; white-space: nowrap; }
.rail .nav { gap: 2px; }
.rail .nav a { justify-content: flex-start; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--rail-ink); font-size: 14px; font-weight: 450; box-shadow: none; }
.rail .nav a svg { color: var(--rail-ink-2); }
.rail .nav a:hover { background: var(--rail-hover); color: var(--rail-ink); }
.rail .nav a[aria-current="page"] { background: var(--rail-active); color: var(--rail-ink); font-weight: 560; box-shadow: none; }
.rail .nav a[aria-current="page"] svg { color: var(--rail-ink); }
.rail-section h2 { color: var(--rail-ink-2); font-size: 12px; font-weight: 560; padding: 0 4px; }
.rail .btn-text { color: var(--rail-ink-2); }
.rail .ms-label { color: var(--rail-ink-2); padding: 0 4px; }
.rail .ms-btn { background: var(--rail-field); border-color: var(--rail-line); color: var(--rail-ink); border-radius: 9px; }
.rail .ms-btn:hover { background: var(--rail-hover); }
.rail .ms-btn[data-active] { border-color: var(--info); }
.rail .ms-panel { background: var(--rail-field); border-color: var(--rail-line); border-radius: 10px; }
.rail .ms-panel .input { background: var(--rail); border-color: var(--rail-line); color: var(--rail-ink); }
.rail .ms-opt { color: var(--rail-ink); border-radius: 7px; }
.rail .ms-opt:hover { background: var(--rail-hover); }
.rail .ms-opt .count, .rail .ms-tools { color: var(--rail-ink-2); }
.rail .ms-check { background: var(--rail); border-color: var(--rail-line); }
.rail-foot { color: var(--rail-ink-2); border-top-color: var(--rail-line); padding: 12px 4px 0; }

/* Collapsed sidebar: icons only */
.shell { transition: grid-template-columns .18s ease; }
.shell.rail-collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.shell.rail-collapsed .rail { padding: 14px 10px; align-items: center; }
.shell.rail-collapsed .rail-top { flex-direction: column; }
.shell.rail-collapsed .rail-label,
.shell.rail-collapsed .rail-foot { display: none; }
.shell.rail-collapsed .brand-logo { height: 22px; }
.shell.rail-collapsed .rail-search { width: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
.shell.rail-collapsed .rail-search:hover { background: var(--rail-hover); }
.shell.rail-collapsed .rail-search input { position: absolute; width: 1px; opacity: 0; pointer-events: none; }
.shell.rail-collapsed .nav a { padding: 10px; justify-content: center; }
@media (max-width: 1080px) {
  .shell.rail-collapsed { grid-template-columns: minmax(0, 1fr); }
  #collapse-btn { display: none; }
}
/* Sidebar fit-and-finish */
:root { --rail-width: 288px; }
.rail .brand { gap: 10px; flex: 1; }
.rail .brand-logo { height: 28px; }
.rail .brand .rail-label { min-width: 0; }
.rail .brand-title { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
.rail-icon-btn { width: 30px; height: 30px; }
.rail-search kbd { font-family: inherit; font-size: 11.5px; font-weight: 500; line-height: 1; }
.shell.rail-collapsed .brand-logo { height: 20px; border-radius: 3px; }

/* ===== Dashboard panels, refreshed ===== */
:root { --type-info: var(--info); --type-idle: var(--idle); --type-new: var(--share-1); }

/* Approval pipeline: vertical stepper */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; position: relative; }
.stepper li { position: relative; }
.stepper li:not(:last-child)::after { content: ""; position: absolute; left: 25px; top: 38px; bottom: -8px; width: 2px; background: var(--line-soft); }
.step { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 9px 10px; border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.step:not(:disabled):hover { background: var(--surface-2); }
.step:disabled { cursor: default; }
.step[aria-pressed="true"] { background: var(--info-soft); border-color: var(--info); }
.step-num { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.step.is-done .step-num { background: var(--good); color: #fff; box-shadow: 0 0 0 1px var(--good); }
.step.is-bottleneck .step-num { background: var(--warn-soft); color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.step-main { display: grid; gap: 6px; min-width: 0; }
.step-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.step-label { font-weight: 600; font-size: 13.5px; }
.step-count { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.step-count b { color: var(--ink); font-size: 13px; }
.step-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.step-track > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--info), var(--share-1)); }
.step.is-done .step-track > span { background: var(--good); }
.step-wait { display: flex; gap: 6px; align-items: center; justify-content: flex-end; min-width: 92px; }
.wait-pill { font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.step.is-bottleneck .wait-pill { background: var(--warn-soft); color: var(--warn); }

/* Stage mix */
.stage-mix { display: grid; gap: 14px; }
.stage-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stage-hero div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stage-hero b { display: block; font-size: 24px; font-weight: 660; letter-spacing: -.02em; line-height: 1.1; }
.stage-hero span { font-size: 11.5px; color: var(--ink-3); }
.stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack span { display: block; height: 100%; min-width: 4px; }
.stage-rows { display: grid; gap: 2px; }
.stage-row { display: grid; grid-template-columns: 12px minmax(0, 1.4fr) minmax(40px, 1fr) 28px 38px; gap: 10px; align-items: center; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; background: none; text-align: left; cursor: pointer; font-size: 12.5px; }
.stage-row:not(:disabled):hover { background: var(--surface-2); }
.stage-row:disabled { cursor: default; opacity: .55; }
.stage-row[aria-pressed="true"] { background: var(--info-soft); border-color: var(--info); }
.stage-row .key { margin: 0; }
.stage-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.stage-bar span { display: block; height: 100%; border-radius: 999px; }
.stage-row b { text-align: right; }
.stage-pct { text-align: right; color: var(--ink-3); font-size: 11.5px; }

/* League with inline meters */
table.league td { padding-top: 11px; padding-bottom: 11px; }
table.league .rank { color: var(--ink-3); font-weight: 600; width: 28px; }
table.league .cell-primary .key { margin-right: 8px; }
.cell-meter { display: grid; gap: 5px; min-width: 76px; }
.cell-meter b { font-weight: 620; }
.cell-meter b small { font-weight: 500; color: var(--ink-3); }
.meter { display: block; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--info); }
.meter.good > span { background: var(--good); }
.meter.warn > span { background: var(--series-3); }
.meter.share > span { background: var(--share-1); }
.growth { color: var(--good); font-weight: 650; white-space: nowrap; }

/* Recent updates */
.feed-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
.feed-body { display: grid; gap: 5px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--info-soft); color: var(--info); }
.feed-meta .chip { vertical-align: 1px; }
.empty-feed { display: grid; justify-items: center; gap: 8px; padding: 36px 24px; }
.empty-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); color: var(--ink-2); }

@media (max-width: 640px) {
  .step { grid-template-columns: 30px minmax(0, 1fr); }
  .step-wait { grid-column: 2; justify-content: flex-start; min-width: 0; }
  .stage-row { grid-template-columns: 12px minmax(0, 1fr) 28px 38px; }
  .stage-row .stage-bar { display: none; }
}
table.league th, table.league td { padding-left: 10px; padding-right: 10px; }
table.league .cell-primary { white-space: nowrap; }
table.league th { white-space: nowrap; }
.cell-meter { min-width: 58px; }
.recent-panel { display: flex; flex-direction: column; }
.recent-panel .feed { max-height: 430px; overflow-y: auto; }
.grid-split.align-start { align-items: start; }
@media (max-width: 640px) { .step-wait:has(> .muted:only-child) { display: none; } }

/* ===== Sidebar v2: Claude-like structure ===== */
.rail { gap: 10px; overflow: hidden; }
.rail-new { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--rail-ink); font-size: 14px; font-weight: 560; cursor: pointer; text-align: left; }
.rail-new:hover { background: var(--rail-hover); }
.rail-new-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; flex-shrink: 0; }
.rail-new-icon svg { width: 15px; height: 15px; stroke-width: 2.4; }
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--rail-ink-2); font-weight: 500; }
.rail-scroll { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 16px; margin: 4px -4px 0; padding: 0 4px; }
.rail-group h2 { font-size: 12px; font-weight: 560; color: var(--rail-ink-2); margin: 0 0 4px; padding: 0 10px; }
.rail-list { display: grid; gap: 1px; }
.rail-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--rail-ink); font-size: 13.5px; cursor: pointer; text-align: left; }
.rail-item:hover { background: var(--rail-hover); }
.rail-item[aria-pressed="true"] { background: var(--rail-active); font-weight: 600; }
.rail-item .key { margin: 0 4px 0 5px; flex-shrink: 0; width: 9px; height: 9px; border-radius: 3px; }
.rail-item-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item-count { font-size: 11.5px; color: var(--rail-ink-2); }
.mini-avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 9.5px; font-weight: 700; background: var(--rail-active); color: var(--rail-ink-2); }
.rail-empty { margin: 0; padding: 4px 10px; font-size: 12px; color: var(--rail-ink-2); }
.rail-user { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--rail-line); padding-top: 10px; }
.rail-user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--rail-ink); cursor: pointer; text-align: left; }
.rail-user-btn:hover { background: var(--rail-hover); }
.rail-user-btn .avatar { width: 32px; height: 32px; flex-shrink: 0; background: var(--brand); color: #fff; }
.rail-user-text { display: grid; min-width: 0; }
.rail-user-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user-text small { font-size: 11.5px; color: var(--rail-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#theme-btn .i-moon { display: none; }
[data-theme="light"] #theme-btn .i-sun { display: none; }
[data-theme="light"] #theme-btn .i-moon { display: block; }
.rail-foot { margin-top: 0; border-top: 0; padding: 0 10px; font-size: 11px; }

.shell.rail-collapsed .rail-new { justify-content: center; padding: 6px; }
.shell.rail-collapsed .rail-user { flex-direction: column; border-top: 0; }
.shell.rail-collapsed .rail-user-btn { justify-content: center; padding: 4px; }
.shell.rail-collapsed .rail-scroll { display: none; }
.shell.rail-collapsed .rail-user-btn .avatar { width: 30px; height: 30px; }
.rail .nav a, .rail-item, .rail-new { transition: background .12s ease; }

/* ===== Filter bar above the dashboard ===== */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 26px 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-bar .ms { position: relative; margin: 0; display: block; }
.filter-bar .ms-label { display: none; }
.filter-bar .ms-btn { width: auto; min-height: 32px; padding: 4px 12px; border-radius: 999px; background: var(--surface); border-color: var(--line); font-size: 12.5px; gap: 8px; }
.filter-bar .ms-btn:hover { background: var(--surface-2); }
.filter-bar .ms-btn[data-active] { background: var(--info-soft); border-color: var(--info); color: var(--ink); font-weight: 600; }
.filter-bar .ms-btn .ms-dim { color: var(--ink-3); font-weight: 500; }
.filter-bar .ms-panel { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 280px; box-shadow: var(--shadow-lg); border-radius: 12px; padding: 10px; }
.filter-bar .ms-list { max-height: 280px; }
.filter-bar #reset-filters { font-size: 12.5px; }
@media (max-width: 640px) {
  .filter-bar { padding: 10px 16px 0; flex-wrap: nowrap; overflow-x: auto; }
  .filter-row { flex-wrap: nowrap; }
  .filter-bar .ms-btn { white-space: nowrap; }
  .filter-bar .ms-panel { position: fixed; left: 16px; right: 16px; top: auto; width: auto; margin-top: 6px; }
}

.rail-user { margin-top: auto; }
.filter-bar #reset-filters { margin-left: 4px; }

/* ===== Layout v3: balanced rows ===== */
.view { gap: 18px; }
.grid-3 { display: grid; gap: 16px; align-items: stretch; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1440px) {
  .grid-3 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .grid-3 > .recent-panel { grid-column: 1 / -1; }
  .grid-3 > .recent-panel .feed-wrap { min-height: 300px; }
}
@media (max-width: 900px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.panel { display: flex; flex-direction: column; }
.panel-head { padding: 14px 18px; align-items: center; }
.panel-head p { margin-top: 3px; }
.panel-body { flex: 1; }

/* Recent updates fills its column and scrolls inside it */
.recent-panel .feed-wrap { flex: 1; position: relative; min-height: 260px; }
.recent-panel .feed-wrap > .feed { position: absolute; inset: 0; overflow-y: auto; max-height: none; }
.recent-panel .feed-item { padding: 10px 16px; gap: 10px; }
.recent-panel .avatar { width: 28px; height: 28px; font-size: 10.5px; }
.recent-panel .feed-item { grid-template-columns: 28px minmax(0, 1fr); }
.recent-panel .feed-top a { font-size: 13px; }
.recent-panel .tag { font-size: 11.5px; padding: 2px 7px; }

/* Compact pipeline */
.stepper { gap: 0; }
.step { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; padding: 6px 8px; }
.step-num { width: 26px; height: 26px; font-size: 11.5px; }
.stepper li:not(:last-child)::after { left: 20px; top: 32px; bottom: -6px; }
.step-main { gap: 5px; }
.step-label { font-size: 13px; }
.step-track { height: 6px; }
.step-wait { min-width: 0; }
.wait-pill { padding: 2px 8px; font-size: 11px; }
.step-wait .chip { font-size: 10.5px; padding: 1px 6px; }

/* Stage mix, tighter */
.stage-mix { gap: 12px; }
.stage-hero b { font-size: 22px; }
.stage-hero div { padding: 9px 11px; }
.stage-row { padding: 6px 6px; }

/* Toolbars */
.select-sm { width: auto; min-height: 32px; padding: 4px 30px 4px 10px; }
.panel-tools { flex-wrap: nowrap; }
#table-search { width: 260px; min-height: 34px; }
#register .panel-head { flex-wrap: wrap; }
@media (max-width: 640px) {
  .panel-tools { flex-wrap: wrap; }
  #table-search { width: 100%; }
}
table.league .cell-meter { max-width: 170px; }
/* KPI row: hero spans two columns only when there is room */
@media (min-width: 1080px) { .kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } .kpi-hero { grid-column: auto; } }
@media (min-width: 1500px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpi-hero { grid-column: span 2; } }
@media (min-width: 1080px) and (max-width: 1499px) { .kpi-hero .hero-money { font-size: 36px; } }
/* Filter chips and Reset share one wrapping row */
.filter-bar { gap: 8px; }
.filter-row { display: contents; }
.filter-bar .ms-btn { padding: 4px 11px; font-size: 12.5px; }
/* Register: keep rows single-line and scroll sideways on narrow screens */
#register table { min-width: 1240px; }
#register td, #register th { white-space: nowrap; }
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpi-hero { grid-column: span 2; } }
@media (min-width: 1080px) and (max-width: 1199px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi-hero { grid-column: auto; } }
@media (max-width: 1499px) { .kpi .kpi-foot { flex-wrap: wrap; } }
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-hero { grid-column: 1 / -1; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 26px; }
  .kpi-foot { flex-direction: column; gap: 2px; }
}
