/* Product styles, built only from css/tokens.css (and /brand.css, which sets the accent and the
   fonts per niche). The shape follows Lance's current app: a light rail on the left, each page
   with its own title row, dense tables, side panels that slide in from the right, neutral ink
   with one accent used sparingly. */

:root { --tabbar-h: 60px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  font-feature-settings: "cv11" 1, "ss01" 1;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-control); }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s-4); top: -60px; z-index: 1400;
  background: var(--inverse); color: var(--ink-inverse); padding: var(--s-2) var(--s-4); border-radius: var(--r);
  text-decoration: none; font-weight: 500;
}
.skip:focus { top: var(--s-3); }

/* ---------- type ---------- */
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; line-height: var(--lh-tight); }
.mono, .code { font-family: var(--font-mono); font-feature-settings: "zero" 0; }
.code { font-size: var(--t-sm); letter-spacing: 0; }
.label {
  font-size: var(--t-xs); color: var(--ink-subtle); font-weight: 500; line-height: 1.35; letter-spacing: 0;
}
.eyebrow {
  font-size: var(--t-2xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-subtle);
  display: inline-flex; align-items: center; gap: 6px;
}
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-subtle); }
.small { font-size: var(--t-sm); }
.xsmall { font-size: var(--t-xs); }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tone-red { color: var(--tone-red); } .tone-amber { color: var(--tone-amber); } .tone-green { color: var(--tone-green); }
.tone-blue { color: var(--tone-blue); } .tone-gray { color: var(--ink-subtle); } .tone-clay { color: var(--tone-clay); }
.link {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-control);
  text-underline-offset: 3px; background: none; border: 0; padding: 0; cursor: pointer; font-weight: 500;
}
.link:hover { text-decoration-color: var(--ink); }
.kbd {
  font-family: var(--font-mono); font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: var(--r-sm);
  background: var(--fill); color: var(--ink-subtle); border: 1px solid var(--line);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h-control); padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--paper-0); color: var(--ink);
  font-size: var(--t-sm); font-weight: 500; white-space: nowrap; cursor: pointer; line-height: 1;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
  text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent; box-shadow: var(--shadow-card);
}
.btn:hover { background: var(--sunken); border-color: var(--line-control); }
.btn:active { background: var(--fill); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex: none; }
.btn-primary, .btn-dark { background: var(--inverse); border-color: var(--inverse); color: var(--ink-inverse); box-shadow: none; }
.btn-primary:hover, .btn-dark:hover { background: var(--inverse-hover); border-color: var(--inverse-hover); }
.btn-primary:active, .btn-dark:active { background: var(--inverse); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); box-shadow: none; }
.btn-ghost:hover { background: var(--state-hover); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--tone-red); border-color: color-mix(in srgb, var(--tone-red) 30%, var(--line-strong)); }
.btn-danger:hover { background: var(--tone-red-bg); border-color: var(--tone-red); }
.btn-danger-solid { background: var(--tone-red-solid); border-color: var(--tone-red-solid); color: #fff; box-shadow: none; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--tone-red-solid) 86%, #000); border-color: transparent; }
.btn-sm { height: var(--h-dense); padding: 0 10px; font-size: var(--t-sm); border-radius: var(--r-control); gap: 5px; }
.btn-lg { height: var(--h-large); padding: 0 16px; font-size: var(--t-base); }
.btn-pill { border-radius: var(--r-pill); }
.btn-icon { width: var(--h-control); padding: 0; }
.btn-sm.btn-icon { width: var(--h-dense); }
.btn-block { width: 100%; }
.btn .busy-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.icon-btn {
  position: relative; width: var(--h-control); height: var(--h-control); border-radius: var(--r); border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-muted); flex: none;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--state-hover); color: var(--ink); }
.icon-btn:active { background: var(--state-pressed); }
.icon-btn-sm { width: var(--h-xs); height: var(--h-xs); border-radius: var(--r-control); }
.icon-btn .badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--tone-red-solid); color: #fff;
  font-size: 10px; font-weight: 600; display: grid; place-items: center; line-height: 1;
}

.actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.actions-end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- chips, counts ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 500; white-space: nowrap; line-height: 1;
  background: var(--tone-gray-bg); color: var(--tone-gray); max-width: 100%; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip svg { flex: none; }
