/* joyaAI Control Center — design system shared with the client dashboard (tokens, cards, pills, range track, light + dark).
   Phone first; sidebar ≥ 900 px. */
:root {
  color-scheme: light;
  --bg: #F4F6F9; --surface: #FFFFFF; --surface-2: #F1F3F7; --surface-3: #E8EBF0; --elev: #FFFFFF;
  --ink: #0E1726; --ink-2: #4A5568; --ink-3: #5E6879; --line: #E3E7ED; --line-2: #D2D8E1;
  --accent: #4F46E5; --accent-2: #EEF0FF; --accent-ink: #FFFFFF;
  --ai-a: #6366F1; --ai-b: #06B6D4; --ai-grad: linear-gradient(135deg, var(--ai-a), var(--ai-b)); --ai-soft: linear-gradient(135deg, rgba(99,102,241,.09), rgba(6,182,212,.09));
  --ok: #109A4C; --ok-bg: #E6F6EC; --warn: #B7791F; --warn-dot: #E8A10C; --warn-bg: #FDF4E1; --serious: #D9622B; --serious-bg: #FDEDE4;
  --crit: #D23434; --crit-bg: #FDE8E8; --stale: #7B8496; --stale-bg: #EEF0F4; --info: #4F6BD8; --info-bg: #EBF0FD;
  --ok-ink: #10793C; --warn-ink: #946218; --serious-ink: #AA4D23; --crit-ink: #C02F2F; --stale-ink: #616876; --info-ink: #4962C6; --ai-ink: #5A5DE8; --badge: #C02F2F;
  --r-xs: 8px; --r-s: 10px; --r: 14px; --r-l: 20px;
  --sh-1: 0 1px 2px rgba(14,23,38,.05), 0 1px 1px rgba(14,23,38,.03);
  --sh-2: 0 1px 2px rgba(14,23,38,.06), 0 12px 32px -14px rgba(14,23,38,.22);
  --sh-3: 0 24px 64px -20px rgba(14,23,38,.35);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 252px; --top-h: 60px; --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0A0E13; --surface: #11161D; --surface-2: #171D26; --surface-3: #1F2631; --elev: #161C25;
  --ink: #E9EDF3; --ink-2: #A9B3C2; --ink-3: #8792A4; --line: #212934; --line-2: #2C3542;
  --accent: #8B85FF; --accent-2: #1E1F3D; --accent-ink: #0A0E13;
  --ai-soft: linear-gradient(135deg, rgba(99,102,241,.16), rgba(6,182,212,.12));
  --ok: #34C374; --ok-bg: #0F2A1C; --warn: #F0B43C; --warn-dot: #F0B43C; --warn-bg: #2C2412; --serious: #F28A55; --serious-bg: #33190E;
  --crit: #F06464; --crit-bg: #361516; --stale: #8A94A6; --stale-bg: #1B212A; --info: #8BA2F5; --info-bg: #161E36;
  --ok-ink: var(--ok); --warn-ink: var(--warn); --serious-ink: var(--serious); --crit-ink: var(--crit); --stale-ink: var(--stale); --info-ink: var(--info); --ai-ink: #8F92F7; --badge: #C93C3C;
  --sh-1: 0 1px 0 rgba(255,255,255,.02); --sh-2: 0 1px 0 rgba(255,255,255,.03), 0 16px 40px -18px rgba(0,0,0,.7); --sh-3: 0 30px 80px -20px rgba(0,0,0,.8);
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0E13; --surface: #11161D; --surface-2: #171D26; --surface-3: #1F2631; --elev: #161C25;
  --ink: #E9EDF3; --ink-2: #A9B3C2; --ink-3: #8792A4; --line: #212934; --line-2: #2C3542;
  --accent: #8B85FF; --accent-2: #1E1F3D; --accent-ink: #0A0E13;
  --ai-soft: linear-gradient(135deg, rgba(99,102,241,.16), rgba(6,182,212,.12));
  --ok: #34C374; --ok-bg: #0F2A1C; --warn: #F0B43C; --warn-dot: #F0B43C; --warn-bg: #2C2412; --serious: #F28A55; --serious-bg: #33190E;
  --crit: #F06464; --crit-bg: #361516; --stale: #8A94A6; --stale-bg: #1B212A; --info: #8BA2F5; --info-bg: #161E36;
  --ok-ink: var(--ok); --warn-ink: var(--warn); --serious-ink: var(--serious); --crit-ink: var(--crit); --stale-ink: var(--stale); --info-ink: var(--info); --ai-ink: #8F92F7; --badge: #C93C3C;
  --sh-1: 0 1px 0 rgba(255,255,255,.02); --sh-2: 0 1px 0 rgba(255,255,255,.03), 0 16px 40px -18px rgba(0,0,0,.7); --sh-3: 0 30px 80px -20px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ic { display: inline-grid; place-items: center; flex: none; } .ic svg { display: block; }
.num, .tbl td { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); } .small { font-size: 13px; } .mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row { display: flex; align-items: center; gap: 8px; } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 8px; }
.gap-l { gap: 14px; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; } .right { margin-inline-start: auto; }
@media (max-width: 899.98px) { .hide-s { display: none !important; } }
@media (min-width: 900px) { .hide-l { display: none !important; } }

