/* Hawthorne KPI Scorecard */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --nav-bg: #07111A;
  --nav-bg-2: #0d1b28;
  --nav-text: #F8F2E3;
  --nav-muted: #9aa5ae;
  --nav-active: #13253a;
  --gold: #DAA32D;
  --gold-2: #EEBE2F;
  --teal: #008C95;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e5e7eb;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --muted: #94a3b8;
  --link: #1d4ed8;
  --green: #0ca30c;
  --amber: #d98b00;
  --red: #d03b3b;
  --grey: #8a94a6;
  --green-bg: #e8f7e8;
  --amber-bg: #fdf3df;
  --red-bg: #fbe9e9;
  --grey-bg: #eef1f5;
  --actual: #0f2a4a;
  --band-a: rgba(12,163,12,.18);
  --band-c: rgba(208,59,59,.18);
  --s1:#2a78d6; --s2:#eb6834; --s3:#1baf7a; --s4:#eda100; --s5:#e87ba4; --s6:#008300; --s7:#4a3aa7; --s8:#e34948; --s9:#0f9ba5;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.06);
  --radius: 14px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1520; --surface: #111e2c; --surface-2: #162536; --border: #24354a;
  --text: #f1f5f9; --text-2: #b6c2d0; --text-3: #94a3b8; --muted: #6b7a8c; --link: #7fb0ff;
  --green: #35c135; --amber: #f0b429; --red: #ef6b6b; --grey: #8a94a6;
  --green-bg: rgba(53,193,53,.14); --amber-bg: rgba(240,180,41,.14); --red-bg: rgba(239,107,107,.16); --grey-bg: rgba(138,148,166,.16);
  --actual: #cfe3ff; --band-a: rgba(53,193,53,.2); --band-c: rgba(239,107,107,.2);
  --s1:#3987e5; --s2:#d95926; --s3:#199e70; --s4:#c98500; --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767; --s9:#1a9ea8;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1520; --surface: #111e2c; --surface-2: #162536; --border: #24354a;
    --text: #f1f5f9; --text-2: #b6c2d0; --text-3: #94a3b8; --muted: #6b7a8c; --link: #7fb0ff;
    --green: #35c135; --amber: #f0b429; --red: #ef6b6b; --grey: #8a94a6;
    --green-bg: rgba(53,193,53,.14); --amber-bg: rgba(240,180,41,.14); --red-bg: rgba(239,107,107,.16); --grey-bg: rgba(138,148,166,.16);
    --actual: #cfe3ff; --band-a: rgba(53,193,53,.2); --band-c: rgba(239,107,107,.2);
    --s1:#3987e5; --s2:#d95926; --s3:#199e70; --s4:#c98500; --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767; --s9:#1a9ea8;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Poppins, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
button { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* layout */
.layout { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav-bg); color: var(--nav-text); padding: 20px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { background: #F8F2E3; border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand img { max-width: 100%; height: auto; max-height: 40px; display: block; }
.brand .fallback { font-weight: 700; color: var(--nav-bg); letter-spacing: .12em; font-size: 13px; }
.fy-label { color: var(--nav-muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 0 8px; }
.fy-value { font-size: 22px; font-weight: 600; padding: 0 8px 18px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--nav-muted); transition: background .15s; }
.nav a:hover { background: var(--nav-bg-2); color: var(--nav-text); }
.nav a.active { background: var(--nav-active); color: var(--nav-text); }
.nav a.active .ico { background: var(--gold); color: var(--nav-bg); }
.nav .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--nav-bg-2); display: grid; place-items: center; flex: none; font-size: 15px; }
.nav .t { font-weight: 600; font-size: 14px; line-height: 1.15; }
.nav .s { font-size: 11px; opacity: .75; }
.sidebar .spacer { flex: 1; }
.livebox { background: var(--nav-bg-2); border-radius: 12px; padding: 12px 14px; font-size: 11.5px; color: var(--nav-muted); line-height: 1.45; }
.livebox b { color: var(--nav-text); display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 4px; }
.livebox .dot { width: 8px; height: 8px; border-radius: 50%; background: #35c135; display: inline-block; }
.livebox .dot.warn { background: var(--amber); }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar .title { font-weight: 600; font-size: 16px; }
.topbar .title small { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--text-2); cursor: pointer; font-weight: 500; font-size: 13px; }
.seg button.on { background: var(--nav-bg); color: #fff; }
.topbar .right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-3); }
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--nav-bg); }
.btn.icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%; }
.btn.primary { background: var(--nav-bg); border-color: var(--nav-bg); color: #fff; }

.content { padding: 28px 32px 48px; max-width: 1280px; }
.page-title { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.page-sub { color: var(--text-2); max-width: 760px; margin: 6px 0 14px; font-size: 14.5px; }
.chips { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 12px; color: var(--text-2); background: var(--surface); align-items: center; }
.chips span + span::before { content: '|'; margin: 0 10px; color: var(--muted); }
hr.rule { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.section-head { display: flex; align-items: flex-start; gap: 12px; margin: 8px 0 14px; }
.section-head .ico { width: 34px; height: 34px; border-radius: 10px; background: rgba(0,140,149,.12); color: var(--teal); display: grid; place-items: center; flex: none; }
.section-head h2 { font-size: 18px; }
.section-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.section-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }

.banner { background: var(--amber-bg); border: 1px solid rgba(217,139,0,.35); color: var(--text); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cards.fit { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kcard { padding: 18px 20px 14px; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.kcard:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.kcard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--rag); }
.kcard .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.kcard .name { font-weight: 600; font-size: 15px; }
.kcard .area { color: var(--text-3); font-size: 12px; }
.kcard .big { font-size: 30px; font-weight: 600; margin-top: 10px; letter-spacing: -0.02em; }
.kcard .wow { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.kcard .wow .d { font-weight: 600; }
.kcard .foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; font-size: 12px; color: var(--text-3); }
.kcard .body { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.kcard svg.spark { width: 110px; height: 44px; flex: none; }
.cards.fit .kcard .big { font-size: 24px; }
.cards.fit .kcard svg.spark { width: 80px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.grey { background: var(--grey-bg); color: var(--grey); }
.up { color: var(--green); } .down { color: var(--red); } .flat { color: var(--text-3); }

/* charts */
.chart-card { padding: 18px 20px; }
.chart-wrap { position: relative; height: 380px; }
.chart-note { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 10px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-bottom: 8px; }
.legend button { border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; }
.legend button.off { opacity: .35; text-decoration: line-through; }
.legend .sw { width: 18px; height: 3px; border-radius: 2px; background: var(--c); position: relative; }
.legend .sw::after { content: ''; position: absolute; left: 6px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--c); }

.worms { display: grid; grid-template-columns: 1fr; gap: 20px; }
.worms.fit { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
.worm { padding: 18px 20px 14px; }
.worm .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.worm .name { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.worm .name .rd { width: 9px; height: 9px; border-radius: 50%; background: var(--rag); }
.worm .meta { color: var(--text-3); font-size: 12px; display: flex; gap: 12px; margin-top: 2px; }
.worm .val { text-align: right; }
.worm .val .big { font-size: 24px; font-weight: 600; }
.worm .val .pct { font-size: 12px; font-weight: 600; color: var(--rag); }
.worm .val .ly { font-size: 12px; color: var(--text-2); }
.worm .chart-wrap { height: 250px; margin-top: 6px; }
.worm .comment { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; font-size: 12.5px; color: var(--text-2); }
.worm .comment b { color: var(--text); }
.worm .phasing { font-size: 12px; color: var(--text-3); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.howto { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 12px 16px; font-size: 12.5px; }
.howto b { margin-right: 6px; }
.howto .k { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.howto .ln { width: 26px; height: 3px; border-radius: 2px; background: var(--actual); }
.howto .ln.b { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 10px); }
.howto .ln.ly { background: repeating-linear-gradient(90deg, var(--muted) 0 6px, transparent 6px 10px); }
.howto .bd { width: 26px; height: 12px; border-radius: 3px; background: linear-gradient(180deg, var(--band-a), var(--band-c)); }

/* scorecard */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.plan { padding: 16px 18px; display: flex; gap: 14px; align-items: center; cursor: pointer; border: 2px solid var(--border); }
.plan.on { border-color: var(--link); background: rgba(29,78,216,.04); }
.plan .ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; flex: none; }
.plan.on .ico { background: var(--link); color: #fff; }
.plan .h { font-weight: 600; font-size: 15px; }
.plan .h small { font-size: 10.5px; letter-spacing: .1em; color: var(--text-3); margin-left: 6px; }
.plan .d { color: var(--text-3); font-size: 12px; }
.plan .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.plan .v small { font-size: 11px; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.pill { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.pill.on { background: rgba(29,78,216,.08); color: var(--link); border-color: rgba(29,78,216,.3); }
.pill.static { cursor: default; }
.explain { color: var(--text-3); font-size: 12.5px; margin: 6px 0 14px; }
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table.sc { width: 100%; border-collapse: collapse; min-width: 860px; }
table.sc th, table.sc td { padding: 12px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.sc th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
table.sc th.group { text-align: center; border-left: 1px solid var(--border); }
table.sc th.group.tw, table.sc td.tw { background: rgba(218,163,45,.07); }
table.sc th.tw { color: #a06f00; }
table.sc td.tw:first-of-type, table.sc th.tw:first-of-type { border-left: 1px solid var(--border); }
table.sc td.l, table.sc th.l { text-align: left; }
table.sc td.c, table.sc th.c { text-align: center; }
table.sc td .kn { font-weight: 600; color: var(--link); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
table.sc td .kn.nolink { color: var(--text); cursor: default; }
table.sc td .ks { font-size: 11.5px; color: var(--text-3); }
table.sc td b { font-weight: 600; }
table.sc tr:last-child td { border-bottom: 0; }
table.sc td.dim { color: var(--text-3); }
.ragkey { display: flex; gap: 18px; align-items: center; padding: 12px 16px; font-size: 12.5px; margin-top: 14px; flex-wrap: wrap; }
.ragkey .k { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.ragkey .dot { width: 8px; height: 8px; border-radius: 50%; }
.foot-note { color: var(--text-3); font-size: 12px; margin-top: 12px; }
.footer { text-align: center; color: var(--text-3); font-size: 12px; padding: 22px; border-top: 1px solid var(--border); }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(2,6,23,.45); z-index: 40; display: none; }
.drawer-bg.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: var(--surface); z-index: 41; transform: translateX(100%); transition: transform .2s; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
.drawer.open { transform: none; }
.drawer .dh { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer .dh h2 { font-size: 17px; }
.drawer .wn { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.drawer .db { padding: 16px 20px; overflow-y: auto; flex: 1; }
.drawer .stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.drawer .stat div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.drawer .stat small { display: block; color: var(--text-3); font-size: 11px; }
.drawer .stat b { font-size: 16px; }
.drawer .note { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.mini th, table.mini td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: right; }
table.mini th { text-align: right; color: var(--text-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
table.mini th:first-child, table.mini td:first-child { text-align: left; }
table.mini tr.cur td { background: rgba(218,163,45,.1); font-weight: 600; }

/* docs pages */
.doc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.doc { padding: 20px 22px; }
.doc h3 { font-size: 15px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.doc h3 .ico { width: 30px; height: 30px; border-radius: 8px; background: rgba(0,140,149,.12); color: var(--teal); display: grid; place-items: center; font-size: 14px; }
.doc p, .doc li { color: var(--text-2); font-size: 13.5px; }
.doc ul { padding-left: 18px; margin: 6px 0; }
.doc b { color: var(--text); }
.pipe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; }
.pipe .st { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; }
.pipe .st b { display: block; font-size: 13px; }
.pipe .st small { color: var(--text-3); font-size: 11.5px; }
.pipe .ar { color: var(--muted); }
table.doc-t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.doc-t th, table.doc-t td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.doc-t th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); background: var(--surface-2); }
table.doc-t td { color: var(--text-2); }
table.doc-t td:first-child { color: var(--text); font-weight: 600; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--grey-bg); color: var(--text-2); }
.tag.auto { background: var(--green-bg); color: var(--green); }
.tag.manual { background: var(--amber-bg); color: var(--amber); }
.tag.calc { background: rgba(29,78,216,.1); color: var(--link); }

/* admin */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.form input, .form select, .form textarea { width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 9px 12px; font: inherit; }
.form .full { grid-column: 1 / -1; }
.status { font-size: 12.5px; color: var(--text-3); margin-top: 8px; }
.status.err { color: var(--red); }
.status.ok { color: var(--green); }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .brand { margin: 0; padding: 8px 12px; }
  .fy-label { display: none; } .fy-value { padding: 0 8px; font-size: 16px; }
  .nav { display: flex; gap: 4px; flex-wrap: wrap; }
  .nav a { padding: 6px 10px; } .nav .s { display: none; } .nav .ico { width: 26px; height: 26px; font-size: 12px; }
  .sidebar .spacer, .livebox { display: none; }
  .content { padding: 18px 16px 40px; }
  .page-title { font-size: 26px; }
  .cards, .doc-grid, .plans { grid-template-columns: 1fr; }
  .worms.fit { grid-template-columns: 1fr; }
  .chart-wrap { height: 300px; }
}
.chart-wrap canvas { max-width: 100%; }
