/* Lines Health Check.
   Look: chimcare-group-design-system/GUIDELINES.md, sections 1 to 10. Every color, text size, corner, shadow and duration comes from
   tokens.css. Cards, rows and tables answer to their own width (container queries); under 760px a table becomes stacked rows. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
:root { --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); } /* a phone's notch and home bar */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; scroll-padding-top: calc(var(--head-h, var(--topbar-h)) + var(--space-2)); }
html.has-dialog { overflow: hidden; }
a, button, summary, label, input, select { touch-action: manipulation; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
h1, h2, h3, p, ul, ol, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
b { font-weight: 600; }
[hidden] { display: none !important; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: var(--space-2); top: -64px; z-index: 40; padding: var(--space-2) var(--space-3); border-radius: var(--radius-control); background: var(--color-ink); color: var(--color-ink-fg); }
.skip:focus { top: var(--space-2); }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic-s { width: 16px; height: 16px; }
.mark { width: 20px; height: 20px; }
.grow { flex: 1 1 0; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.stack-l { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.mut { color: var(--color-mut); }
.strong { font-weight: 600; }
.small { font-size: var(--text-caption); }
.tel, .nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.cap { font-size: var(--text-caption); color: var(--color-mut); overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--color-mut); overflow-wrap: anywhere; }
.hint { font-size: var(--text-caption); color: var(--color-mut); overflow-wrap: anywhere; }
.error-text { font-size: var(--text-caption); font-weight: 500; color: var(--color-act-strong); overflow-wrap: anywhere; }
.print-only { display: none; }
.noscript { padding: var(--space-6); }

/* ---------- Top bar ---------- */
.head { --edge: var(--space-6); position: sticky; top: 0; z-index: 20; }
.top, .simbar, .faultbar, .startbar, .runbar { padding-left: max(var(--edge), var(--safe-l)); padding-right: max(var(--edge), var(--safe-r)); }
.top { position: relative; z-index: 2; display: flex; align-items: center; gap: var(--space-3); height: calc(var(--topbar-h) + var(--safe-t)); padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--color-paper) 92%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--color-line); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; white-space: nowrap; flex: none; }
.brand-co { font-weight: 600; }
.brand-app { color: var(--color-mut); }
.tabs { display: flex; gap: 2px; margin-left: var(--space-2); flex: none; }
.tab { display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: var(--radius-control); color: var(--color-ink-2); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background var(--duration-small) var(--ease); }
.tab:hover { background: var(--color-band); color: var(--color-ink); }
.tab[aria-selected="true"] { background: var(--color-band); color: var(--color-ink); font-weight: 600; }
.updated { font-size: var(--text-caption); color: var(--color-mut); white-space: nowrap; flex: none; }
.updated.is-bad { color: var(--color-act-strong); font-weight: 500; }
.pill { flex: none; text-decoration: none; white-space: nowrap; min-height: 24px; line-height: 22px; }
.pill .dot { margin-top: 8px; }
.pill-short { display: none; }
.menu { display: none; position: relative; flex: none; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; top: 44px; left: 0; min-width: 220px; padding: var(--space-2); display: flex; flex-direction: column; gap: 2px;
  background: var(--color-paper); border: 1px solid var(--color-line); border-radius: var(--radius-panel); box-shadow: var(--shadow-raised); }
.menu-list a { display: flex; align-items: center; height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-segment); color: var(--color-ink-2); font-weight: 500; text-decoration: none; }
.menu-list a:hover { background: var(--color-band); }
.menu-list a[aria-current="page"] { background: var(--color-band); color: var(--color-ink); font-weight: 600; }
.menu-list .menu-out { position: relative; margin-top: 9px; }
.menu-list .menu-out::before { content: ""; position: absolute; left: 0; right: 0; top: -5px; border-top: 1px solid var(--color-line); }

.simbar { display: flex; align-items: flex-start; gap: var(--space-2); padding-top: var(--space-2); padding-bottom: var(--space-2); background: var(--color-watch-tint); color: var(--color-watch-strong); font-size: var(--text-caption);
  border-bottom: 1px solid color-mix(in srgb, var(--color-watch) 25%, transparent); }
.simbar .dot { margin-top: 6px; background: var(--color-dot-watch); }
.faultbar, .startbar { display: flex; align-items: flex-start; gap: var(--space-2); padding-top: var(--space-2); padding-bottom: var(--space-2); font-size: var(--text-caption); overflow-wrap: anywhere; }
.faultbar { background: var(--color-act-tint); color: var(--color-act-strong); border-bottom: 1px solid color-mix(in srgb, var(--color-act) 25%, transparent); }
.faultbar .dot { margin-top: 6px; background: var(--color-dot-act); }
.startbar { background: var(--color-band); color: var(--color-ink-2); border-bottom: 1px solid var(--color-line); }
.startbar .dot { margin-top: 6px; background: var(--color-dot-low); }