.chip-green { background: var(--tone-green-bg); color: var(--tone-green); }
.chip-amber { background: var(--tone-amber-bg); color: var(--tone-amber); }
.chip-red { background: var(--tone-red-bg); color: var(--tone-red); }
.chip-clay { background: var(--tone-clay-bg); color: var(--tone-clay); }
.chip-blue { background: var(--tone-blue-bg); color: var(--tone-blue); }
.chip-gray { background: var(--tone-gray-bg); color: var(--tone-gray); }
.chip-done { background: transparent; color: var(--ink-subtle); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip-done::before { content: ""; width: 9px; height: 5px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg) translate(1px, -1px); flex: none; }
.chip-urgent { background: var(--tone-red-solid); color: #fff; }
.chip-accent { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.chip-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-muted); }
.chip-ink { background: var(--inverse); color: var(--ink-inverse); }
a.chip { text-decoration: none; }
a.chip:hover, button.chip:hover { filter: brightness(0.97); }
button.chip { border: 0; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.count-pill {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--fill); color: var(--ink-muted); font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.count-ink { background: var(--inverse); color: var(--ink-inverse); }
.count-red { background: var(--tone-red-bg); color: var(--tone-red); }
.count-amber { background: var(--tone-amber-bg); color: var(--tone-amber); }

.pri-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); white-space: nowrap; color: var(--ink-muted); }
.pri-dot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-control); flex: none; }
.pri-dot.pri-high { color: var(--ink); } .pri-dot.pri-high .dot { background: #d9822b; }
.pri-dot.pri-urgent { color: var(--tone-red); font-weight: 600; } .pri-dot.pri-urgent .dot { background: var(--tone-red-solid); }
.pri-dot.pri-low .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-control); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > .label { color: var(--ink-muted); font-size: var(--t-sm); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: var(--h-control); padding: 0 10px;
  border: 1px solid var(--line-control); border-radius: var(--r); background: var(--paper-0);
  color: var(--ink); font-size: var(--t-base);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.textarea { height: auto; min-height: 88px; padding: 8px 10px; line-height: var(--lh); resize: vertical; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%23808080' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 16px;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus, .input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none; border-color: var(--line-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--tone-red); }
.input-sm, .select-sm { height: var(--h-dense); font-size: var(--t-sm); border-radius: var(--r-control); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--sunken); color: var(--ink-subtle); cursor: not-allowed; }
.input-search {
  padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%23808080' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M9 15a6 6 0 1 0 0-12 6 6 0 0 0 0 12z M13.5 13.5 17 17'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; background-size: 15px;
}
.hint { font-size: var(--t-xs); color: var(--ink-subtle); line-height: 1.4; }
.field-error { font-size: var(--t-sm); color: var(--tone-red); }
.form { display: grid; gap: var(--s-4); }
.form-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { display: grid; gap: var(--s-4); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.input-group { display: flex; gap: var(--s-2); align-items: center; }
.input-group > .input, .input-group > .select { flex: 1; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; min-height: 28px; }
.check input { width: 16px; height: 16px; accent-color: var(--inverse); margin: 0; flex: none; }

.switch {
  position: relative; display: inline-flex; align-items: center; width: 36px; height: 22px; flex: none;
  border-radius: var(--r-pill); background: var(--line-control); border: 0; padding: 0; cursor: pointer;
  transition: background var(--dur-2) var(--ease);
}
.switch::after {
  content: ""; position: absolute; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform var(--dur-2) var(--ease);
}
.switch[aria-checked="true"] { background: var(--tone-green); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }
.switch[disabled] { opacity: 0.5; cursor: not-allowed; }
.switch:focus-visible { box-shadow: var(--focus-ring); }
.switch-row { display: flex; align-items: flex-start; gap: var(--s-3); }
.switch-row > .switch { margin-top: 1px; }

.range { width: 100%; accent-color: var(--inverse); height: 28px; }

/* A segmented control hugs its options (inside a grid or a column it never stretches); .seg-full
   spans its container and splits the width evenly. */
.seg { display: inline-flex; width: max-content; max-width: 100%; justify-self: start; align-self: start; flex: none; padding: 2px; gap: 2px; border-radius: var(--r); background: var(--fill); overflow-x: auto; scrollbar-width: none; }
.seg.seg-full { display: flex; width: 100%; justify-self: stretch; }
.seg.seg-full > button { flex: 1 1 0; justify-content: center; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 26px; padding: 0 10px; border: 0; border-radius: var(--r-control); background: transparent;
  color: var(--ink-muted); font-size: var(--t-sm); font-weight: 500; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--paper-0); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* ---------- surfaces ---------- */
.panel { background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.panel-head {
  display: flex; align-items: center; gap: var(--s-2); padding: 12px var(--s-4);
  border-bottom: 1px solid var(--line); min-height: 48px;
}
.panel-head h2, .panel-head h3 { font-size: var(--t-base); font-weight: 600; letter-spacing: -0.005em; }
.panel-head .count { font-size: var(--t-xs); color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.panel-body { padding: var(--s-4); }
.panel-foot { padding: 10px var(--s-4); border-top: 1px solid var(--line); display: flex; gap: var(--s-2); align-items: center; }
.panel-flush .panel-body { padding: 0; }
.stack { display: grid; gap: var(--s-4); min-width: 0; }
.stack-lg { display: grid; gap: var(--s-6); min-width: 0; }
.stack-sm { display: grid; gap: var(--s-2); min-width: 0; }
.row { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.row-top { align-items: flex-start; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.grid-2 { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-main-side { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.note {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border-radius: var(--r); background: var(--sunken); color: var(--ink-muted); font-size: var(--t-sm); line-height: 1.45;
  border: 1px solid var(--line);
}
.note svg { flex: none; margin-top: 1px; color: var(--ink-subtle); }
/* A note without an icon is one paragraph: its bold lead, text and link flow as a sentence. */
.note:not(:has(> svg)) { display: block; }
.note strong { color: var(--ink); }
.note-amber { background: var(--tone-amber-bg); color: var(--ink); border-color: transparent; }
.note-amber svg { color: var(--tone-amber); }
.note-red { background: var(--tone-red-bg); color: var(--ink); border-color: transparent; }
.note-red svg { color: var(--tone-red); }
.note-green { background: var(--tone-green-bg); color: var(--ink); border-color: transparent; }
.note-green svg { color: var(--tone-green); }
.note-blue { background: var(--tone-blue-bg); color: var(--ink); border-color: transparent; }
.note-blue svg { color: var(--tone-blue); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; min-width: 0; -webkit-overflow-scrolling: touch; }
.table { font-size: var(--t-sm); }
.table th {
  text-align: left; font-size: var(--t-xs); font-weight: 500; color: var(--ink-subtle);
  padding: 0 12px; height: 34px; border-bottom: 1px solid var(--line); background: var(--paper-0); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.table th:first-child, .table td:first-child { padding-left: var(--s-4); }
.table th:last-child, .table td:last-child { padding-right: var(--s-4); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; height: 44px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1) var(--ease); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--state-hover); }
.table tbody tr[aria-selected="true"], .table tbody tr.is-selected { background: var(--state-selected); box-shadow: inset 2px 0 0 var(--ink); }
.table tbody tr.clickable:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); border-radius: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-title { font-weight: 500; color: var(--ink); font-size: var(--t-base); }
.table .cell-sub { color: var(--ink-subtle); font-size: var(--t-xs); }
.table .cell-unit { font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 500; }
.unit-box {
  display: inline-grid; place-items: center; min-width: 40px; height: 24px; padding: 0 6px; border-radius: var(--r-control);
  background: var(--fill); font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 600; color: var(--ink); letter-spacing: -0.01em;
}
.unit-box-lg { min-width: 56px; height: 34px; font-size: var(--t-lg); border-radius: var(--r); }

/* plain row lists */
.list > li, .list > .li { display: flex; gap: var(--s-3); align-items: center; padding: 10px var(--s-4); border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child, .list > .li:last-child { border-bottom: 0; }
.list .li-main { flex: 1; min-width: 0; }
.list .li-title { font-weight: 500; }
.list .li-sub { color: var(--ink-subtle); font-size: var(--t-xs); margin-top: 1px; }
.list-btn { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; color: inherit; text-decoration: none; }
.list-btn:hover { background: var(--state-hover); }
.list > li > .list-btn { margin: -10px calc(-1 * var(--s-4)); padding: 10px var(--s-4); width: calc(100% + 2 * var(--s-4)); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; height: 38px; padding: 0 10px; background: none; border: 0; cursor: pointer;
  color: var(--ink-subtle); font-size: var(--t-sm); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
  transition: color var(--dur-1) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.tab .count { font-size: 11px; font-weight: 600; color: var(--ink-subtle); background: var(--fill); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count { background: var(--inverse); color: var(--ink-inverse); }
.tab svg { color: var(--ink-subtle); }

/* ---------- loading, empty, error ---------- */
.steps { display: grid; gap: var(--s-2); padding: var(--s-8) 0; max-width: 420px; }
.steps-title { font-size: var(--t-md); font-weight: 600; margin-bottom: 4px; }
.step { display: flex; align-items: center; gap: 10px; color: var(--ink-subtle); font-size: var(--t-sm); }
.step .mark { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-control); display: grid; place-items: center; flex: none; }
.step[data-state="active"] { color: var(--ink); }
.step[data-state="active"] .mark { border-color: var(--ink); }
.step[data-state="active"] .mark::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); animation: pulse 1s var(--ease) infinite; }
.step[data-state="done"] { color: var(--ink-muted); }
.step[data-state="done"] .mark { border-color: var(--tone-green); background: var(--tone-green); color: var(--paper-0); }
.steps-inline { display: flex; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-3) 0; }

.empty { padding: var(--s-10) var(--s-6); display: grid; gap: 10px; justify-items: start; max-width: 520px; }
.empty-title { font-size: var(--t-md); font-weight: 600; color: var(--ink); line-height: 1.3; }
.empty p { color: var(--ink-muted); font-size: var(--t-sm); line-height: 1.5; }
.empty > .muted:first-child svg { color: var(--ink-subtle); }
.empty-sm { padding: var(--s-5) var(--s-4); gap: 6px; }
.empty-sm .empty-title { font-size: var(--t-base); }
.empty-center { justify-items: center; text-align: center; margin: 0 auto; }

.error-box { display: flex; align-items: center; gap: var(--s-3); padding: 12px 14px; border-radius: var(--r-lg); background: var(--paper-0); border: 1px solid var(--line); color: var(--ink); max-width: 640px; }
.error-box .eb-ico { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--ink-muted); }
.error-box .eb-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.error-box strong { font-size: var(--t-base); font-weight: 600; }
.error-box p { color: var(--ink-muted); font-size: var(--t-sm); line-height: 1.45; }
.error-box .btn { flex: none; }
@media (max-width: 520px) { .error-box { flex-wrap: wrap; } .error-box .btn { margin-left: 44px; } }
.inline-error { color: var(--tone-red); font-size: var(--t-sm); }

/* ---------- overlays: drawer, dialog, sheet, popover ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 1090; animation: fade var(--dur-2) var(--ease); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 1100;
  background: var(--paper-0); box-shadow: var(--shadow-dialog); display: flex; flex-direction: column;
  animation: slide-in var(--dur-2) var(--ease); border-left: 1px solid var(--line);
}
.drawer-wide { width: min(720px, 100vw); }
.drawer-head { display: flex; align-items: flex-start; gap: var(--s-3); padding: 16px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: var(--t-lg); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: var(--s-5); align-content: start; overscroll-behavior: contain; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; background: var(--paper-0); }
.dialog {
  position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: min(520px, calc(100vw - 32px)); z-index: 1100;
  background: var(--paper-0); border-radius: var(--r-lg); box-shadow: var(--shadow-dialog); border: 1px solid var(--line);
  animation: rise var(--dur-2) var(--ease); max-height: 76vh; display: flex; flex-direction: column;
}
.dialog .drawer-body { padding: 16px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 6px); opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes pop { from { transform: translateY(-4px); opacity: 0; } }

.popover {
  position: fixed; z-index: 1000; background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-menu); min-width: 220px; max-width: min(420px, calc(100vw - 24px)); overflow: hidden; animation: pop var(--dur-1) var(--ease);
}
.menu-list { padding: 4px; display: grid; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 10px; background: none; border: 0; border-radius: var(--r-control);
  text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; font-size: var(--t-sm); font-weight: 500;
}
.menu-item svg { color: var(--ink-subtle); flex: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--state-hover); outline: none; box-shadow: none; }
.menu-item.danger { color: var(--tone-red); }
.menu-item.danger svg { color: var(--tone-red); }
.menu-item[disabled] { opacity: 0.5; cursor: not-allowed; }
.menu-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.menu-divider { height: 1px; background: var(--line); margin: 4px 0; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 1200; display: grid; gap: var(--s-2); pointer-events: none; justify-items: end; }
.toast {
  pointer-events: auto; background: var(--inverse); color: var(--ink-inverse); padding: 10px 14px 10px 10px; border-radius: var(--r-lg);
  box-shadow: var(--shadow-menu); font-size: var(--t-sm); font-weight: 500; max-width: 420px; display: flex; gap: 10px; align-items: center;
  animation: sheet-up var(--dur-2) var(--ease); line-height: 1.4;
}
.toast-ico { width: 20px; height: 20px; border-radius: 50%; background: color-mix(in srgb, var(--ink-inverse) 16%, transparent); display: grid; place-items: center; flex: none; }
.toast-error { background: var(--tone-red-solid); color: #fff; }
.toast-error .toast-ico { background: rgba(255, 255, 255, 0.2); }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--paper-0); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-dialog); padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); animation: sheet-up var(--dur-2) var(--ease);
  max-height: 84vh; overflow-y: auto;
}
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line-control); margin: 4px auto 10px; }
.sheet .menu-item { min-height: 46px; font-size: var(--t-md); border-radius: var(--r); }
.sheet-title { font-size: var(--t-xs); font-weight: 600; color: var(--ink-subtle); padding: 12px 10px 4px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.app[data-collapsed="true"] { grid-template-columns: var(--rail-collapsed) minmax(0, 1fr); }
.rail-col { min-width: 0; background: var(--canvas); border-right: 1px solid var(--line); }
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-width: 0;
  color: var(--ink); z-index: 20;
}
.rail-head { padding: 10px 8px 6px; display: flex; align-items: center; gap: 4px; }
.switcher {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 8px; border-radius: var(--r);
  background: none; border: 0; cursor: pointer; text-align: left; color: var(--ink);
}
.switcher:hover { background: var(--state-hover); }
.switcher[disabled] { cursor: default; }
.switcher[disabled]:hover { background: none; }
.brand-mark {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px;
  background: var(--inverse); color: var(--ink-inverse); overflow: hidden; padding: 3px;
}
.brand-mark svg { width: 100%; height: 100%; }
.switcher .sw-text { display: grid; min-width: 0; line-height: 1.2; }
.switcher .sw-name { font-weight: 600; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .sw-sub { font-size: var(--t-xs); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .sw-chev { color: var(--ink-subtle); margin-left: auto; flex: none; }
.rail-toggle { flex: none; }

.rail-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 8px 12px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.rail-group { display: grid; gap: 1px; padding-top: 2px; }
.rail-group + .rail-group { margin-top: 10px; }
.rail-label {
  display: flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; width: 100%;
  font-size: var(--t-xs); font-weight: 500; color: var(--ink-subtle); background: none; border: 0; text-align: left; border-radius: var(--r-control);
}
button.rail-label { cursor: pointer; }
button.rail-label:hover { color: var(--ink); background: var(--state-hover); }
.rail-label .chev { transition: transform var(--dur-1) var(--ease); opacity: 0; }
.rail-label:hover .chev, .rail-label:focus-visible .chev, .rail-label[aria-expanded="false"] .chev { opacity: 1; }
.rail-label[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.rail-label .count-pill { margin-left: auto; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--r-control);
  color: var(--ink-muted); text-decoration: none; font-size: var(--t-sm); font-weight: 500; white-space: nowrap; min-width: 0;
  background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.nav-item svg { flex: none; color: var(--ink-subtle); transition: color var(--dur-1) var(--ease); }
.nav-item:hover { background: var(--state-hover); color: var(--ink); }
.nav-item:hover svg { color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--paper-0); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.04); }
.nav-item[aria-current="page"] svg { color: var(--ink); }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.nav-item .nav-badge { margin-left: auto; }
.nav-item .kbd { margin-left: auto; }
.nav-row { position: relative; display: flex; align-items: center; }
.nav-row > .nav-item { flex: 1; }
.nav-row .nav-tool {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: var(--r-sm); border: 0; background: var(--canvas); color: var(--ink-subtle); cursor: pointer; opacity: 0;
  transition: opacity var(--dur-1) var(--ease);
}
.nav-row .nav-tool:hover { color: var(--ink); background: var(--fill); }
.nav-row:hover .nav-tool, .nav-row:focus-within .nav-tool, .nav-row .nav-tool:focus-visible { opacity: 1; }
.nav-row:hover .nav-badge, .nav-row:focus-within .nav-badge { visibility: hidden; }
.nav-row.dragging { opacity: 0.4; }
.nav-row.drop-before::before { content: ""; position: absolute; left: 8px; right: 8px; top: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.nav-row .grip { position: absolute; left: -2px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); cursor: grab; opacity: 0; width: 12px; display: grid; place-items: center; }
.nav-row:hover .grip { opacity: 1; }
.rail-empty { font-size: var(--t-xs); color: var(--ink-subtle); padding: 4px 8px 6px; line-height: 1.4; }

.rail-foot { padding: 8px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.user-btn {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 40px; padding: 0 8px; border-radius: var(--r); border: 0;
  background: none; cursor: pointer; text-align: left; color: var(--ink);
}
.user-btn:hover { background: var(--state-hover); }
.user-btn .u-text { display: grid; min-width: 0; line-height: 1.2; }
.user-btn .u-name { font-size: var(--t-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .u-sub { font-size: var(--t-xs); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-line { font-size: var(--t-xs); color: var(--ink-subtle); padding: 6px 8px 2px; text-decoration: none; display: flex; gap: 6px; align-items: center; border-radius: var(--r-control); }
a.plan-line:hover { color: var(--ink); background: var(--state-hover); }
.plan-line .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

.app[data-collapsed="true"] .rail-head { flex-direction: column; padding: 10px 6px 6px; }
.app[data-collapsed="true"] .switcher { width: 36px; padding: 0; justify-content: center; flex: none; }
.app[data-collapsed="true"] .switcher .sw-text,
.app[data-collapsed="true"] .switcher .sw-chev,
.app[data-collapsed="true"] .nav-label,
.app[data-collapsed="true"] .nav-badge,
.app[data-collapsed="true"] .nav-item .kbd,
.app[data-collapsed="true"] .rail-label,
.app[data-collapsed="true"] .nav-tool,
.app[data-collapsed="true"] .grip,
.app[data-collapsed="true"] .rail-empty,
.app[data-collapsed="true"] .plan-line,
.app[data-collapsed="true"] .user-btn .u-text { display: none; }
.app[data-collapsed="true"] .rail-scroll { padding: 2px 6px 12px; }
.app[data-collapsed="true"] .nav-item { justify-content: center; padding: 0; height: 34px; }
.app[data-collapsed="true"] .rail-group + .rail-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.app[data-collapsed="true"] .user-btn { justify-content: center; padding: 0; }
.app[data-collapsed="true"] .rail-foot { padding: 6px; }
.app[data-collapsed="true"] .nav-item .dot-badge { display: block; }
.dot-badge { display: none; position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--tone-red-solid); box-shadow: 0 0 0 2px var(--canvas); }

.main { min-width: 0; display: flex; flex-direction: column; background: var(--raised); min-height: 100vh; min-height: 100dvh; }
.practice-banner {
  display: flex; align-items: center; gap: var(--s-2); padding: 7px 28px; background: var(--tone-amber-bg); color: var(--ink);
  font-size: var(--t-xs); border-bottom: 1px solid color-mix(in srgb, var(--tone-amber) 18%, var(--line)); flex-wrap: wrap;
}
.practice-banner strong { color: var(--tone-amber); font-weight: 600; }
.mobile-top { display: none; }

.content { width: 100%; min-width: 0; flex: 1; display: flex; flex-direction: column; }
.page { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.page > * + * { margin-top: 0; }
.page-body { padding: 20px 28px 56px; display: grid; gap: var(--s-5); align-content: start; min-width: 0; flex: 1; }
.page-body.flush-top { padding-top: 0; }
.page-head {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; justify-content: space-between;
  padding: 14px 28px 12px; min-height: 60px; background: color-mix(in srgb, var(--raised) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.page-head .titles { display: grid; gap: 2px; min-width: 0; }
.title-row { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: var(--t-2xl); font-weight: 400; line-height: 1.12; letter-spacing: -0.015em; }
.page-meta { font-size: var(--t-sm); color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.page-sub { color: var(--ink-subtle); font-size: var(--t-sm); max-width: 80ch; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--ink-subtle); }
.crumbs a { color: var(--ink-subtle); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.crumb-sep { color: var(--ink-subtle); }
/* a tab row that sits under the title, edge to edge */
.page-tabs { padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--raised); }
.page-tabs .tabs { border-bottom: 0; }
.toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; min-width: 0; }
.toolbar .select, .toolbar .input { width: auto; min-width: 140px; height: var(--h-control); font-size: var(--t-sm); }
.toolbar .input.search, .toolbar .input-search { min-width: 240px; width: 300px; flex: 0 1 300px; }
.filter-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: var(--r-pill); background: var(--paper-0); border: 1px solid var(--line-strong); font-size: var(--t-xs); font-weight: 500; }
.fchip-k { color: var(--ink-subtle); font-weight: 500; }
.fchip button { width: 20px; height: 20px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: var(--ink-subtle); }
.fchip button:hover { background: var(--fill); color: var(--ink); }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  background: var(--paper-0); font-size: var(--t-sm); font-weight: 500; color: var(--ink-muted); cursor: pointer; white-space: nowrap;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.chip-filter:hover { color: var(--ink); border-color: var(--line-control); }
.chip-filter[aria-pressed="true"] { background: var(--inverse); border-color: var(--inverse); color: var(--ink-inverse); }
.chip-filter[aria-pressed="true"] .n { color: inherit; opacity: 0.8; }
.chip-filter .n { font-size: 11px; font-weight: 600; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }

/* the detail pane docks beside the list on wide screens */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); align-items: start; min-width: 0; }
.split:has(> .side-panel-wrap) { grid-template-columns: minmax(0, 1fr) var(--panel-w); }
.side-scrim { display: none; }
.side-panel {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); display: flex; flex-direction: column;
  background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; overflow: hidden;
  animation: slide-in var(--dur-2) var(--ease);
}
.sp-head { display: flex; align-items: flex-start; gap: var(--s-2); padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.sp-head h2 { font-size: var(--t-lg); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.side-panel > .tabs { padding: 0 12px; }
.sp-body { flex: 1; overflow-y: auto; padding: 16px 18px 20px; display: grid; gap: var(--s-5); align-content: start; overscroll-behavior: contain; }
.sp-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }

/* key and value table inside panels: the field table of a work order */
.kv { display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: clip; background: var(--paper-0); margin: 0; }
.kv > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: var(--s-3); align-items: center; padding: 8px 14px; min-height: 42px; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt, .kv .k { font-size: var(--t-sm); color: var(--ink-subtle); margin: 0; }
.kv dd, .kv .v { margin: 0; font-size: var(--t-sm); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kv .select, .kv .input { height: var(--h-dense); font-size: var(--t-sm); }

/* activity in words */
.timeline { display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; font-size: var(--t-sm); padding-bottom: 12px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .t-dot { width: 21px; height: 21px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--ink-subtle); font-size: 9px; font-weight: 600; }
.timeline .t-when { color: var(--ink-subtle); font-size: var(--t-xs); }

/* command palette */
.palette { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); z-index: 1100; background: var(--paper-0); border-radius: var(--r-lg); box-shadow: var(--shadow-dialog); border: 1px solid var(--line); overflow: hidden; animation: rise var(--dur-2) var(--ease); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--ink-subtle); }
.palette-input input { flex: 1; height: 52px; border: 0; background: transparent; font-size: var(--t-md); outline: none; min-width: 0; color: var(--ink); }
.palette-input input::placeholder { color: var(--ink-subtle); }
/* The palette frame is the container: the field inside it draws no border, ring or box of its own. */
.palette-input input:focus, .palette-input input:focus-visible { outline: none; box-shadow: none; border: 0; border-radius: 0; }
.palette-input input::-webkit-search-decoration, .palette-input input::-webkit-search-cancel-button { -webkit-appearance: none; }
.palette-results { max-height: min(400px, 56vh); overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: var(--t-xs); font-weight: 500; color: var(--ink-subtle); }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; background: none; border: 0; border-radius: var(--r); text-align: left; cursor: pointer; min-width: 0; color: var(--ink); }
.palette-item[aria-selected="true"] { background: var(--state-selected); }
.palette-item .pi-main { flex: 1; min-width: 0; }
.palette-item .pi-ico { width: 26px; height: 26px; border-radius: var(--r-control); background: var(--fill); display: grid; place-items: center; color: var(--ink-muted); flex: none; }
.palette-foot { display: flex; gap: var(--s-4); padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink-subtle); font-size: var(--t-xs); background: var(--sunken); }
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* notification center: a quiet frosted panel beside the rail, same material as the assistant rail */
.notif-rail {
  position: fixed; top: 0; bottom: 0; left: var(--rail-w); width: min(400px, calc(100vw - var(--rail-w))); z-index: 1095;
  background: var(--glass-bg); -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
  border-right: 1px solid var(--glass-edge); border-left: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  animation: slide-in-left var(--dur-2) var(--ease);
}
html:has(.app[data-collapsed="true"]) .notif-rail { left: var(--rail-collapsed); }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.notif-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--q-body); }
.sheet .notif-panel { height: auto; max-height: 78vh; }
.sheet .notif-panel .notif-head .cp-hbtn { display: none; }
.notif-head { display: flex; align-items: center; gap: 4px; height: 48px; flex: none; padding: 0 8px 0 16px; }
.notif-head h2 { font-size: var(--t-base); font-weight: 600; color: var(--q-ink); }
.n-head-btn { height: 28px; padding: 0 8px; border: 0; border-radius: var(--r-control); background: none; color: var(--q-dim); font: inherit; font-size: var(--t-xs); font-weight: 500; cursor: pointer; }
.n-head-btn:hover { background: var(--q-hover); color: var(--q-ink); }
.notif-tools { display: flex; gap: 6px; padding: 0 12px 8px; flex: none; }
.n-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: var(--r); background: var(--q-field); border: 1px solid var(--q-field-line); color: var(--q-dim); }
.n-search:focus-within { border-color: color-mix(in srgb, var(--q-ink) 28%, var(--q-field-line)); }
.n-search input { flex: 1; min-width: 0; height: 30px; border: 0; background: transparent; color: var(--q-ink); font: inherit; font-size: var(--t-sm); outline: none; }
.n-search input:focus, .n-search input:focus-visible { box-shadow: none; outline: none; }
.n-search input::placeholder { color: var(--q-dim); }
.n-search input::-webkit-search-decoration { -webkit-appearance: none; }
.n-filter { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; flex: none; border-radius: var(--r); border: 1px solid var(--q-field-line); background: transparent; color: var(--q-body); font: inherit; font-size: var(--t-xs); font-weight: 500; cursor: pointer; max-width: 150px; }
.n-filter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-filter:hover { background: var(--q-hover); }
.n-filter.is-on { color: var(--q-ink); border-color: color-mix(in srgb, var(--q-ink) 30%, var(--q-field-line)); }
.notif-tabs { flex: none; padding: 0 8px; }
.notif-tabs .tabs { border-bottom-color: var(--q-line); }
.notif-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 12px; }
.n-group-label { padding: 12px 16px 4px; font-size: var(--t-xs); font-weight: 500; color: var(--q-dim); }
.n-rows { list-style: none; margin: 0; padding: 0 6px; }
.n-row { position: relative; border-radius: var(--r); }
.n-row:hover, .n-row:focus-within { background: var(--q-hover); }
.n-main { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: var(--r); text-align: left; cursor: pointer; color: var(--q-body); font: inherit; }
.n-row.is-post .n-main { cursor: default; }
.n-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--q-bubble); display: grid; place-items: center; color: var(--q-dim); }
.n-text { min-width: 0; display: grid; gap: 1px; }
.n-title { display: block; font-size: var(--t-sm); font-weight: 500; color: var(--q-ink); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-row.unread .n-title { font-weight: 600; }
.n-title.is-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.n-body { display: block; font-size: var(--t-xs); color: var(--q-dim); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-side { display: grid; justify-items: end; gap: 6px; padding-top: 1px; }
.n-when { font-size: var(--t-xs); color: var(--q-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.n-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--q-ink); }
.n-acts { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 9px 48px; }
.n-acts:empty { display: none; }
.n-act { height: 24px; padding: 0 9px; border-radius: var(--r-pill); border: 1px solid var(--q-field-line); background: var(--q-card); color: var(--q-body); font: inherit; font-size: var(--t-xs); font-weight: 500; cursor: pointer; }
.n-act:hover { color: var(--q-ink); border-color: color-mix(in srgb, var(--q-ink) 30%, var(--q-field-line)); }
@media (hover: hover) and (pointer: fine) {
  .n-acts { position: absolute; right: 8px; top: 7px; padding: 2px; margin: 0; background: var(--q-card); border-radius: var(--r-pill); box-shadow: 0 0 0 1px var(--q-field-line); opacity: 0; pointer-events: none; transition: opacity var(--dur-1) var(--ease); }
  .n-acts .n-act { border: 0; background: transparent; }
  .n-acts .n-act:hover { background: var(--q-hover); }
  .n-row:hover .n-acts, .n-row:focus-within .n-acts { opacity: 1; pointer-events: auto; }
}
.n-empty { padding: 28px 16px; display: grid; gap: 4px; }
.n-empty-title { font-size: var(--t-base); font-weight: 600; color: var(--q-ink); }
.n-empty p:not(.n-empty-title) { font-size: var(--t-sm); color: var(--q-dim); line-height: 1.5; }
.n-dim { padding: 16px; font-size: var(--t-sm); color: var(--q-dim); }
.n-post { padding: 10px 12px 4px; display: grid; gap: 8px; }
.n-post .textarea { min-height: 60px; }
/* A calm one-line state for something that did not load: no red, one Retry. */
.calm-line { display: flex; align-items: center; gap: 8px; margin: 8px 12px; padding: 8px 10px; border-radius: var(--r); background: var(--sunken); color: var(--ink-muted); font-size: var(--t-sm); }
.notif-panel .calm-line, .copilot .calm-line { background: var(--q-bubble); color: var(--q-body); }
.calm-line svg { color: var(--ink-subtle); flex: none; }
.calm-retry { height: 26px; padding: 0 10px; border-radius: var(--r-control); border: 1px solid var(--line-control); background: var(--paper-0); color: var(--ink); font: inherit; font-size: var(--t-xs); font-weight: 500; cursor: pointer; flex: none; }
.calm-retry:hover { background: var(--state-hover); }

/* user menu: theme picker */
.theme-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 4px; background: var(--fill); border-radius: var(--r); }
.theme-pick button { height: 28px; border: 0; border-radius: var(--r-control); background: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: var(--t-xs); font-weight: 500; color: var(--ink-muted); cursor: pointer; }
.theme-pick button[aria-pressed="true"] { background: var(--paper-0); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* bottom tab bar (phones) */
.tabbar { display: none; }

/* ---------- avatars ---------- */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--ink-muted); display: inline-grid; place-items: center;
  font-size: 11px; letter-spacing: 0.01em; flex: none; font-weight: 600;
}
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-lg { width: 40px; height: 40px; font-size: 13px; }