/* ---- app shell ------------------------------------------------------------------------------- */
.app { min-height: 100%; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 14px 0; display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.top.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--ai-grad); font-weight: 800; font-size: 15px; letter-spacing: -.02em; flex: none; }
.brand b { font-size: 16px; letter-spacing: -.01em; white-space: nowrap; display: block; line-height: 1.15; }
.brand b i { font-style: normal; background: var(--ai-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.iconbtn { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); transition: background .15s; }
.iconbtn:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13.5px; color: #fff; background: linear-gradient(135deg, #334155, #64748B); flex: none; }
.main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 6px 16px calc(var(--tab-h) + var(--safe-b) + 28px); }
.preview-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--warn-ink); background: var(--warn-bg); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }

.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); position: relative; }
.tabbar button.on { color: var(--accent); }
.tabbar .badge, .side .n.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--badge); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }

@media (min-width: 900px) {
  body { font-size: 14.5px; }
  .app { grid-template-columns: var(--side-w) 1fr; }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px 14px; border-inline-end: 1px solid var(--line); background: var(--surface); gap: 2px; scrollbar-width: thin; }
  .side .brand { padding: 4px 8px 14px; }
  .side .grp { font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 14px 10px 6px; letter-spacing: .01em; }
  .side a.nav { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: 14px; position: relative; }
  .side a.nav:hover { background: var(--surface-2); color: var(--ink); }
  .side a.nav.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
  .side a.nav .n { margin-inline-start: auto; font-size: 11.5px; font-weight: 700; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); position: static; height: auto; }
  .side .foot { margin-top: auto; padding: 12px 8px 0; font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; gap: 6px; }
  .top { padding: 0 24px; } .top .brand { display: none; }
  .main { padding: 8px 28px 48px; }
  .tabbar { display: none; }
}

