/* Setters Desk: the sibling of OPS. Same colours, same cards, same buttons.
   Phone first (360 px wide): top bar + bottom tab bar. From 900 px: tabs move into the top bar and the
   lists sit in columns. Dark by default, light when the phone or the person asks for it.
   System fonts only; no images, no imports: the page's security policy allows nothing else. */

/* ------------------------------------------------------------------ colours */
:root {
  --bg: #0a1526; --glow: #12294d; --card: #10233f; --inset: #0b1a30; --line: #1e3a5f;
  --txt: #eef4f8; --mut: #8fa8c0; --acc: #00b4c8; --accdark: #008fa3; --acctxt: #2fcfe0; --onacc: #04222a;
  --navy: #102040; --bad: #ff6b6b; --warn: #ffb64f; --good: #2ec56f;
  --stale: #b3261e; --shadow: rgba(0, 0, 0, 0.45); --veil: rgba(4, 12, 24, 0.72); --focus: #7fe9f5;
  --h0: #7cc4ff; --h1: #b9a3ff; --h2: #4fd89a; --h3: #ff9ecb; --h4: #ffb64f; --h5: #5ee0e6; --h6: #ffa07a; --h7: #c8d36b;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef2f7; --glow: #dfeaf4; --card: #ffffff; --inset: #f4f8fb; --line: #d3deea;
  --txt: #132540; --mut: #4d6380; --acc: #0098ab; --accdark: #007a8a; --acctxt: #006c7a; --onacc: #04222a;
  --bad: #a8281c; --warn: #7d4b00; --good: #126336;
  --stale: #b3261e; --shadow: rgba(16, 32, 64, 0.2); --veil: rgba(16, 32, 64, 0.45); --focus: #005f6b;
  --h0: #1260a8; --h1: #5b3fc4; --h2: #177245; --h3: #b02a6b; --h4: #8a5300; --h5: #006f7a; --h6: #b0431a; --h7: #5f6b00;
  color-scheme: light;
}
/* before the script has run (or without it): follow the device */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #eef2f7; --glow: #dfeaf4; --card: #ffffff; --inset: #f4f8fb; --line: #d3deea;
    --txt: #132540; --mut: #4d6380; --acc: #0098ab; --accdark: #007a8a; --acctxt: #006c7a;
    --bad: #a8281c; --warn: #7d4b00; --good: #126336;
    --shadow: rgba(16, 32, 64, 0.2); --veil: rgba(16, 32, 64, 0.45); --focus: #005f6b;
    --h0: #1260a8; --h1: #5b3fc4; --h2: #177245; --h3: #b02a6b; --h4: #8a5300; --h5: #006f7a; --h6: #b0431a; --h7: #5f6b00;
    color-scheme: light;
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
@media (max-width: 699px) { html:has(.sheet-wrap) { overflow: hidden; } }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden; overscroll-behavior-y: contain;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--txt); background: var(--bg);
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.3; }
h4 { margin: 16px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--mut); }
strong { font-weight: 700; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ top bar (always navy, like OPS) */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 0 12px; padding-top: env(safe-area-inset-top, 0px);
  background: var(--navy); border-bottom: 2px solid var(--acc); color: #eef4f8;
}
.logo { display: block; width: auto; height: 24px; }
.brand { padding-left: 12px; border-left: 1px solid #2b4a75; font-size: 15px; font-weight: 600; white-space: nowrap; }
.top-gap { flex: 1; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--mut);
}
.top .icon-button { border-color: #2b4a75; color: #2fcfe0; width: 40px; min-width: 40px; height: 40px; min-height: 40px; position: relative; }
.top .icon-button::after, .avatar::after { content: ""; position: absolute; inset: -2px; }
.avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: #00b4c8; color: #04222a; font-size: 14px; font-weight: 700; letter-spacing: 0.3px;
}
.avatar.small { width: 36px; min-width: 36px; height: 36px; min-height: 36px; font-size: 13px; background: var(--inset); color: var(--acctxt); border: 1px solid var(--line); }
.avatar.small::after { content: none; }
.menu {
  position: absolute; top: calc(100% + 8px); right: 12px; z-index: 30; display: flex; flex-direction: column; gap: 4px;
  min-width: 232px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--txt);
  box-shadow: 0 14px 40px var(--shadow);
}
.menu-name { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.who { font-weight: 600; overflow-wrap: anywhere; }
.menu-role { font-size: 12px; color: var(--mut); text-transform: capitalize; white-space: nowrap; }
.menu-item { justify-content: flex-start; gap: 12px; width: 100%; border-color: transparent; background: transparent; color: var(--txt); font-weight: 500; }
.menu-item .ic { color: var(--mut); }
.menu-item:hover { background: var(--inset); }

/* ------------------------------------------------------------------ tabs: bottom bar on a phone */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 0 4px env(safe-area-inset-bottom, 0px); background: var(--navy); border-top: 1px solid #2b4a75;
}
.tab {
  position: relative; display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; min-height: 60px; padding: 6px 2px; border: 0; border-radius: 0; background: transparent;
  color: #9fb4cc; font-size: 11px; font-weight: 500; line-height: 1.2;
}
.tab .ic { width: 22px; height: 22px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.on { color: #2fcfe0; font-weight: 700; }
.tab.on::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: #00b4c8; }
.tab-count {
  position: absolute; top: 5px; left: calc(50% + 4px); min-width: 20px; padding: 1px 5px; border-radius: 10px;
  background: #00b4c8; color: #04222a; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; border: 2px solid var(--navy);
}

/* ------------------------------------------------------------------ page */
main.app { max-width: 1240px; margin: 0 auto; padding: 16px 12px calc(92px + env(safe-area-inset-bottom, 0px)); }
section { margin-bottom: 24px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin: 0 0 8px; }
.count { color: var(--mut); font-weight: 500; }
.asof { font-size: 12px; color: var(--mut); white-space: nowrap; }
.hint, .note, .foot, .sub { color: var(--mut); font-size: 13px; }
.hint { margin-bottom: 12px; }
.foot { margin-top: 32px; font-size: 12px; text-align: center; }
.suggest { margin-top: 8px; text-align: center; }
.link-button { min-height: 44px; padding: 0 12px; border-color: transparent; background: transparent; color: var(--acctxt); font-size: 13px; font-weight: 600; }
.link-button .ic { width: 15px; height: 15px; }
.error { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 1.5em; }
.stale {
  display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 16px; border-radius: 12px;
  background: var(--stale); color: #fff; font-weight: 700;
}
.stale::before {
  content: "!"; flex: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--stale);
  font-weight: 800; line-height: 24px; text-align: center;
}
.viewing {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 8px 8px 8px 16px;
  border-radius: 12px; background: var(--warn); color: #2b1a00; font-weight: 600;
}
:root[data-theme="light"] .viewing { background: #ffe2ad; }
.viewing button { background: #2b1a00; border-color: #2b1a00; color: #ffe9c4; }
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px 16px; border: 1px dashed var(--line); border-radius: 12px;
  color: var(--mut); text-align: center; grid-column: 1 / -1;
}
.empty .ic { width: 28px; height: 28px; color: var(--good); }

/* ------------------------------------------------------------------ buttons, links that look like buttons, forms */
button, .button, select, input, textarea { font: inherit; }
button, .button {
  display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--txt);
  font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button:hover, .button:hover { border-color: var(--acc); }
button.primary, .button.primary { border-color: var(--acc); background: var(--acc); color: var(--onacc); }
button.primary:hover, .button.primary:hover { filter: brightness(1.1); }
button.quiet { background: transparent; color: var(--mut); }
button.quiet.warn { color: var(--bad); }
button.danger { border-color: var(--bad); background: var(--bad); color: #2b0a0a; }
:root[data-theme="light"] button.danger { color: #fff; }
button.small, .button.small { padding: 0 12px; font-size: 13px; }
.button .ic, button.copy .ic { width: 15px; height: 15px; opacity: 0.8; }
button:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.actions.end { justify-content: flex-end; margin-top: 16px; }
.actions select { width: auto; flex: 1 1 150px; min-width: 0; max-width: 220px; font-weight: 600; color: var(--mut); }
.more { display: flex; width: 100%; margin-top: 12px; border-style: dashed; border-color: var(--acc); background: transparent; color: var(--acctxt); }
.name-button {
  justify-content: flex-start; min-height: 44px; padding: 0; border: 0; background: none; color: var(--txt); font-size: 15px; font-weight: 700; text-align: left;
  white-space: normal; text-decoration: underline; text-decoration-color: var(--acc); text-underline-offset: 3px;
}
select, input, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--inset); color: var(--txt); font-size: 16px;
}
select:focus, input:focus, textarea:focus { border-color: var(--acc); }
textarea { min-height: 132px; resize: vertical; line-height: 1.45; }
::placeholder { color: var(--mut); opacity: 0.8; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--mut); }
.field-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--mut); }
.counter { font-variant-numeric: tabular-nums; white-space: nowrap; }
.counter.good { color: var(--good); }
.peek-row { display: flex; gap: 8px; }
.peek-row input { flex: 1; min-width: 0; }
.peek { flex: none; min-width: 64px; padding: 0 12px; background: transparent; color: var(--acctxt); font-size: 13px; }

