/* ================================================================
   Total Control design tokens
   Same brand as theacclivusgroup.com (src/styles/global.css), different job:
   the site persuades, this is where someone works all day. Green stays the
   single accent; amber is the only other signal, reserved for "a person
   needs to look at this".
   ================================================================ */
@font-face { font-family: "Roboto"; font-weight: 300; font-display: swap; src: url("/fonts/roboto-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("/fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("/fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("/fonts/roboto-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Condensed"; font-weight: 400; font-display: swap; src: url("/fonts/roboto-condensed-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Condensed"; font-weight: 700; font-display: swap; src: url("/fonts/roboto-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --purple-950: #1a052f;
  --purple-900: #260848;
  --purple-800: #34294f;
  --purple-100: #eae5f2;
  --purple-50: #f5f2fa;
  --green-700: #1e4e08;
  --green-600: #296509;
  --green-100: #e8f0e2;
  --green-50: #f3f8ef;
  --amber-700: #8a4b05;
  --amber-50: #fdf5e9;
  --ink-900: #191919;
  --ink-700: #3b3b3b;
  --ink-500: #5f5f5f;
  --line: #e0dde6;
  --mist: #f6f5f8;
  --white: #fff;

  --font-sans: "Roboto", Arial, Helvetica, sans-serif;
  --font-cond: "Roboto Condensed", "Roboto", Arial, sans-serif;

  --rail-w: 248px;
  --context-w: 380px;
  --radius: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 160ms;
  --shadow-1: 0 1px 2px rgba(38, 8, 72, 0.06), 0 1px 1px rgba(38, 8, 72, 0.04);
  --shadow-2: 0 10px 30px rgba(38, 8, 72, 0.12), 0 2px 6px rgba(38, 8, 72, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green-600); }
:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- type ---- */
.t-display { font-weight: 300; font-size: 22px; line-height: 1.25; letter-spacing: -0.005em; margin: 0; }
.t-display-lg { font-weight: 300; font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
.t-title { font-weight: 500; font-size: 15px; line-height: 1.35; margin: 0; }
.t-body { color: var(--ink-700); margin: 0; }
.t-small { font-size: 13px; color: var(--ink-500); }
.t-num { font-weight: 300; font-size: 26px; line-height: 1.1; letter-spacing: -0.01em; }
.eyebrow {
  font-family: var(--font-cond); font-weight: 700; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--green-600); margin: 0;
}
.muted { color: var(--ink-500); }

/* ================================================================
   Shell: rail | work | context
   ================================================================ */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--context-w);
  height: 100vh;
}
.app.no-context { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.app.no-context .context { display: none; }

/* ---- rail ---- */
.rail {
  background: var(--purple-900);
  color: rgba(255, 255, 255, 0.82);
  display: flex; flex-direction: column;
  min-height: 0;
  position: relative;
}
.rail::after {
  /* the logo's three ascending columns, as a quiet floor under the rail */
  content: ""; position: absolute; inset: auto 0 0 0; height: 140px; pointer-events: none;
  background: url("/brand/acclivus-mark.png") no-repeat right -24px bottom -30px / 210px auto;
  filter: brightness(0) invert(1); opacity: 0.05;
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; color: #fff; text-decoration: none; }
.rail-brand img { width: 34px; height: auto; filter: brightness(0) invert(1); }
.rail-brand b { font-weight: 500; font-size: 16px; letter-spacing: 0.01em; display: block; line-height: 1.1; }
.rail-brand small { font-family: var(--font-cond); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; }

.room-switch {
  margin: 4px 16px 10px; display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(255, 255, 255, 0.07); border-radius: 999px; padding: 3px;
}
.room-switch button {
  border: 0; background: transparent; color: rgba(255, 255, 255, 0.7); cursor: pointer;
  padding: 7px 4px; border-radius: 999px; font-family: var(--font-cond); font-weight: 700;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  transition: background var(--fast) var(--ease), color var(--fast);
}
.room-switch button[aria-pressed="true"] { background: #fff; color: var(--purple-900); }

.rail-nav { flex: 1; overflow-y: auto; padding: 4px 0 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.rail-group { margin: 14px 20px 4px; font-family: var(--font-cond); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); }
.rail-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 20px; color: rgba(255, 255, 255, 0.78);
  text-decoration: none; font-size: 14px; position: relative;
  transition: background var(--fast), color var(--fast);
}
.rail-link:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.rail-link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.08); }
.rail-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; background: var(--green-600); border-radius: 0 2px 2px 0; }
.rail-link .count { margin-left: auto; font-size: 12px; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.rail-link .count.hot { background: var(--green-600); color: #fff; }
.rail-link svg { width: 16px; height: 16px; flex: none; opacity: 0.8; }

.rail-foot { border-top: 1px solid rgba(255, 255, 255, 0.08); padding: 14px 16px 16px; display: grid; gap: 10px; position: relative; z-index: 1; }
.meter { text-decoration: none; color: inherit; display: block; padding: 10px 12px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); }
.meter:hover { background: rgba(255, 255, 255, 0.1); }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: #fff; }
.meter-top b { font-weight: 500; font-size: 18px; }
.meter-bar { height: 4px; background: rgba(255, 255, 255, 0.14); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--green-600); border-radius: 2px; transition: width 400ms var(--ease); }
.meter small { display: block; margin-top: 6px; font-size: 12px; color: rgba(255, 255, 255, 0.55); }
.rail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rail-btn {
  border: 1px solid rgba(255, 255, 255, 0.2); background: transparent; color: #fff; border-radius: var(--radius);
  padding: 8px 6px; font-size: 12px; cursor: pointer; font-family: var(--font-cond); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.rail-btn:hover { background: rgba(255, 255, 255, 0.08); }
.rail-btn[aria-pressed="true"] { background: var(--green-600); border-color: var(--green-600); }
.rail-user { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(255, 255, 255, 0.55); }

/* ---- work ---- */
.work { overflow-y: auto; min-width: 0; position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: rgba(246, 245, 248, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-500); flex-wrap: wrap; }
.topbar .crumbs button { border: 0; background: none; padding: 2px 4px; border-radius: 4px; cursor: pointer; color: var(--ink-500); }
.topbar .crumbs button:hover { color: var(--ink-900); background: var(--purple-50); }
.topbar .crumbs button[aria-current="true"] { color: var(--ink-900); font-weight: 500; }
.topbar .crumbs .sep { opacity: 0.4; }
.topbar .spacer { flex: 1; }
.page { padding: 28px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { margin: 4px 0 0; color: var(--ink-500); font-size: 14px; max-width: 64ch; }

/* ---- context ---- */
.context { background: #fff; border-left: 1px solid var(--line); overflow-y: auto; min-width: 0; }
.context-inner { padding: 24px; }
.context-empty { padding: 40px 24px; color: var(--ink-500); font-size: 14px; }

/* ================================================================
   Components
   ================================================================ */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: 18px; position: relative;
}
.card.rule { border-top: 3px solid var(--green-600); }
.card.amber { border-top: 3px solid var(--amber-700); }
.card.select { cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease); }
.card.select:hover { border-color: #cfc9da; box-shadow: var(--shadow-2); }
.card.select[aria-selected="true"] { border-color: var(--purple-900); box-shadow: 0 0 0 1px var(--purple-900), var(--shadow-2); }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head .grow { flex: 1; min-width: 0; }
.card-foot { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.section { margin-top: 30px; }
.section > .eyebrow { margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--line); background: #fff; color: var(--ink-900); cursor: pointer;
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform 80ms;
}
.btn:hover { border-color: #c9c3d4; background: var(--mist); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.btn.primary:hover { background: var(--green-700); border-color: var(--green-700); }
.btn.dark { background: var(--purple-900); border-color: var(--purple-900); color: #fff; }
.btn.dark:hover { background: var(--purple-950); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-700); }
.btn.ghost:hover { background: var(--purple-50); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--mist); color: var(--ink-700); border: 1px solid var(--line); white-space: nowrap; line-height: 1.6;
}
.pill.green { background: var(--green-50); color: var(--green-700); border-color: #cfe0c4; }
.pill.amber { background: var(--amber-50); color: var(--amber-700); border-color: #f0d9b5; }
.pill.dark { background: var(--purple-900); color: #fff; border-color: var(--purple-900); }
.pill.sample { background: transparent; color: var(--ink-500); border-style: dashed; font-weight: 400; }
.pill.live::before, .dot-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); display: inline-block;
  box-shadow: 0 0 0 0 rgba(41, 101, 9, 0.5); animation: pulse 2s infinite;
}
.dot-live { display: inline-flex; align-items: center; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(41, 101, 9, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(41, 101, 9, 0); } 100% { box-shadow: 0 0 0 0 rgba(41, 101, 9, 0); } }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--purple-100); color: var(--purple-900); font-weight: 500; font-size: 13px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.green { background: var(--green-100); color: var(--green-700); }

.stat { padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--ink-500); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.stat .delta { font-size: 12px; color: var(--green-700); margin-top: 4px; }

.progress { height: 8px; background: var(--purple-50); border-radius: 4px; overflow: hidden; position: relative; }
.progress i { display: block; height: 100%; background: var(--green-600); border-radius: 4px; transition: width 500ms var(--ease); }
.progress.thin { height: 4px; }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-500); margin-top: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-500); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--mist); }
.table .num { text-align: right; }
.table-wrap { overflow-x: auto; }