/* ---------- home: greeting, stats, widgets ---------- */
.greet { display: grid; gap: 6px; }
.greet h1 { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1.08; letter-spacing: -0.02em; }
.greet p { color: var(--ink-muted); font-size: var(--t-md); max-width: 74ch; line-height: 1.5; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); overflow: hidden; }
.stat { padding: 14px 18px 16px; border-right: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; align-content: start; text-decoration: none; color: inherit; transition: background var(--dur-1) var(--ease); }
.stat:last-child { border-right: 0; }
a.stat:hover { background: var(--state-hover); }
.stat-label { font-size: var(--t-xs); font-weight: 500; color: var(--ink-subtle); }
.stat-value { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: var(--t-base); color: var(--ink-subtle); letter-spacing: 0; margin-left: 4px; font-weight: 500; }
.stat-sub { font-size: var(--t-xs); color: var(--ink-subtle); }
.widgets { display: block; columns: 2; column-gap: var(--s-4); }
.widgets .widget { break-inside: avoid; margin-bottom: var(--s-4); }
.widget { background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; display: flex; flex-direction: column; }
.widget-2 { column-span: all; }
.widget-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px 16px; min-height: 46px; }
.widget-head h2 { font-size: var(--t-base); font-weight: 600; letter-spacing: -0.005em; }
.widget-link { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-xs); font-weight: 500; color: var(--ink-subtle); text-decoration: none; padding: 4px 6px; border-radius: var(--r-control); }
.widget-link:hover { color: var(--ink); background: var(--state-hover); }
.widget-body { border-top: 1px solid var(--line); min-width: 0; }
.widget-body > .empty { padding: 18px 16px; }
.wrow { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); min-width: 0; text-decoration: none; color: inherit; }
.wrow:last-child { border-bottom: 0; }
a.wrow:hover, button.wrow:hover { background: var(--state-hover); }
button.wrow { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; cursor: pointer; }
.wrow .w-main { flex: 1; min-width: 0; }
.wrow .w-title { font-size: var(--t-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow .w-sub { font-size: var(--t-xs); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow .w-end { font-size: var(--t-xs); color: var(--ink-subtle); white-space: nowrap; flex: none; text-align: right; }
.w-more { display: block; padding: 9px 16px; font-size: var(--t-xs); color: var(--ink-subtle); text-decoration: none; font-weight: 500; }
.w-more:hover { color: var(--ink); background: var(--state-hover); }
.meter { display: grid; gap: 8px; padding: 14px 16px; }
.meter-track { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; display: flex; }
.meter-track > span { display: block; height: 100%; }
.meter-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--t-xs); color: var(--ink-muted); }
.meter-legend span { display: inline-flex; align-items: center; gap: 6px; }
.meter-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.setup-card { display: flex; align-items: center; gap: var(--s-3); padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); flex-wrap: wrap; }
.setup-card-icon { width: 32px; height: 32px; border-radius: var(--r); background: var(--accent-soft); color: var(--ink); display: grid; place-items: center; flex: none; }
.customize-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: 10px 14px; border: 1px dashed var(--line-control); border-radius: var(--r-lg); background: var(--sunken); }
.customize-bar > .grow { flex: 1 1 260px; }
.widget[data-editing="true"] { outline: 1px dashed var(--line-control); outline-offset: 3px; }