/* ---- page header / grids ---------------------------------------------------------------------- */
.ph { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 10px 0 16px; }
.ph h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.025em; margin: 0; font-weight: 700; }
.ph .sub { color: var(--ink-3); margin: 4px 0 0; font-size: 14px; }
.ph > .grow { flex: 1 1 240px; }
.ph .tools { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (min-width: 900px) { .ph h1 { font-size: 30px; } }
.grid { display: grid; gap: 12px; }
.g2, .g3 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.g-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.g-stats { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.main, .main-col { overflow-x: clip; }
@media (min-width: 640px) { .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- cards / stats / kv ----------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; box-shadow: var(--sh-1); min-width: 0; position: relative; }
.card.tap { cursor: pointer; transition: transform .12s, box-shadow .2s, border-color .2s; }
.card.tap:hover { box-shadow: var(--sh-2); border-color: var(--line-2); } .card.tap:active { transform: scale(.995); }
.card-h { display: flex; align-items: flex-start; gap: 8px 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h > div:first-child { flex: 1 1 160px; min-width: 0; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-h .sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.card.pad0 { padding: 0; overflow: hidden; }
.card.ai { border: 1px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--ai-grad) border-box; }
.card.ai::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--ai-soft); pointer-events: none; } .card.ai > * { position: relative; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--sh-1); }
.stat small { font-size: 12px; color: var(--ink-3); font-weight: 600; } .stat b { font-size: 24px; letter-spacing: -.02em; font-weight: 700; line-height: 1.1; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.kv:first-child { border-top: 0; } .kv b { color: var(--ink); font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

/* ---- pills / dots / track --------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill.sm { font-size: 11.5px; padding: 2px 7px 2px 5px; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); } .pill.warn { background: var(--warn-bg); color: var(--warn-ink); } .pill.serious { background: var(--serious-bg); color: var(--serious-ink); }
.pill.crit { background: var(--crit-bg); color: var(--crit-ink); } .pill.stale { background: var(--stale-bg); color: var(--stale-ink); } .pill.info { background: var(--info-bg); color: var(--info-ink); }
.pill.ai { background: var(--ai-soft); color: var(--ai-ink); } .pill.accent { background: var(--accent-2); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stale); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn-dot); } .dot.crit { background: var(--crit); } .dot.info { background: var(--info); }
.track { position: relative; height: 10px; margin: 6px 0 2px; }
.track .trk { position: absolute; left: 0; right: 0; top: 4px; height: 2px; border-radius: 2px; background: var(--line-2); }
.track .band { position: absolute; top: 2px; height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--ok) 32%, transparent); }
.track .mark { position: absolute; top: 0; width: 10px; height: 10px; margin-inline-start: -5px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.track .mark.crit { background: var(--crit); } .track .mark.stale { background: var(--stale); }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; } .meter i { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .5s; }

/* ---- buttons / segmented / chips -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); box-shadow: var(--sh-1); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 40%, var(--line-2)); } .btn.danger:hover { background: var(--crit-bg); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; } .btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; line-height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-block; vertical-align: middle; text-align: center; background: var(--surface); max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---- forms ----------------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field input, .field select, .field textarea { height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 0 14px; font-size: 16px; outline: 0; font-weight: 500; color: var(--ink); width: 100%; min-width: 0; }
.field textarea { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); background: var(--surface); }
.field input.code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.field .help { font-weight: 500; color: var(--ink-3); font-size: 12.5px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.err { color: var(--crit-ink); font-size: 13.5px; min-height: 18px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--line-2); transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch.on { background: var(--ok); } .switch.on::after { transform: translateX(18px); }
.secret { font-family: var(--mono); font-size: 15px; word-break: break-all; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .codes span { font-family: var(--mono); font-size: 15px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); text-align: center; }
.qr { display: grid; place-items: center; padding: 10px; background: #fff; border-radius: 14px; width: fit-content; margin: 0 auto; }
.qr svg { display: block; width: 180px; height: 180px; }

/* ---- lists / tables / empty / login ----------------------------------------------------------- */
.list { display: flex; flex-direction: column; } .list > * { border-top: 1px solid var(--line); } .list > :first-child { border-top: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-width: 0; text-align: start; width: 100%; color: inherit; }
.li .t { font-weight: 600; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 13px; color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li.tap:hover .t { color: var(--accent); }
.chev { color: var(--ink-3); flex: none; }
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; color: var(--ink-3); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; } .tbl tr:last-child td { border-bottom: 0; }
.tbl tr.tap { cursor: pointer; } .tbl tr.tap:hover td { background: var(--surface-2); }
.tbl td.r, .tbl th.r { text-align: end; } .tbl td.nowrap, .tbl th.nowrap { white-space: nowrap; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 16px; color: var(--ink-3); }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; background: var(--surface-2); color: var(--ink-3); margin-bottom: 6px; }
.empty b { color: var(--ink); font-size: 15px; } .empty p { margin: 0; font-size: 13.5px; max-width: 420px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,.18), transparent), radial-gradient(900px 500px at 110% 110%, rgba(6,182,212,.16), transparent), var(--bg); }
.login form, .login .panel { width: 100%; max-width: 400px; min-width: 0; display: flex; flex-direction: column; gap: 14px; background: var(--surface); padding: 28px 24px; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--sh-3); }
.login h1 { margin: 6px 0 0; font-size: 24px; letter-spacing: -.02em; } .login p { margin: 0; color: var(--ink-3); font-size: 14px; }
.login .btn { height: 48px; font-size: 15px; border-radius: 12px; }