.runbar { position: relative; display: flex; align-items: center; gap: var(--space-3); padding-top: var(--space-2); padding-bottom: var(--space-2); background: var(--color-paper); border-bottom: 1px solid var(--color-line); }
.runbar-text { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.runbar-link { text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.runbar-link:hover b { text-decoration: underline; text-underline-offset: 3px; }
.runbar-now { color: var(--color-ink-2); }
.runbar-why { display: none; width: fit-content; text-decoration: underline; text-decoration-color: var(--color-rule); text-underline-offset: 3px; }
.runbar-acts { display: flex; gap: var(--space-2); flex: none; }
.runbar-progress { position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; border-radius: 0; }

@media (max-width: 1300px) {
  .brand-name { display: flex; flex-direction: column; line-height: 1.2; }
  .brand-co { font-size: var(--text-caption); font-weight: 500; color: var(--color-mut); }
  .brand-app { font-weight: 600; color: var(--color-ink); }
  .brand-dash { display: none; }
}
@media (max-width: 1100px) { .pill-mode { display: none; } }
@media (max-width: 1010px) { .upd-more { display: none; } }
@media (max-width: 880px) { .updated { display: none; } .head { --edge: var(--space-4); } }
@media (max-width: 760px) { .brand-name { display: none; } .tabs { margin-left: 0; } .tab { padding: 0 var(--space-2); } .top { gap: var(--space-2); } }
@media (max-width: 600px) {
  .tabs { display: none; }
  .menu { display: block; }
  .head { --edge: var(--space-3); }
  .brand-name { display: flex; }
  .brand-app { font-size: var(--text-caption); }
  .brand-co { font-size: var(--text-label); }
  .runbar-acts { gap: var(--space-3); }
  .runbar-acts .btn { width: 44px; height: 44px; padding: 0; }
  .runbar-acts .bt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 600px), (max-height: 480px) { .runbar.has-why .runbar-now { display: none; } .runbar.has-why .runbar-why { display: block; } }
@media (max-width: 420px) {
  .brand .mark { display: none; }
  .pill-long { display: none; }
  .pill-short { display: inline; }
}

/* ---------- Page ---------- */
.content, .foot { --edge: var(--space-6); padding-left: max(var(--edge), var(--safe-l)); padding-right: max(var(--edge), var(--safe-r)); }
.content { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding-top: var(--space-6); padding-bottom: var(--space-12); min-width: 0; }
.content:focus { outline: none; }
.view { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; container-type: inline-size; container-name: view; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); }
.page-title { min-width: 0; }
.title { font-size: var(--text-title); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; overflow-wrap: anywhere; }
.sub { margin-top: var(--space-1); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: var(--color-mut); font-size: var(--text-caption); }
.section { font-size: var(--text-section); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.sub-title { font-size: var(--text-body); font-weight: 600; }
.meta { margin-top: var(--space-1); color: var(--color-mut); font-size: var(--text-caption); overflow-wrap: anywhere; }
.label { font-size: var(--text-label); font-weight: var(--label-weight); color: var(--color-mut); text-transform: var(--label-transform); letter-spacing: var(--label-tracking); line-height: 1.3; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.back { display: inline-flex; align-items: center; gap: var(--space-1); align-self: flex-start; min-height: 24px; }
.foot-links { font-size: var(--text-caption); }
.foot { width: 100%; max-width: 1280px; margin: 0 auto; padding-top: var(--space-3); padding-bottom: calc(var(--space-6) + var(--safe-b)); display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: var(--text-caption); color: var(--color-mut); }
@media (max-width: 900px) { .content, .foot { --edge: var(--space-4); } .content { padding-top: var(--space-4); } }
@media (max-width: 600px) { .content, .foot { --edge: var(--space-3); } }

/* ---------- Buttons, links, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; max-width: 100%; padding: 0 var(--space-3); border: 1px solid var(--color-rule); border-radius: var(--radius-control);
  background: var(--color-paper); color: var(--color-ink); font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; flex: none;
  transition: transform var(--duration-press) var(--ease), background var(--duration-small) var(--ease); }
.btn:hover { background: var(--color-band); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--color-ink-2); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-danger { color: var(--color-act-strong); border-color: color-mix(in srgb, var(--color-act) 35%, transparent); }
.btn-danger:hover { background: var(--color-act-tint); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary:disabled:hover { background: var(--accent); }
.file-btn:focus-within { outline: 2px solid var(--color-ink); outline-offset: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; border: 1px solid var(--color-rule); border-radius: var(--radius-control); background: var(--color-paper); color: var(--color-ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--color-band); color: var(--color-ink); }
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { text-decoration: underline; text-decoration-color: var(--color-rule); text-underline-offset: 3px; cursor: pointer; }
.link:hover { text-decoration-color: var(--color-ink); }
.linkish { min-height: 24px; padding: 0; border: 0; background: none; text-align: left; font-size: var(--text-caption); color: var(--color-mut); white-space: nowrap; cursor: pointer; text-decoration: underline; text-decoration-color: var(--color-rule); text-underline-offset: 3px; }
.linkish:hover { color: var(--color-ink); text-decoration-color: var(--color-ink); }
.input { height: 34px; width: 100%; min-width: 0; padding: 0 var(--space-3); border: 1px solid var(--color-rule); border-radius: var(--radius-control); background: var(--color-paper); }
textarea.input { height: auto; padding: var(--space-2) var(--space-3); line-height: 1.4; resize: vertical; }
.input::placeholder { color: var(--color-mut); opacity: 1; }
.input:disabled { background: var(--color-wash); color: var(--color-mut); }
.input[aria-invalid="true"] { border-color: var(--color-act); }
input[type="search"] { -webkit-appearance: textfield; appearance: textfield; }
input[type="time"] { -webkit-appearance: none; appearance: none; }
input[type="time"]::-webkit-date-and-time-value { text-align: left; } /* an iPhone centers it */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.select-wrap { position: relative; display: inline-flex; min-width: 0; max-width: 100%; }
.select-wrap > .ic { position: absolute; right: var(--space-2); top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--color-mut); }
.select { width: 100%; max-width: 240px; min-width: 0; height: 34px; padding: 0 var(--space-8) 0 var(--space-3); border: 1px solid var(--color-rule); border-radius: var(--radius-control); background: var(--color-paper); -webkit-appearance: none; appearance: none; cursor: pointer; text-overflow: ellipsis; }
.nf .select-wrap, .nf .select { width: 100%; max-width: none; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 34px; cursor: pointer; }
.check input, .cell-check input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.cell-check { display: inline-grid; place-items: center; width: 28px; height: 28px; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 28px; cursor: pointer; white-space: nowrap; }
.switch input { -webkit-appearance: none; appearance: none; position: relative; width: 34px; height: 20px; margin: 0; flex: none; border-radius: 999px; background: var(--color-low); cursor: pointer; transition: background var(--duration-small) var(--ease); }
.switch input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-paper); transition: transform var(--duration-small) var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(14px); }
.switch input:disabled { opacity: 0.45; cursor: progress; }
.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field-label { font-size: var(--text-caption); font-weight: 500; color: var(--color-ink-2); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--space-3); align-items: start; }
.nf { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.nf-label { font-size: var(--text-caption); font-weight: 500; color: var(--color-ink-2); }
.nf-box { position: relative; display: block; }
.nf-box .input { padding-right: var(--space-8); }
.nf-unit { position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); font-size: var(--text-caption); color: var(--color-mut); pointer-events: none; }
.nf-help { font-size: var(--text-caption); color: var(--color-mut); }
.nf.is-bad .nf-help { color: var(--color-act-strong); font-weight: 500; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.seg { display: inline-flex; max-width: 100%; padding: 2px; border-radius: var(--radius-segment); background: var(--color-band); }
.seg button, .seg-opt span { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-control); background: transparent; color: var(--color-ink-2); white-space: nowrap; cursor: pointer; transition: background var(--duration-small) var(--ease); }
.seg button[aria-pressed="true"], .seg-opt input:checked + span { background: var(--color-paper); color: var(--color-ink); font-weight: 600; box-shadow: var(--shadow-selected); }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--color-ink); outline-offset: 2px; }
.seg-opt input:disabled { cursor: not-allowed; }
.seg-opt input:disabled + span { opacity: 0.45; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-1); min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--color-rule); border-radius: var(--radius-badge); background: var(--color-paper); color: var(--color-ink-2); white-space: nowrap; cursor: pointer; transition: transform var(--duration-press) var(--ease), background var(--duration-small) var(--ease); }
.chip:hover { background: var(--color-wash); }
.chip:active { transform: scale(0.97); }
.chip b { color: var(--color-ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--color-ink); }
@media (max-width: 600px) { .page-head .controls, .card-head .controls { width: 100%; } .filters .select-wrap, .filters .select { width: 100%; max-width: none; } .filters .search { max-width: none; flex-basis: 100%; } }
@media (max-width: 360px) { .btn { padding: 0 10px; } .seg button, .seg-opt span { padding: 0 var(--space-2); font-size: var(--text-caption); } }