/* bars */
.bar-track { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--ink); }
.bar-fill.over { background: var(--tone-red-solid); }
.bar-fill.accent { background: var(--accent); }
.hbar { display: grid; grid-template-columns: minmax(100px, 180px) minmax(0, 1fr) 48px; gap: var(--s-3); align-items: center; padding: 6px 0; font-size: var(--t-sm); }
.hbars { padding: 10px 16px 12px; }

/* ---------- calls, agent console ---------- */
.console { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s-4); align-items: start; }
.chat { display: flex; flex-direction: column; height: min(680px, calc(100vh - 220px)); height: min(680px, calc(100dvh - 220px)); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: var(--s-4); display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.msg { display: grid; gap: 5px; max-width: min(80%, 620px); }
.msg-body { padding: 9px 13px; border-radius: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--t-base); }
.msg-customer { align-self: flex-end; justify-items: end; }
.msg-customer .msg-body { background: var(--inverse); color: var(--ink-inverse); border-bottom-right-radius: 5px; }
.msg-agent .msg-body, .msg-staff .msg-body { background: var(--fill); color: var(--ink); border-bottom-left-radius: 5px; }
.msg-staff .msg-body { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.msg-system { align-self: center; max-width: 100%; }
.msg-system .msg-body { background: transparent; color: var(--ink-subtle); font-size: var(--t-xs); padding: 0; text-align: center; }
.msg-meta { font-size: var(--t-xs); color: var(--ink-subtle); font-weight: 500; }
.composer { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: var(--s-2); align-items: flex-end; }
.composer textarea { flex: 1; min-height: 36px; max-height: 160px; height: 36px; resize: none; padding: 7px 12px; border: 1px solid var(--line-control); border-radius: 18px; background: var(--paper-0); line-height: 1.45; }
.composer textarea:focus { outline: none; border-color: var(--line-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.mic-on { background: var(--tone-red-bg) !important; border-color: var(--tone-red) !important; color: var(--tone-red) !important; }
.transcript { display: flex; flex-direction: column; gap: 10px; }
.call-props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: clip; }
.call-props > div { padding: 10px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.call-props > div:nth-child(2n) { border-right: 0; }
.call-props > div:nth-last-child(-n+2) { border-bottom: 0; }
.call-props .k { font-size: var(--t-xs); color: var(--ink-subtle); }
.call-props .v { font-size: var(--t-sm); font-weight: 500; }
.call-actions { display: grid; gap: 6px; }
.call-actions li { display: flex; align-items: center; gap: 10px; font-size: var(--t-sm); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.call-actions li svg { color: var(--ink-subtle); flex: none; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .w-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .w-sub { font-size: var(--t-xs); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--ink-muted); flex: none; }
.ch-ico.attn { background: var(--tone-red-bg); color: var(--tone-red); }

/* knowledge health */
.health { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); }
.health-ring { width: 64px; height: 64px; position: relative; flex: none; }
.health-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.health-ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--t-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.health-counts { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.health-counts div { display: grid; gap: 0; }
.health-counts .n { font-size: var(--t-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.health-counts .k { font-size: var(--t-xs); color: var(--ink-subtle); }
.qa-card { display: grid; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 560px; height: calc(100vh - 150px); height: calc(100dvh - 150px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); overflow: hidden; }
.inbox-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.inbox-tools { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.inbox-list { overflow-y: auto; flex: 1; min-height: 0; }
.thread-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer; color: var(--ink); }
.thread-item:hover { background: var(--state-hover); }
.thread-item[aria-current="true"] { background: var(--state-selected); box-shadow: inset 2px 0 0 var(--ink); }
.thread-item .t-name { font-weight: 600; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-item .t-when { font-size: var(--t-xs); color: var(--ink-subtle); white-space: nowrap; }
.thread-item .t-last { font-size: var(--t-xs); color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.thread-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread-head h2 { font-size: var(--t-md); font-weight: 600; }
.thread-banner { margin: 12px 16px 0; }
.thread-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.reply-box { border-top: 1px solid var(--line); padding: 12px 16px; display: grid; gap: 8px; }

/* ---------- board ---------- */
.board-area { display: grid; gap: 10px; }
.area-head { display: flex; align-items: center; gap: 10px; }
.area-head h3 { font-size: var(--t-base); font-weight: 600; }
.unit-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.unit {
  position: relative; display: grid; gap: 6px; align-content: start; padding: 10px; border-radius: var(--r-lg); min-height: 104px;
  background: var(--paper-0); border: 1px solid var(--line); cursor: pointer; text-align: left; min-width: 0; color: var(--ink);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.unit:hover { border-color: var(--line-control); box-shadow: var(--shadow-card); }
.unit[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.unit-code { font-family: var(--font-mono); font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; display: inline-grid; place-items: center; min-width: 38px; height: 24px; padding: 0 6px; border-radius: var(--r-control); background: var(--fill); justify-self: start; }
.unit-status { font-size: var(--t-xs); font-weight: 600; line-height: 1.25; display: flex; align-items: center; gap: 5px; }
.unit-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.unit-meta { font-size: var(--t-xs); color: var(--ink-subtle); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.unit-flags { display: flex; gap: 4px; flex-wrap: wrap; }
.unit[data-tone="red"] .unit-status { color: var(--tone-red); }
.unit[data-tone="red"] { box-shadow: inset 3px 0 0 var(--tone-red); }
.unit[data-tone="amber"] .unit-status { color: var(--tone-amber); }
.unit[data-tone="amber"] { box-shadow: inset 3px 0 0 var(--tone-amber); }
.unit[data-tone="blue"] .unit-status { color: var(--tone-blue); }
.unit[data-tone="blue"] { box-shadow: inset 3px 0 0 var(--tone-blue); }
.unit[data-tone="green"] .unit-status { color: var(--tone-green); }
.unit[data-tone="gray"] .unit-status { color: var(--ink-subtle); }
.unit[data-tone="gray"] { background: var(--sunken); }
.unit[aria-pressed="true"][data-tone] { box-shadow: inset 0 0 0 1px var(--ink); }
.unit .sel-box { position: absolute; top: 9px; right: 9px; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-control); background: var(--paper-0); display: grid; place-items: center; }
.unit[aria-pressed="true"] .sel-box { background: var(--inverse); border-color: var(--inverse); color: var(--ink-inverse); }
.selection-bar {
  position: sticky; bottom: var(--s-4); z-index: 10; display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: 10px 14px; background: var(--inverse); color: var(--ink-inverse); border-radius: var(--r-lg); box-shadow: var(--shadow-menu);
}
.selection-bar .select { background-color: color-mix(in srgb, var(--ink-inverse) 10%, var(--inverse)); color: var(--ink-inverse); border-color: color-mix(in srgb, var(--ink-inverse) 22%, transparent); width: auto; height: var(--h-control); font-size: var(--t-sm); }
.selection-bar .btn { box-shadow: none; }
.summary-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.legend-btn { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--paper-0); cursor: pointer; font-size: var(--t-sm); font-weight: 500; color: var(--ink-muted); }
.legend-btn:hover { color: var(--ink); border-color: var(--line-control); }
.legend-btn[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.legend-btn .n { font-size: 11px; font-weight: 600; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.swatch { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.swatch-red { background: var(--tone-red); } .swatch-amber { background: var(--tone-amber); } .swatch-blue { background: var(--tone-blue); }
.swatch-green { background: var(--tone-green); } .swatch-gray { background: var(--ink-faint); } .swatch-clay { background: var(--tone-clay); }
.person-row { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr) 96px; gap: var(--s-4); align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.person-row:last-child { border-bottom: 0; }
.person-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); overflow: hidden; }
.person-card-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.person-card-head .p-name { font-weight: 600; }
.person-card-head .p-stats { font-size: var(--t-xs); color: var(--ink-subtle); letter-spacing: 0.02em; }

/* ---------- to-dos ---------- */
.task-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 150px 120px 130px; gap: var(--s-4); align-items: center; padding: 10px var(--s-4); border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; color: var(--ink); }
.task-row:hover { background: var(--state-hover); }
.task-row:last-child { border-bottom: 0; }
.task-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-sub { font-size: var(--t-xs); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); align-items: start; }
.kcol { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; display: grid; gap: 8px; min-width: 0; }
.kcol-head { display: flex; align-items: center; gap: var(--s-2); padding: 4px 4px 2px; }
.kcard { background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 6px; cursor: pointer; text-align: left; min-width: 0; color: var(--ink); }
.kcard:hover { border-color: var(--line-control); box-shadow: var(--shadow-card); }
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-xs); font-weight: 500; white-space: nowrap; }
.history { display: grid; gap: var(--s-3); }
.history li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: var(--s-3); font-size: var(--t-sm); }
.history li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-control); margin-top: 6px; }
.comment { display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--line); font-size: var(--t-sm); }
.dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s-2) var(--s-4); font-size: var(--t-sm); align-items: center; }
.dl dt { font-size: var(--t-xs); color: var(--ink-subtle); }
.dl dd { margin: 0; min-width: 0; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- facilities ---------- */
.date-group { display: grid; gap: 0; }
.date-head { padding: 8px var(--s-4); background: var(--sunken); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--s-3); font-size: var(--t-xs); font-weight: 600; color: var(--ink-muted); }
.reading-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: var(--s-3); align-items: center; }
.type-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--fill); font-size: 10px; font-weight: 700; color: var(--ink-muted); flex: none; }