.field { display: grid; gap: 5px; }
.field label, .field .label { font-size: 12px; color: var(--ink-500); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px 10px; min-height: 36px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(41, 101, 9, 0.12); }
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--purple-900); color: #fff; }

.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-500); }
.empty .t-title { color: var(--ink-900); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--mist) 0%, #eeebf2 50%, var(--mist) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 4px; height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.note { border-left: 3px solid var(--amber-700); background: var(--amber-50); padding: 10px 12px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; color: var(--ink-700); }
.note.green { border-color: var(--green-600); background: var(--green-50); }
.note.purple { border-color: var(--purple-900); background: var(--purple-50); }

.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; color: var(--ink-700); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

/* ---- morning board ---- */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.next {
  background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--green-600); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center;
}
.next .t-display-lg { margin: 6px 0 6px; }
.next-actions { display: grid; gap: 8px; min-width: 190px; }
.queue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.queue .card { padding: 14px; }
.queue .card .t-title { margin-top: 6px; }
.queue .card .t-small { margin-top: 2px; }
.queue .card[aria-selected="true"] { border-color: var(--purple-900); }
.timer { font-variant-numeric: tabular-nums; font-weight: 500; }
.behind { margin-top: 28px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }

/* ---- script ---- */
.steps { display: grid; gap: 0; counter-reset: step; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 0; position: relative; }
.step::before {
  counter-increment: step; content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-cond); font-weight: 700; font-size: 13px; border: 1.5px solid var(--line); color: var(--ink-500); background: #fff; z-index: 1;
}
.step:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 38px; bottom: -12px; width: 1.5px; background: var(--line); }
.step.done::before { background: var(--green-600); border-color: var(--green-600); color: #fff; content: "✓"; }
.step.now::before { border-color: var(--green-600); color: var(--green-700); box-shadow: 0 0 0 4px var(--green-50); }
.step.locked { opacity: 0.55; }
.say { background: var(--purple-50); border-radius: var(--radius); padding: 12px 14px; font-size: 15px; line-height: 1.55; color: var(--ink-900); margin-top: 6px; }

/* ---- live floor ---- */
.floor-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.call { padding: 14px; }
.call .who { display: flex; gap: 10px; align-items: center; }
.call .dur { margin-left: auto; font-weight: 500; font-size: 14px; }
.stage { display: flex; gap: 3px; margin: 12px 0 6px; }
.stage i { flex: 1; height: 4px; border-radius: 2px; background: var(--purple-100); }
.stage i.on { background: var(--green-600); }
.call-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.call-controls .btn { padding: 0 4px; font-size: 12px; min-height: 30px; }
.call.paused { opacity: 0.6; }
.call.ringing .dur { color: var(--ink-500); }
.banner {
  display: flex; gap: 12px; align-items: center; background: var(--purple-900); color: #fff; padding: 10px 16px; border-radius: var(--radius); margin-bottom: 14px;
}
.banner .grow { flex: 1; }
.wave { display: flex; gap: 3px; align-items: center; height: 26px; }
.wave i { width: 3px; background: var(--green-600); border-radius: 2px; animation: wave 1.1s ease-in-out infinite; }
.wave i:nth-child(2n) { animation-delay: -0.3s; } .wave i:nth-child(3n) { animation-delay: -0.6s; } .wave i:nth-child(5n) { animation-delay: -0.9s; }
@keyframes wave { 0%, 100% { height: 5px; } 50% { height: 24px; } }

/* ---- spread waterfall ---- */
.spread { display: grid; gap: 8px; }
.spread-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: 14px; }
.spread-bar { height: 22px; background: var(--mist); border-radius: 4px; position: relative; overflow: hidden; }
.spread-bar i { position: absolute; top: 0; bottom: 0; background: var(--purple-900); border-radius: 4px; transition: left 400ms var(--ease), width 400ms var(--ease); }
.spread-row.agent .spread-bar i { background: var(--green-600); }
.spread-row.bad .spread-bar i { background: var(--amber-700); }