/* ---------- Status: a dot and a word ---------- */
.dot { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.dot-good { background: var(--color-dot-good); }
.dot-watch { background: var(--color-dot-watch); }
.dot-act { background: var(--color-dot-act); }
.dot-low { background: var(--color-dot-low); }
.badges { display: flex; flex-wrap: wrap; gap: var(--space-1); min-width: 0; }
.badge { display: inline-flex; align-items: flex-start; gap: 6px; max-width: 100%; min-height: 20px; padding: 1px var(--space-2); border-radius: var(--radius-badge); font-size: var(--text-caption); font-weight: 500; line-height: 18px; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; margin-top: 6px; }
.badge-good { background: var(--color-good-tint); color: var(--color-good-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-good) 30%, transparent); }
.badge-watch { background: var(--color-watch-tint); color: var(--color-watch-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-watch) 30%, transparent); }
.badge-act { background: var(--color-act-tint); color: var(--color-act-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-act) 25%, transparent); }
.badge-low { background: var(--color-low-tint); color: var(--color-ink-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-low) 35%, transparent); }
.badge-note { background: transparent; color: var(--color-ink-2); box-shadow: inset 0 0 0 1px var(--color-rule); white-space: nowrap; }
.badge-good .dot { background: var(--color-dot-good); }
.badge-watch .dot { background: var(--color-dot-watch); }
.badge-act .dot { background: var(--color-dot-act); }
.badge-low .dot { background: var(--color-dot-low); }
.status { display: inline-flex; align-items: flex-start; gap: 6px; font-weight: 500; overflow-wrap: anywhere; }
.status .dot { margin-top: 0.45em; }
.status-good { color: var(--color-good-strong); }
.status-watch { color: var(--color-watch-strong); }
.status-act { color: var(--color-act-strong); }
.status-low { color: var(--color-ink-2); }
.status-good .dot { background: var(--color-dot-good); }
.status-watch .dot { background: var(--color-dot-watch); }
.status-act .dot { background: var(--color-dot-act); }
.status-low .dot { background: var(--color-dot-low); }
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 4px; border: 0; border-radius: 999px; overflow: hidden; background: var(--color-band); color: var(--color-ink); }
progress::-webkit-progress-bar { background: var(--color-band); }
progress::-webkit-progress-value { background: var(--color-ink); transition: width var(--duration-open) var(--ease); }
progress::-moz-progress-bar { background: var(--color-ink); }