/* ---- matrix ----------------------------------------------------------------------------------- */
.matrix { display: grid; gap: 10px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.mrow:first-child { border-top: 0; }
.mrow .lbl { font-weight: 600; font-size: 14px; } .mrow .lbl small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12.5px; }
.mrow .seg button { padding: 0 10px; font-size: 12.5px; }
.mrow .eff { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.area-h { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .03em; text-transform: uppercase; margin: 14px 0 2px; }

/* ---- sheet / toast ---------------------------------------------------------------------------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(8,12,18,0); display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.sheet-wrap.in { background: rgba(8,12,18,.42); } .sheet-wrap.out { background: rgba(8,12,18,0); }
.sheet { width: 100%; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; background: var(--elev); border-radius: 22px 22px 0 0; box-shadow: var(--sh-3); transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); padding-bottom: var(--safe-b); }
.sheet-wrap.in .sheet { transform: none; } .sheet-wrap.out .sheet { transform: translateY(100%); }
.sheet-h { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 6px; }
.sheet-h > div:first-child { flex: 1; min-width: 0; } .sheet-h h3 { margin: 0; font-size: 18px; letter-spacing: -.015em; } .sheet-h .sub { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.sheet-b { overflow-y: auto; padding: 6px 16px 20px; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } .sheet { max-width: 560px; border-radius: 22px; transform: translateY(16px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; } .sheet-wrap.in .sheet { transform: none; opacity: 1; } .sheet-wrap.out .sheet { opacity: 0; } }
.toast-root { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; max-width: calc(100% - 32px); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--sh-3); animation: tin .2s; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }
@media (min-width: 900px) { .toast-root { bottom: 24px; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- step 2: Now board, feed, alert queue, devices ------------------------------------------------ */
h2.sec, h4.sec { font-size: 13px; font-weight: 700; color: var(--ink-3); letter-spacing: .03em; text-transform: uppercase; margin: 18px 0 8px; }
h4.sec { margin: 16px 0 6px; }
.tiles .tile { padding: 14px 16px; }
.tile.has-crit { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.tile.silent { border-color: color-mix(in srgb, var(--crit) 70%, var(--line)); }
.tile-body { display: flex; gap: 14px; align-items: center; }
.score { flex: none; width: 64px; height: 64px; border-radius: 18px; display: grid; place-content: center; text-align: center; background: var(--surface-2); }
.score b { font-size: 24px; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; } .score small { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.score.ok { background: var(--ok-bg); color: var(--ok-ink); } .score.warn { background: var(--warn-bg); color: var(--warn-ink); } .score.crit { background: var(--crit-bg); color: var(--crit-ink); } .score.stale { background: var(--stale-bg); color: var(--stale-ink); }
.score.ok small, .score.warn small, .score.crit small { color: inherit; opacity: .8; }
.tile-stats { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 16px 12px; }
.filters.card { padding: 12px 14px; }
.ctl { height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 0 10px; font-size: 14px; color: var(--ink); min-width: 0; max-width: 100%; }
input.ctl.grow { flex: 1 1 160px; } textarea.ctl { height: auto; min-height: 56px; padding: 8px 10px; width: 100%; resize: vertical; }
.feed-li .t, .group-li .t { white-space: normal; } .feed-li.unseen .t { font-weight: 700; }
.feed-li.unseen { position: relative; } .feed-li.unseen::before { content: ''; position: absolute; left: -16px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent); }
.feed-li .grow.tap { cursor: pointer; } .feed-li .grow.tap:hover .t { color: var(--accent); }
.group-li .badges { margin-top: 6px; gap: 6px; } .group-li .badges .pill { font-size: 11.5px; }
.note-box { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--info-bg); color: var(--info-ink); font-size: 13px; margin-bottom: 12px; }
.actions.left { justify-content: flex-start; margin: 12px 0; } .actions.left label.row { gap: 6px; }
.site-row.silent { border-color: color-mix(in srgb, var(--crit) 60%, var(--line)); }
.tabbar button .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--badge); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.side .nav .n { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
@media (max-width: 639.98px) { .tile-body { gap: 12px; } .score { width: 56px; height: 56px; } .score b { font-size: 21px; } }

/* ---- step 4: client links (open dashboard / open as client), site health line ------------------------ */
.iconlink { width: 32px; padding: 0; } .iconlink .ic { color: var(--ink-2); } .iconlink:hover .ic { color: var(--accent); }
.tile-links { display: flex; gap: 6px; flex: 0 0 100%; justify-content: flex-end; margin-top: -4px; }
.tile .card-h { row-gap: 6px; }
@media (min-width: 640px) { .tile-links { flex: none; margin-top: 0; order: 3; } .tile .card-h > div:first-child { flex-basis: 120px; } }
.client-card .links .btn { flex: 1 1 140px; }
.health { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); margin: -4px 0 10px; }
.health.silent, .health .dot.silent { color: var(--crit-ink); } .health .dot.silent { background: var(--crit); } .health .dot.awaiting { background: var(--info); } .health .dot.none { background: var(--stale); }
.health-card.silent { border-color: color-mix(in srgb, var(--crit) 60%, var(--line)); }
.health-card.awaiting { border-color: color-mix(in srgb, var(--info) 55%, var(--line)); }
.health-card .card-h { margin-bottom: 8px; } .health-card .card-h:last-child { margin-bottom: 0; }
.ph .tools .btn { height: 34px; }

