:root {
  color-scheme: light;
  --page: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --line: #e6e7ee;
  --ink: #0f1222;
  --ink-2: #4a4e63;
  --muted: #7b7f93;
  --grid: #e9e9ef;
  --brand: #3566f2;
  --brand-soft: #eef4ff;
  /* categorical slots (validated reference palette) */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --c5: #e87ba4; --c6: #008300; --c7: #4a3aa7; --c8: #e34948;
  /* status */
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #006300; --crit-ink: #b42323; --warn-ink: #8a5a00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0c10; --surface: #15161c; --surface-2: #1d1f27; --line: #2a2c36;
    --ink: #f4f5fa; --ink-2: #c3c5d2; --muted: #8b8ea0; --grid: #262833;
    --brand: #6e95ff; --brand-soft: #1b2340;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
    --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
    --good-ink: #2fc42f; --crit-ink: #ff7b7b; --warn-ink: #f5c04a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0c10; --surface: #15161c; --surface-2: #1d1f27; --line: #2a2c36;
  --ink: #f4f5fa; --ink-2: #c3c5d2; --muted: #8b8ea0; --grid: #262833;
  --brand: #6e95ff; --brand-soft: #1b2340;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --good-ink: #2fc42f; --crit-ink: #ff7b7b; --warn-ink: #f5c04a;
}

html, body { background: var(--page); color: var(--ink); }
body { overflow-x: hidden; }
.tnum { font-variant-numeric: tabular-nums; }

.logo-dot { width: 22px; height: 22px; border-radius: 7px; display: inline-block;
  background: conic-gradient(from 210deg, #009c3b, #ffdf00, #3566f2, #e34948, #009c3b); }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 12px; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav-link .nav-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 15px; }
.nav-link[aria-current="page"] .nav-ico { background: var(--brand); color: #fff; }
.sidebar.open { transform: translateX(0); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.card-pad { padding: 20px; }
@media (min-width: 640px) { .card-pad { padding: 24px; } }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.h-title { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.h-sec { font-size: 18px; font-weight: 750; letter-spacing: -0.01em; }
.sub { color: var(--ink-2); }
.muted { color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; flex: none; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px;
  font-weight: 650; font-size: 14px; background: var(--brand); color: #fff; }
.btn:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }

.field label { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 10px 12px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.field input:focus, .field select:focus, button:focus-visible, a:focus-visible, input[type=checkbox]:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
input[type=range] { width: 100%; accent-color: var(--brand); }

.hero { position: relative; overflow: hidden; border-radius: 28px; color: #fff;
  background: radial-gradient(1200px 400px at 0% 0%, #2a57e8 0%, transparent 60%),
              radial-gradient(800px 400px at 100% 100%, #0f8f4a 0%, transparent 55%),
              linear-gradient(135deg, #142a7a, #1b3ab8 55%, #0d6b46); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,223,0,.35), transparent 70%); }
.hero .glass { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 16px; backdrop-filter: blur(6px); }

.kpi-val { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s ease; }

/* checklist */
.task { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: start; padding: 12px 8px; border-radius: 12px; }
.task:hover { background: var(--surface-2); }
.task input[type=checkbox] { appearance: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; margin-top: 1px; transition: all .15s; }
.task input[type=checkbox]:checked { background: var(--good); border-color: var(--good); }
.task input[type=checkbox]:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px,-1px); }
.task.done .t-text { text-decoration: line-through; color: var(--muted); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] .chev { transform: rotate(90deg); }
.chev { transition: transform .2s; }

/* gantt */
.gantt { position: relative; }
.g-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; min-height: 40px; border-top: 1px solid var(--grid); }
@media (max-width: 640px) { .g-row { grid-template-columns: 100px 1fr; } }
.g-label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); padding-right: 10px; }
.g-track { position: relative; height: 40px; }
.g-bar { position: absolute; top: 11px; height: 18px; border-radius: 5px; cursor: default; }
.g-ms { position: absolute; top: 12px; width: 14px; height: 14px; transform: translateX(-7px) rotate(45deg); border-radius: 3px; box-shadow: 0 0 0 2px var(--surface); cursor: default; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--critical); z-index: 2; pointer-events: none; }
.g-today span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: var(--crit-ink); white-space: nowrap; }
.g-month { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--grid); }
.g-month span { position: absolute; top: 4px; left: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-h { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: .06em; }
.cal-d { min-height: 92px; border-radius: 12px; background: var(--surface-2); padding: 6px; text-align: left; border: 1px solid transparent; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.cal-d:hover { border-color: var(--line); }
.cal-d.out { opacity: .38; }
.cal-d.today { border-color: var(--critical); }
.cal-d.sel { outline: 2px solid var(--brand); }
.cal-n { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cal-ev { font-size: 10.5px; font-weight: 600; line-height: 1.25; padding: 2px 5px; border-radius: 5px; color: var(--ink); background: var(--surface); border-left: 3px solid; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .cal-d { min-height: 56px; } .cal-ev { font-size: 0; padding: 0; height: 5px; border-left-width: 0; background: var(--ec); } }

/* heat strip */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(1, 1fr); gap: 4px; }
.heat div { height: 34px; border-radius: 6px; }

/* flow */
.flow-step { position: relative; padding-left: 56px; padding-bottom: 26px; }
.flow-step::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--line); }
.flow-step:last-child::before { display: none; }
.flow-num { position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; }

.alert { border-radius: 16px; padding: 14px 16px; border: 1px solid; }
.alert-warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.alert-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.alert-crit { background: color-mix(in srgb, var(--critical) 10%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 40%, var(--line)); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px; white-space: nowrap; }
.b-reach { background: color-mix(in srgb, var(--c8) 15%, var(--surface)); color: var(--crit-ink); }
.b-target { background: color-mix(in srgb, var(--c4) 18%, var(--surface)); color: var(--warn-ink); }
.b-likely { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good-ink); }
.b-neutral { background: var(--surface-2); color: var(--ink-2); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th button { text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; vertical-align: top; }
.tbl tr:hover td { background: var(--surface-2); }

.viz-tip { position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .12s; max-width: 280px;
  background: var(--ink); color: var(--surface); font-size: 12px; line-height: 1.4; padding: 8px 10px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.viz-tip.show { opacity: 1; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 30px); opacity: 0; transition: all .25s; z-index: 70;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } .bar > span { transition: none; } }

.chart-box { position: relative; width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.prose-sm p { margin: 0 0 .6em; } .prose-sm ul { list-style: disc; padding-left: 1.2em; } .prose-sm li { margin: .2em 0; }
a.link { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* larger touch targets on phones/tablets */
@media (pointer: coarse) {
  button.chip, select.chip { min-height: 40px; padding: 6px 14px; }
  .btn, .btn-sm { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  a.link { display: inline-block; padding: 6px 0; }
  .task { padding: 14px 8px; }
}