/* ---------- Cards ---------- */
.card { min-width: 0; padding: var(--pad-card); border: var(--card-border); border-radius: var(--radius-panel); background: var(--color-paper); box-shadow: var(--card-shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); min-width: 0; }
.card-head > div:first-child { min-width: 0; }
.figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.figs-3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
@container view (min-width: 760px) { .figs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); } }
.fig { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); text-align: left; color: inherit; cursor: pointer; transition: transform var(--duration-press) var(--ease), border-color var(--duration-small) var(--ease), box-shadow var(--duration-small) var(--ease); }
.fig:hover { border-color: var(--color-rule); }
.fig:active { transform: scale(0.985); }
.fig[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--card-shadow); }
.fig-flat { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; padding: var(--space-3); border-radius: var(--radius-segment); background: var(--color-wash); }
.metric { font-size: var(--text-metric); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.basis { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) 6px; font-size: var(--text-caption); color: var(--color-mut); }
.fig .basis { flex-wrap: nowrap; align-items: flex-start; }
.fig .basis .dot { margin-top: 6px; }
.note { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); padding: var(--space-3); border-radius: var(--radius-segment); background: var(--color-wash); overflow-wrap: anywhere; }
.note-watch { background: var(--color-watch-tint); color: var(--color-watch-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-watch) 25%, transparent); }
.note-act { background: var(--color-act-tint); color: var(--color-act-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-act) 25%, transparent); }
.note-ink { background: var(--color-paper); box-shadow: inset 0 0 0 1px var(--color-ink); }
.note .btn { margin-top: var(--space-1); }
.plain { display: flex; flex-direction: column; gap: var(--space-1); }
.plain li { overflow-wrap: anywhere; }
ul.plain li::before, .problems li::before { content: "•"; margin-right: var(--space-2); color: inherit; }
.block { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.state { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.state p { max-width: 640px; color: var(--color-ink-2); }
.empty { padding: var(--space-6) var(--space-4); color: var(--color-mut); }
.fold > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 24px; list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary > .ic { color: var(--color-mut); transition: transform var(--duration-small) var(--ease); }
.fold[open] > summary > .ic { transform: rotate(180deg); }
.fold[open] > summary { margin-bottom: var(--space-3); }
.fold-plain { padding-top: var(--space-3); border-top: 1px solid var(--color-line); }
.fold-plain > summary { justify-content: flex-start; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.fold-plain > summary > .mut { flex: 1 1 0; min-width: 160px; font-size: var(--text-caption); }
.ok-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: var(--space-3) var(--space-4); }
.ok-list li { display: flex; flex-direction: column; min-width: 0; }
.ok-list .strong { font-weight: 500; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin-top: var(--space-3); }
.facts dt { color: var(--color-mut); }
.facts dd { overflow-wrap: anywhere; }
.fold .facts, .sect .facts { margin-top: 0; }
.problems { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-3); color: var(--color-act-strong); overflow-wrap: anywhere; }
.problems:empty { display: none; }
.accounts { display: flex; flex-direction: column; margin-top: var(--space-3); }
.accounts li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--color-line); }
.accounts li:first-child { border-top: 0; padding-top: 0; }
.accounts .cap, .accounts .full { flex-basis: 100%; }
.notes { margin-top: var(--space-3); font-size: var(--text-caption); color: var(--color-ink-2); }
.notes:empty { display: none; }
.cap-watch { color: var(--color-watch-strong); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); align-items: start; }
@container view (min-width: 900px) { .cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.run-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
#run-verdicts { margin-top: var(--space-3); }
#run-verdicts:empty { display: none; }
#run-note, #review-noretry { margin-top: var(--space-3); }

/* ---------- Adding lines ---------- */
.result-line { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-segment); background: var(--color-wash); overflow-wrap: anywhere; }
.result-line.is-bad { background: var(--color-act-tint); color: var(--color-act-strong); }
.import { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.drop { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px dashed var(--color-rule); border-radius: var(--radius-segment); }
.drop.is-over { border-color: var(--color-ink); background: var(--color-wash); }
.totals { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; }
.table-card.scroll-box { max-height: 420px; overflow: auto; border: 1px solid var(--color-line); border-radius: var(--radius-segment); }

/* ---------- Filters ---------- */
.toolbar { background: var(--color-paper); border-bottom: 1px solid var(--color-line); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--color-band); }
.filters .check { color: var(--color-ink-2); }
.search { position: relative; flex: 1 1 200px; min-width: 0; max-width: 320px; }
.search > .ic { position: absolute; left: var(--space-2); top: 50%; transform: translateY(-50%); color: var(--color-mut); pointer-events: none; }
.search .input { padding-left: var(--space-8); padding-right: var(--space-2); }
.count { margin-left: auto; font-size: var(--text-caption); color: var(--color-ink-2); white-space: nowrap; }
.selbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--color-paper); }
.selbar-n { font-size: var(--text-caption); color: var(--color-mut); }
.selbar-bulk { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.stack-only { display: none; }

/* ---------- Tables (stacked rows when their container is narrow) ---------- */
.table-card { padding: 0; overflow: clip; container-type: inline-size; container-name: tbl; }
.table-card > .card-head { padding: var(--space-4) var(--space-4) var(--space-3); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { padding: var(--space-2); border-bottom: 1px solid var(--color-line); background: var(--color-paper); text-align: left; vertical-align: middle; white-space: nowrap; font-size: var(--text-label); font-weight: var(--label-weight); color: var(--color-mut); text-transform: var(--label-transform); letter-spacing: var(--label-tracking); }
.card-head + div .tbl th { border-top: 1px solid var(--color-line); }
.tbl td { padding: var(--space-3) var(--space-2); border-top: 1px solid var(--color-line); vertical-align: top; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: var(--space-4); }
.tbl th:last-child, .tbl td:last-child { padding-right: var(--space-4); }
.tbl tr.is-link { cursor: pointer; }
.tbl tr.is-link:hover td, .tbl tr.is-on td { background: var(--color-wash); }
.tbl-mid td { vertical-align: middle; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.tbl .c-fit { width: 1%; white-space: nowrap; }
.tbl .c-text { min-width: 160px; }
.what { font-weight: 600; overflow-wrap: anywhere; }
.tbl .c-verify { width: 152px; }
.tbl .c-enabled { width: 168px; }
.line-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.line-btn { min-height: 24px; padding: 0; border: 0; background: none; text-align: left; font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none; }
.line-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.line-tel { display: inline-flex; align-items: center; min-height: 24px; font-weight: 500; white-space: nowrap; }
.line-label { overflow-wrap: anywhere; }
.line-sub { font-size: var(--text-caption); color: var(--color-mut); overflow-wrap: anywhere; }
.cell-stack { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); min-width: 0; }
.row-acts { display: inline-flex; gap: var(--space-1); }
.row-acts .ic { display: none; }
.sub-compact { display: none; }
.prog { display: flex; flex-direction: column; gap: 6px; min-width: 96px; }
.run-acts { display: flex; flex-wrap: nowrap; gap: var(--space-1); justify-content: flex-end; }

@container tbl (min-width: 760px) and (max-width: 1019.98px) {
  .tbl-numbers .c-brand, .tbl-numbers .c-metro, .tbl-numbers .c-verify { display: none; }
  .sub-compact { display: block; }
  .row-acts .ic { display: block; }
  .row-acts .btn { width: 34px; padding: 0; }
  .row-acts .bt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@container tbl (max-width: 759.98px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl td { display: block; }
  .tbl tbody tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-line); }
  .tbl tbody tr:first-child { border-top: 0; }
  .card-head + div .tbl tbody tr:first-child { border-top: 1px solid var(--color-line); }
  .tbl td, .tbl td:first-child, .tbl td:last-child { padding: 0; border: 0; }
  .tbl .c-fit, .tbl .c-text, .tbl .c-verify, .tbl .c-enabled { width: auto; min-width: 0; white-space: normal; }
  .tbl td { min-width: 0; }
  .tbl tr.is-link:hover, .tbl tr.is-on { background: var(--color-wash); }
  .tbl td.c-wide { grid-column: 1 / -1; }
  .tbl td:empty { display: none; }
  .tbl td[data-th]:not([data-th=""])::before { content: attr(data-th); display: block; margin-bottom: 2px; font-size: var(--text-label); font-weight: var(--label-weight); color: var(--color-mut); text-transform: var(--label-transform); letter-spacing: var(--label-tracking); line-height: 1.3; }
  .tbl td.c-check { position: absolute; top: var(--space-2); right: var(--space-3); }
  .tbl td.c-check + td { padding-right: var(--space-8); }
  .stack-only { display: inline-flex; }
  .run-acts { flex-wrap: wrap; justify-content: flex-start; }
  .toolbar { display: contents; }
  .selbar { border-bottom: 1px solid var(--color-line); }
  .has-sel .selbar { position: sticky; top: var(--head-h, var(--topbar-h)); z-index: 4; }
  .has-sel #test-all { display: none; }
}
@media (max-width: 600px) { .has-sel .selbar .grow { display: none; } .has-sel #test-selected { flex: 1 1 auto; } }
/* Long lists keep their filters and column headings pinned while the list scrolls. */
@media (min-height: 640px) {
  @container tbl (min-width: 760px) {
    .toolbar { position: sticky; top: var(--head-h, var(--topbar-h)); z-index: 4; }
    .tbl-pin th { position: sticky; top: calc(var(--head-h, var(--topbar-h)) + var(--toolbar-h, 0px)); z-index: 3; }
  }
}
.scroll-box .tbl th { position: sticky; top: 0; z-index: 2; }

/* ---------- Dialogs ---------- */
.dialog { --room: calc(100vw - 32px - var(--safe-l) - var(--safe-r)); width: min(520px, var(--room)); max-width: none; max-height: none; padding: 0; border: 0; border-radius: var(--radius-panel); overflow: hidden; background: var(--color-paper); color: var(--color-ink); box-shadow: var(--shadow-dialog); }
.dialog-lg { width: min(780px, var(--room)); }
.dialog-sm { width: min(420px, var(--room)); }
.dialog[open] { animation: lc-rise var(--duration-open) var(--ease); }
.dialog::backdrop, .drawer::backdrop { background: color-mix(in srgb, var(--color-ink) 35%, transparent); }
@keyframes lc-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes lc-slide { from { opacity: 0; transform: translateX(16px); } }
.dlg { display: flex; flex-direction: column; max-height: min(88vh, 860px); max-height: min(88dvh, 860px); margin: 0; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-3) var(--space-6); }
.dlg-head h2:focus, .ask-body h2:focus, .drawer-title h2:focus { outline: none; }
.dlg-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-1) var(--space-6) var(--space-6); overflow-y: auto; overscroll-behavior: contain; }
.dlg-body > * { flex: none; }
.ask-body { gap: var(--space-2); padding-top: var(--space-6); }
.dlg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-6); border-top: 1px solid var(--color-line); }
.dlg-status { flex: 1 1 200px; min-width: 0; font-size: var(--text-caption); color: var(--color-mut); overflow-wrap: anywhere; }
.dlg-status:empty { flex-basis: 0; }
.dlg-status.is-bad { color: var(--color-act-strong); font-weight: 500; }
.dest { max-height: 248px; overflow-y: auto; border: 1px solid var(--color-line); border-radius: var(--radius-segment); overscroll-behavior: contain; }
.dest li { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 2px var(--space-3); padding: var(--space-2) var(--space-3); border-top: 1px solid var(--color-line); }
.dest li:first-child { border-top: 0; }
.dest .tel { font-weight: 500; }
.dest .cap { grid-column: 2; }
.confirm-field { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.confirm-field .input { width: 64px; text-align: center; font-weight: 600; }
@media (max-width: 600px) {
  .dlg-head { padding-left: var(--space-4); }
  .dlg-body { padding-left: var(--space-4); padding-right: var(--space-4); }
  .dlg-foot { padding-left: var(--space-4); padding-right: var(--space-4); }
  .dialog-lg { inset: 0; width: 100%; height: 100vh; height: 100dvh; margin: 0; border-radius: 0; }
  .dialog-lg .dlg { height: 100%; max-height: none; }
  .dialog-lg .dlg-head { padding-top: calc(var(--space-4) + var(--safe-t)); }
  .dialog-lg .dlg-foot { padding-bottom: calc(var(--space-3) + var(--safe-b)); }
  .dest li { grid-template-columns: minmax(0, 1fr); }
  .dest .cap { grid-column: 1; }
  .block > .seg > .seg-opt { flex: 1 1 0; }
  .block > .seg > .seg-opt > span { width: 100%; }
}

/* ---------- Details panel ---------- */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(480px, 100%); height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: var(--color-paper); color: var(--color-ink); box-shadow: var(--shadow-dialog); }
.drawer[open] { animation: lc-slide var(--duration-open) var(--ease); }
.drawer-in { display: flex; flex-direction: column; height: 100%; }
.drawer-head, .drawer-body { padding: var(--space-4) max(var(--space-4), var(--safe-r)) var(--space-4) var(--space-4); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding-top: calc(var(--space-4) + var(--safe-t)); border-bottom: 1px solid var(--color-line); }
.drawer-title { min-width: 0; }
.drawer-acts { display: flex; gap: var(--space-1); flex: none; }
.drawer-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-6); padding-bottom: calc(var(--space-8) + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
.drawer-body > * { flex: none; }
.sect { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.three { display: flex; flex-direction: column; border: 1px solid var(--color-line); border-radius: var(--radius-segment); }
.three > div { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: var(--space-1) var(--space-3); padding: var(--space-2) var(--space-3); border-top: 1px solid var(--color-line); }
.three > div:first-child { border-top: 0; }
.three dt { color: var(--color-mut); }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-1) 0; }
.timeline time { color: var(--color-mut); white-space: nowrap; }
.timeline span { overflow-wrap: anywhere; }
.history li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--color-line); }
.history li:first-child { border-top: 0; }
.form-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.form-row .field { flex: 1 1 160px; }
@media (max-width: 600px) {
  .drawer { inset: auto 0 0 0; width: 100%; height: auto; max-height: 90vh; max-height: 90dvh; border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
  .drawer[open] { animation-name: lc-rise; }
  .drawer-in { height: auto; max-height: 90vh; max-height: 90dvh; }
  .drawer-head, .drawer-body { padding-left: var(--space-3); padding-right: var(--space-3); }
  .drawer-head { padding-top: var(--space-4); }
  .three > div { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- The phone's keyboard is open: what is typed in stays in the part that can be seen (app.js, followKeyboard) ---------- */
.has-keyboard .dialog { inset: calc(var(--vv-top, 0px) + var(--space-2)) 0 auto; margin: 0 auto; }
.has-keyboard .dialog .dlg { max-height: calc(var(--vv-h, 100dvh) - var(--space-4)); }
.has-keyboard .drawer { inset-block: var(--vv-top, 0px) auto; height: var(--vv-h, 100dvh); }
.has-keyboard .toast { bottom: calc(100% - var(--vv-top, 0px) - var(--vv-h, 100%) + var(--space-2)); }
@media (max-width: 600px) {
  .has-keyboard .dialog-lg, .has-keyboard .drawer { inset: var(--vv-top, 0px) 0 auto; height: var(--vv-h, 100dvh); max-height: none; border-radius: 0; }
  .has-keyboard .dialog-lg .dlg, .has-keyboard .drawer-in { height: 100%; max-height: none; }
  .has-keyboard .dialog-lg .dlg-foot { padding-bottom: var(--space-3); }
}
@media (max-height: 480px) { .has-keyboard .dialog .dlg-head, .has-keyboard .drawer-head { display: none; } }

/* ---------- Fingers: phones, and every screen that is touched ---------- */
@media (max-width: 600px), (pointer: coarse) {
  .btn, .icon-btn, .input, .select, .chip, .seg button, .seg-opt span, .tab { height: 40px; }
  textarea.input { height: auto; }
  .input, .select { font-size: 16px; } /* smaller, and an iPhone zooms into the page */
  .icon-btn, .row-acts .btn { min-width: 40px; }
  .menu-list { top: 48px; }
  .menu-list a { height: 44px; }
  .check, .switch, .fold > summary, .brand { min-height: 40px; }
  .back, .card-head .link, .foot-links .link, .foot .link { min-height: 40px; display: inline-flex; align-items: center; }
  .faultbar .link { min-height: 40px; display: flex; align-items: center; width: fit-content; }
  .linkish { min-height: 32px; }
  .check input, .cell-check input { width: 20px; height: 20px; }
  .cell-check { width: 40px; height: 40px; }
  .pill, .linkish, .simbar .link { position: relative; }
  .pill::after { content: ""; position: absolute; inset: -8px -4px; } /* small to see, big to touch */
  .linkish::after, .simbar .link::after { content: ""; position: absolute; inset: -4px 0; }
  .simbar .link::after { inset: -12px 0; }
  @container tbl (max-width: 759.98px) {
    .tbl td.c-check { top: var(--space-1); right: var(--space-1); }
    .tbl td.c-check + td { padding-right: 44px; }
  }
}
/* A phone lying on its side has little height: the pinned parts get smaller, and nothing else is pinned. */
@media (max-height: 480px) {
  :root { --topbar-h: 48px; }
  .runbar { padding-top: var(--space-1); padding-bottom: var(--space-1); }
  .simbar-more { display: none; }
  .has-sel .selbar { position: static; }
  .menu-list { max-height: calc(100dvh - 56px); overflow-y: auto; }
}

/* ---------- Not opened from the start file: one message, nothing else ---------- */
.locked { flex: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); padding: var(--space-6); text-align: center; }
.is-locked > :not(.locked):not(.sprite) { display: none !important; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--space-4) + var(--safe-b)); z-index: 60; width: max-content; max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: var(--radius-segment); background: var(--color-ink); color: var(--color-ink-fg); box-shadow: var(--shadow-raised); overflow-wrap: anywhere;
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity var(--duration-open) var(--ease), transform var(--duration-open) var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 600px) { dialog > .toast, .has-keyboard dialog > .toast { top: calc(var(--vv-top, 0px) + var(--safe-t) + var(--space-4)); bottom: auto; } } /* the buttons of a dialog are at the bottom, under the thumb */