/* ---- CC-2 tickets ---- */
.thread { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px; }
.msg { max-width: 92%; border-radius: var(--r); padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); }
.msg.operator { align-self: flex-end; background: var(--accent-2); border-color: transparent; }
.msg.internal { align-self: stretch; max-width: 100%; background: var(--warn-bg); border: 1px dashed var(--warn-dot); }
.msg .who { font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.msg.internal .who { color: var(--warn-ink); font-weight: 600; }
.msg .txt { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.msg .atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att-img img { max-width: 220px; max-height: 160px; border-radius: var(--r-s); display: block; border: 1px solid var(--line); }
.att-img small, .att-doc small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.att-doc { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); color: inherit; }
.att-audio { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); }
.att-audio audio { width: 100%; max-width: 360px; height: 36px; display: block; margin-top: 4px; }
.att-audio small { color: var(--ink-3); font-size: 12px; }
.composer-box { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.composer-box textarea.ctl { width: 100%; min-height: 84px; resize: vertical; }
.ctx-chart { width: 100%; max-width: 640px; border-radius: var(--r-s); border: 1px solid var(--line); margin-top: 6px; display: block; background: #fff; }
.tk-row[data-colour="red"] .t { color: var(--crit-ink); }
.crit-text { color: var(--crit-ink); font-weight: 600; }
.pill.serious { background: var(--serious-bg); color: var(--serious-ink); }
.dot.serious { background: var(--serious); }
.due-card .li .t { font-weight: 600; }
.tk-filters .seg { flex-wrap: wrap; }
.composer-box .err { margin: 0; }

/* ---------- CC-3: documentation, maintenance, equipment ---------- */
.md { line-height: 1.55; font-size: 15px; overflow-wrap: anywhere; }
.md h1 { font-size: 22px; margin: 4px 0 10px; } .md h2 { font-size: 18px; margin: 18px 0 8px; } .md h3 { font-size: 16px; margin: 14px 0 6px; } .md h4, .md h5, .md h6 { font-size: 14px; margin: 12px 0 4px; }
.md p { margin: 0 0 10px; } .md ul, .md ol { margin: 0 0 10px; padding-left: 22px; } .md li { margin: 2px 0; }
.md li.task { list-style: none; margin-left: -18px; } .md li.task::before { content: '\2610  '; color: var(--ink-3); } .md li.task.done::before { content: '\2611  '; color: var(--ok); }
.md blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--r-xs) var(--r-xs) 0; } .md blockquote p:last-child { margin: 0; }
.md code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; } .md pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-s); overflow: auto; margin: 0 0 10px; } .md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 0 0 12px; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; } .md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; min-width: 60px; } .md th { background: var(--surface-2); font-weight: 600; }
.md img { max-width: 100%; border-radius: var(--r-s); border: 1px solid var(--line); } .md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; } .md a { color: var(--accent); }
.doc-body { padding: 18px 20px; }
.editor { display: grid; gap: 12px; } .editor-card[data-mode="preview"] .pane-write { display: none; } .editor-card[data-mode="write"] .pane-preview { display: none; }
@media (min-width: 900px) { .editor.split { grid-template-columns: 1fr 1fr; } .editor-card[data-mode] .pane-write, .editor-card[data-mode] .pane-preview { display: block; } }
.editor textarea { min-height: 360px; width: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.5; resize: vertical; } .preview { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 12px 14px; min-height: 120px; background: var(--surface); }
.diff { font-family: var(--mono); font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: var(--r-s); padding: 8px 0; max-height: 60vh; overflow: auto; }
.diff div { padding: 0 10px; } .diff .add { background: var(--ok-bg); color: var(--ok-ink); } .diff .del { background: var(--crit-bg); color: var(--crit-ink); } .diff .same { color: var(--ink-3); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; } .att-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; } .att-cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-grid a.att-img img { width: 100%; height: 96px; object-fit: cover; }
.sec-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .sec-tabs::-webkit-scrollbar { display: none; } .sec-tabs .chip { white-space: nowrap; flex: none; }
.client-tabs { margin-top: 10px; overflow-x: auto; max-width: 100%; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; } .cal .dow { font-size: 11px; color: var(--ink-3); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.cal .day { min-height: 68px; border: 1px solid var(--line); border-radius: var(--r-xs); padding: 4px; background: var(--surface); font-size: 12px; min-width: 0; } .cal .day.out { border-color: transparent; background: transparent; } .cal .day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .day b { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.cal .ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 2px 5px; margin-top: 2px; font: inherit; font-size: 11px; line-height: 1.25; background: var(--info-bg); color: var(--info-ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.overdue { background: var(--crit-bg); color: var(--crit-ink); } .cal .ev.today { background: var(--warn-bg); color: var(--warn-ink); } .cal .ev.soon { background: var(--info-bg); } .cal .ev.done { background: var(--ok-bg); color: var(--ok-ink); } .cal .ev.cancelled { background: var(--stale-bg); color: var(--stale-ink); text-decoration: line-through; } .cal .ev.snoozed, .cal .ev.scheduled, .cal .ev.none { background: var(--stale-bg); color: var(--stale-ink); }
@media (max-width: 639.98px) { .cal .day { min-height: 46px; padding: 3px; } .cal .ev { font-size: 0; height: 6px; padding: 0; margin-top: 3px; } .cal .day small { display: none; } }
.label-box { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border-radius: var(--r-s); padding: 10px 12px; overflow-wrap: anywhere; user-select: all; }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; } .photo-strip img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-xs); border: 1px solid var(--line); } .photo-strip .att-doc { padding: 6px 10px; }
.sec { margin: 8px 0 4px; }

