/* Chairside Periodontal Screening Desk - clinical diagnostic cockpit */
:root {
  --canvas: #E6FFFA;
  --paper: #FFFFFF;
  --mast: #134E4A;
  --mast-ink: #F0FDFA;
  --ink: #0F172A;
  --muted: #334155;
  --primary: #0F766E;
  --primary-ink: #FFFFFF;
  --primary-press: #115E59;
  --accent: #1D4ED8;
  --accent-press: #1E40AF;
  --line: #5EEAD4;
  --field-line: #0F766E;
  --tint: #F0FDFA;
  --radius: 8px;
  --font-display: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ok-ink: #166534; --ok-bg: #F0FDF4; --ok-line: #15803D;
  --warn-ink: #854D0E; --warn-bg: #FEFCE8; --warn-line: #CA8A04;
  --alert-ink: #9A3412; --alert-bg: #FFF7ED; --alert-line: #EA580C;
  --critical-ink: #991B1B; --critical-bg: #FEF2F2; --critical-line: #DC2626;
  --incomplete-ink: #7F1D1D; --incomplete-bg: #F8FAFC; --incomplete-line: #B91C1C;
  --neutral-ink: #134E4A; --neutral-bg: #F0FDFA; --neutral-line: #0F766E;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; color: var(--ink); }
p { margin: 0; }

.mono,
.kpi-value,
.sheet-meta dd,
.measure-table td.num,
.unit-pill { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

/* ---------- Control geometry ---------- */
button,
[data-preset-chip],
.preset-chip,
label.dropzone-trigger,
.format-button,
a[data-checkout],
select,
input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 44px;
}

button,
[data-preset-chip],
a[data-checkout],
.btn-primary,
.btn-secondary {
  padding-top: 6px;
  padding-bottom: 6px;
  cursor: pointer;
  font-family: var(--font-body);
}

button { font-size: 14px; }

:focus-visible { outline: 3px solid var(--mast); outline-offset: 2px; }

.btn-primary,
.btn-secondary,
.btn-pro-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

.btn-primary { background: var(--primary); color: var(--primary-ink); border: 1px solid var(--primary); }
.btn-primary:hover { background: var(--primary-press); border-color: var(--primary-press); }
.btn-primary:active { background: #134E4A; transform: translateY(1px); }

.btn-secondary { background: var(--paper); color: var(--primary-press); border: 1px solid var(--primary); }
.btn-secondary:hover { background: var(--tint); }
.btn-secondary:active { background: #CCFBF1; transform: translateY(1px); }

.btn-compact { padding-left: 12px; padding-right: 12px; font-size: 13px; }

/* Commercial controls always use the blue accent */
a[data-checkout] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
a[data-checkout]:hover { background: var(--accent-press); border-color: var(--accent-press); }
a[data-checkout]:active { background: #1E3A8A; transform: translateY(1px); }
.btn-pro-outline { background: var(--paper); color: var(--accent); border: 1px solid var(--accent); }
.btn-pro-outline:hover { background: #EFF6FF; }
.btn-pro-outline:active { background: #DBEAFE; transform: translateY(1px); }

/* ---------- Role badges & pills ---------- */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}
.role-badge-in { background: #CCFBF1; color: #134E4A; border-color: #0F766E; }
.role-badge-out { background: #134E4A; color: #F0FDFA; border-color: #134E4A; }

.req-pill,
.optional-pill,
.unit-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 8px;
  white-space: nowrap;
}
.req-pill { background: #CCFBF1; color: #134E4A; border: 1px solid #0F766E; text-transform: uppercase; letter-spacing: 0.05em; }
.optional-pill { background: #F1F5F9; color: #334155; border: 1px solid #94A3B8; text-transform: uppercase; letter-spacing: 0.05em; }
.unit-pill { background: var(--tint); color: #134E4A; border: 1px solid var(--line); font-size: 11.5px; }

/* ---------- Header stack ---------- */
.app-header-stack { flex-shrink: 0; }

.masthead {
  background-color: #134E4A;
  color: #F0FDFA;
  padding: 0 20px 8px;
}
.masthead-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-height: 52px;
  padding-top: 4px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  max-height: 52px;
  margin: 0;
  color: #F0FDFA;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}
.wordmark-mark { flex: 0 0 auto; color: #5EEAD4; }
.wordmark-brand { color: #CCFBF1; font-weight: 500; }
.wordmark-sep { color: #99F6E4; margin: 0 6px; }
.masthead-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240, 253, 250, 0.55);
  color: #F0FDFA;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.masthead a[data-checkout] {
  margin-left: auto;
  max-height: 50px;
  white-space: nowrap;
  font-size: 13px;
}
.masthead :focus-visible { outline-color: #F0FDFA; }
.value-prop { color: #CCFBF1; font-size: 14px; line-height: 1.4; max-width: 980px; }

.scenario-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 6px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.scenario-caption { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; }
.scenario-chips { display: contents; }
.preset-chip {
  display: inline-flex;
  align-items: center;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--tint);
  color: #134E4A;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  transition: background-color 120ms ease;
}
.preset-chip:hover { background: #CCFBF1; border-color: #0F766E; }
.preset-chip:active { background: #99F6E4; transform: translateY(1px); }
.preset-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }

.sample-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px dashed #0F766E;
  background: var(--tint);
  color: #134E4A;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.reset-btn {
  margin-left: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--paper);
  color: var(--primary-press);
  line-height: 1.2;
  text-align: left;
}
.reset-btn:hover { background: var(--tint); }
.reset-btn:active { background: #CCFBF1; transform: translateY(1px); }
.reset-btn > span:first-child { font-size: 13px; font-weight: 700; }
.reset-btn > span:last-child { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.orientation-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 5px 20px 4px;
}
.trust-reassurance-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.trust-reassurance-bar p { font-size: 12.5px; color: var(--muted); }
.trust-reassurance-bar .trust-badge { flex: 0 0 auto; }
.trust-badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  background: #134E4A;
  color: #F0FDFA;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.workflow-cue {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: #134E4A;
  font-size: 12.5px;
  font-weight: 600;
}
.workflow-step { white-space: nowrap; }

/* ---------- Workbench ---------- */
.workbench { padding: 8px 16px 12px; gap: 16px; }

.pane { min-width: 0; }

.inspector-pane {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
}
.inspector-head { padding: 12px 20px 8px; }
.inspector-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; }
.inspector-title-row h2 { font-size: 20px; font-weight: 600; }
.live-cue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #134E4A;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px #CCFBF1; }
.edited-marker {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px dashed #475569;
  background: #F1F5F9;
  color: #334155;
  font-size: 11.5px;
  font-weight: 700;
}

.inspector-scroll-body { padding: 0 20px 16px; }

form { margin: 0; }

.deck {
  margin: 0;
  padding: 10px 0 6px;
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.deck + .deck { margin-top: 6px; }
.deck-title {
  float: left;
  width: 100%;
  padding: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: #134E4A;
}
.deck-title + * { clear: both; }
.deck-hint { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.deck-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(170px, calc((100% - 8px) / 2)), 1fr));
  gap: 8px;
}
.toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.toggle:hover { background: var(--tint); border-color: #0F766E; }
.toggle:active { background: #CCFBF1; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.toggle-box {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid #0F766E;
  border-radius: 6px;
  color: transparent;
  background: var(--paper);
}
.toggle input:checked + .toggle-box { background: var(--primary); color: #FFFFFF; }
.toggle input:focus-visible + .toggle-box { outline: 3px solid var(--mast); outline-offset: 2px; }
.toggle:has(input:checked) { border-color: #0F766E; background: var(--tint); }
.toggle:has(input:disabled) { cursor: not-allowed; background: #F8FAFC; border-style: dashed; color: #475569; }
.toggle-text { flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.toggle-state { display: inline-flex; }
.toggle-state > span {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.when-off { color: #334155; background: #F1F5F9; }
.when-on { display: none; color: #FFFFFF; background: #134E4A; }
.toggle input:checked ~ .toggle-text .when-on { display: inline; }
.toggle input:checked ~ .toggle-text .when-off { display: none; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(190px, calc((100% - 12px) / 2)), 1fr));
  gap: 8px 12px;
}
.field { min-width: 0; border-radius: var(--radius); }
.field-wide { margin-top: 10px; }
.field-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.input-shell {
  display: flex;
  align-items: center;
  min-width: 180px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
.input-shell:focus-within { box-shadow: 0 0 0 3px #99F6E4; border-color: #134E4A; }
.input-shell input,
.input-shell select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}
.input-shell select { padding-right: 4px; font-size: 14px; cursor: pointer; }
.input-shell input.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.field.is-skipped .input-shell { border-style: dashed; background: #F8FAFC; }
.field.is-skipped input,
.field.is-skipped select { cursor: not-allowed; color: #475569; }
.field.has-error .input-shell { border-color: #B91C1C; box-shadow: 0 0 0 1px #B91C1C; }
.field-error { color: #B91C1C; font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.field-error:empty { display: none; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  resize: vertical;
}
textarea:focus-visible { outline: 3px solid #99F6E4; outline-offset: 0; border-color: #134E4A; }

.prop-collapsible { margin-top: 14px; }
.step-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
  color: #134E4A;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.step-tab::-webkit-details-marker { display: none; }
.step-tab:hover { border-color: #0F766E; }
.step-tab:active { background: #CCFBF1; }
.prop-collapsible[open] .step-tab svg { transform: rotate(180deg); }
.collapsible-body { padding: 12px 2px 4px; }

.storage-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 12px; color: var(--muted); }
.save-warning { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #92400E; }
.storage-note svg { flex: 0 0 auto; margin-top: 2px; color: #0F766E; }

.dock-jump-shelf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  border-radius: 0 0 var(--radius) var(--radius);
}
.shelf-status { font-size: 12.5px; color: var(--muted); }

/* ---------- Deliverable dock ---------- */
.deliverable-dock {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px 12px;
}
.dock-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.dock-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dock-verdict {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 8px;
  padding: 8px 12px;
  min-height: 78px;
  border-radius: var(--radius);
  border: 1px solid var(--tone-line);
  border-left: 5px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-ink);
}
.verdict-icon { display: inline-flex; margin-top: 2px; }
.verdict-text { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.2; color: var(--tone-ink); }
.deliverable-dock[data-state="awaiting"] .verdict-text,
.deliverable-dock[data-state="incomplete"] .verdict-text { font-size: 15.5px; }
.verdict-sub { font-size: 13px; color: var(--ink); margin-top: 3px; line-height: 1.4; }
.verdict-sub a { color: var(--tone-ink); font-weight: 700; text-underline-offset: 2px; }

[data-tone="ok"] { --tone-ink: var(--ok-ink); --tone-bg: var(--ok-bg); --tone-line: var(--ok-line); }
[data-tone="warn"] { --tone-ink: var(--warn-ink); --tone-bg: var(--warn-bg); --tone-line: var(--warn-line); }
[data-tone="alert"] { --tone-ink: var(--alert-ink); --tone-bg: var(--alert-bg); --tone-line: var(--alert-line); }
[data-tone="critical"] { --tone-ink: var(--critical-ink); --tone-bg: var(--critical-bg); --tone-line: var(--critical-line); }
[data-tone="incomplete"] { --tone-ink: var(--incomplete-ink); --tone-bg: var(--incomplete-bg); --tone-line: var(--incomplete-line); }
[data-tone="neutral"],
[data-tone=""] { --tone-ink: var(--neutral-ink); --tone-bg: var(--neutral-bg); --tone-line: var(--neutral-line); }

.deliverable-dock[data-tone="critical"] .dock-verdict { border-left-width: 8px; box-shadow: inset 0 0 0 1px var(--critical-line); }
.deliverable-dock[data-tone="incomplete"] .dock-verdict { border-style: dashed; border-left-style: solid; }

.kpi-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; }
.kpi {
  min-width: 0;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--tint);
  cursor: pointer;
}
.kpi:hover { background: #CCFBF1; }
.kpi:active { background: #99F6E4; }
.kpi dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kpi dd { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.kpi-value { font-size: 17px; font-weight: 600; color: var(--ink); }
.kpi-note { font-size: 11.5px; color: var(--muted); }

/* ---------- Deliverable sheet ---------- */
.deliverable-sheet {
  margin-top: 12px;
  padding: 22px 26px 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
}
.sheet-title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.deliverable-sheet { container-type: inline-size; }
@container (max-width: 600px) {
  .sheet-title-row { flex-direction: column; align-items: flex-start; }
}
.sheet-title-row h2 { font-size: 22px; font-weight: 600; }
.state-marker {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-ink);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.state-marker[data-tone="critical"] { border-width: 2px; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 10px 0 0; }
.sheet-meta div { min-width: 0; }
.sheet-meta dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sheet-meta dd { margin: 0; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }

.sheet-flag {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border-left: 5px solid var(--tone-line);
  background: var(--tone-bg);
}
.sheet-flag[data-edit-target] { cursor: pointer; }
.sheet-flag[data-tone="critical"] { border-left-width: 8px; box-shadow: inset 0 0 0 1px var(--critical-line); }
.flag-title { font-size: 14.5px; font-weight: 700; color: var(--tone-ink); }
.flag-text { font-size: 13px; color: var(--ink); margin-top: 3px; }

.sheet-section { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }
.sheet-section h3 { font-size: 16px; font-weight: 600; color: #134E4A; margin-bottom: 8px; }

table { width: 100%; border-collapse: collapse; }
.summary-table th,
.summary-table td { padding: 9px 8px; text-align: left; vertical-align: top; border-top: 1px solid #CCFBF1; }
.summary-table tr:first-child th,
.summary-table tr:first-child td { border-top: 0; }
.summary-table th { width: 36%; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.summary-table td { font-size: 14px; color: var(--ink); }
.summary-table tr[data-row="determination"] td { font-weight: 700; color: var(--tone-ink); }

.edit-row { cursor: pointer; }
.edit-row:hover { background: var(--tint); }
.edit-row:active { background: #CCFBF1; }
.edit-row:focus-visible { outline: 3px solid var(--mast); outline-offset: -3px; }

.table-scroll { overflow-x: auto; }
.measure-table th,
.measure-table td { padding: 9px 8px; text-align: left; vertical-align: top; font-size: 13.5px; border-top: 1px solid #CCFBF1; }
.measure-table thead th { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-top: 0; border-bottom: 1px solid var(--line); }
.measure-table tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
.measure-table .num { text-align: right; padding-right: 12px; white-space: nowrap; }
.measure-table td[data-col="finding"] { font-size: 12.5px; color: var(--muted); }
.measure-table tr[data-tone="critical"] td[data-col="finding"] { color: var(--critical-ink); font-weight: 700; }
.measure-table tr[data-tone="alert"] td[data-col="finding"] { color: var(--alert-ink); font-weight: 700; }
.measure-table tr[data-tone="warn"] td[data-col="finding"] { color: var(--warn-ink); font-weight: 600; }
.measure-table tr[data-tone="ok"] td[data-col="finding"] { color: var(--ok-ink); }
.measure-table tr[data-tone="incomplete"] td { color: var(--incomplete-ink); font-weight: 600; }

.paired-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 28px; }
.tier-line { font-size: 13px; font-weight: 700; color: #134E4A; margin-bottom: 6px; }
.homecare-list,
.guidance-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.homecare-list li,
.guidance-list li { font-size: 13.5px; color: var(--ink); padding-left: 2px; }
.homecare-list li::marker { font-family: var(--font-mono); color: #0F766E; font-weight: 600; }
.guidance-list li::marker { color: #0F766E; }
.risk-note { margin-top: 10px; font-size: 13px; color: var(--muted); }

.notes-text { font-size: 13.5px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; border-radius: 4px; }
.notes-text:hover { background: var(--tint); }
.signoff-line { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 10px; font-size: 13px; }
.signoff-line span { color: var(--muted); }

.sheet-disclaimer { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.free-watermark { margin-top: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: #0F766E; }

/* ---------- Pro sign-off gate ---------- */
.pro-signoff-gate { margin-top: 28px; padding: 18px 4px 8px; border-top: 1px solid var(--line); }
.pro-gate-head { display: flex; align-items: center; gap: 10px; }
.pro-gate-head h2 { font-size: 18px; font-weight: 600; }
.pro-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 4px 16px; border-radius: 999px; background: var(--accent); color: #FFFFFF; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.pro-gate-copy { font-size: 13.5px; color: var(--muted); margin: 8px 0 12px; max-width: 640px; }
.input-locked { border-style: dashed; border-color: #64748B; background: #F8FAFC; }
.input-locked input { cursor: pointer; }
.input-locked input::placeholder { color: #475569; opacity: 1; }
body[data-pro="active"] .input-locked { border-style: solid; border-color: var(--field-line); background: var(--paper); }
body[data-pro="active"] .input-locked input { cursor: text; }
body[data-pro="active"] .lock-note { display: none; }
.lock-note { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.lock-note svg { color: var(--accent); }
.pro-gate-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pro-gate-actions a[data-checkout],
.pro-gate-actions .btn-pro-outline { font-size: 13px; }

/* ---------- Horizon, HUD, undo ---------- */
.cockpit-horizon-bar {
  display: none;
  align-items: center;
  gap: 20px;
  height: 28px;
  padding: 0 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.horizon-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--tone-ink); }
.horizon-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone-line); }
.horizon-privacy { margin-left: auto; }

.mobile-hud { display: none; }

.undo-region {
  position: fixed;
  left: 16px;
  bottom: 40px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 14px;
  border-radius: var(--radius);
  background: #0F172A;
  color: #FFFFFF;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}
.undo-region .btn-secondary { border-color: #FFFFFF; }
.undo-region :focus-visible { outline-color: #99F6E4; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
dialog h2 { font-size: 20px; font-weight: 600; }
dialog p { font-size: 14px; color: var(--muted); margin-top: 8px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.dialog-close:hover { background: var(--tint); }
.dialog-close:active { background: #CCFBF1; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.free-vs-pro-table { margin-top: 14px; font-size: 13px; }
.free-vs-pro-table th,
.free-vs-pro-table td { padding: 8px 10px; border: 1px solid #94A3B8; text-align: left; vertical-align: top; color: #0F172A; }
.free-vs-pro-table thead th { background: #134E4A; color: #FFFFFF; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.free-vs-pro-table thead th:last-child { background: var(--accent); }
.free-vs-pro-table tbody th { font-weight: 700; background: var(--tint); }

/* ---------- Click-to-edit pulse ---------- */
.flash-recalc { animation: flash-recalc 900ms ease-out; }
@keyframes flash-recalc {
  0% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.55); background-color: #CCFBF1; }
  100% { box-shadow: 0 0 0 10px rgba(15, 118, 110, 0); background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .flash-recalc { animation: none; outline: 3px solid #0F766E; }
  * { transition: none !important; }
}

/* ---------- Desktop cockpit ---------- */
@media (min-width: 901px) {
  html,
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  body { display: flex; flex-direction: column; }
  .workbench {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: start;
  }
  .inspector-pane,
  .deliverable-zone { height: 100%; max-height: 100%; }
  .inspector-pane { display: flex; flex-direction: column; min-height: 0; }
  .inspector-head { flex: 0 0 auto; }
  .inspector-scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .dock-jump-shelf { flex: 0 0 auto; }
  .deliverable-zone {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-right: 4px;
  }
  .inspector-scroll-body,
  .deliverable-zone {
    mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
    padding-bottom: 56px;
  }
  .inspector-scroll-body.is-at-end,
  .deliverable-zone.is-at-end { mask-image: none; -webkit-mask-image: none; }
  .deliverable-dock { position: sticky; top: 0; z-index: 30; }
  .deliverable-sheet,
  #executive-deliverable,
  .pro-signoff-gate { position: static; }
  .cockpit-horizon-bar { display: flex; flex: 0 0 28px; }
}

@media (min-width: 901px) and (max-width: 1239px) {
  .step-extra { display: none; }
  .role-badge-out { letter-spacing: 0.04em; }
  .dock-actions { gap: 6px; }
  .dock-actions .btn-compact { padding-left: 10px; padding-right: 10px; }
  .dock-actions .btn-compact svg { display: none; }
  .dock-scroll-cue span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dock-scroll-cue { padding-left: 12px; padding-right: 12px; min-width: 44px; }
  .masthead-status { display: none; }
  .horizon-hint { display: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  html, body { height: auto; overflow: visible; }
  body { padding-bottom: 88px; }
  .workbench { display: grid; grid-template-columns: minmax(0, 1fr); padding: 10px 12px 16px; }
  .inspector-scroll-body,
  .deliverable-zone { overflow: visible; mask-image: none; -webkit-mask-image: none; }
  .deliverable-dock { position: static; }
  .cockpit-horizon-bar { display: none; }
  .mobile-hud {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 64px;
    padding: 0 14px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: #134E4A;
    color: #F0FDFA;
    white-space: nowrap;
  }
  .hud-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #F0FDFA; white-space: nowrap; }
  .hud-state::before { content: ""; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #CBD5E1; }
  .hud-state[data-tone="ok"]::before { background: #4ADE80; }
  .hud-state[data-tone="warn"]::before { background: #FACC15; }
  .hud-state[data-tone="alert"]::before { background: #FB923C; }
  .hud-state[data-tone="critical"]::before { background: #F87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.35); }
  .hud-btn {
    flex: 0 0 auto;
    padding-left: 16px;
    padding-right: 16px;
    border: 0;
    border-radius: 999px;
    background: #F0FDFA;
    color: #134E4A;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
  }
  .hud-btn:active { background: #CCFBF1; transform: translateY(1px); }
  .mobile-hud :focus-visible { outline-color: #F0FDFA; }
  .undo-region { bottom: 76px; left: 12px; right: 12px; }
  .workflow-cue { margin-left: 0; }
  .masthead a[data-checkout] { margin-left: 0; }
}

@media (max-width: 680px) {
  fieldset [class*="grid"],
  form [class*="grid"],
  .field-pair,
  .prop-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .field-grid,
  .toggle-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .masthead { padding: 0 14px 8px; }
  .wordmark { font-size: 15px; }
  .wordmark-brand,
  .wordmark-sep { display: none; }
  .masthead-row { gap: 6px 10px; }
  .masthead-status { font-size: 11px; padding: 2px 8px; }
  .masthead a[data-checkout] { font-size: 12.5px; padding-left: 12px; padding-right: 12px; }
  .cta-extra { display: none; }
  .scenario-chips { display: contents; }
  .value-prop { font-size: 13px; }
  .scenario-toolbar,
  .orientation-row { padding-left: 14px; padding-right: 14px; }
  .scenario-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .scenario-caption { grid-column: 1 / -1; }
  .preset-chip { font-size: 12px; line-height: 1.2; padding-left: 10px; padding-right: 10px; border-radius: 22px; }
  .reset-btn { margin-left: 0; padding-left: 10px; padding-right: 10px; }
  .reset-btn > span:first-child { font-size: 12px; }
  .reset-btn > span:last-child { font-size: 11px; }
  .trust-reassurance-bar { display: block; }
  .trust-reassurance-bar .trust-badge { margin-right: 6px; vertical-align: 1px; }
  .trust-reassurance-bar p { display: inline; font-size: 12px; }
  .orientation-row { padding-top: 8px; padding-bottom: 4px; }
  .workbench { padding-top: 8px; }
  .inspector-head { padding-top: 10px; }
  .inspector-title-row { margin-top: 6px; }
  .inspector-title-row h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .trust-reassurance-bar p { font-size: 11.5px; }
  .workflow-cue { display: none; }
  .inspector-head,
  .inspector-scroll-body,
  .dock-jump-shelf { padding-left: 14px; padding-right: 14px; }
  .kpi-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .kpi { flex: 1 1 calc(50% - 0.5rem); max-width: 48%; min-width: 0; padding: 8px 12px; }
  .kpi-value { font-size: 0.88rem; }
  .kpi-note { font-size: 0.72rem; }
  .dock-actions { width: 100%; flex-wrap: nowrap; }
  .dock-actions .btn-compact { flex: 1 1 auto; }
  .dock-scroll-cue { flex: 0 0 auto; min-width: 44px; padding-left: 12px; padding-right: 12px; }
  .dock-scroll-cue span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .deliverable-sheet { padding: 16px 14px 20px; }
  .measure-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .measure-table,
  .measure-table tbody { display: block; }
  .measure-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; padding: 10px 6px; border-top: 1px solid #CCFBF1; }
  .measure-table tbody th { grid-column: 1 / -1; padding: 0; border: 0; }
  .measure-table td { padding: 0; border: 0; text-align: left; }
  .measure-table .num { text-align: left; padding-right: 6px; }
  .measure-table td[data-col="finding"] { grid-column: 1 / -1; }
  .measure-table td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-family: var(--font-body); }
  .summary-table th { width: 42%; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { height: auto !important; overflow: visible !important; background: #FFFFFF !important; color: #111827 !important; padding: 0 !important; display: block !important; }
  .app-header-stack,
  .inspector-pane,
  .deliverable-dock,
  .pro-signoff-gate,
  .cockpit-horizon-bar,
  .mobile-hud,
  .undo-region,
  dialog,
  button,
  input,
  select,
  textarea,
  [data-preset-chip] { display: none !important; }
  .workbench { display: block !important; padding: 0 !important; }
  .deliverable-zone { display: block !important; height: auto !important; overflow: visible !important; mask-image: none !important; -webkit-mask-image: none !important; padding: 0 !important; }
  #executive-deliverable { display: block !important; }
  .deliverable-sheet { margin: 0; border: 0; padding: 0; color: #111827; background: #FFFFFF; }
  .deliverable-sheet * { color: #111827 !important; background: transparent !important; box-shadow: none !important; }
  .state-marker,
  .sheet-flag { border: 1.5px solid #111827 !important; }
  .sheet-flag { border-left-width: 6px !important; }
  .deliverable-sheet [style] { min-height: 0 !important; height: auto !important; }
  .sheet-flag,
  .sheet-head,
  tr,
  li { break-inside: avoid; page-break-inside: avoid; }
  .sheet-section { margin-top: 18px; }
  .free-watermark,
  .sheet-disclaimer { break-before: avoid; page-break-before: avoid; break-inside: avoid; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  .edit-row:hover { background: transparent; }
  .free-watermark { display: block; }
  body[data-pro="active"] .free-watermark { display: none; }
}

@media (max-width: 900px) {
  .masthead .value-prop { display: none; }
  .masthead { padding-top: 6px; padding-bottom: 6px; }
}