/* ------------------------------------------------------------------ sign-in screens (the card is navy in both themes, like OPS) */
main.auth {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 16px;
  background: radial-gradient(1200px 600px at 50% 0%, var(--glow) 0%, var(--bg) 60%);
}
.auth-tools { position: absolute; top: 12px; right: 12px; }
.auth-tools .icon-button { border-color: var(--line); color: var(--acctxt); }
.boot { display: flex; align-items: center; gap: 12px; color: var(--mut); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen {
  --card: #10233f; --inset: #0b1a30; --line: #1e3a5f; --txt: #eef4f8; --mut: #8fa8c0; --acc: #00b4c8; --acctxt: #2fcfe0; --bad: #ff6b6b; --focus: #7fe9f5;
  width: 100%; max-width: 380px; padding: 32px 28px 24px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--txt); box-shadow: 0 20px 60px var(--shadow); color-scheme: dark;
}
.screen-logo { display: block; width: 200px; height: auto; margin: 0 auto 20px; }
.screen h1 { margin-bottom: 4px; font-size: 20px; text-align: center; }
.screen .note { margin-bottom: 20px; text-align: center; }
.screen .primary { width: 100%; margin: 4px 0 8px; min-height: 48px; font-size: 15px; }
.screen .quiet { width: 100%; }
.screen .peek { width: auto; }
input.code { font-size: 26px; font-weight: 700; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
input.code::placeholder { opacity: 0.35; }

/* ------------------------------------------------------------------ tiles (the KPI tiles of OPS) */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; min-width: 0; min-height: 84px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--txt); text-align: left;
}
.tile-label { max-width: 100%; font-size: 11px; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; color: var(--mut); line-height: 1.3; }
.tile-value { font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-sub { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 400; color: var(--mut); line-height: 1.3; }
.tile-sub .ic { width: 14px; height: 14px; }
.tile.hot .tile-value, .tile.win .tile-value { color: var(--acctxt); }
.tile.lv-bad .tile-value { color: var(--bad); }
.tile.lv-warn .tile-value { color: var(--warn); }
.tile-link { cursor: pointer; white-space: normal; }
.tile-link .tile-sub { color: var(--acctxt); }
.tiles.compact .tile { min-height: 0; background: var(--inset); }
.tiles.compact .tile-value { font-size: 18px; }
.tiles.three .tile-value { font-size: 20px; }
.tiles.three .tile { min-height: 0; }

/* ------------------------------------------------------------------ chips, pills, badges */
.chips { display: flex; gap: 8px; margin: 0 -12px 16px; padding: 5px 12px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative; flex: none; min-height: 34px; padding: 0 12px; border-radius: 17px; background: transparent; color: var(--mut);
  font-size: 13px; font-weight: 500; white-space: nowrap; gap: 6px;
}
.chip::after { content: ""; position: absolute; inset: -5px 0; }
.chip-n { font-weight: 700; font-variant-numeric: tabular-nums; opacity: 0.85; }
.chip.on { border-color: var(--acc); background: var(--acc); color: var(--onacc); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc, var(--mut)); flex: none; }
.chip.on .dot { background: var(--onacc); }
.pill {
  display: inline-block; max-width: 100%; padding: 1px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--inset); color: var(--mut);
  font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; vertical-align: 1px;
}
.badge, .type-chip, .role-chip {
  position: relative; display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; color: var(--tc); isolation: isolate;
}
.badge::before, .type-chip::before, .role-chip::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border: 1px solid currentColor; border-radius: inherit; background: currentColor; opacity: 0.16;
}
.badge::after, .type-chip::after, .role-chip::after { content: ""; position: absolute; inset: 0; z-index: -1; border: 1px solid currentColor; border-radius: inherit; opacity: 0.55; }
.badge .ic { width: 13px; height: 13px; }
.badge.ok { --tc: var(--acctxt); }
.badge.warn { --tc: var(--warn); }
.badge.bad { --tc: var(--bad); }
.badge.good { --tc: var(--good); }
.badge.mut { --tc: var(--mut); }
.t0 { --tc: var(--h0); } .t1 { --tc: var(--h1); } .t2 { --tc: var(--h2); } .t3 { --tc: var(--h3); }
.t4 { --tc: var(--h4); } .t5 { --tc: var(--h5); } .t6 { --tc: var(--h6); } .t7 { --tc: var(--h7); }
.type-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; flex: 0 1 auto; }
.role-chip { text-transform: capitalize; }
.role-admin { --tc: var(--acctxt); } .role-supervisor { --tc: var(--h1); } .role-setter { --tc: var(--mut); }