/* ---- CC-4 limits ------------------------------------------------------------------------------ */
.g-limits { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .g-limits { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); } }
.tbl-scroll.flat { border: 0; border-radius: 0; }
.limits-tbl td, .limits-tbl th { padding: 8px 12px; } .limits-tbl tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--warn-dot); }
.qflag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--warn-ink); background: var(--warn-bg); border-radius: 999px; padding: 1px 7px 1px 4px; vertical-align: middle; cursor: help; }
.limits-card .hist summary { cursor: pointer; padding: 6px 0; } .limits-card .hist .li { padding: 8px 0; }
.band-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 70px 70px 32px; gap: 6px; align-items: center; padding: 6px 0; }
.band-row .ctl.num { padding: 0 6px; } @media (max-width: 639.98px) { .band-row { grid-template-columns: 1fr 1fr; } .band-row .ctl.num { grid-column: span 1; } }
.preview .li.skip_site .t, .preview .li.skip_not_editable .t { color: var(--ink-3); } .preview .li.same .t { color: var(--ink-2); } .preview label.li { cursor: pointer; }
.note-box.ok { background: var(--ok-bg); color: var(--ok-ink); } .note-box.warn { background: var(--warn-bg); color: var(--warn-ink); }
.hist-row[data-status="failed"] .t { color: var(--warn-ink); } .hist-row[data-status="refused"] .t { color: var(--crit-ink); }
/* ---- CC-4 reports: charts (the dashboard's style) ---------------------------------------------- */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #4a3aa7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #9085e9; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #9085e9; }
.chart-wrap { position: relative; width: 100%; } .chart { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .axis { stroke: var(--line-2); stroke-width: 1; } .chart .ylbl, .chart .xlbl { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar-m { fill: var(--s1); } .chart .bar.crit .bar-m { fill: var(--crit); } .chart .bar.warn .bar-m { fill: var(--warn-dot); } .chart .bar.ok .bar-m { fill: var(--ok); } .chart .bar.stale .bar-m { fill: var(--line-2); }
.chart .bar-hit { fill: transparent; } .chart .bar.tap { cursor: pointer; } .chart .bar:hover .bar-m { opacity: .8; }
.chart-empty { padding: 28px 12px; text-align: center; color: var(--ink-3); font-size: 13.5px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.tip { position: absolute; top: 0; transform: translate(-50%, -6px); pointer-events: none; opacity: 0; transition: opacity .12s; background: var(--elev); border: 1px solid var(--line-2); box-shadow: var(--sh-2); border-radius: 10px; padding: 7px 10px; font-size: 12.5px; min-width: 130px; z-index: 5; }
.tip.on { opacity: 1; } .tip-t { color: var(--ink-3); font-size: 11.5px; margin-bottom: 3px; white-space: nowrap; } .tip-r { display: flex; align-items: center; gap: 6px; white-space: nowrap; } .tip-r i { width: 8px; height: 8px; border-radius: 3px; flex: none; } .tip-r b { margin-inline-start: auto; padding-inline-start: 10px; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); } .legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: flex; flex-direction: column; gap: 6px; } .hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; text-align: start; color: inherit; width: 100%; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); } .hbar-t { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; } .hbar-t i { display: block; height: 100%; border-radius: 6px; background: var(--s1); }
.hbar.crit .hbar-t i { background: var(--crit); } .hbar.warn .hbar-t i { background: var(--warn-dot); } .hbar-v { font-variant-numeric: tabular-nums; } .hbar-n { grid-column: 1 / -1; color: var(--ink-3); font-size: 12px; margin-top: -4px; }
.share-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-3); } .share-bar i { display: block; height: 100%; background: var(--s1); }
.share-bar i.ok, .share-key.ok { background: var(--ok); } .share-bar i.warn, .share-key.warn { background: var(--warn-dot); } .share-bar i.crit, .share-key.crit { background: var(--crit); } .share-bar i.stale, .share-key.stale { background: var(--line-2); }
.rep-tabs { max-width: 100%; } .report-text { white-space: pre-wrap; font: 13px/1.5 var(--font); margin: 0; color: var(--ink-2); } .wk-tbl td, .wk-tbl th { padding: 8px 10px; }
.stat .pill { align-self: flex-start; margin-top: 4px; }
/* ---- CC-5 AI ---------------------------------------------------------------------------------- */
.ask-box textarea.ctl { width: 100%; min-height: 64px; resize: vertical; } .answer-text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; }
.figures { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; } .fig { margin: 4px 0 0 0; padding-inline-start: 18px; font-size: 12.5px; color: var(--ink-2); }
.briefing-card .answer-text { font-size: 14px; }
.draft-box { border: 1px solid transparent; background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--ai-grad) border-box; border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.draft-text { white-space: pre-wrap; font-size: 14px; line-height: 1.5; background: var(--surface); border-radius: var(--r-s); padding: 8px 10px; border: 1px dashed var(--line-2); }