/* ---- kanban ---- */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.lane-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; padding: 2px 4px 10px; }
.lane .card { padding: 12px; margin-bottom: 8px; }

/* ---- calendar ---- */
.cal { display: grid; grid-template-columns: 52px repeat(5, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.cal > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 52px; padding: 4px; font-size: 12px; position: relative; }
.cal .h { background: var(--mist); font-weight: 500; text-align: center; min-height: 0; padding: 8px 4px; }
.cal .t { color: var(--ink-500); text-align: right; padding-right: 8px; }
.appt { background: var(--purple-50); border-left: 3px solid var(--purple-900); border-radius: 3px; padding: 4px 6px; font-size: 12px; line-height: 1.3; }
.appt.green { background: var(--green-50); border-color: var(--green-600); }
.appt.amber { background: var(--amber-50); border-color: var(--amber-700); }

/* ---- messages ---- */
.thread { display: grid; gap: 8px; }
.bubble { max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.bubble.in { background: var(--mist); border-bottom-left-radius: 4px; }
.bubble.out { background: var(--purple-900); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble small { display: block; opacity: 0.6; font-size: 11px; margin-top: 3px; }

/* ---- matrix ---- */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.cell { display: inline-block; width: 22px; height: 22px; border-radius: 4px; line-height: 22px; font-size: 11px; }
.cell.ok { background: var(--green-600); color: #fff; }
.cell.pend { background: var(--purple-100); color: var(--purple-900); }
.cell.gap { background: var(--amber-50); color: var(--amber-700); border: 1px dashed var(--amber-700); }
.cell.na { background: var(--mist); color: var(--ink-500); }

/* ---- checker ---- */
.checker { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.finding { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.finding:last-child { border-bottom: 0; }
.finding .icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.finding.pass .icon { background: var(--green-600); }
.finding.block .icon { background: var(--amber-700); }
.finding.warn .icon { background: var(--purple-800); }
mark.flag { background: var(--amber-50); color: var(--amber-700); border-bottom: 2px solid var(--amber-700); padding: 0 1px; }

/* ================================================================
   Inspector
   ================================================================ */
body.inspecting [data-el] { cursor: help; }
body.inspecting [data-el]:hover { outline: 2px dashed var(--green-600); outline-offset: 3px; }
[data-el].inspected { outline: 2px solid var(--green-600) !important; outline-offset: 3px; }
.el-chip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--purple-900); color: #fff; font-size: 11px;
  padding: 3px 8px; border-radius: 4px; font-family: var(--font-cond); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
  transform: translateY(-100%); white-space: nowrap; display: none;
}
.inspector {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw; background: #fff; z-index: 50;
  border-left: 1px solid var(--line); box-shadow: var(--shadow-2); transform: translateX(105%);
  transition: transform 220ms var(--ease); display: flex; flex-direction: column;
}
.inspector.open { transform: none; }
.insp-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.insp-head .grow { flex: 1; }
.insp-body { padding: 18px 20px 30px; overflow-y: auto; flex: 1; }
.insp-section { margin-bottom: 22px; }
.insp-section > .eyebrow { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.swatches { display: grid; gap: 6px; }
.swatch { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.swatch i { width: 26px; height: 26px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.08); }
.links { display: grid; gap: 6px; }
.link-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink-900); font-size: 13px; }
.link-row:hover { background: var(--mist); }
.link-row .grow { flex: 1; min-width: 0; }
.link-row small { display: block; color: var(--ink-500); font-size: 11px; }
.q { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.q.blocker { border-left: 3px solid var(--amber-700); }
.q.answered { border-left: 3px solid var(--green-600); }
.q-head { display: flex; gap: 8px; align-items: baseline; }
.q-num { font-family: var(--font-cond); font-weight: 700; color: var(--ink-500); font-size: 13px; flex: none; }
.q-text { font-size: 14px; line-height: 1.45; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.q-why { font-size: 13px; color: var(--ink-500); margin: 0 0 10px; }
.dial { display: grid; grid-template-columns: 1fr 96px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.dial input[type="range"] { width: 100%; accent-color: var(--green-600); }
.dial .input { min-height: 30px; padding: 4px 8px; text-align: right; }
.dial-table { width: 100%; font-size: 13px; border-collapse: collapse; margin-bottom: 8px; }
.dial-table td { padding: 3px 4px; }
.dial-table .input { min-height: 28px; padding: 3px 6px; text-align: right; }
.saved { font-size: 12px; color: var(--green-700); }

/* ---- walk ---- */
.walk {
  position: fixed; left: calc(var(--rail-w) + 24px); bottom: 24px; z-index: 70; width: 380px; background: var(--purple-900); color: #fff;
  border-radius: 10px; box-shadow: 0 20px 50px rgba(26, 5, 47, 0.35); padding: 18px 18px 14px; display: none;
}
.walk.open { display: block; animation: rise 240ms var(--ease); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.walk .eyebrow { color: #a9d58f; }
.walk h3 { margin: 6px 0 6px; font-weight: 400; font-size: 18px; }
.walk p { margin: 0; color: rgba(255, 255, 255, 0.8); font-size: 14px; }
.walk-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.walk-dots { display: flex; gap: 4px; flex: 1; }
.walk-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.walk-dots i.on { background: #fff; }
.walk .btn { border-color: rgba(255, 255, 255, 0.3); background: transparent; color: #fff; }
.walk .btn.primary { background: var(--green-600); border-color: var(--green-600); }
.spot { position: relative; z-index: 2; box-shadow: 0 0 0 4px rgba(41, 101, 9, 0.25), 0 0 0 9999px rgba(26, 5, 47, 0.18) !important; border-radius: var(--radius); transition: box-shadow 200ms; }

/* ---- toast ---- */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; }
.toast { background: var(--ink-900); color: #fff; padding: 9px 14px; border-radius: var(--radius); font-size: 14px; box-shadow: var(--shadow-2); animation: rise 200ms var(--ease); }

/* ---- studio ---- */
.tokens { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.token { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; font-size: 12px; }
.token i { display: block; height: 56px; }
.token div { padding: 8px 10px; }
.token b { display: block; font-weight: 500; font-size: 13px; }
.specimen { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.specimen:last-child { border-bottom: 0; }
.comp { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.comp-spec { border-left: 1px solid var(--line); padding-left: 18px; font-size: 13px; }
.comp-spec dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.comp-spec dt { color: var(--ink-500); }
.comp-spec dd { margin: 0; }

/* ---- decisions / packet ---- */
.qrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) 150px 110px; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; background: #fff; }
.qrow:hover { background: var(--mist); }
.qrow .num { font-family: var(--font-cond); font-weight: 700; color: var(--ink-500); }
.qgroup { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.qgroup-head { padding: 10px 16px; background: var(--mist); font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.packet { background: #fff; max-width: 820px; margin: 0 auto; padding: 48px 56px; border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.packet h1 { font-weight: 300; font-size: 30px; margin: 0 0 4px; }
.packet h2 { font-weight: 400; font-size: 19px; margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--green-600); }
.packet .pq { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.packet .pq b { font-weight: 500; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--purple-900); position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; inset: 0; background: url("/brand/acclivus-mark.png") no-repeat right -80px bottom -90px / 620px auto; filter: brightness(0) invert(1); opacity: 0.05; }
.login-card { position: relative; width: min(400px, calc(100vw - 32px)); background: #fff; border-radius: 10px; padding: 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); border-top: 3px solid var(--green-600); }
.login-card img { width: 180px; display: block; margin-bottom: 20px; }

/* ---- responsive ---- */
@media (max-width: 1280px) {
  :root { --context-w: 330px; }
  .queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.menu-btn, .nav-backdrop { display: none; }
.menu-btn {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius); min-height: 36px; min-width: 40px;
  padding: 0 10px; cursor: pointer; align-items: center; justify-content: center; gap: 6px; color: var(--ink-900); flex: none;
}
.topbar-title { display: none; font-weight: 500; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- module parts: tabs, stage chips, bars, columns, tree */
.grow { flex: 1; min-width: 0; }
.tabs { max-width: 100%; overflow-x: auto; }
.tabs button { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips span { font-size: 11px; line-height: 18px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--mist); color: var(--ink-500); }
.chips span.done { background: var(--green-50); border-color: #cfe0c4; color: var(--green-700); }
.chips span.now { background: var(--purple-900); border-color: var(--purple-900); color: #fff; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr) 64px; align-items: center; gap: 10px; }
.bar-row b { font-weight: 500; text-align: right; font-size: 14px; }
.bar-track { height: 8px; background: var(--purple-50); border-radius: 4px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--green-600); border-radius: 4px; transition: width 500ms var(--ease); }
.bar-track i.alt { background: var(--purple-900); }
.cols { display: flex; align-items: stretch; gap: 6px; height: 170px; }
.cols > div { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.cols i { display: block; width: 100%; max-width: 34px; min-height: 2px; background: var(--green-600); border-radius: 3px 3px 0 0; }
.cols i.now { background: var(--purple-900); }
.cols span { font-size: 11px; color: var(--ink-500); }
.tree { list-style: none; margin: 0; padding: 0; }
.tree button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px; border-radius: var(--radius); text-align: left; cursor: pointer; }
.tree button:hover { background: var(--purple-50); }
.tree button[aria-current="true"] { background: var(--purple-900); color: #fff; }
.tree .type { font-family: var(--font-cond); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-500); min-width: 58px; }
.tree button[aria-current="true"] .type { color: rgba(255, 255, 255, 0.7); }
.tree .n { font-size: 12px; min-width: 20px; text-align: right; }

/* Tablet and phone: the rail becomes a drawer, the page scrolls as a document, and the context column follows the content. */
@media (max-width: 1080px) {
  html, body { height: auto; }
  .app, .app.no-context { display: block; height: auto; min-height: 100vh; }
  .work { overflow: visible; display: contents; }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 80; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform 220ms var(--ease); box-shadow: 0 0 40px rgba(26, 5, 47, 0.35);
  }
  body.nav-open .rail { transform: none; }
  body.nav-open { overflow: hidden; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 79; background: rgba(26, 5, 47, 0.4); }
  body.nav-open .nav-backdrop { display: block; }
  .rail-link { padding: 10px 20px; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .context { display: block; border-left: 0; border-top: 1px solid var(--line); }
  .app.no-context .context { display: none; }
  .context-inner { max-width: 760px; }
  .walk { left: 16px; right: 16px; width: auto; bottom: 16px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .behind, .checker, .comp { grid-template-columns: minmax(0, 1fr); }
  .comp-spec { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .grid[style*="grid-template-columns"]:not(.keep) { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 760px) {
  .topbar .crumbs, .topbar .pill { display: none; }
  .topbar-title { display: block; flex: 1; }
  .topbar .spacer { display: none; }
  .g2, .g3, .g4, .queue, .next, .behind { grid-template-columns: minmax(0, 1fr); }
  .next-actions { min-width: 0; }
  .page { padding: 18px 16px 28px; }
  .page-head { align-items: flex-start; }
  .page-head .grow { min-width: 0; flex-basis: 100%; }
  .t-display-lg { font-size: 26px; line-height: 1.2; }
  .card, .grid > *, .stack > * { min-width: 0; }
  .row { flex-wrap: wrap; }
  .list-item { flex-wrap: wrap; row-gap: 8px; }
  .list-item .grow { flex-basis: 55%; }
  .floor { grid-template-columns: minmax(0, 1fr); }
  .qrow { grid-template-columns: 28px minmax(0, 1fr); }
  .qrow > :nth-child(n + 3) { grid-column: 2; }
  .packet { padding: 24px 18px; }
  .packet, .say, .note, .t-small, .q-text { overflow-wrap: anywhere; }
  .bubble { max-width: 90%; }
  .table-wrap > .table { min-width: 600px; }
  .table .t-small, .table .note { overflow-wrap: normal; }
  .cal { font-size: 11px; grid-template-columns: 38px repeat(5, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: minmax(0, 1fr) 56px; row-gap: 4px; }
  .bar-row > span { grid-column: 1 / -1; }
  .bar-row .bar-track { grid-column: 1; }
  .cols { gap: 3px; height: 140px; }
  .cols span { font-size: 9px; }
  .inspector { width: 100vw; }
  .el-chip { display: none !important; }
  .toasts { left: 12px; right: 12px; transform: none; }
}

@media print {
  .rail, .topbar, .context, .inspector, .walk, .toasts, .no-print { display: none !important; }
  .app { display: block; height: auto; }
  .work { overflow: visible; }
  body { background: #fff; }
  .packet { border: 0; box-shadow: none; padding: 0; max-width: none; }
}