/* ------------------------------------------------------------------ cards and rows */
.card, .row { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.card p, .row p { overflow-wrap: anywhere; }
.card.off { opacity: 0.6; }
.list { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.page-numbers .grid { align-items: start; }
.grid > .card { display: flex; flex-direction: column; }
.grid > .card > .actions { margin-top: auto; padding-top: 12px; }
.row { border-left: 4px solid var(--line); }
.row.lv-bad { border-left-color: var(--bad); }
.row.lv-warn { border-left-color: var(--warn); }
.row.lv-ok { border-left-color: var(--acc); }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.row-title, .title { min-width: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.row-meta { margin-top: 4px; font-size: 13px; color: var(--mut); line-height: 1.7; }
.row-meta .pill { margin-right: 8px; }
.when { color: var(--txt); font-weight: 600; }
.zone { font-size: 12px; }
.row-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.row-sub { font-size: 12px; color: var(--mut); }

.ticket { border-left: 4px solid var(--tc, var(--line)); }
.ticket-who { margin-top: 8px; line-height: 1.7; }
.assignee { font-size: 12px; color: var(--mut); white-space: nowrap; }
.ticket-text { margin-top: 4px; font-size: 15px; font-weight: 400; line-height: 1.5; }
.stamp { font-weight: 600; white-space: nowrap; }
.ticket-todo, .bonus-next { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; color: var(--acctxt); font-size: 13px; font-weight: 600; }
.ticket-todo { color: var(--mut); }
.ticket-todo .ic, .bonus-next .ic { width: 16px; height: 16px; margin-top: 2px; }
.ticket .hint { margin: 8px 0 0; }

.playbook .sub { margin-top: 2px; }
.actions.stack { flex-direction: column; align-items: stretch; }
.actions.stack > .button { width: 100%; }
.pair { display: flex; flex-wrap: wrap; gap: 8px; }
.pair > .button { flex: 1 1 auto; min-width: 0; }
.pair > button { flex: 0 1 auto; }
.gap { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--mut); font-size: 13px; flex: 1; }
.copy.done { border-color: var(--good); color: var(--good); }
.playbook .hint, .playbook .error { margin: 4px 0 0; min-height: 0; }

/* ------------------------------------------------------------------ clinic clocks (top of the Now tab) */
.clocks-wrap { margin-bottom: 12px; }
.clocks { display: flex; flex-wrap: wrap; gap: 6px; }
.clock { position: relative; min-height: 34px; padding: 0 10px; gap: 6px; border-radius: 17px; font-size: 13px; }
.clock::after { content: ""; position: absolute; inset: -5px 0; }
.clock.on { border-color: var(--acc); }
.clock-zone { color: var(--mut); font-size: 11px; font-weight: 600; letter-spacing: 0.4px; }
.clock-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-clinics { margin-top: 8px; font-size: 13px; color: var(--mut); }
.clock-clinics strong { color: var(--txt); }

/* ------------------------------------------------------------------ callbacks (Now tab) */
.cb-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.cb-tools .seg { flex: 0 1 150px; margin: 0; }
.cb-tools .sound { flex: 0 1 auto; }
.cb-tools .seg-button { min-height: 36px; }
.sound.on { border-color: var(--good); color: var(--good); }
.pill.for { display: inline-flex; align-items: center; gap: 4px; vertical-align: 0; }
.pill.for .ic { width: 12px; height: 12px; }
.time-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices .chip { min-height: 40px; padding: 0 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
input[type="checkbox"] { flex: none; width: 22px; min-width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--acc); }
.due-alert .due-item { margin: 12px 0 0; }
.due-alert .due-item .actions { margin-top: 8px; }
.head-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.cb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cb-bar .hint { margin: 0; }
.notice { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--warn); border-radius: 10px; background: var(--inset); color: var(--warn); font-size: 13px; font-weight: 600; }
.row.lv-good { border-left-color: var(--good); }
.grid > .row.cb { display: flex; flex-direction: column; align-items: stretch; }
.grid > .row.cb > .actions { margin-top: auto; padding-top: 12px; }
.cb-reason { margin-top: 8px; font-size: 14px; line-height: 1.45; }
.cb-note { margin-top: 4px; font-size: 13px; color: var(--mut); }
.cb-src { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
.cb .zone { white-space: nowrap; }
.cb-wa { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--mut); }
.cb-wa .ic { width: 14px; height: 14px; }
.cb-wa.sent { color: var(--good); font-weight: 600; }
.cb-wa.missed { color: var(--warn); font-weight: 600; }
.cb-done { background: var(--inset); }
.cb-done .row-title { color: var(--mut); }
.cb-done .cb-reason, .cb-done .when { color: var(--mut); font-weight: 400; }
.zone-note { color: var(--acctxt); white-space: nowrap; }
input[type="date"], input[type="time"] { min-width: 0; }
textarea.short { min-height: 92px; }
.sheet-about .sub { margin-top: 2px; }
.sheet .actions.end > button.first { margin-right: auto; }

/* ------------------------------------------------------------------ paid clients (Numbers tab) */
.paid-clients { margin-top: 24px; }
.paid-clients .panel-head { flex-wrap: wrap; }
.paid-clients .asof { margin-left: auto; }
.paid-clients .seg { max-width: 320px; margin-bottom: 12px; }
.paid-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.paid-why { grid-column: 1; margin-top: 6px; font-size: 13px; color: var(--mut); }
.paid-why strong { color: var(--txt); }
.row.paid .row-sub { line-height: 1.45; }
.paid-removed { margin-top: 12px; }
.paid-removed .hint { margin: 12px 0 8px; }
.paid-removed .more { margin-top: 0; }
input[type="search"] { -webkit-appearance: none; appearance: none; }

/* ------------------------------------------------------------------ numbers */
.seg { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; border: 1px solid var(--line); border-radius: 26px; background: var(--card); }
.seg-button { flex: 1 1 0; min-width: 0; padding: 0 8px; border: 0; border-radius: 22px; background: transparent; color: var(--mut); font-size: 13px; white-space: nowrap; }
.seg-button.on { background: var(--acc); color: var(--onacc); }
.numbers-mine > .row-top, .team-numbers > h3 { margin-bottom: 8px; }
.team-numbers { margin: 8px 0 16px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.card.bars { margin-bottom: 16px; }
.setter-numbers .bars { margin-top: 12px; }
.bars.rates { padding-top: 12px; border-top: 1px solid var(--line); }
.bars .hint { margin: 0; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 52px; align-items: center; gap: 8px; font-size: 13px; }
.bars.wide .bar-row { grid-template-columns: 72px minmax(0, 1fr) 96px; }
.bar-label { color: var(--mut); }
.bar-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bar { display: block; height: 10px; border-radius: 5px; background: var(--inset); border: 1px solid var(--line); overflow: hidden; }
.fill { display: block; height: 100%; border-radius: 5px; background: var(--accdark); }
.fill.win { background: var(--good); }
.fill.rate { background: var(--h1); }
.w-0 { width: 0; } .w-2 { width: 2%; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; } .w-25 { width: 25%; }
.w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; } .w-50 { width: 50%; } .w-55 { width: 55%; }
.w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; } .w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; }
.w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }
.pos-0 { left: 0; } .pos-2 { left: 2%; } .pos-5 { left: 5%; } .pos-10 { left: 10%; } .pos-15 { left: 15%; } .pos-20 { left: 20%; } .pos-25 { left: 25%; }
.pos-30 { left: 30%; } .pos-35 { left: 35%; } .pos-40 { left: 40%; } .pos-45 { left: 45%; } .pos-50 { left: 50%; } .pos-55 { left: 55%; }
.pos-60 { left: 60%; } .pos-65 { left: 65%; } .pos-70 { left: 70%; } .pos-75 { left: 75%; } .pos-80 { left: 80%; } .pos-85 { left: 85%; }
.pos-90 { left: 90%; } .pos-95 { left: 95%; } .pos-100 { left: 100%; }