/* ---- CC-6 field tasks ---- */
.task-tabs { max-width: 100%; }
.task-row .badges { margin-top: 6px; gap: 6px; } .task-row[data-due="overdue"] .t { color: var(--crit-ink); }
.load-card .chip.warn { border-color: color-mix(in srgb, var(--warn-dot) 60%, var(--line-2)); }
.inbox-btn { position: relative; } .inbox-btn .n { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--badge); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.new-task .step { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); } .new-task .step:first-child { border-top: 0; }
.step-h { display: flex; align-items: center; gap: 8px; font-size: 13.5px; } .step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.running-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; border-color: color-mix(in srgb, var(--ai-a) 55%, var(--line)); background: var(--ai-soft); color: inherit; }
.running-card .t { font-weight: 650; } .running-card .s { font-size: 13px; color: var(--ink-3); }
.action-card { display: flex; flex-direction: column; gap: 10px; }
.big-btn { width: 100%; min-height: 60px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); box-shadow: var(--sh-1); transition: transform .1s; }
.big-btn:active { transform: scale(.985); } .big-btn small { font-size: 12px; font-weight: 500; opacity: .85; }
.big-btn.start { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); min-height: 68px; flex-direction: row; gap: 10px; font-size: 19px; }
.big-btn.stop { background: var(--ai-soft); border-color: color-mix(in srgb, var(--ai-a) 55%, var(--line-2)); color: var(--ai-ink); min-height: 68px; }
.result-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.result-row .big-btn { min-height: 54px; font-size: 14.5px; flex-direction: row; gap: 6px; }
.big-btn.done { background: var(--ok-bg); color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok) 45%, var(--line-2)); }
.big-btn.partial { background: var(--warn-bg); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn-dot) 45%, var(--line-2)); }
.big-btn.notdone { background: var(--crit-bg); color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 40%, var(--line-2)); }
@media (max-width: 420px) { .result-row { grid-template-columns: 1fr; } .result-row .big-btn { min-height: 50px; } }
.checklist { display: flex; flex-direction: column; } .check-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; font-size: 15px; min-height: 52px; }
.check-row:first-child { border-top: 0; } .check-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-row .box { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; background: var(--surface); transition: background .15s, border-color .15s; }
.check-row.on .box { background: var(--ok); border-color: var(--ok); color: #fff; } .check-row.on .grow { color: var(--ink-3); text-decoration: line-through; }
.check-row small { font-size: 11.5px; white-space: nowrap; } .check-row input:disabled ~ .box { opacity: .6; }
.offline-banner { margin: 0 0 10px; }
.result-seg { flex-wrap: wrap; } .result-seg button { flex: 1 1 auto; }
.on-site .btn { max-width: 100%; } .on-site .btn .ic + * { overflow: hidden; text-overflow: ellipsis; }
.tpl-card.inactive { opacity: .6; } .rule-row .s + .s { margin-top: 2px; }
.manager-card .chips .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- 0.7.2: phones — stacked tables, edge fade + swipe hint, tap targets, sticky sheet footer, audit cells --------------- */
.tbl-scroll { position: relative; }
.tbl-scroll[data-hint]::after { content: attr(data-hint); display: block; font-size: 11.5px; color: var(--ink-3); padding: 6px 12px 8px; text-align: end; }
@media (min-width: 900px) { .tbl-scroll[data-hint]::after { display: none; } }
.json-cell { font-family: var(--mono); font-size: 12px; text-align: start; color: inherit; overflow-wrap: anywhere; cursor: pointer; display: block; max-width: 100%; }
.json-cell[aria-expanded="true"] { white-space: pre-wrap; } .json-cell:hover { color: var(--accent); }
@media (max-width: 639.98px) {
  /* a wide table keeps scrolling sideways, with a fade on the hidden edge (covers scroll with the content, shadows stay) */
  .tbl-scroll[data-hint] { background: linear-gradient(to right, var(--surface) 30%, transparent) 0 0 / 40px 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 18%, transparent), transparent) 0 0 / 16px 100% no-repeat scroll, radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 18%, transparent), transparent) 100% 0 / 16px 100% no-repeat scroll; }
  /* stacked rows: one card per row, label above each value (data-l), the first cell and .full across the width */
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl.stack tr:last-child { border-bottom: 0; } .tbl.stack tr.tap:hover td { background: transparent; } .tbl.stack tr.tap:hover { background: var(--surface-2); }
  .tbl.stack td { padding: 0; border: 0; min-width: 0; white-space: normal; text-align: start; }
  .tbl.stack td:first-child, .tbl.stack td.full { grid-column: 1 / -1; }
  .tbl.stack td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 1px; }
  .tbl.stack td.full .btn { width: 100%; } .tbl.stack td.full:empty, .tbl.stack td.chev-td { display: none; }
  .limits-tbl.stack td.full .col { align-items: stretch; }
}
@media (max-width: 899.98px) {   /* sheets on phones AND tablets (0.7.3): the submit row stays visible while a tall form scrolls */
  .sheet-b { padding-bottom: 0; } .sheet-b > :last-child { margin-bottom: 20px; } .sheet-b > form:last-child, .sheet-b > .new-task:last-child { margin-bottom: 0; }
  .sheet-b > form > .actions:last-child, .sheet-b > .actions:last-child, .sheet-b > .new-task > form > .actions:last-child { position: sticky; bottom: 0; margin: 6px -16px 0; padding: 10px 16px 14px; background: var(--elev); border-top: 1px solid var(--line); z-index: 2; }
}
@media (max-width: 639.98px) {   /* role walks 0.7.2: tab strips wrap instead of running off the edge; the first column of a scrolling table keeps its words together */
  .seg.rep-tabs, .seg.task-tabs, .filters .seg, .sec-tabs { flex-wrap: wrap; overflow: visible; } .sec-tabs .chip { flex: 0 1 auto; }
  .tbl-scroll[data-hint] .tbl td:first-child { min-width: 140px; }
}
@media (pointer: coarse) {   /* fingers: every control at least 40 px tall */
  .btn.sm { height: auto; min-height: 40px; } .seg button { height: auto; min-height: 40px; } .chip { height: 40px; line-height: 38px; }
  .iconbtn { width: 44px; height: 44px; } .top-actions .avatar { width: 40px; height: 40px; } .iconlink { width: 40px; } .mrow .seg button { min-height: 40px; }
}

