@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap");

/* ============================================================
   F1rstmed demo — design tokens
   Clinical, calm, high-contrast. Every pair below is >= 4.5:1.
   ============================================================ */
:root {
  --ink:        #0B1B26;
  --ink-2:      #16303F;
  --ink-3:      #2C4C5E;
  --muted:      #5B7688;
  --line:       #D5E1E6;
  --line-soft:  #E8EFF1;
  --paper:      #F4F7F8;
  --card:       #FFFFFF;

  --accent:      #00A69E;
  --accent-deep: #00706A;
  --accent-tint: #E0F4F2;

  --ok:       #0B7A4B;
  --ok-tint:  #E4F3EA;
  --warn:     #8A5A00;
  --warn-tint:#FCF2DF;
  --bad:      #A8231B;
  --bad-tint: #FBEBE9;

  --font-display: "Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-ui:      "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;

  --shadow-1: 0 1px 2px rgba(11, 27, 38, .05), 0 1px 1px rgba(11, 27, 38, .04);
  --shadow-2: 0 10px 30px -14px rgba(11, 27, 38, .28), 0 2px 6px rgba(11, 27, 38, .05);
  --shadow-3: 0 34px 70px -28px rgba(11, 27, 38, .48);

  --wrap: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* faint clinical grid */
  background-image:
    linear-gradient(rgba(11, 27, 38, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 27, 38, .028) 1px, transparent 1px);
  background-size: 34px 34px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -.02em;
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; }
a { color: var(--accent-deep); }

button, input, select, textarea { font: inherit; color: inherit; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2.5px solid var(--accent-deep);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--ink);
  color: #EAF2F4;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar__inner {
  max-width: var(--wrap); margin: 0 auto;
  padding: 11px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand__logo {
  height: 30px; width: auto; flex: none;
  background: #fff; border-radius: 7px; padding: 4px 8px;
}
.brand__name {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  letter-spacing: -.02em; color: #fff;
}

.demo-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: #A8E6E1;
  background: rgba(0, 198, 186, .12);
  border: 1px solid rgba(0, 198, 186, .34);
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
.demo-badge__dot {
  width: 7px; height: 7px; border-radius: 50%; background: #00C2BA; flex: none;
  box-shadow: 0 0 0 3px rgba(0, 194, 186, .2);
}