.bonus { margin-bottom: 16px; border-color: var(--acc); }
.setter-numbers .bonus { margin: 12px 0 0; background: var(--inset); border-color: var(--line); }
.bonus-total { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.bonus-amount { font-size: 36px; line-height: 1.1; color: var(--acctxt); font-variant-numeric: tabular-nums; }
.bonus-word, .bonus-track { color: var(--mut); font-size: 13px; }
.bonus-track strong { color: var(--txt); }
.bonus-line { font-size: 13px; margin-top: 4px; }
.ladder-track { position: relative; height: 8px; margin: 12px 7px 10px; border-radius: 4px; background: var(--inset); border: 1px solid var(--line); }
.ladder-track .fill { position: absolute; left: 0; top: -1px; bottom: -1px; height: auto; background: var(--acc); }
.marker { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 3px solid var(--card); border-radius: 50%; background: var(--txt); box-shadow: 0 0 0 2px var(--acc); }
.setter-numbers .marker { border-color: var(--inset); }
.ladder-steps { display: flex; gap: 4px; }
.step { display: flex; flex: 1 1 0; flex-direction: column; min-width: 0; padding: 6px 4px; border: 1px solid var(--line); border-radius: 8px; text-align: center; color: var(--mut); }
.step-pct { font-size: 11px; line-height: 1.3; white-space: nowrap; }
.step.current .step-pct { font-weight: 700; }
.step-amt { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.step.reached { border-color: var(--accdark); color: var(--txt); }
.step.current { border-color: var(--acc); background: var(--acc); color: var(--onacc); }
.ladder-you { margin-top: 10px; font-size: 13px; color: var(--mut); }
.ladder-you strong { color: var(--txt); font-size: 15px; }
.parts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.part { display: flex; flex: 1 1 120px; flex-direction: column; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--mut); }
.part strong { font-size: 16px; color: var(--txt); font-variant-numeric: tabular-nums; }
.rules { margin-top: 12px; font-size: 12px; color: var(--mut); }
.period { margin-top: 16px; }

/* ------------------------------------------------------------------ team and users */
.setter-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.setter-top .title { flex: 1; font-weight: 400; }
.username { color: var(--mut); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: var(--inset); }
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 11px; color: var(--mut); line-height: 1.3; }
.stat strong { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.lv-bad strong { color: var(--bad); }
.stat.lv-warn strong { color: var(--warn); }
.type-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.setter .sub, .user .sub { margin-top: 8px; }
.audit-list { margin-top: 12px; }
.audit { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--mut); overflow-wrap: anywhere; }
.audit-when { font-variant-numeric: tabular-nums; }
.audit-who { color: var(--txt); font-weight: 600; }
.audit-what { color: var(--txt); }
.once { padding: 16px; border: 1px solid var(--warn); border-radius: 12px; background: var(--inset); }
.once .primary { width: 100%; margin-top: 12px; }
.password { margin: 8px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: 1px; user-select: all; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ sheet: from the bottom on a phone, a window from 700 px */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: var(--veil); animation: fade 0.15s ease-out; }
.sheet {
  width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--card); box-shadow: 0 -12px 40px var(--shadow);
  animation: rise 0.2s ease-out;
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 4px; border-radius: 2px; background: var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sheet-head .icon-button { margin-right: -8px; }
.sheet-about { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 16px; padding: 12px; border-radius: 10px; background: var(--inset); border-left: 4px solid var(--tc, var(--line)); }
.sheet-text { color: var(--txt); }
.sheet-text + .field { margin-top: 16px; }
.sheet .actions.end > button { flex: 1 1 0; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ toast, loading */
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 50; max-width: 440px; margin: 0 auto; padding: 12px 16px;
  border-radius: 12px; background: var(--acc); color: var(--onacc); font-weight: 600; text-align: center; box-shadow: 0 10px 30px var(--shadow);
}
.toast.bad { background: var(--stale); color: #fff; }
.skel { border-radius: 12px; background: var(--card); border: 1px solid var(--line); animation: pulse 1.2s ease-in-out infinite; }
.skel.tile { min-height: 84px; }
.skel.row { height: 96px; margin-bottom: 8px; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------------ wider screens */
@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.two, .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chips { flex-wrap: wrap; margin: 0 0 16px; padding: 0; overflow: visible; row-gap: 10px; }
  .numbers-mine { max-width: 720px; }
  .seg { max-width: 420px; }
  .sheet .actions.end > button { flex: 0 0 auto; min-width: 120px; }
}
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { width: min(540px, 100%); max-height: 88vh; padding: 16px 24px 24px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px var(--shadow); }
  .sheet::before { content: none; }
}
@media (min-width: 900px) {
  .top { gap: 16px; padding: 0 24px; }
  .tabs { position: static; flex: 1; justify-content: flex-start; gap: 6px; min-width: 0; padding: 0; border: 0; background: transparent; overflow-x: auto; scrollbar-width: none; }
  .tab { flex: none; flex-direction: row; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; color: #a9bdd4; }
  .tab .ic { display: none; }
  .tab:hover { border-color: #2b4a75; }
  .tab.on { border-color: #00b4c8; background: rgba(0, 180, 200, 0.14); color: #fff; font-weight: 600; }
  .tab.on::before { content: none; }
  .tab-count { position: static; min-width: 0; padding: 0 7px; border: 0; line-height: 18px; }
  .top-gap { display: none; }
  main.app { padding: 24px 24px 48px; }
  .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center; }
  .row-top, .row-meta, .row-sub { grid-column: 1; }
  .row-foot { display: contents; }
  .row-foot > span:empty { display: none; }
  .row-sub { margin-top: 4px; }
  .row-foot > .button { grid-column: 2; grid-row: 1 / span 3; }
  .toast { bottom: 24px; }
  .actions select { font-size: 14px; }
  .card, .row { padding: 14px 16px; }
  .tile { padding: 14px 16px; }
  .tile-value { font-size: 28px; }
}
@media (min-width: 900px) and (max-width: 1039px) {
  .top { gap: 12px; padding: 0 16px; }
  .tabs { gap: 2px; }
  .tab { padding: 0 9px; }
}
@media (min-width: 1100px) {
  .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 379px) {
  .step-pct { font-size: 10px; }
  .brand { font-size: 14px; padding-left: 8px; }
  .top { gap: 8px; }
  .tab { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-wrap, .skel, .spinner { animation: none; }
}