/* ---------- schedule ---------- */
.sched-wrap { overflow-x: auto; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); }
.sched { display: grid; grid-template-columns: 200px repeat(7, minmax(108px, 1fr)); min-width: 980px; }
.sched > div { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; min-height: 48px; min-width: 0; }
.sched > div:nth-child(8n) { border-right: 0; }
.sched .sh { background: var(--paper-0); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-subtle); min-height: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 10px 10px; position: sticky; top: 0; }
.sched .sh .d { font-size: var(--t-sm); text-transform: none; letter-spacing: 0; color: var(--ink-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.sched .sh.is-today { background: var(--sunken); color: var(--ink); }
.sched .is-today { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.sched .sn { display: grid; gap: 1px; align-content: center; }
.sched .cell { display: grid; gap: 4px; align-content: start; cursor: pointer; }
.sched .cell:hover { background: var(--state-hover); }
.sched .cell-open { background: var(--tone-amber-bg); }
.shift {
  display: grid; gap: 1px; padding: 4px 7px; border-radius: var(--r-control); background: var(--sunken); color: var(--ink);
  font-size: var(--t-xs); line-height: 1.3; border: 1px solid var(--line-strong); text-align: left; cursor: pointer; width: 100%; min-width: 0;
}
.shift:hover { border-color: var(--line-control); }
.shift .t { font-size: var(--t-sm); font-weight: 500; font-variant-numeric: tabular-nums; }
.shift .dpt { color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-open { background: var(--tone-amber-bg); border: 1px dashed var(--tone-amber); color: var(--tone-amber); }
.shift-open .dpt { color: var(--tone-amber); }
.shift[draggable="true"] { cursor: grab; }
.cell.drop-target { background: var(--state-selected); box-shadow: inset 0 0 0 2px var(--ink); }
.off-pill { display: inline-grid; place-items: center; height: 20px; padding: 0 9px; border-radius: var(--r-pill); background: var(--fill); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-subtle); }
.cover { display: grid; gap: 4px; }
.cover .bar-track { height: 5px; }
.demand-input { width: 100%; height: var(--h-dense); text-align: center; font-family: var(--font-mono); font-size: var(--t-sm); border: 1px solid var(--line-control); border-radius: var(--r-control); background: var(--paper-0); color: var(--ink); }
.demand-input:focus { outline: none; border-color: var(--line-focus); }
.demand-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.demand-days .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .demand-days { gap: 4px; } .demand-days .label { font-size: 11px; } .demand-input { padding: 0 2px; } }

/* ---------- inquiries ---------- */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: var(--s-3); align-items: start; overflow-x: auto; padding-bottom: var(--s-2); }
.brief-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.brief-cell { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 2px; min-width: 0; }
.brief-cell .v { font-weight: 500; overflow-wrap: anywhere; font-size: var(--t-sm); }
.brief-cell.missing .v { color: var(--ink-subtle); font-weight: 400; }

/* ---------- rules ---------- */
.rule-sentence { font-size: var(--t-md); line-height: 1.45; color: var(--ink); font-weight: 500; }
.builder-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 1fr) auto; gap: var(--s-2); align-items: center; }
.builder-row-2 { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) auto; gap: var(--s-2); align-items: center; }
.builder-act { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr) auto; gap: var(--s-2); align-items: center; }
.builder-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); align-items: center; }

