/* Aloha - Onboarding & Offboarding.
   The tokens and the topbar / section / row / pill pieces are the sales dashboard's
   (sales-dashboards app/src/index.css), so the two read as one family. Status colours
   always come with a text label, never colour alone. */

@font-face { font-family: "Manrope"; src: url("../assets/fonts/Manrope-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Manrope"; src: url("../assets/fonts/Manrope-SemiBold.ttf") format("truetype"); font-weight: 600; }
@font-face { font-family: "Manrope"; src: url("../assets/fonts/Manrope-Bold.ttf") format("truetype"); font-weight: 700; }
@font-face { font-family: "Manrope"; src: url("../assets/fonts/Manrope-ExtraBold.ttf") format("truetype"); font-weight: 800; }

:root {
  color-scheme: light;
  --page: #ebe6df;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --hairline: #e1e0d9;
  --baseline: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-wash: rgba(42, 120, 214, 0.09);
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --warning-text: #8a5a00;
  --serious: #ec835a;
  --serious-text: #b4532c;
  --critical: #d03b3b;
  --critical-wash: rgba(208, 59, 59, 0.07);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05);
  --navy: #03223b;
  --cream: #f1f1ef;
  --row-alt: rgba(235, 230, 223, 0.5);
  --topbar-bg: #03223b;
  --topbar-ink: #f1f1ef;
  --topbar-line: rgba(241, 241, 239, 0.16);
  --band: #f1f1ef;
  --section-head: #03223b;
  --section-head-ink: #f1f1ef;
  --section-head-hover: #123d61;
  --critical-on-navy: #ffb3a8;
  --bar-track: #e6e2da;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --hairline: #2c2c2a;
    --baseline: #383835;
    --ring: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --good-text: #0ca30c;
    --warning-text: #fab219;
    --serious-text: #ec835a;
    --critical-wash: rgba(208, 59, 59, 0.14);
    --shadow: none;
    --navy: #e8edf2;
    --cream: #15171a;
    --row-alt: rgba(255, 255, 255, 0.028);
    --topbar-bg: #1a1a19;
    --topbar-ink: #ffffff;
    --topbar-line: #2c2c2a;
    --band: #24262b;
    --section-head: #24262b;
    --section-head-ink: #ffffff;
    --section-head-hover: #30333a;
    --critical-on-navy: #ff9b8d;
    --bar-track: #2c2c2a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.shell { max-width: 1680px; margin: 0 auto; padding: 0 28px 64px; }

/* ---- topbar: the navy slab ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--topbar-bg); color: var(--topbar-ink);
  border-bottom: 1px solid var(--topbar-line);
  margin: 0 -28px 20px; padding: 12px 28px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; row-gap: 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { height: 30px; width: 30px; border-radius: 7px; flex: none; }
.brand h1 { margin: 0; font-size: 15px; font-weight: 800; color: var(--topbar-ink); white-space: nowrap; }
.brand .tagline { font-size: 12.5px; opacity: 0.7; white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--topbar-line); }
.topbar .spacer { flex: 1; }
.asof { font-size: 12px; opacity: 0.72; }
.asof.stale { opacity: 1; color: var(--critical-on-navy); font-weight: 700; }
.who { font-size: 12.5px; opacity: 0.85; }
.topbar-link { font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; color: var(--topbar-ink); }
.refresh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--topbar-ink); border: 1px solid var(--topbar-line);
}
.refresh-btn:hover:not(:disabled) { border-color: var(--topbar-ink); background: rgba(241, 241, 239, 0.1); }
.refresh-btn:disabled { opacity: 0.5; cursor: progress; }
.refresh-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Onboarding | Offboarding - a segmented switch on the slab */
.proc-tabs { display: inline-flex; border: 1px solid var(--topbar-line); border-radius: 9px; overflow: hidden; margin-left: 8px; }
.proc-tabs button { padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--topbar-ink); opacity: 0.75; }
.proc-tabs button + button { border-left: 1px solid var(--topbar-line); }
.proc-tabs button[aria-pressed="true"] { background: var(--topbar-ink); color: var(--topbar-bg); opacity: 1; }
.proc-tabs .n { font-weight: 500; opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---- gate / states ---- */
.gate { max-width: 460px; margin: 80px auto; text-align: center; background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 32px 28px; box-shadow: var(--shadow); }
.gate-msg { margin: 0 0 16px; color: var(--ink-2); }
.gate-msg strong { color: var(--ink); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--ring); background: var(--surface); font-weight: 600; font-size: 13px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.banner { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--ring); background: var(--surface); }
.banner.critical { border-color: rgba(208, 59, 59, 0.35); background: var(--critical-wash); box-shadow: inset 4px 0 0 var(--critical); }
.banner.critical strong { color: var(--critical); }