/* ---- 0.7.3: tablets (iPad portrait 820 px) — the phone shell (top bar + bottom tabs) with two-column grids; the sidebar starts at 900 px ---- */
@media (max-width: 639.98px) { .hide-xs { display: none !important; } }   /* shown from 640 px: the read-only flag in the top bar */
@media (min-width: 640px) and (max-width: 899.98px) {
  .main { padding-inline: 20px; }
  .ph h1 { font-size: 28px; }
  .tabbar { padding-inline: calc((100% - 640px) / 2); }   /* the five tabs sit together in the middle instead of 164 px apart */
  .tbl-scroll[data-hint] .tbl td:first-child { min-width: 140px; }
}
@media (min-width: 640px) { .tile-links { margin-inline-start: auto; } }   /* a tile whose status pill is long: the links wrap to the right, not under the name */
@media (max-width: 999.98px) {
  .g2.g2-tables { grid-template-columns: minmax(0, 1fr); }   /* report tables need their width: one column until the sidebar layout */
  .ver-li { flex-wrap: wrap; } .ver-li > .grow { flex-basis: 100%; }   /* documentation versions: label line, buttons underneath */
}
.scope-li .t { white-space: normal; }   /* client scope rows on the user page: the client's name wraps instead of "SP Central …" */
.link-row input.ctl { flex: 1 1 160px; }