/* ---------- reports ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-ui); font-size: 11px; fill: var(--ink-subtle); }
.chart .val { fill: var(--ink-muted); font-weight: 600; }
.chart .bar { fill: var(--ink); }
.chart .bar-2 { fill: var(--line-strong); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--paper-0); stroke: var(--ink); stroke-width: 1.5; }

/* ---------- settings area ---------- */
.settings { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; flex: 1; align-items: stretch; }
.settings-nav { position: sticky; top: 0; align-self: start; padding: 16px 10px 40px; max-height: 100vh; max-height: 100dvh; overflow-y: auto; background: var(--raised); scrollbar-width: thin; }
.settings-nav .s-search { margin: 0 2px 10px; }
.settings-nav .s-group { font-size: var(--t-xs); font-weight: 500; color: var(--ink-subtle); padding: 12px 8px 4px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--r-control); color: var(--ink-muted); text-decoration: none; font-size: var(--t-sm); font-weight: 500; }
.settings-nav a svg { color: var(--ink-subtle); flex: none; }
.settings-nav a:hover { background: var(--state-hover); color: var(--ink); }
.settings-nav a[aria-current="page"] { background: var(--paper-0); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.settings-nav a[aria-current="page"] svg { color: var(--ink); }
.settings-main { min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.settings-main .page-body { max-width: 980px; }
.set-section { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: var(--s-6); padding: 20px 0; border-top: 1px solid var(--line); }
.set-section:first-child { border-top: 0; padding-top: 4px; }
.set-section > .s-intro h2 { font-size: var(--t-base); font-weight: 600; }
.set-section > .s-intro p { font-size: var(--t-sm); color: var(--ink-subtle); margin-top: 4px; line-height: 1.5; }
.set-card { background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: var(--s-4); min-width: 0; }
.set-card.flush { padding: 0; gap: 0; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: var(--s-3); padding: 12px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.set-row:last-child { border-bottom: 0; }
.save-bar { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; padding-top: 4px; }
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.hub-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); text-decoration: none; color: var(--ink); transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.hub-card:hover { border-color: var(--line-control); }
.hub-card .h-ico { width: 32px; height: 32px; border-radius: var(--r); background: var(--fill); display: grid; place-items: center; color: var(--ink-muted); flex: none; }
.hub-card .h-title { font-weight: 600; font-size: var(--t-sm); }
.hub-card .h-sub { font-size: var(--t-xs); color: var(--ink-subtle); line-height: 1.45; margin-top: 2px; }
.usage-row { display: grid; gap: 6px; }
.usage-row .bar-track { height: 6px; }
.danger-zone { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.invite-url { overflow-wrap: anywhere; }
.code-reveal {
  font-family: var(--font-mono); font-size: var(--t-lg); letter-spacing: 0.06em; padding: 14px; border-radius: var(--r);
  background: var(--sunken); border: 1px dashed var(--line-control); text-align: center; word-break: break-all; user-select: all;
}
.audit-list > li.audit-day { padding: 8px var(--s-4) 6px; background: var(--sunken); color: var(--ink-subtle); font-size: var(--t-xs); font-weight: 600; }
.audit-list > li.audit-row { align-items: flex-start; }
.audit-text { display: block; line-height: 1.45; overflow-wrap: anywhere; font-size: var(--t-sm); }
.audit-text strong { font-weight: 600; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--ink-muted); }
.audit-dot.audit-ai { background: var(--accent); }
.audit-dot.audit-automation { background: var(--tone-blue); }
.audit-dot.audit-system { background: var(--line-control); }

/* ---------- auth: dark canvas, serif title, translucent fields, white pill ---------- */
.auth {
  --a-ink: #f3f3f1; --a-muted: #a3a39f; --a-line: rgba(255, 255, 255, 0.12); --a-field: rgba(255, 255, 255, 0.06);
  min-height: 100vh; min-height: 100dvh; background: #0b0b0c; color: var(--a-ink);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); position: relative; overflow: hidden; color-scheme: dark;
}
.auth-side { position: relative; padding: 36px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-8); min-width: 0; border-right: 1px solid var(--a-line); }
.auth-art { position: absolute; inset: 0; pointer-events: none; opacity: 0.9; }
.auth-art svg { width: 100%; height: 100%; }
.auth-art .ln { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.auth-art .ln-strong { stroke: rgba(255, 255, 255, 0.5); }
.auth-art .lit { fill: color-mix(in srgb, var(--accent) 55%, transparent); stroke: color-mix(in srgb, var(--accent) 90%, #fff); }
.auth-art .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.auth-brand { position: relative; display: flex; align-items: center; gap: 10px; color: var(--a-ink); text-decoration: none; }
.auth-brand .brand-mark { background: #f3f3f1; color: #0b0b0c; }
.auth-brand .bn { font-family: var(--font-display); font-size: 24px; letter-spacing: -0.01em; }
.auth-quote { position: relative; font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.08; letter-spacing: -0.02em; max-width: 15ch; }
.auth-points { position: relative; display: grid; gap: 12px; max-width: 44ch; color: var(--a-muted); font-size: var(--t-sm); }
.auth-points li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; line-height: 1.5; }
.auth-points li svg { color: var(--a-ink); margin-top: 2px; }
.auth-points strong { color: var(--a-ink); font-weight: 500; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; min-width: 0; position: relative; }
.auth-card { width: min(400px, 100%); display: grid; gap: 22px; }
.auth-card h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; color: var(--a-ink); }
.auth-card .muted, .auth-card .hint, .auth-card p { color: var(--a-muted); }
.auth-card .field > .label { color: var(--a-muted); }
.auth-card .link { color: var(--a-ink); text-decoration-color: rgba(255, 255, 255, 0.35); }
.auth-card .input, .auth-card .select, .auth-card .textarea {
  height: 44px; border-radius: 12px; background: var(--a-field); border: 1px solid var(--a-line); color: var(--a-ink); font-size: var(--t-md);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.auth-card .textarea { height: auto; }
.auth-card .input::placeholder { color: rgba(255, 255, 255, 0.36); }
.auth-card .input:hover { border-color: rgba(255, 255, 255, 0.24); }
.auth-card .input:focus, .auth-card .select:focus { border-color: rgba(255, 255, 255, 0.6); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); }
.auth-card .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%23a3a39f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); }
.auth-card .select option { background: #1a1a1a; color: #f3f3f1; }
.auth-card .btn { height: 44px; border-radius: var(--r-pill); font-size: var(--t-md); background: transparent; color: var(--a-ink); border-color: var(--a-line); box-shadow: none; }
.auth-card .btn:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.24); }
.auth-card .btn-primary { background: #f3f3f1; color: #0b0b0c; border-color: #f3f3f1; }
.auth-card .btn-primary:hover { background: #ffffff; border-color: #ffffff; }
.auth-card .btn-ghost { border-color: transparent; color: var(--a-muted); }
.auth-card .btn:focus-visible { box-shadow: 0 0 0 2px #0b0b0c, 0 0 0 4px rgba(255, 255, 255, 0.7); }
.auth-card .note { background: rgba(255, 255, 255, 0.05); border-color: var(--a-line); color: var(--a-muted); }
.auth-card .note svg { color: var(--a-ink); }
.auth-card .note strong { color: var(--a-ink); }
.auth-card .note-amber { background: rgba(201, 164, 107, 0.12); color: #e9dcc4; }
.auth-card .note-amber svg { color: #d2b07a; }
.auth-card .inline-error, .auth-card .field-error { color: #f0a3b4; }
.auth-card .check input { accent-color: #f3f3f1; }
.auth-card .code-reveal { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.24); color: var(--a-ink); }
.auth-card .steps-title, .auth-card .step[data-state="active"] { color: var(--a-ink); }
.auth-card .step .mark { border-color: rgba(255, 255, 255, 0.3); }
.auth-card .step[data-state="active"] .mark { border-color: var(--a-ink); }
.auth-card .step[data-state="active"] .mark::after { background: var(--a-ink); }
.auth-alt { display: flex; align-items: center; gap: var(--s-3); color: var(--a-muted); font-size: var(--t-xs); }
.auth-alt::before, .auth-alt::after { content: ""; height: 1px; background: var(--a-line); flex: 1; }
.auth-foot { font-size: var(--t-xs); color: var(--a-muted); }
.auth-foot a { color: var(--a-muted); }
.auth-card .seg { background: rgba(255, 255, 255, 0.06); }
.auth-card .seg button { color: var(--a-muted); }
.auth-card .seg button[aria-pressed="true"] { background: #f3f3f1; color: #0b0b0c; }
.auth-card :focus-visible { box-shadow: 0 0 0 2px #0b0b0c, 0 0 0 4px rgba(255, 255, 255, 0.7); }

/* ---------- onboarding (dark, one question per screen) ---------- */
.onb { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: #0b0b0c; color: #f3f3f1; color-scheme: dark;
  --a-ink: #f3f3f1; --a-muted: #a3a39f; --a-line: rgba(255, 255, 255, 0.12); --a-field: rgba(255, 255, 255, 0.06); }
.onb-top { display: flex; align-items: center; gap: var(--s-4); padding: 14px 28px; border-bottom: 1px solid var(--a-line); }
.onb-top .auth-brand .bn { font-size: 20px; }
.progress { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; flex: 1; max-width: 360px; }
.progress > span { display: block; height: 100%; width: 100%; background: #f3f3f1; transform-origin: left center; transition: transform var(--dur-3) var(--ease); }
.onb-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.onb-steps span { height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 500; display: inline-flex; align-items: center; color: var(--a-muted); border: 1px solid var(--a-line); }
.onb-steps span[aria-current="step"] { background: #f3f3f1; color: #0b0b0c; border-color: #f3f3f1; }
.onb-steps span.done { color: var(--a-ink); }
.onb-body { width: min(760px, 100%); margin: 0 auto; padding: 48px 24px 72px; display: grid; gap: 22px; align-content: start; }
.onb-body h1 { font-family: var(--font-display); font-weight: 400; font-size: 42px; line-height: 1.05; letter-spacing: -0.02em; }
.onb .auth-card { width: 100%; }
.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice {
  display: flex; gap: var(--s-3); align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--paper-0); cursor: pointer; text-align: left; min-height: 60px; color: var(--ink); transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.choice:hover { border-color: var(--line-control); }
.choice[aria-pressed="true"], .choice[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice .box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-control); flex: none; display: grid; place-items: center; margin-top: 1px; background: var(--paper-0); }
.choice[aria-pressed="true"] .box, .choice[aria-checked="true"] .box { background: var(--inverse); border-color: var(--inverse); color: var(--ink-inverse); }
.choice .c-title { font-weight: 600; font-size: var(--t-sm); }
.choice .c-sub { font-size: var(--t-xs); color: var(--ink-subtle); line-height: 1.45; }
.onb .choice, .auth-card .choice { background: var(--a-field); border-color: var(--a-line); color: var(--a-ink); }
.onb .choice:hover { border-color: rgba(255, 255, 255, 0.28); }
.onb .choice[aria-pressed="true"], .onb .choice[aria-checked="true"] { border-color: #f3f3f1; box-shadow: inset 0 0 0 1px #f3f3f1; background: rgba(255, 255, 255, 0.09); }
.onb .choice .c-sub { color: var(--a-muted); }
.onb .choice .box { background: transparent; border-color: rgba(255, 255, 255, 0.36); }
.onb .choice[aria-pressed="true"] .box, .onb .choice[aria-checked="true"] .box { background: #f3f3f1; border-color: #f3f3f1; color: #0b0b0c; }
.onb .panel, .onb .list > li { background: var(--a-field); border-color: var(--a-line); color: var(--a-ink); }
.onb .panel { border: 1px solid var(--a-line); }
.onb .li-sub, .onb .muted, .onb .hint, .onb .label { color: var(--a-muted); }
.onb .input, .onb .select, .onb .textarea { background: var(--a-field); border-color: var(--a-line); color: var(--a-ink); }
.onb .input:focus, .onb .select:focus, .onb .textarea:focus { border-color: rgba(255, 255, 255, 0.6); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); }
.onb .select option { background: #1a1a1a; color: #f3f3f1; }
.onb .btn { background: transparent; color: var(--a-ink); border-color: var(--a-line); box-shadow: none; border-radius: var(--r-pill); }
.onb .btn:hover { background: rgba(255, 255, 255, 0.06); }
.onb .btn-primary { background: #f3f3f1; color: #0b0b0c; border-color: #f3f3f1; }
.onb .btn-primary:hover { background: #fff; }
.onb .btn-ghost { border-color: transparent; color: var(--a-muted); }
.onb .note { background: rgba(255, 255, 255, 0.05); border-color: var(--a-line); color: var(--a-muted); }
.onb .note svg { color: var(--a-ink); }
.onb .seg { background: rgba(255, 255, 255, 0.06); }
.onb .seg button { color: var(--a-muted); }
.onb .seg button[aria-pressed="true"] { background: #f3f3f1; color: #0b0b0c; }
.onb .chip { background: rgba(255, 255, 255, 0.08); color: var(--a-ink); }
.onb .inline-error { color: #f0a3b4; }
.onb :focus-visible { box-shadow: 0 0 0 2px #0b0b0c, 0 0 0 4px rgba(255, 255, 255, 0.7); }
.onb .link { color: var(--a-ink); text-decoration-color: rgba(255, 255, 255, 0.35); }
.onb .check input { accent-color: #f3f3f1; }
.ready-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); }
.ready-grid > div { padding: 16px; border-right: 1px solid var(--line); display: grid; gap: 2px; }
.ready-grid > div:last-child { border-right: 0; }
.onb .ready-grid { background: var(--a-field); border-color: var(--a-line); }
.onb .ready-grid > div { border-color: var(--a-line); }
.onb-preview .list > li.onb-prev-row { flex-wrap: wrap; row-gap: var(--s-2); }
.onb-prev-field .input { width: 96px; }
.onb-prev-field .select { width: 220px; max-width: 100%; }
.onb-details summary { cursor: pointer; color: var(--a-ink); }
.onb-details ul { margin: var(--s-2) 0 var(--s-2) var(--s-5); list-style: disc; display: grid; gap: 2px; }
.kpi-value { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: var(--t-base); color: var(--ink-subtle); letter-spacing: 0; margin-left: 4px; }
.kpi-note { font-size: var(--t-xs); color: var(--ink-subtle); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--paper-0); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpi { padding: 14px 18px; border-right: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; align-content: start; text-decoration: none; color: inherit; }
.kpi:last-child { border-right: 0; }
a.kpi:hover { background: var(--state-hover); }

/* ---------- pad (the staff app moves to css/pad.css; these keep the current pad working) ---------- */
.pad-body { background: var(--paper); }
.pad { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--paper); }
.pad-top { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--night); color: var(--night-ink); position: sticky; top: 0; z-index: 10; min-height: 60px; }
.pad-top .brand { color: var(--night-ink); }
.pad-main { flex: 1; padding: var(--s-4) var(--s-4) calc(var(--tabbar-h) + var(--s-6)); display: grid; gap: var(--s-4); align-content: start; }
.pad-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(var(--pad-tab-count, 4), minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); max-width: 720px; margin: 0 auto; }
.pad-tab { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; min-height: var(--tabbar-h); background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; min-width: 0; }
.pad-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-tab[aria-current="page"] { color: var(--ink); }
.pad-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4); display: grid; gap: var(--s-3); }
.pad-card h3 { font-size: var(--t-lg); font-weight: 600; line-height: 1.25; }
.pad-card > .pad-btn { width: 100%; }
.pad-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.pad-btn { min-height: 52px; border-radius: var(--r); font-size: var(--t-md); font-weight: 600; }
.pin-dots { display: flex; gap: var(--s-4); justify-content: center; padding: var(--s-4) 0; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); }
.pin-dots span.on { background: var(--ink); border-color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); max-width: 340px; margin: 0 auto; width: 100%; }
.key { height: 64px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); font-size: 26px; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.key:hover { background: var(--surface-2); }
.key:active { background: var(--surface-3); }
.staff-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.staff-pick button { min-height: 56px; display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-3); border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; text-align: left; font-weight: 500; color: var(--ink); }
.staff-pick button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pad-unit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-4); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); min-height: 72px; }
.pad-unit .unit-code { font-size: var(--t-xl); }
.pad-org { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); }
.pad-org-name { font-weight: 600; color: var(--ink-2); }
.pad-section-head { display: flex; align-items: center; gap: var(--s-2); padding-top: var(--s-2); }
.pad-section-head h2 { font-size: var(--t-md); font-weight: 600; }
.pad-section-head .count { font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-sm); }
.pad-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pad-check h3 { overflow-wrap: anywhere; }
.pad-body .drawer-foot { gap: var(--s-2); }
.pad-body .drawer-foot .btn { flex: 1 1 0; min-height: 52px; }
.pad-body .drawer .check { min-height: 48px; width: 100%; padding: 4px 0; font-size: var(--t-md); }
.pad-body .drawer .check input { width: 24px; height: 24px; }
.pad-body .drawer .reading-row .input { height: 52px; font-size: 20px; }
.pad-body .drawer .icon-btn { width: var(--tap); height: var(--tap); }
.reading-state { min-width: 110px; }
.list .li-sub.tone-red { color: var(--tone-red); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand-name { font-family: var(--font-display); font-size: 20px; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- admin console ---------- */
.admin-top { display: flex; align-items: center; gap: var(--s-4); padding: 0 28px; height: var(--topbar-h); background: var(--night); color: var(--night-ink); }
.admin-top .brand { color: var(--night-ink); flex: none; }
.admin-top .brand-mark { background: var(--night-ink); color: var(--night); }

/* ---------- wide tables scroll sideways with a soft edge ---------- */
.table-wrap {
  background:
    linear-gradient(to right, var(--paper-0) 30%, transparent) left center / 32px 100% no-repeat local,
    linear-gradient(to left, var(--paper-0) 30%, transparent) right center / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 12%, transparent), transparent) left center / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 12%, transparent), transparent) right center / 10px 100% no-repeat scroll;
}

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  .split:has(> .side-panel-wrap) { grid-template-columns: minmax(0, 1fr); }
  .side-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 1090; animation: fade var(--dur-2) var(--ease); }
  .side-panel { position: fixed; top: 0; right: 0; bottom: 0; max-height: none; width: min(480px, 100vw); z-index: 1100; border-radius: 0; border-width: 0 0 0 1px; box-shadow: var(--shadow-dialog); }
  .unit-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .grid-main-side, .console { grid-template-columns: minmax(0, 1fr); }
  .task-row { grid-template-columns: 84px minmax(0, 1fr) 130px 120px; }
  .task-row > :nth-child(5) { display: none; }
  .inbox { grid-template-columns: 290px minmax(0, 1fr); }
  .set-section { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
}
@media (max-width: 1100px) {
  .widgets { columns: 1; }
}
@media (max-width: 900px) {
  .app, .app[data-collapsed="true"] { grid-template-columns: minmax(0, 1fr); }
  .rail-col { display: none; }
  .mobile-top {
    display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 30; height: 52px; padding: 0 8px 0 12px;
    background: color-mix(in srgb, var(--raised) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .mobile-top .m-title { font-weight: 600; font-size: var(--t-md); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 6px; }
  .mobile-top .icon-btn { width: 40px; height: 40px; }
  .page-head { position: static; padding: 14px 16px 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--raised); }
  .page-title { font-size: 24px; }
  .page-body { padding: 16px 16px calc(var(--tabbar-h) + 40px); }
  .page-tabs { padding: 0 12px; }
  .practice-banner { padding: 6px 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--paper-0) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 4px 6px env(safe-area-inset-bottom);
  }
  .tabbar a, .tabbar button {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; color: var(--ink-subtle); text-decoration: none;
    font-size: 11px; font-weight: 500; background: none; border: 0; cursor: pointer; padding: 0 2px; min-width: 0; border-radius: var(--r);
  }
  .tabbar .tl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar [aria-current="page"] { color: var(--ink); background: var(--state-selected); }
  .tabbar .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--tone-red-solid); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; }
  .stats, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2n), .kpi:nth-child(2n) { border-right: 0; }
  .stat:nth-child(-n+2), .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .unit-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .inbox[data-view="thread"] .inbox-side { display: none; }
  .inbox[data-view="list"] .thread-view { display: none; }
  .inbox-list { max-height: none; }
  .thread-log { max-height: 60vh; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { padding: 22px 20px 26px; gap: 18px; border-right: 0; border-bottom: 1px solid var(--a-line); min-height: 220px; }
  .auth-quote { font-size: 30px; }
  .auth-points { display: none; }
  .auth-main { padding: 28px 20px 48px; place-items: start center; }
  .auth-card h1 { font-size: 34px; }
  .ready-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ready-grid > div:nth-child(2) { border-right: 0; }
  .ready-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .grid-2, .hub-grid { grid-template-columns: minmax(0, 1fr); }
  .toast-stack { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 14px); justify-items: stretch; }
  .toast { max-width: none; }
  .greet h1 { font-size: 28px; }
  .onb-top { padding: 12px 16px; }
  .onb-body { padding: 28px 18px 56px; }
  .onb-body h1 { font-size: 32px; }
  .drawer, .drawer-wide { width: 100vw; border-left: 0; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav .s-group, .settings-nav .s-search { display: none; }
  .settings-nav a { flex: none; height: 32px; padding: 0 10px; }
  .call-props { grid-template-columns: minmax(0, 1fr); }
  .call-props > div { border-right: 0; }
  .call-props > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .call-props > div:last-child { border-bottom: 0; }
  .health { grid-template-columns: auto minmax(0, 1fr); }
  .health > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .form-row, .form-row-3, .choice-grid, .brief-grid { grid-template-columns: minmax(0, 1fr); }
  .unit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .unit { min-height: 92px; padding: 8px; }
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .task-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px var(--s-4); }
  .task-row > :nth-child(1) { grid-column: 1 / -1; display: flex; gap: var(--s-2); }
  .task-row > :nth-child(4), .task-row > :nth-child(5) { display: none; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 24px; }
  .panel-head { padding: 10px 14px; }
  .panel-body { padding: 14px; }
  .list > li, .list > .li { padding: 10px 14px; }
  .person-row { grid-template-columns: minmax(0, 1fr) 72px; }
  .person-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .hbar { grid-template-columns: minmax(80px, 120px) minmax(0, 1fr) 40px; }
  .builder-row, .builder-row-2, .builder-act, .builder-pair { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dd { margin-bottom: var(--s-2); }
  .kv > div { grid-template-columns: 104px minmax(0, 1fr); padding: 8px 12px; }
  .msg { max-width: 92%; }
  .chat { height: calc(100dvh - 260px); min-height: 380px; }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  /* A status line in a drawer footer ("0 of 13 answered") gets its own row above the buttons. */
  .drawer-foot > .grow:not(.btn) { flex: 1 1 100%; }
  .ready-grid > div { padding: 14px; }
  .toolbar .select, .toolbar .input { min-width: 0; flex: 1 1 140px; }
  .toolbar .input.search, .toolbar .input-search { min-width: 0; width: auto; flex: 1 1 100%; }
  .staff-pick { grid-template-columns: minmax(0, 1fr); }
  .widget-head { padding: 10px 12px 8px 14px; }
  .wrow { padding: 9px 14px; }
  .reading-row { grid-template-columns: minmax(0, 1fr) auto; }
  .reading-row > label { grid-column: 1 / -1; }
  .reading-state { min-width: 0; }
  .sp-head { padding: 12px 12px 10px 16px; }
  .sp-body { padding: 14px 16px 18px; }

  /* tables marked table-cards become one card per row, each value with its label */
  .table.table-cards thead { display: none; }
  .table.table-cards, .table.table-cards tbody, .table.table-cards tr, .table.table-cards td { display: block; width: 100%; }
  .table.table-cards tr { padding: 10px var(--s-4); border-bottom: 1px solid var(--line); }
  .table.table-cards tbody tr:last-child { border-bottom: 0; }
  .table.table-cards td { padding: 3px 0 !important; border-bottom: 0; height: auto; display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; min-width: 0; white-space: normal; }
  .table.table-cards td[data-label]::before { content: attr(data-label); flex: none; font-size: var(--t-xs); color: var(--ink-subtle); margin-right: auto; }
  .table.table-cards td[data-label] { column-gap: 8px; text-align: right; }
  .table.table-cards td[data-label]::before { font-family: var(--font-ui); font-weight: 400; }
  .table.table-cards td[data-label]:empty { display: none !important; }
  .table.table-cards td:first-child { padding-bottom: 6px !important; justify-content: flex-start; }
  .table.table-cards td:first-child::before { display: none; }
  .table.table-cards td > * { min-width: 0; }
  .table.table-cards td.hide-sm { display: none; }

  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .seg { flex-wrap: wrap; overflow-x: visible; }
  .task-title, .task-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .onb-prev-field .select { width: 100%; }
  .onb-preview .list > li.onb-prev-row > .li-main { flex-basis: 100%; }
  .health-counts { gap: 6px 14px; }
}
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .input, .select { height: 42px; }
  .icon-btn { width: 40px; height: 40px; }
  .tab { height: 42px; }
  .seg button { height: 34px; }
  .check { min-height: 40px; }
  .chip-filter { height: 34px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
  .auth-art .draw { stroke-dashoffset: 0; }
}