/* ---- alarm: someone with no board ---- */
.alarm { margin-bottom: 18px; }
.alarm .who-list { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 10px; padding: 0; list-style: none; }
.alarm .who-list li { background: var(--surface); border: 1px solid var(--ring); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.alarm .who-list li .d { color: var(--ink-muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.alarm .more { margin-top: 8px; font-size: 12.5px; text-decoration: underline; color: var(--ink-2); }

/* ---- KPI row ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.kpi .sub { font-size: 11.5px; color: var(--ink-muted); }
.kpi.critical .value { color: var(--critical); }
.kpi.critical { box-shadow: inset 0 -3px 0 var(--critical); }

/* ---- scopebar: view switch, search, toggles ---- */
.scopebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--ring); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { padding: 6px 14px; font-size: 13px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--ring); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.search { flex: 0 1 320px; min-width: 200px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--ring); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.search:focus { outline: none; border-color: var(--accent); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.scopebar .spacer { flex: 1; }
.scopebar .hint { font-size: 12px; color: var(--ink-muted); }

/* Department chips: "my department" */
.dept-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.dept-chips .lead { font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-right: 2px; }
.chip { border: 1px solid var(--ring); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--surface); font-weight: 600; }
.chip .c { font-variant-numeric: tabular-nums; opacity: 0.75; font-size: 12px; }
.chip .c.bad { color: var(--critical); opacity: 1; font-weight: 700; }
.chip[aria-pressed="true"] .c.bad { color: var(--critical-on-navy); }

/* ---- sections (navy header) ---- */
.section { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden; }
.section > header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--section-head); color: var(--section-head-ink);
}
.section > header h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section > header .counts { font-size: 12px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.section > header .bad { font-size: 12px; font-weight: 700; color: var(--critical-on-navy); }
.section > header .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.section > header .hbtn { font-size: 12px; color: var(--section-head-ink); border: 1px solid rgba(241, 241, 239, 0.3); border-radius: 6px; padding: 3px 9px; }
.section > header .hbtn:hover { background: rgba(241, 241, 239, 0.1); }
.section > header .bar { font-size: 12px; }
.section > header .bar .track { width: 120px; background: rgba(241, 241, 239, 0.18); }
.section.minimised { box-shadow: none; }
.section.minimised > header { background: var(--band); color: var(--ink); }
.section.minimised > header .counts { opacity: 1; color: var(--ink-2); }
.section.minimised > header .bad { color: var(--critical); }
.section.minimised > header .bar .track { background: var(--bar-track); }
.section.minimised > header .hbtn { color: var(--ink-2); border-color: var(--ring); }
.section.minimised > header .hbtn:hover { background: var(--surface); }
.acc-head { cursor: pointer; user-select: none; }
.section > header.acc-head:hover { background: var(--section-head-hover); }
.section.minimised > header.acc-head:hover { background: var(--accent-wash); }
.acc-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chev { width: 16px; height: 16px; flex: none; transition: transform 0.15s ease; }
.open > .chev, [aria-expanded="true"] > .chev { transform: rotate(90deg); }
.empty { padding: 18px; color: var(--ink-muted); font-size: 13px; }

/* ---- progress bar: label always beside it ---- */
.bar { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar .track { width: 84px; height: 6px; border-radius: 999px; background: var(--bar-track); overflow: hidden; flex: none; }
.bar .fill { height: 100%; background: var(--good); border-radius: 999px; }

/* ---- person rows inside a department ---- */
.prow { border-bottom: 1px solid var(--hairline); }
.prow:last-child { border-bottom: none; }
.prow-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 18px; text-align: left; }
.prow-head:hover { background: var(--accent-wash); }
.prow.flagged > .prow-head { box-shadow: inset 3px 0 0 var(--critical); }
.pname { font-weight: 700; min-width: 180px; }
.meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.meta .m { white-space: nowrap; }
.meta .m b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.meta .m.bad b, .meta .m.bad { color: var(--critical); }
.meta .m.muted { color: var(--ink-muted); }

/* ---- task table ---- */
.tasks { width: 100%; border-collapse: collapse; }
.tasks td { padding: 7px 12px; border-top: 1px solid var(--hairline); vertical-align: top; font-size: 13px; }
.tasks tr:nth-child(even) td { background: var(--row-alt); }
/* Status and when shrink to their content; the task name takes the rest. */
.tasks td.st { width: 1%; white-space: nowrap; padding-left: 46px; padding-right: 18px; }
.tasks td.when { width: 1%; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tasks .when.bad { color: var(--critical); font-weight: 700; }
.tasks .when.today { color: var(--warning-text); font-weight: 700; }
.tasks .when-inline { display: none; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
/* A narrow panel (the person view beside the list, or a phone) moves "when" under the name. */
.section { container-type: inline-size; }
@container (max-width: 640px) {
  .tasks td.when { display: none; }
  .tasks .when-inline { display: block; }
  .tasks td.st { padding-left: 18px; }
}
.tasks td.go { width: 44px; text-align: right; }
.tasks td.go a { text-decoration: none; color: var(--ink-muted); font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.tasks td.go a:hover { color: var(--accent); background: var(--accent-wash); }
.tasks tr.done td.tn { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: var(--baseline); }
.tasks tr.na td.tn { color: var(--ink-muted); }
.tasks .who-tag { display: inline-block; font-size: 11.5px; color: var(--ink-muted); margin-left: 8px; }
.tasks .req-btn { font-size: 11.5px; color: var(--accent); margin-left: 8px; text-decoration: underline; text-underline-offset: 2px; }
.tasks .req { margin-top: 6px; padding: 8px 10px; border-left: 3px solid var(--baseline); background: var(--band); color: var(--ink-2); font-size: 12.5px; white-space: pre-wrap; border-radius: 0 6px 6px 0; }
.dept-block .tasks td.st { padding-left: 18px; }
.done-toggle { display: block; width: 100%; text-align: left; padding: 7px 18px 7px 46px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--hairline); }
.done-toggle:hover { background: var(--accent-wash); }
.dept-block .done-toggle { padding-left: 18px; }

/* ---- status pill: dot + label ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.pill .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--baseline); flex: none; }
.pill.good { color: var(--good-text); } .pill.good .dot { background: var(--good); }
.pill.info .dot { background: var(--accent); }
.pill.warning { color: var(--warning-text); } .pill.warning .dot { background: var(--warning); }
.pill.serious { color: var(--serious-text); } .pill.serious .dot { background: var(--serious); }
.pill.critical { color: var(--critical); } .pill.critical .dot { background: var(--critical); }
.pill.neutral { color: var(--ink-muted); }

/* ---- by person: list + detail ---- */
.person-layout { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.plist { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.plist .pcard { display: block; width: 100%; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
.plist .pcard:last-child { border-bottom: none; }
.plist .pcard:hover { background: var(--accent-wash); }
.plist .pcard[aria-current="true"] { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.plist .pcard.flagged:not([aria-current="true"]) { box-shadow: inset 3px 0 0 var(--critical); }
.pcard .n1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pcard .nm { font-weight: 700; }
.pcard .dt { font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pcard .dt.bad { color: var(--critical); font-weight: 700; }
.pcard .sub { font-size: 12px; color: var(--ink-muted); margin: 1px 0 6px; }
.pcard .n3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pcard .tag { font-size: 11.5px; font-weight: 700; color: var(--critical); }
.pcard .tag.warn { color: var(--warning-text); }

.pdetail .facts { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 18px; border-bottom: 1px solid var(--hairline); font-size: 13px; color: var(--ink-2); }
.pdetail .facts b { color: var(--ink); font-weight: 700; }
.pdetail .flags { padding: 10px 18px; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 4px; }
.pdetail .flag { font-size: 12.5px; font-weight: 600; color: var(--warning-text); }
.pdetail .flag.critical { color: var(--critical); }
.dept-block > .dhead { display: flex; align-items: center; gap: 12px; padding: 9px 18px; background: var(--band); border-top: 1px solid var(--hairline); font-weight: 700; font-size: 13.5px; }
.dept-block:first-child > .dhead { border-top: none; }
.dept-block > .dhead .bar { margin-left: auto; font-weight: 500; }

/* ---- data notes ---- */
.notes { margin-top: 24px; font-size: 12.5px; color: var(--ink-2); }
.notes summary { cursor: pointer; font-weight: 600; }
.notes ul { margin: 8px 0 0; padding-left: 18px; }
.footnote { margin-top: 10px; font-size: 12px; color: var(--ink-muted); }

@media (max-width: 900px) {
  .shell { padding: 0 16px 48px; }
  .topbar { margin: 0 -16px 16px; padding: 10px 16px; position: static; }
  .person-layout { grid-template-columns: 1fr; }
  .plist { position: static; max-height: 360px; }
  .tasks td.st { width: auto; padding-left: 18px; }
  .tasks td.when { width: auto; white-space: normal; }
  .pname { min-width: 0; }
  .meta { margin-left: 0; gap: 10px; }
  .prow-head { flex-wrap: wrap; }
}