/* ---------- Print: the report on paper ---------- */
@page { size: landscape; margin: 12mm; }
@media print {
  .head, .foot, .no-print, .toast, .skip, dialog { display: none !important; }
  .print-only { display: block; }
  .print-head { display: flex; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--color-rule); }
  body { background: var(--color-paper); }
  .content { max-width: none; padding: 0; }
  .card { box-shadow: none; }
  .fig, .badge, .dot, .fig-flat, .note { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tbl tr, .ok-list li, .fig { break-inside: avoid; }
  .tbl-pin th, .toolbar { position: static; }
  .table-card { overflow: visible; }
  .fold > summary > .ic { display: none; }
}
@media (prefers-reduced-motion: reduce) { .btn:active, .chip:active, .fig:active { transform: none; } }

/* ---------- The web app: signing out is in the menu on phones, in the footer elsewhere ---------- */
body:not(.is-web) .only-web, body:not(.is-web):not(.is-readonly) .only-live { display: none; }
@media (max-width: 600px) { .is-web .foot .only-live { display: none; } }

/* ---------- The live page: results only. Tests are started on the Mac ---------- */
.is-readonly [data-tab="settings"], .is-readonly #pill, .is-readonly #groups-card, .is-readonly #add-card, .is-readonly .selbar, .is-readonly #runs-choose,
.is-readonly #report-retest, .is-readonly #results-retest, .is-readonly .row-acts, .is-readonly .runbar-acts, .is-readonly [data-fk="panel:again"],
.is-readonly .cell-check, .is-readonly .switch input { display: none !important; }
.is-readonly .switch { pointer-events: none; }
.is-readonly .tbl-numbers th:first-child, .is-readonly .tbl-numbers td:first-child, .is-readonly .tbl-numbers th:last-child, .is-readonly .tbl-numbers td:last-child { display: none; }
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-4); }
.login-box { width: min(360px, 100%); padding: var(--space-6); }
.login-box form { display: grid; gap: var(--space-4); margin-top: var(--space-6); }
.login-box .input { width: 100%; height: 44px; font-size: 16px; }
.login-box .btn { height: 44px; }
.login-err { color: var(--color-act-strong); font-weight: 500; }