/* ---------- print: Home, the PM log and the schedule ---------- */
@media print {
  @page { margin: 14mm; }
  :root { color-scheme: light; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .rail-col, .mobile-top, .tabbar, .practice-banner, .no-print, .toast-stack, .scrim, .drawer, .selection-bar, .tabs, .toolbar, .btn, .side-panel-wrap { display: none !important; }
  .app { display: block; }
  .main { background: #fff; }
  .page-head { position: static; backdrop-filter: none; background: #fff; padding: 0 0 8px; }
  .page-body { padding: 8px 0 0; }
  .widget, .panel, .stats, .ready-grid { border-color: #bbb; box-shadow: none; break-inside: avoid; }
  .widgets { columns: 2 !important; }
  .stats { grid-template-columns: repeat(4, 1fr) !important; }
  .chip { box-shadow: inset 0 0 0 1px #999; background: #fff !important; color: #000 !important; }
  .sched { min-width: 0; grid-template-columns: 150px repeat(7, 1fr) !important; font-size: 9pt; }
  .sched-wrap { overflow: visible; border-color: #bbb; }
  .shift { background: #fff; border: 1px solid #888; }
  .table th { position: static; }
  .print-only { display: block !important; }
  a { text-decoration: none; }
}
.print-only { display: none; }

/* the agent console inside the "Try the agent" panel */
.console-compact { grid-template-columns: minmax(0, 1fr); }
.console-compact .chat { height: calc(100vh - 230px); height: calc(100dvh - 230px); min-height: 380px; }
.console-compact > aside { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; gap: var(--s-3); }
.console-compact > aside > :first-child { grid-column: 1 / -1; }
@media (max-width: 600px) { .console-compact > aside { grid-template-columns: minmax(0, 1fr); } }
.unit-box-none { color: var(--ink-subtle); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
@media (min-width: 1280px) {
  .split:has(> .side-panel-wrap) .hide-split { display: none; }
}
/* loading and error states that sit straight in the page, outside a page body */
.content > .steps, .page > .steps, .settings-main > .steps { padding: 32px 28px; }
.content > .error-box, .page > .error-box { margin: 24px 28px; }
@media (max-width: 900px) { .content > .steps, .page > .steps { padding: 24px 16px; } .content > .error-box, .page > .error-box { margin: 16px; } }
.pb-short { display: none; }
@media (max-width: 600px) {
  .pb-long { display: none; }
  .pb-short { display: inline; color: var(--ink-muted); }
  .hide-sm { display: none !important; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row > * { flex: none; }
  /* Rows that scroll sideways fade at the right edge, so a cut-off tab or chip reads as "more this way". */
  .chip-row, .page-tabs .tabs, .side-panel .tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 28px; }
  .table.table-cards td:not([data-label]) { display: block; }
  .table.table-cards td:first-child + td:not([data-label]) { padding-bottom: 6px !important; }
  .mobile-top .m-title { font-family: var(--font-display); font-weight: 400; font-size: 19px; }
}
/* auth: the drawing fills the lower part of the side, the words sit above it */
.auth-side { justify-content: flex-start; gap: 40px; }
.auth-side .auth-art { top: 40%; }
.auth-side > .stack-lg { margin-top: 6vh; }
.auth-side > .auth-foot { margin-top: auto; }
.auth-card .label { color: var(--a-muted); font-size: var(--t-sm); }
@media (max-width: 900px) {
  .auth-side { gap: 18px; min-height: 0; padding-bottom: 150px; }
  .auth-side .auth-art { top: 46%; }
  .auth-side > .stack-lg { margin-top: 4px; }
  .auth-side > .auth-foot { display: none; }
}

/* panel and drawer bodies stack their sections at full height and scroll as a whole */
.sp-body, .drawer-body { grid-auto-rows: max-content; }
@media (min-width: 1280px) {
  .split:has(> .side-panel-wrap) .col-title { max-width: 240px !important; min-width: 0 !important; }
}
.sched .cover .bar-fill { background: var(--ink-faint); }
.sched .cover .bar-fill.over { background: var(--tone-amber); }
@media (max-width: 900px) { .settings-main { border-left: 0; } .settings-nav { max-height: none; } }
/* keyboard focus always shows, even on selected items */
.nav-item:focus-visible, .switcher:focus-visible, .user-btn:focus-visible, .rail-label:focus-visible,
.chip-filter:focus-visible, .legend-btn:focus-visible, .thread-item:focus-visible, .hub-card:focus-visible, .unit:focus-visible,
.kcard:focus-visible, .wrow:focus-visible, .stat:focus-visible, .settings-nav a:focus-visible, .tab:focus-visible, .seg button:focus-visible,
.menu-item:focus-visible, .palette-item:focus-visible, .notif-item:focus-visible, .list-btn:focus-visible, .widget-link:focus-visible,
.tabbar a:focus-visible, .tabbar button:focus-visible, .theme-pick button:focus-visible {
  outline: none; box-shadow: var(--focus-ring) !important; position: relative; z-index: 1;
}
.table tbody tr.clickable:focus-visible { box-shadow: inset 0 0 0 2px var(--ink) !important; }
/* with a panel or drawer open, toasts rise above its footer instead of covering its actions */
@media (min-width: 901px) {
  body:has(.drawer) .toast-stack, body:has(.side-panel) .toast-stack, body:has(.dialog) .toast-stack { bottom: 76px; }
}
/* the operator console keeps its own simple layout: a padded column under the dark top bar */
.admin-top ~ .content, .admin-top + main.content { padding: 28px 28px 56px; max-width: var(--content-max); margin: 0 auto; display: block; }
.admin-top ~ .content .page { display: grid; gap: var(--s-5); }
.admin-top ~ .content .page-head { position: static; padding: 0; border: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; min-height: 0; }
.admin-top .label { color: var(--night-muted); }
.swatch-alt { opacity: 0.55; box-shadow: inset 0 0 0 1.5px currentColor; }
.unit[data-alt="true"] .unit-status::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
@media (max-width: 600px) {
  .summary-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .summary-strip::-webkit-scrollbar { display: none; }
  .summary-strip > * { flex: none; }
}
/* single-column grids never grow past their container: a long line truncates instead of widening the page */
.page-body, .stack, .stack-lg, .stack-sm, .sp-body, .drawer-body, .form, .widget-body, .greet, .steps { grid-template-columns: minmax(0, 1fr); }
.widgets { min-width: 0; }
.widgets > * { min-width: 0; }
.date-group { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 600px) { .date-group .list > li { flex-wrap: wrap; } .date-group .list > li .li-main { flex-basis: calc(100% - 40px); } }
@media (min-width: 901px) { .auth-side .auth-art { top: 50%; } }

/* Onboarding departments: a toggle with its extension beside it */
.dept-choice { cursor: default; padding: 8px 10px 8px 14px; gap: 8px; }
.dept-toggle { display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0; background: none; border: 0; padding: 6px 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.dept-toggle[aria-pressed="true"] .box { background: var(--inverse); border-color: var(--inverse); color: var(--ink-inverse); }
.onb .dept-toggle[aria-pressed="true"] .box { background: #f3f3f1; border-color: #f3f3f1; color: #111; }
.dept-ext .input { width: 104px; }