.usermenu { display: flex; align-items: center; gap: 12px; }
.usermenu__who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.usermenu__name { font-size: 13px; font-weight: 600; color: #fff; }
.usermenu__role { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #9FB6C2; }
.usermenu__out { color: #fff; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); }
.usermenu__out:hover { background: rgba(255,255,255,.16); }
@media (max-width: 560px) { .usermenu__who { align-items: flex-start; } }

.role-switch { display: flex; align-items: center; gap: 9px; }
.role-switch > label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: #9FB6C2; white-space: nowrap;
}
.select { position: relative; display: inline-flex; }
.select select {
  appearance: none; -webkit-appearance: none;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff; font-size: 14px; font-weight: 500;
  padding: 7px 32px 7px 12px; border-radius: var(--r-sm); cursor: pointer;
}
.select select:hover { background: rgba(255, 255, 255, .12); }
.select select option { background: var(--ink); color: #fff; }
.select__chev {
  position: absolute; right: 11px; top: 50%; width: 11px; height: 8px;
  transform: translateY(-50%); color: #A8C0CC; pointer-events: none;
}

/* ---------------- hero strip ---------------- */
.herostrip {
  max-width: var(--wrap); margin: 0 auto;
  padding: 26px 20px 22px;
  font-size: clamp(15px, 1.5vw, 17.5px); color: var(--ink-2); line-height: 1.5;
}
.herostrip strong { color: var(--ink); font-weight: 600; }

/* ---------------- tabs ---------------- */
.tabs {
  position: sticky; top: 53px; z-index: 30;
  background: rgba(244, 247, 248, .93);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tabs__inner {
  max-width: var(--wrap); margin: 0 auto; padding: 0 20px;
  display: flex; gap: 4px; overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: var(--font-display); font-size: 14.5px; font-weight: 600;
  letter-spacing: -.01em; color: var(--muted);
  padding: 14px 14px 12px; white-space: nowrap;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab__key {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent-deep);
  margin-right: 7px;
}

/* ---------------- layout ---------------- */
.main { max-width: var(--wrap); margin: 0 auto; padding: 30px 20px 64px; }
.panel:focus { outline: none; }
.panel__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 24px;
}
.panel__title { font-size: clamp(24px, 3vw, 31px); }
.panel__sub { color: var(--muted); margin-top: 7px; max-width: 62ch; font-size: 15px; }
.panel__stamp {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); background: var(--card);
  padding: 7px 12px; border-radius: var(--r-sm);
}

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px;
}
.card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.card__title { font-size: 16.5px; font-weight: 600; }
.card__hint { font-size: 12.5px; color: var(--muted); }

.section-gap { margin-top: 18px; }

/* ---------------- stat tiles ---------------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 16px 17px 15px; box-shadow: var(--shadow-1);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent); opacity: .85;
}
.stat--ok::after   { background: var(--ok); }
.stat--warn::after { background: var(--warn); }
.stat--bad::after  { background: var(--bad); }
.stat__label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.stat__value {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(28px, 3.4vw, 38px); letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.05; margin-top: 8px;
}
.stat__delta { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.stat__delta b { font-weight: 600; }
.stat__delta--up b { color: var(--ok); }
.stat__delta--down b { color: var(--bad); }
.stat.is-live { animation: pulse 1.1s ease; }
@keyframes pulse {
  0%   { box-shadow: var(--shadow-1), 0 0 0 0 rgba(0, 166, 158, .5); }
  100% { box-shadow: var(--shadow-1), 0 0 0 14px rgba(0, 166, 158, 0); }
}

/* ---------------- charts (pure CSS) ---------------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 62px 1fr 46px; align-items: center; gap: 12px; }
.bar-row__label { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track {
  height: 22px; background: var(--line-soft); border-radius: 5px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  width: 0; transition: width .7s cubic-bezier(.22, 1, .36, 1);
}
.bar-row__value {
  font-family: var(--font-mono); font-size: 12px; text-align: right;
  color: var(--ink-2); font-variant-numeric: tabular-nums;
}

.stackbar {
  display: flex; height: 30px; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--line-soft); background: var(--line-soft);
}
.stackbar span {
  width: 0; transition: width .7s cubic-bezier(.22, 1, .36, 1);
  display: block;
}
.stackbar span[data-k="PENDING"]     { background: #A7BAC5; }
.stackbar span[data-k="INPROGRESS"] { background: #00A69E; }
.stackbar span[data-k="PENDINGCERT"]{ background: #E0A33C; }
.stackbar span[data-k="FIT"]        { background: #2E9E68; }
.stackbar span[data-k="UNFIT"]      { background: #C4614F; }
.stackbar span[data-k="APPEAL"]     { background: #7C6BC4; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; }
.legend__item {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2);
}
.legend__swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend__count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ---------------- worker header ---------------- */
.workerbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--ink); color: #E7F0F2;
  border-radius: var(--r-lg); padding: 16px 20px; box-shadow: var(--shadow-2);
}
.workerbar__id { font-family: var(--font-mono); font-size: 12px; color: #8FAFBE; }
.workerbar__name {
  font-family: var(--font-display); font-size: 22px; font-weight: 600; color: #fff;
  letter-spacing: -.02em;
}
.workerbar__meta { display: flex; gap: 8px 22px; flex-wrap: wrap; margin-left: auto; }
.workerbar__meta div { font-size: 12.5px; color: #A9C2CE; }
.workerbar__meta b { display: block; color: #fff; font-weight: 600; font-size: 13.5px; }

/* ---------------- badges & pills ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; flex: none; }
.badge--ok    { color: var(--ok);   background: var(--ok-tint);   border-color: #BFE3CE; }
.badge--bad   { color: var(--bad);  background: var(--bad-tint);  border-color: #F1CBC6; }
.badge--warn  { color: var(--warn); background: var(--warn-tint); border-color: #EDD5A8; }
.badge--info  { color: var(--accent-deep); background: var(--accent-tint); border-color: #B9E5E1; }
.badge--mute  { color: var(--ink-3); background: #EEF2F4; border-color: var(--line); }

.mono { font-family: var(--font-mono); font-size: 12.5px; }
.num  { font-variant-numeric: tabular-nums; }

/* ---------------- progress pips ---------------- */
.pips { display: flex; gap: 5px; flex-wrap: wrap; }
.pip {
  width: 26px; height: 6px; border-radius: 3px; background: var(--line); display: block;
}
.pip.is-done { background: var(--accent); }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.input {
  appearance: none; -webkit-appearance: none;
  width: 100%; background: #FBFDFD;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 15px; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:hover { border-color: #B8CBD3; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 166, 158, .16); outline: none; }
.input--unit { padding-right: 40px; }
.unitwrap { position: relative; }
.unitwrap__unit {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--muted); pointer-events: none; font-weight: 500;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.5; }
.input-row { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }

.reading {
  display: flex; align-items: baseline; gap: 8px;
  font-variant-numeric: tabular-nums;
}
.reading__val { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -.03em; }

/* ---------------- finding chips ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px 8px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #FBFDFD;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: border-color .14s ease, background .14s ease, color .14s ease;
  user-select: none;
}
.chip:hover { border-color: #A9C4CE; background: #fff; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip__tick {
  width: 16px; height: 16px; border-radius: 4px; flex: none;
  border: 1.5px solid #B7C9D1; background: #fff;
  display: grid; place-items: center; transition: all .14s ease;
}
.chip__tick svg { width: 10px; height: 10px; opacity: 0; color: #fff; }
.chip input:checked ~ .chip__tick { background: var(--accent); border-color: var(--accent); }
.chip input:checked ~ .chip__tick svg { opacity: 1; }
.chip:has(input:checked) {
  border-color: var(--accent); background: var(--accent-tint); color: var(--accent-deep); font-weight: 600;
}
.chip input:focus-visible ~ .chip__tick { outline: 2.5px solid var(--accent-deep); outline-offset: 2px; }
.chip--fail:has(input:checked) {
  border-color: #E3A9A2; background: var(--bad-tint); color: var(--bad);
}
.chip--fail input:checked ~ .chip__tick { background: var(--bad); border-color: var(--bad); }
.chip--fail:has(input:checked) .chip__tick svg { opacity: 1; }

.chip-legend {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px;
  font-size: 12.5px; color: var(--muted);
}
.chip-legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatchbox { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid var(--accent); background: var(--accent-tint); }
.swatchbox--fail { border-color: var(--bad); background: var(--bad-tint); }

/* ---------------- verdict banner ---------------- */
.verdict {
  display: flex; align-items: center; gap: 16px;
  border-radius: var(--r); padding: 16px 18px;
  border: 1px solid; flex-wrap: wrap;
}
.verdict__icon {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
}
.verdict__icon svg { width: 22px; height: 22px; }
.verdict__text { min-width: 0; }
.verdict__title { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.verdict__sub { font-size: 13.5px; margin-top: 3px; }
.verdict--ok  { background: var(--ok-tint);  border-color: #BFE3CE; color: #085C39; }
.verdict--bad { background: var(--bad-tint); border-color: #F1CBC6; color: #7E1A14; }
.verdict--warn{ background: var(--warn-tint);border-color: #EDD5A8; color: #6B4700; }

/* ---------------- buttons ---------------- */
.btn {
  appearance: none; cursor: pointer; border-radius: var(--r-sm);
  font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
  padding: 11px 18px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; gap: 9px;
  transition: transform .1s ease, background .14s ease, border-color .14s ease;
}
.btn:hover { background: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #04302E; }
.btn--accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: #F1F6F7; border-color: #B8CBD3; }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger:hover { background: #8C1D16; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.segmented button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 9px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-right: 1px solid var(--line);
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.segmented button:hover:not([aria-pressed="true"]) { background: #F1F6F7; color: var(--ink); }

.icon-btn {
  appearance: none; cursor: pointer; background: none; border: 1px solid var(--line);
  width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--muted);
}
.icon-btn svg { width: 13px; height: 13px; }
.icon-btn:hover { background: #F1F6F7; color: var(--ink); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl caption { text-align: left; font-size: 12.5px; color: var(--muted); padding-bottom: 10px; }
table.tbl th {
  text-align: left; font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding: 0 14px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr.is-click { cursor: pointer; }
table.tbl tbody tr.is-click:hover { background: #F7FBFB; }
.t-right { text-align: right; padding-right: 0 !important; }

.gauge { display: flex; align-items: center; gap: 10px; min-width: 148px; }
.gauge__track {
  flex: 1; height: 7px; background: var(--line-soft); border-radius: 4px; overflow: hidden;
}
.gauge__fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.gauge__fill--ok   { background: var(--ok); }
.gauge__fill--warn { background: var(--warn); }
.gauge__fill--bad  { background: var(--bad); }
.gauge__text { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.scroll-hint {
  display: none; font-size: 12px; color: var(--muted); margin-top: 10px; align-items: center; gap: 6px;
}
.scroll-hint svg { width: 13px; height: 13px; }

/* ---------------- centre detail ---------------- */
.centre-detail {
  border: 1px solid var(--accent); background: #F5FBFB;
  border-radius: var(--r); padding: 18px; margin-top: 4px;
}
.centre-detail__grid { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
.kv { display: grid; gap: 3px; }
.kv__k { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kv__v { font-size: 14.5px; font-weight: 600; }

/* ---------------- section result cards ---------------- */
.secgrid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sec {
  border: 1px solid var(--line-soft); border-radius: var(--r); padding: 15px 16px;
  background: #FDFEFE; border-left-width: 4px; border-left-style: solid;
}
.sec--pass { border-left-color: var(--ok); }
.sec--fail { border-left-color: var(--bad); background: #FFFBFA; }
.sec--todo { border-left-color: var(--line); background: #FAFCFC; }
.sec__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec__name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; }
.sec__by { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sec__sum { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }

.minitable { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.minitable th, .minitable td { padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.minitable th { font-weight: 500; color: var(--muted); font-size: 12px; }
.minitable td { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
.minitable tr:last-child td { border-bottom: 0; }

/* ---------------- certificate ---------------- */
.cert {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px 24px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-2);
}
.cert::before {
  content: ""; position: absolute; inset: 7px; border: 1px solid var(--line-soft);
  border-radius: 6px; pointer-events: none;
}
.cert__watermark {
  position: absolute; right: -18px; bottom: -14px;
  font-family: var(--font-display); font-weight: 700; font-size: 74px;
  letter-spacing: -.05em; color: var(--line-soft); pointer-events: none; line-height: 1;
}

/* --- masthead: issuer on the left, certificate number on the right --- */
.cert__top {
  position: relative; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--ink);
}
.cert__org { display: flex; align-items: center; gap: 11px; }
.cert__org .brand__logo { height: 26px; background: none; padding: 0; }
.cert__orgtext { display: flex; flex-direction: column; line-height: 1.3; }
.cert__orgtext b { font-family: var(--font-display); font-size: 14px; color: var(--ink); }
.cert__orgtext span { font-size: 11px; color: var(--muted); }
.cert__refbox { text-align: right; line-height: 1.35; }
.cert__refbox span { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cert__refbox b { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }

.cert__title {
  text-align: center; font-family: var(--font-display); font-size: 15px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
  margin: 16px 0 18px;
}

/* --- details grid --- */
.cert__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden;
}
.cert__cell { background: #fff; padding: 9px 12px; }
.cert__cell span { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.cert__cell b { font-size: 13.5px; color: var(--ink); font-weight: 600; }

/* --- verdict band --- */
.cert__band {
  position: relative; margin: 16px 0; padding: 14px 16px; border-radius: 10px;
  border: 1.5px solid; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.cert__bandlabel { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.cert__verdictbig { font-family: var(--font-display); font-size: 25px; font-weight: 700; letter-spacing: .05em; margin-top: 2px; }
.cert__bandnote { font-size: 12.5px; margin-top: 4px; opacity: .85; }
.cert__band--ok   { color: var(--ok);   background: var(--ok-tint);   border-color: color-mix(in srgb, var(--ok) 35%, #fff); }
.cert__band--bad  { color: var(--bad);  background: var(--bad-tint);  border-color: color-mix(in srgb, var(--bad) 35%, #fff); }
.cert__band--wait { color: var(--warn); background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 35%, #fff); }

/* --- footer: dates · QR · signature --- */
.cert__foot {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.cert__footcol { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); line-height: 1.5; }
.cert__footcol b { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.cert__footcol span { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.cert__footgap { margin-top: 6px; }
.cert__footcol--sig { text-align: right; align-items: flex-end; }
.cert__sig { font-family: "Segoe Script", "Bradley Hand", cursive; font-size: 22px; color: var(--ink); text-transform: none !important; letter-spacing: 0; margin: 2px 0; }

/* --- QR verify block --- */
.cert__verify { display: flex; align-items: center; gap: 10px; }
.cert__qr { width: 78px; height: 78px; flex: none; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.cert__qr svg { display: block; width: 100%; height: 100%; }
.cert__qrfail { width: 100%; height: 100%; display: grid; place-items: center; font: 700 11px var(--font-mono); color: var(--muted); }
.cert__verifytext { display: flex; flex-direction: column; line-height: 1.4; }
.cert__verifytext b { font-size: 11.5px; color: var(--ink); }
.cert__verifytext span { font-size: 10px; color: var(--muted); }
.cert__verifyref { font-family: var(--font-mono) !important; color: var(--ink-3) !important; }

/* --- legacy centred layout (TB clearance cert header/body still use these) --- */
.cert__head { display: flex; align-items: center; gap: 10px; justify-content: center; }
.cert__head .brand__logo { height: 20px; background: none; padding: 0; }
.cert__body { font-size: 14px; color: var(--ink-2); text-align: center; line-height: 1.75; }
.cert__body b { color: var(--ink); }
.cert__body .cert__title { border-bottom: 1px solid var(--line-soft); padding-bottom: 14px; margin: 12px 0 18px; }
.cert__verdict {
  display: inline-block; margin: 14px auto 4px; font-family: var(--font-display);
  font-size: 24px; font-weight: 700; letter-spacing: .06em;
}
.cert__verdict--ok { color: var(--ok); }
.cert__verdict--bad { color: var(--bad); }

/* ---------------- cross-device scan overlay (laptop) ---------------- */
.scanov {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(11, 27, 38, .62); backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; animation: scanov-in .22s ease;
}
@keyframes scanov-in { from { opacity: 0; } to { opacity: 1; } }
.scanov__bar {
  width: min(460px, 100%); display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; padding: 11px 14px;
  border-radius: var(--r) var(--r) 0 0; font-size: 12.5px;
}
.scanov__tag { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.scanov__dot { width: 8px; height: 8px; border-radius: 50%; background: #35D399; box-shadow: 0 0 0 0 rgba(53,211,153,.6); animation: scanov-pulse 1.4s infinite; }
@keyframes scanov-pulse { 0% { box-shadow: 0 0 0 0 rgba(53,211,153,.6); } 70% { box-shadow: 0 0 0 7px rgba(53,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(53,211,153,0); } }
.scanov__ref { font-family: var(--font-mono); font-size: 11.5px; opacity: .8; margin-left: auto; }
.scanov__close {
  background: rgba(255,255,255,.14); color: #fff; border: 0; cursor: pointer;
  width: 26px; height: 26px; border-radius: 6px; font-size: 18px; line-height: 1;
}
.scanov__close:hover { background: rgba(255,255,255,.26); }
.scanov__frame {
  width: min(460px, 100%); height: min(76vh, 760px); border: 0;
  background: var(--paper); border-radius: 0 0 var(--r) var(--r); box-shadow: var(--shadow-3);
}

/* ---------------- appeal ---------------- */
.pricelist { display: grid; gap: 2px; margin: 14px 0; }
.pricerow {
  display: flex; justify-content: space-between; gap: 14px; padding: 8px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.pricerow__amt { font-family: var(--font-mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pricerow--total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 11px; font-weight: 700; font-size: 15px; }

.note {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.55;
  background: #F2F7F8; border: 1px solid var(--line-soft); color: var(--ink-2);
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent-deep); }
.note--warn { background: var(--warn-tint); border-color: #EDD5A8; color: #6B4700; }
.note--warn svg { color: var(--warn); }

/* ---------------- reports ---------------- */
.reportgrid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report {
  text-align: left; cursor: pointer; appearance: none; font: inherit; color: inherit;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 0; overflow: hidden; box-shadow: var(--shadow-1);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  display: flex; flex-direction: column;
}
.report:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--accent); }
.report__thumb {
  height: 152px; background: #F7FAFA; border-bottom: 1px solid var(--line-soft);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; overflow: hidden;
}
.report__line { height: 5px; border-radius: 2px; background: var(--line); }
.report__line--head { height: 8px; width: 58%; background: var(--ink-3); }
.report__line--accent { background: var(--accent); width: 34%; }
.report__line--short { width: 72%; }
.report__line--verdict { height: 12px; width: 42%; margin-top: 4px; }
.report__meta { padding: 14px 16px 16px; }
.report__name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; }
.report__desc { font-size: 13px; color: var(--muted); margin-top: 5px; }
.report__cta {
  margin-top: 12px; font-size: 12.5px; font-weight: 600; color: var(--accent-deep);
  display: inline-flex; align-items: center; gap: 6px;
}
.report__cta svg { width: 13px; height: 13px; transition: transform .14s ease; }
.report:hover .report__cta svg { transform: translateX(3px); }

/* ---------------- document preview ---------------- */
.doc {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 30px 28px; box-shadow: var(--shadow-1);
  font-size: 13.5px; color: var(--ink-2); line-height: 1.6;
}
.doc h3 {
  text-align: center; font-size: 15px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 4px;
}
.doc__sub { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.doc__rule { height: 1px; background: var(--line); margin: 16px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc th, .doc td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.doc th { width: 38%; color: var(--muted); font-weight: 600; font-size: 12px; }
.doc__sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 26px; font-size: 12px; }
.doc__sign div { flex: 1; border-top: 1px solid var(--line); padding-top: 7px; color: var(--muted); }

/* ---------------- modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(11, 27, 38, .55); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative; background: var(--card); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); width: min(720px, 100%);
  max-height: min(86vh, 900px); display: flex; flex-direction: column;
  animation: pop .18s cubic-bezier(.22, 1, .36, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
}
.modal__title { font-size: 17px; }
.modal__body { padding: 20px 18px 24px; overflow-y: auto; }

/* ---------------- toasts ---------------- */
.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #EAF2F4; padding: 12px 16px;
  border-radius: var(--r-sm); box-shadow: var(--shadow-2);
  font-size: 14px; max-width: 330px; animation: slidein .2s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }
.toast svg { width: 16px; height: 16px; flex: none; color: #00C2BA; }

/* ---------------- footer ---------------- */
.footer {
  border-top: 1px solid var(--line); background: var(--card);
  padding: 26px 20px 34px;
}
.footer p { max-width: var(--wrap); margin: 0 auto; font-size: 13px; color: var(--muted); }
.footer__legal {
  font-family: var(--font-display); font-size: 15px !important; color: var(--ink) !important;
  letter-spacing: .01em; margin-bottom: 8px !important;
}
.footer__alias {
  display: inline-block; margin-left: 8px; padding: 2px 9px;
  background: var(--accent-tint); border: 1px solid #B9E5E1; border-radius: 999px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  letter-spacing: .09em; color: var(--accent-deep); vertical-align: 2px;
}
.footer__meta { margin-top: 7px !important; font-size: 12px !important; color: #8CA3AF !important; }

/* ============================================================
   Responsive — tablet
   ============================================================ */
@media (max-width: 1040px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--sidebar, .grid--3, .reportgrid { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .centre-detail__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   Responsive — phone (375px target)
   ============================================================ */
@media (max-width: 720px) {
  .topbar__inner { padding: 10px 14px; gap: 10px; }
  .brand { margin-right: 0; width: 100%; }
  .demo-badge { order: 3; }
  .role-switch { order: 2; width: 100%; justify-content: space-between; }
  .tabs { top: 0; position: sticky; }
  .herostrip { padding: 18px 14px 16px; }
  .main { padding: 20px 14px 48px; }
  .tabs__inner { padding: 0 14px; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2, .secgrid { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .centre-detail__grid { grid-template-columns: 1fr; }
  .panel__head { margin-bottom: 18px; }
  .card { padding: 16px; border-radius: var(--r); }

  .workerbar { padding: 14px 16px; gap: 12px; }
  .workerbar__meta { margin-left: 0; gap: 8px 18px; width: 100%; }

  /* tables collapse into stacked cards */
  .table-wrap { overflow-x: visible; }
  table.tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr {
    border: 1px solid var(--line-soft); border-radius: var(--r);
    padding: 6px 14px; margin-bottom: 12px; background: #FDFEFE;
  }
  table.tbl tbody tr.is-click:hover { background: #F7FBFB; }
  table.tbl td {
    border-bottom: 0; padding: 7px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    font-size: 14px; text-align: right;
  }
  table.tbl td::before {
    content: attr(data-label); font-size: 11px; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted); text-align: left; flex: none;
  }
  .t-right { text-align: right; }
  .gauge { min-width: 0; width: 100%; }
  table.tbl td:has(.gauge) { flex-direction: column; align-items: flex-start; }

  .reportgrid { grid-template-columns: 1fr; }
  .report { flex-direction: row; }
  .report__thumb { width: 108px; height: auto; flex: none; border-bottom: 0; border-right: 1px solid var(--line-soft); }
  .btn { width: 100%; justify-content: center; }
  .btn-row .btn { width: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 10px 6px; font-size: 12.5px; }
  .modal__panel { max-height: 92vh; }
  .doc { padding: 20px 16px; }
  .cert { padding: 20px 16px; }
  .cert__grid { grid-template-columns: 1fr; }
  .cert__foot { flex-direction: column; align-items: stretch; gap: 16px; }
  .cert__footcol--sig { text-align: left; align-items: flex-start; }
  .cert__verify { order: -1; }
  .toasts { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}

@media (max-width: 400px) {
  .stats { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: 1fr; }
}

/* ---------------- JPETS: TB screening ---------------- */
.jpets-band {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--ink); color: #E7F0F2; border-radius: var(--r-lg);
  padding: 16px 20px; box-shadow: var(--shadow-2); margin-bottom: 18px;
}
.jpets-band__seal {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: rgba(0,198,186,.14); border: 1px solid rgba(0,198,186,.4);
  display: grid; place-items: center;
}
.jpets-band__seal svg { width: 21px; height: 21px; color: #00C2BA; }
.jpets-band__title { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: #fff; letter-spacing: -.01em; }
.jpets-band__sub { font-size: 12.5px; color: #9FB6C2; margin-top: 2px; }
.jpets-band__body { margin-left: auto; text-align: right; }

.datestrip { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.datestrip__item {
  border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 16px;
  background: #FDFEFE; border-left: 3px solid var(--accent);
}
.datestrip__item--live { border-left-color: var(--warn); background: #FFFEFA; }
.datestrip__k { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.datestrip__v { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; }
.datestrip__n { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.flow { list-style: none; margin: 0; padding: 0; }
.flow__step {
  position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 14px;
  padding-bottom: 20px;
}
.flow__step:last-child { padding-bottom: 0; }
.flow__step::before {
  content: ""; position: absolute; left: 14px; top: 28px; bottom: 0;
  width: 2px; background: var(--line);
}
.flow__step:last-child::before { display: none; }
.flow__step.is-done::before { background: var(--accent); }
.flow__dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; z-index: 1;
  border: 2px solid var(--line); background: #fff; color: var(--muted);
}
.flow__dot svg { width: 14px; height: 14px; }
.flow__step.is-done .flow__dot { border-color: var(--accent); background: var(--accent); color: #04302E; }
.flow__step.is-now .flow__dot { border-color: var(--warn); background: var(--warn-tint); color: var(--warn); }
.flow__step.is-blocked .flow__dot { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }
.flow__name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.flow__meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.flow__step.is-now .flow__name { color: var(--warn); }
.flow__step.is-blocked .flow__name { color: var(--bad); }

.xray { display: grid; gap: 12px; }
.xray__row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.xray__row:last-child { border-bottom: 0; }
.xray__k { font-size: 14px; }
.xray__k small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.xray__v { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.meta-list { display: grid; gap: 0; }
.meta-row {
  display: grid; grid-template-columns: 150px 1fr; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.meta-row:last-child { border-bottom: 0; }
.meta-row dt { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.meta-row dd { margin: 0; font-weight: 500; }

@media (max-width: 720px) {
  .datestrip { grid-template-columns: 1fr; }
  .jpets-band__body { margin-left: 0; text-align: left; }
  .meta-row { grid-template-columns: 1fr; gap: 3px; }
  .xray__row { grid-template-columns: 1fr; gap: 6px; }
  .xray__v { text-align: left; }
}

/* ---------------- motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .bar-fill, .stackbar span { transition: none; }
}

@media print {
  .topbar, .tabs, .herostrip, .footer, .panel__head { display: none !important; }
  body { background: #fff; }
  .cert { box-shadow: none; break-inside: avoid; }
  .cert__qr, .cert__band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- MVP app shell additions ---------------- */
.kv-list { display: grid; gap: 2px; margin-top: 4px; }
.kv-list .kv { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.kv-list .kv:last-child { border-bottom: 0; }
.empty {
  padding: 22px; text-align: center; color: var(--muted); font-size: 14px;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-sm);
}
.usermenu__out { margin-left: 4px; }
