:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #f2f6ff;
  --text: #172033;
  --text-strong: #0f172a;
  --muted: #0f172a;
  --muted-2: #334155;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #f97316;
  --accent-soft: #fff7ed;
  --dap-accent: #d6336c;
  --dap-accent-strong: #c2255c;
  --dap-accent-soft: #fff0f6;
  --success: #16a34a;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --danger-soft: #fff1f2;
  --sidebar: #0f172a;
  --sidebar-soft: #172033;
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, .06);
  --shadow-md: 0 18px 46px rgba(15, 23, 42, .09);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .13);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --thai: "Sarabun", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="night"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111b2e;
  --surface-soft: #152238;
  --surface-tint: #132540;
  --text: #dbe5f2;
  --text-strong: #f8fafc;
  --muted: #9eacc0;
  --muted-2: #6f8199;
  --line: #26364d;
  --line-strong: #3a4c65;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: rgba(59, 130, 246, .12);
  --accent: #fb923c;
  --accent-soft: rgba(249, 115, 22, .10);
  --dap-accent: #f06595;
  --dap-accent-strong: #e64980;
  --dap-accent-soft: rgba(240, 101, 149, .12);
  --warning-soft: rgba(180, 83, 9, .12);
  --danger-soft: rgba(225, 29, 72, .11);
  --sidebar: #060b13;
  --sidebar-soft: #0d1726;
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, .18);
  --shadow-md: 0 18px 46px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

html { min-width: 0; min-height: 100%; scroll-behavior: smooth; }

body {
  min-width: 0;
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 88% -10%, rgba(37, 99, 235, .08), transparent 28%),
    radial-gradient(circle at 8% 18%, rgba(249, 115, 22, .045), transparent 24%),
    var(--bg);
  font-family: var(--thai);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select { font: inherit; }

button { cursor: pointer; }

button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(37, 99, 235, .22); outline-offset: 2px; }

.admin-topbar { position: sticky; top: 0; z-index: 50; min-width: 0; grid-template-columns: minmax(260px, 1fr) auto auto; }

.topbar-left, .topbar-right { display: flex; align-items: center; min-width: 0; }

.topbar-left { gap: 11px; overflow: hidden; }

.topbar-right { gap: 8px; flex: 0 0 auto; }

.logo-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid rgba(249, 115, 22, .18);
}

.logo-mark img { width: 31px; height: 31px; object-fit: contain; display: block; }

.topbar-brand-copy { min-width: 0; display: flex; align-items: baseline; gap: 12px; overflow: hidden; }

.topbar-title { color: var(--text-strong); font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }

.topbar-tag { min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-nav { align-items: center; min-width: 0; padding: 4px; border-radius: 15px; background: var(--surface-soft); border: 1px solid var(--line); }

.top-nav-item.nav-item {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-align: center;
  white-space: nowrap;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.top-nav-item.nav-item:hover { color: var(--text-strong); background: color-mix(in srgb, var(--surface) 76%, transparent); transform: none; }

.top-nav-item.nav-item.active { color: var(--primary); background: var(--surface); border: 0; }

.utility-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
  transition: .18s ease;
}

.utility-btn:hover { border-color: var(--line-strong); background: var(--surface-soft); transform: translateY(-1px); }

.language-toggle { min-width: 44px; color: var(--primary); }

.view-panel { display: none; }

.view-panel.active { display: block; animation: view-in .22s ease both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }

  to { opacity: 1; transform: translateY(0); }
}

.content-page { width: min(100%, 1560px); margin-inline: auto; }

.page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }

.page-eyebrow, .section-kicker, .result-kicker { display: block; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.page-title h1 { margin: 4px 0 0; color: var(--text-strong); line-height: 1.15; font-weight: 800; letter-spacing: -.035em; }

.page-title p { margin: 7px 0 0; color: var(--muted); }

.page-context {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 18px; align-items: start; }

.dashboard-grid.layout-wide { grid-template-columns: minmax(680px, 1.56fr) minmax(430px, .92fr); gap: clamp(16px, 1.15vw, 22px); align-items: stretch; }

.dashboard-grid.layout-wide .result-stack { position: static; align-self: stretch; }

.workbench { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-md); }

.calc-panel-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.panel-heading-copy { min-width: 0; display: flex; align-items: center; gap: 11px; }

.calc-panel-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 800;
}

.calc-panel-head h2 { margin: 2px 0 0; color: var(--text-strong); font-size: 19px; line-height: 1.3; font-weight: 800; letter-spacing: -.02em; }

.tutorial-start-btn {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid rgba(37,99,235,.18);
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  transition: .18s ease;
}

.tutorial-start-btn:hover { border-color: rgba(37,99,235,.32); transform: translateY(-1px); }

#esak-form {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  grid-template-areas: "ref" "machine" "geometry" "dap";
  gap: 12px;
  padding: 16px;
  background: var(--surface-soft);
}

.workbench.form-wide #esak-form { grid-template-columns: repeat(2, minmax(0,1fr)); grid-template-areas: "ref ref" "machine geometry" "dap dap"; }

#calc-ref-box { grid-area: ref; }

#calc-machine-box { grid-area: machine; }

#geometry-stack { grid-area: geometry; }

#calc-dap-box { grid-area: dap; }

.postbox { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 1px 0 rgba(15,23,42,.015); }

.postbox-title { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px; border-bottom: 1px solid var(--line); }

.postbox-heading { min-width: 0; display: flex; align-items: center; gap: 9px; }

.postbox-title h2 { min-width: 0; margin: 0; color: var(--primary); font-size: 14px; line-height: 1.35; font-weight: 800; letter-spacing: -.012em; }

.title-muted { color: inherit; font-weight: 600; }

.step-no {
  min-width: 31px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.dose-step { border-color: color-mix(in srgb, var(--dap-accent) 22%, transparent); background: var(--dap-accent-soft); color: var(--dap-accent); }

.postbox-body { padding: 13px; }

.box-description { margin: -1px 0 11px; color: var(--text-strong); font-size: 11.5px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }

.field { min-width: 0; }

.field.full { grid-column: 1 / -1; }

label { display: block; margin: 0 0 5px; color: var(--text); font-size: 11.5px; font-weight: 700; }

label sub { font-size: 9px; }

.input-shell {
  min-width: 0;
  height: 42px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.input-shell:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }

.input-shell input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.input-shell input::placeholder { color: var(--muted-2); opacity: .72; }

.input-shell:has(input:disabled) { background: var(--surface-soft); border-style: dashed; }

.input-shell input:disabled { color: var(--muted); cursor: not-allowed; }

.input-unit { padding: 0 10px 0 6px; color: var(--muted); font-size: 10.5px; font-weight: 700; white-space: nowrap; }

.segmented { min-width: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }

.select-btn {
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: left;
  transition: .17s ease;
}

.select-btn:hover { border-color: var(--line-strong); background: var(--surface); }

.select-btn.active { border-color: rgba(37,99,235,.45); background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(37,99,235,.07); }

.select-btn strong { color: var(--text-strong); font-size: 12px; font-weight: 800; }

.select-btn.active strong { color: var(--primary); }

.select-btn span { margin-top: 2px; color: inherit; font-size: 9.5px; }

.geometry-stack { min-width: 0; display: grid; gap: 10px; }

.geometry-mini { min-width: 0; }

#calc-patient-box .patient-body { padding-top: 12px; padding-bottom: 12px; }

#calc-patient-box { background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft)); }

.dap-panel { border-color: color-mix(in srgb, var(--dap-accent) 22%, transparent); }

.dap-panel .postbox-title { background: linear-gradient(90deg, var(--dap-accent-soft), var(--surface)); }

.dap-panel .postbox-title h2 { color: var(--dap-accent); }

.unit-badge {
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--dap-accent) 18%, transparent);
  border-radius: 999px;
  background: var(--dap-accent-soft);
  color: var(--dap-accent);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 800;
}

.dap-body { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(210px,.85fr); align-items: end; gap: 14px; }

.dap-shell { height: 48px; border-color: color-mix(in srgb, var(--dap-accent) 32%, transparent); }

.dap-shell:focus-within { border-color: var(--dap-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dap-accent) 10%, transparent); }

.dap-shell .dap-input { font-size: 16px; }

.unit-text { margin-top: 5px; color: var(--text-strong); font-size: 10.5px; }

.action-row { min-width: 0; display: grid; gap: 7px; }

.action-note { color: var(--text-strong); font-size: 9.5px; line-height: 1.35; }

.admin-btn { min-height: 38px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; transition: .18s ease; }

.admin-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

.admin-btn:disabled { opacity: .58; cursor: wait; transform: none; }

.admin-btn.secondary { border: 1px solid rgba(37,99,235,.24); background: var(--primary-soft); color: var(--primary); }

.admin-btn.secondary:hover { border-color: rgba(37,99,235,.4); }

.admin-btn.compact { min-height: 31px; padding: 0 10px; font-size: 10.5px; }

#calc-btn {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 10px 22px rgba(249,115,22,.18);
  font-size: 14px;
}

#calc-btn:hover { background: linear-gradient(135deg, #ea580c, #c2410c); box-shadow: 0 13px 26px rgba(249,115,22,.24); transform: none; }

.result-stack { min-width: 0; }

.dashboard-grid.layout-wide > .workbench,
.dashboard-grid.layout-wide > .result-stack {
  min-height: 0;
}

.dashboard-grid.layout-wide .workbench,
.dashboard-grid.layout-wide .result-card {
  height: 100%;
}

.dashboard-grid.layout-wide .result-stack { display: flex; height: 100%; }

.dashboard-grid.layout-wide .result-card { display: flex; flex: 1 1 auto; flex-direction: column; height: 100%; }

.dashboard-grid.layout-wide .result-body { flex: 1 1 auto; align-content: start; }

.dashboard-grid.layout-wide .result-footer-note { margin-top: auto; }

.result-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-md); }

.result-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 17px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(circle at 100% 0%, rgba(96,165,250,.17), transparent 34%),
    linear-gradient(135deg, #172033, #0f172a);
  color: #fff;
}

.result-head h2 { margin: 2px 0 0; font-size: 18px; line-height: 1.25; font-weight: 800; }

.result-kicker { color: #93c5fd; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: #dbeafe;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}

.result-body {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(rgba(37,99,235,.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,.024) 1px, transparent 1px),
    var(--surface);
  background-size: 26px 26px;
}

.dose-label { color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }

.result-number {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: end;
  gap: 9px;
  padding: 17px 15px 14px;
  border: 1px solid rgba(37,99,235,.15);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface), var(--primary-soft));
}

.result-number span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: clamp(48px, 7vw, 86px);
  font-weight: 800;
  line-height: .88;
  letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-number small { margin-bottom: 6px; padding: 5px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 800; line-height: 1; }

.result-note { margin: 0; color: var(--muted); font-size: 11.5px; }

.formula-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
}

.formula-strip strong { color: var(--text); font-family: var(--mono); font-size: 11px; }

.metric-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }

.metric { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }

.metric span { display: block; color: var(--muted); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.metric strong { display: block; margin-top: 3px; color: var(--text-strong); font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

.warning-msg {
  display: none;
  padding: 10px 11px;
  border: 1px solid rgba(180,83,9,.18);
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.45;
}

.calc-summary { display: none; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

.step-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 10.5px; }

.step-row:last-child { border-bottom: 0; }

.step-row .key { color: var(--muted); }

.step-row .val { color: var(--text-strong); font-family: var(--mono); font-weight: 700; text-align: right; }

.result-toggle-btn {
  width: 100%;
  min-height: 37px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.result-toggle-btn:hover { border-color: rgba(37,99,235,.25); background: var(--primary-soft); }

.result-footer-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 17px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9.5px;
}

.result-card.result-compact .formula-strip,
.result-card.result-compact .metric-grid,
.result-card.result-compact .calc-summary {
  display: none !important;
}

.content-page { padding-bottom: 24px; }

.content-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at 86% 12%, rgba(37,99,235,.13), transparent 28%),
    linear-gradient(135deg, var(--surface), var(--surface-tint));
  box-shadow: var(--shadow-sm);
}

.content-hero::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -54px;
  bottom: -68px;
  border-radius: 50%;
  border: 24px solid rgba(249,115,22,.07);
  pointer-events: none;
}

.content-hero h1 { margin: 7px 0 0; line-height: 1.12; font-weight: 800; letter-spacing: -.04em; }

.content-hero p { max-width: 760px; margin: 10px 0 0; color: var(--muted); }

.guide-steps { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }

.guide-step {
  min-width: 0;
  min-height: 164px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.guide-step > span {
  width: 31px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

.guide-step h2 { margin: 0; color: var(--text-strong); line-height: 1.35; }

.guide-step p { margin: 5px 0 0; color: var(--muted); }

.content-grid { display: grid; gap: 12px; }

.content-grid.two-columns { grid-template-columns: repeat(2,minmax(0,1fr)); }

.content-grid.three-columns { grid-template-columns: repeat(3,minmax(0,1fr)); }

.content-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.content-card h2 { margin: 0; color: var(--text-strong); line-height: 1.35; }

.content-card p { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }

.card-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 11px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
}

.warning-card .card-icon { background: var(--accent-soft); color: var(--accent); }

.clean-list { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }

.clean-list li { position: relative; padding-left: 18px; color: var(--muted); font-size: 12.5px; }

.clean-list li::before { content: ""; position: absolute; left: 2px; top: .65em; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.inline-action { margin-top: 14px; padding: 0; border: 0; background: transparent; color: var(--primary); font-weight: 800; }

.inline-action:hover { text-decoration: underline; }

.feature-card { min-height: 190px; padding-top: 52px; }

.feature-index { position: absolute; top: 15px; left: 17px; color: var(--primary); font-family: var(--mono); font-weight: 800; }

.formula-card {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface), var(--surface-tint));
  box-shadow: var(--shadow-sm);
}

.formula-card h2 { margin: 5px 0 0; color: var(--text-strong); }

.formula-card p { max-width: 660px; margin: 7px 0 0; color: var(--muted); }

.formula-display {
  min-width: 280px;
  padding: 16px 18px;
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.formula-display span { color: var(--primary); }

.disclaimer-card {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 17px;
  border: 1px solid rgba(249,115,22,.18);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.disclaimer-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.disclaimer-card h2 { margin: 1px 0 0; color: var(--text-strong); }

.disclaimer-card p { margin: 5px 0 0; color: var(--muted); }

.hero-chip-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.hero-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(37,99,235,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.page-quick-links {
  position: sticky;
  top: calc(var(--esak-topbar-height) + 10px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 84%, rgba(255,255,255,.45));
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.quick-link {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 700;
  transition: .18s ease;
}

.quick-link:hover { transform: translateY(-1px); border-color: rgba(37,99,235,.24); background: var(--primary-soft); color: var(--primary); }

.quick-link.active { border-color: rgba(37,99,235,.24); background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(37,99,235,.06); }

.content-card,
.formula-card,
.disclaimer-card,
.usage-formula-card,
.usage-rule-card,
.parameter-pill,
.validation-note,
.usage-disclaimer {
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}

.content-card:hover,
.formula-card:hover,
.disclaimer-card:hover,
.usage-formula-card:hover,
.usage-rule-card:hover,
.parameter-pill:hover,
.validation-note:hover,
.usage-disclaimer:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.content-card:hover,
.formula-card:hover,
.usage-formula-card:hover,
.usage-rule-card:hover,
.parameter-pill:hover {
  border-color: rgba(37,99,235,.22);
}

.usage-section { position: relative; overflow: hidden; }

.usage-section::after {
  content: "";
  position: absolute;
  inset: auto -70px -70px auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.06), transparent 70%);
  pointer-events: none;
}

.content-hero,
.usage-section,
.formula-card,
.disclaimer-card {
  isolation: isolate;
}

.reveal-on-scroll { opacity: 0; transform: translateY(16px); transition: opacity .45s ease, transform .45s ease; }

.reveal-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll { opacity: 1; transform: none; transition: none; }

  .content-card,
  .formula-card,
  .disclaimer-card,
  .usage-formula-card,
  .usage-rule-card,
  .parameter-pill,
  .validation-note,
  .usage-disclaimer,
  .quick-link {
    transition: none;
  }
}

#toast {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 10000;
  width: min(420px, calc(100vw - 28px));
  padding: 11px 14px;
  transform: translate(-50%, 10px);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  transition: .2s ease;
}

#toast.show { visibility: visible; opacity: 1; transform: translate(-50%,0); }

.usage-tour { display: none; position: fixed; inset: 0; z-index: 9000; pointer-events: none; }

.usage-tour.active { display: block; }

.tour-shade { position: fixed; z-index: 9001; background: rgba(3, 7, 18, .68); pointer-events: auto; }

.tour-spotlight {
  position: fixed;
  z-index: 9002;
  border: 2px solid #60a5fa;
  border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(96,165,250,.18), 0 14px 36px rgba(0,0,0,.18);
  pointer-events: none;
  transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
}

.tour-popup {
  position: fixed;
  z-index: 9003;
  width: min(360px, calc(100vw - 20px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.tour-popup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 13px 8px; }

.tour-step-badge { padding: 4px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }

.tour-close-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}

.tour-progress-track { height: 3px; background: var(--line); }

.tour-progress-bar { display: block; width: 0; height: 100%; background: var(--primary); transition: width .18s ease; }

.tour-popup-body { padding: 14px 15px 15px; }

.tour-popup-body h3 { margin: 0; color: var(--text-strong); line-height: 1.35; }

.tour-popup-body p, .tour-popup-body li { color: var(--muted); font-size: 12px; line-height: 1.6; }

.tour-popup-body p { margin: 7px 0 0; }

.tour-popup-body ul, .tour-popup-body ol { margin: 7px 0 0 18px; padding: 0; }

.tour-popup-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 9px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }

.tour-btn { min-height: 35px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--text); font-weight: 800; }

.tour-btn.primary { border-color: var(--primary); background: var(--primary); color: #fff; }

.tour-btn:disabled { opacity: .4; cursor: not-allowed; }

.tour-step-status { color: var(--muted); font-family: var(--mono); text-align: center; }

html.tour-open, body.tour-open { overflow: hidden !important; }

@media (max-width: 899px) {
  html.tour-open, body.tour-open { overflow-x: hidden !important; overflow-y: auto !important; }

  .tour-shade { touch-action: none; }
}

@media (max-width: 1180px) {
  .admin-topbar { grid-template-columns: minmax(200px,1fr) auto auto; gap: 12px; padding-inline: 18px; }

  .topbar-tag { display: none; }

  .top-nav-item.nav-item { width: clamp(96px, 8.4vw, 108px); min-height: 39px; padding-inline: 12px; }

  .admin-main { padding-inline: 20px; }

  .guide-steps { grid-template-columns: repeat(3,minmax(0,1fr)); }

  .guide-step:nth-child(n/**/+4) { min-height: 145px; }
}

@media (max-width: 899px) {
  .admin-topbar {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand utilities"
      "nav nav";
    gap: 8px 12px;
    padding: 9px 12px 8px;
  }

  .topbar-left { grid-area: brand; }

  .topbar-right { grid-area: utilities; }

  .topbar-nav { grid-area: nav; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .top-nav-item.nav-item { width: 100%; min-height: 41px; padding: 0 10px; }

  .page-title-row { align-items: flex-start; margin-bottom: 14px; }

  .page-context { display: none; }

  .dashboard-grid, .dashboard-grid.layout-wide { grid-template-columns: 1fr; gap: 14px; }

  .dashboard-grid.layout-wide .result-stack { position: static; }

  .guide-steps { grid-template-columns: repeat(2,minmax(0,1fr)); }

  .content-grid.three-columns { grid-template-columns: 1fr; }

  .feature-card { min-height: 0; }

  .formula-card { grid-template-columns: 1fr; }

  .formula-display { min-width: 0; width: 100%; }
}

@media (max-width: 680px) {
  .topbar-title { font-size: 16px; }

  .admin-main { padding-inline: 10px; }

  .page-title h1 { font-size: 26px; }

  .page-title p { font-size: 12.5px; }

  .calc-panel-head { min-height: 66px; padding: 11px 12px; }

  .calc-panel-icon { width: 36px; height: 36px; }

  .calc-panel-head h2 { font-size: 16px; }

  .section-kicker { font-size: 9px; }

  .tutorial-start-btn { min-height: 35px; padding-inline: 10px; font-size: 10.5px; }

  #esak-form, .workbench.form-wide #esak-form { grid-template-columns: 1fr; grid-template-areas: "ref" "machine" "geometry" "dap"; padding: 11px; gap: 10px; }

  .postbox-title { padding-inline: 11px; }

  .postbox-body { padding: 11px; }

  .dap-body { grid-template-columns: 1fr; gap: 10px; }

  .action-note { display: none; }

  .result-body { padding: 14px; }

  .content-hero { padding: 24px 18px; }

  .content-grid.two-columns, .guide-steps { grid-template-columns: 1fr; }

  .guide-step { min-height: 0; flex-direction: row; align-items: flex-start; }
}

@media (max-width: 480px) {
  .admin-topbar { padding: 8px 8px 7px; gap: 7px 8px; }

  .logo-mark { width: 34px; height: 34px; border-radius: 10px; }

  .logo-mark img { width: 28px; height: 28px; }

  .topbar-brand-copy { gap: 7px; }

  .topbar-title { font-size: 15px; }

  .utility-btn { min-height: 32px; padding-inline: 8px; font-size: 10.5px; }

  .theme-toggle { max-width: 78px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

  .top-nav-item.nav-item { min-height: 39px; padding-inline: 6px; }

  .admin-main { padding-top: 14px; padding-inline: 8px; }

  .page-title-row { margin-bottom: 11px; }

  .page-eyebrow { font-size: 9px; }

  .page-title h1 { font-size: 23px; }

  .page-title p { margin-top: 5px; font-size: 11.5px; }

  .workbench, .result-card, .content-hero { border-radius: 18px; }

  .panel-heading-copy { gap: 8px; }

  .tutorial-start-btn { max-width: 37%; }

  .form-grid { grid-template-columns: 1fr; }

  .field.full { grid-column: auto; }

  .segmented { grid-template-columns: 1fr 1fr; }

  .postbox-title h2 { font-size: 12.5px; }

  .title-muted { display: none; }

  .step-no { min-width: 29px; height: 23px; }

  .unit-badge { display: none; }

  .result-head { min-height: 64px; padding: 12px 13px; }

  .result-head h2 { font-size: 16px; }

  .result-number { padding-inline: 12px; }

  .result-number span { font-size: clamp(42px, 16vw, 64px) !important; }

  .result-number small { font-size: 12px; }

  .metric-grid { grid-template-columns: 1fr; }

  .formula-strip { align-items: flex-start; flex-direction: column; gap: 4px; }

  .formula-strip strong { overflow-wrap: anywhere; }

  .content-hero h1 { font-size: 27px; }

  .formula-display { font-size: 17px; padding-inline: 10px; }
}

@media (max-width: 340px) {
  .topbar-title { display: none; }

  .topbar-left { gap: 6px; }

  .tutorial-start-btn { max-width: 43%; padding-inline: 7px; }

  .calc-panel-head h2 { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

.usage-page { display: grid; gap: 14px; }

.usage-page .content-hero { margin-bottom: 0; }

.usage-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }

.usage-hero-copy { min-width: 0; }

.usage-hero-copy p { max-width: 920px; }

.usage-tour-link {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(37,99,235,.20);
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.usage-tour-link:hover { border-color: var(--primary); }

.usage-section { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }

.usage-section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }

.usage-section-index {
  width: 34px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

.usage-section-heading h2 { margin: 0; color: var(--text-strong); line-height: 1.35; }

.usage-section-heading p { margin: 4px 0 0; color: var(--muted); }

.parameter-pill-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }

.parameter-pill {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.parameter-pill strong { color: var(--text-strong); overflow-wrap: anywhere; }

.parameter-pill small { color: var(--muted); }

.usage-formulas { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }

.usage-formula-card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }

.usage-formula-card.primary-formula { grid-column: 1 / -1; }

.formula-title-line { display: flex; align-items: center; gap: 9px; }

.formula-title-line h3 { margin: 0; color: var(--text-strong); line-height: 1.4; }

.formula-badge {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

.equation-box {
  position: relative;
  min-height: 76px;
  margin: 13px 0;
  padding: 15px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: clamp(14px,1.55vw,18px);
  font-weight: 700;
  text-align: center;
  overflow-x: auto;
}

.equation-box.equation-small { font-size: clamp(12px,1.25vw,16px); }

.equation-box > * { flex: 0 0 auto; }

.equation-inline-fixed { flex-wrap: nowrap; }

.equation-nowrap { white-space: nowrap; }

.equation-singleline { min-height: 92px; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

.equation-track { min-width: max-content; display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; margin-inline: auto; }

.fraction { display: inline-grid; grid-template-rows: auto auto; align-items: center; vertical-align: middle; line-height: 1.15; }

.fraction > span { white-space: nowrap; }

.fraction > span:first-child { padding: 0 7px 4px; border-bottom: 1.5px solid currentColor; }

.fraction > span:last-child { padding: 4px 7px 0; }

.fraction.fraction-wide > span:first-child { padding-inline: 12px; }

.paren-fraction { display: inline-flex; align-items: flex-start; gap: 1px; }

.paren-fraction::before { content: "("; align-self: center; font-size: 1.35em; }

.paren-fraction .fraction + sup { margin-left: 2px; }

.paren-fraction::after { content: ")"; order: 2; align-self: center; font-size: 1.35em; }

.paren-fraction sup { order: 3; }

.term-list { margin: 0; display: grid; gap: 7px; }

.term-list > div { display: grid; grid-template-columns: minmax(92px, auto) minmax(0,1fr); gap: 9px; padding-top: 7px; border-top: 1px dashed var(--line); }

.term-list dt { color: var(--text-strong); font-family: var(--mono); font-weight: 800; overflow-wrap: anywhere; }

.term-list dd { margin: 0; color: var(--muted); }

.usage-rules { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }

.usage-rule-card {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.rule-icon {
  min-width: 35px;
  height: 29px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0 7px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-weight: 800;
}

.usage-rule-card h3 { margin: 0; color: var(--text-strong); }

.usage-rule-card p { margin: 4px 0 0; color: var(--muted); }

.validation-note { margin-top: 10px; padding: 13px 15px; border-left: 3px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }

.validation-note strong { color: var(--text-strong); }

.validation-note p { margin: 4px 0 0; color: var(--muted); }

.usage-final-section { margin-bottom: 4px; }

.usage-disclaimer { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid rgba(249,115,22,.18); border-radius: 14px; background: var(--accent-soft); }

.usage-disclaimer p { margin: 0; color: var(--text); }

@media (max-width: 899px) {
  .parameter-pill-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }

  .usage-hero { align-items: flex-start; flex-direction: column; gap: 14px; }

  .usage-tour-link { width: 100%; }
}

@media (max-width: 680px) {
  .usage-section { padding: 15px; border-radius: 16px; }

  .usage-section-heading h2 { font-size: 16px; }

  .usage-formulas, .usage-rules { grid-template-columns: 1fr; }

  .usage-formula-card.primary-formula { grid-column: auto; }

  .term-list > div { grid-template-columns: 1fr; gap: 2px; }

  .equation-box { justify-content: center; text-align: center; font-size: 13px; }
}

@media (max-width: 420px) {
  .parameter-pill-grid { grid-template-columns: 1fr; }

  .usage-section { padding: 13px; }

  .usage-formula-card { padding: 13px; }

  .equation-box { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 560px) {
  .equation-inline-fixed,
  .equation-singleline {
    justify-content: flex-start;
  }

  .equation-inline-fixed .fraction > span,
  .equation-inline-fixed .equation-nowrap,
  .equation-track {
    min-width: max-content;
  }
}

:root { --esak-topbar-height: 70px; }

html,
body,
.admin-shell,
.admin-main,
.view-panel,
#view-calculator,
#view-calculator .dashboard-grid,
#view-calculator .workbench,
#view-calculator #esak-form,
#view-calculator .postbox,
#view-calculator .postbox-body,
#view-calculator .field {
  min-width: 0;
  max-width: 100%;
}

body { min-height: 100dvh; }

#view-calculator { container-type: inline-size; }

#view-calculator .workbench { container-type: inline-size; }

#view-calculator .dashboard-grid.layout-wide { grid-template-columns: minmax(620px, 1.28fr) minmax(420px, .72fr); gap: clamp(14px, 1.15vw, 22px); }

#view-calculator .dashboard-grid.layout-stacked { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 900px) {
  #view-calculator .workbench.form-wide #esak-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "ref ref"
      "machine geometry"
      "dap dap";
  }
}

html.viewport-fit-compact { --esak-topbar-height: 60px; }

html.viewport-fit-compact .admin-shell { grid-template-rows: var(--esak-topbar-height) minmax(0, 1fr); }

html.viewport-fit-compact .admin-topbar { height: var(--esak-topbar-height); padding-left: 22px; padding-right: 18px; gap: 14px; }

html.viewport-fit-compact .logo-mark { width: 34px; height: 34px; }

html.viewport-fit-compact .logo-mark img { width: 28px; height: 28px; }

html.viewport-fit-compact .topbar-title { font-size: 17px; }

html.viewport-fit-compact .topbar-tag { font-size: 11.5px; }

html.viewport-fit-compact .top-nav-item.nav-item { min-height: 38px; padding-inline: 11px; }

html.viewport-fit-compact .utility-btn { min-height: 33px; padding-inline: 10px; }

html.viewport-fit-compact .admin-main { padding-top: 10px; padding-bottom: 10px; }

html.viewport-fit-compact #view-calculator .dashboard-grid { gap: 12px; }

html.viewport-fit-compact #view-calculator .calc-panel-head { min-height: 54px; padding: 8px 12px; }

html.viewport-fit-compact #view-calculator .calc-panel-icon { width: 34px; height: 34px; }

html.viewport-fit-compact #view-calculator .calc-panel-head h2 { font-size: 16px; }

html.viewport-fit-compact #view-calculator .section-kicker { font-size: 8.5px; }

html.viewport-fit-compact #view-calculator .tutorial-start-btn { min-height: 32px; padding-inline: 10px; font-size: 10.5px; }

html.viewport-fit-compact #view-calculator #esak-form { gap: 8px; padding: 8px; }

html.viewport-fit-compact #view-calculator .postbox-title { min-height: 36px; padding: 5px 9px; }

html.viewport-fit-compact #view-calculator .postbox-title h2 { font-size: 12.5px; }

html.viewport-fit-compact #view-calculator .step-no { min-width: 29px; height: 22px; font-size: 9px; }

html.viewport-fit-compact #view-calculator .postbox-body { padding: 8px 9px; }

html.viewport-fit-compact #view-calculator .box-description { margin-bottom: 5px; font-size: 10px; line-height: 1.3; }

html.viewport-fit-compact #view-calculator .form-grid { gap: 7px 9px; }

html.viewport-fit-compact #view-calculator label { margin-bottom: 3px; font-size: 10px; }

html.viewport-fit-compact #view-calculator .input-shell { height: 35px; }

html.viewport-fit-compact #view-calculator .input-shell input { font-size: 12px; }

html.viewport-fit-compact #view-calculator .input-unit { font-size: 9px; }

html.viewport-fit-compact #view-calculator .select-btn { min-height: 39px; padding: 4px 8px; }

html.viewport-fit-compact #view-calculator .select-btn strong { font-size: 10.5px; }

html.viewport-fit-compact #view-calculator .select-btn span { margin-top: 0; font-size: 8px; }

html.viewport-fit-compact #view-calculator .geometry-stack { gap: 7px; }

html.viewport-fit-compact #view-calculator #calc-patient-box .patient-body { padding-top: 7px; padding-bottom: 7px; }

html.viewport-fit-compact #view-calculator .dap-body { gap: 9px; }

html.viewport-fit-compact #view-calculator .dap-shell { height: 37px; }

html.viewport-fit-compact #view-calculator #calc-btn { min-height: 38px; font-size: 12.5px; }

html.viewport-fit-compact #view-calculator .action-row { gap: 4px; }

html.viewport-fit-compact #view-calculator .unit-text,
html.viewport-fit-compact #view-calculator .action-note {
  font-size: 8.5px;
  line-height: 1.2;
}

html.viewport-fit-compact #view-calculator #calc-ref-box,
html.viewport-fit-compact #view-calculator #calc-dap-box {
  display: grid;
  align-items: stretch;
}

html.viewport-fit-compact #view-calculator #calc-ref-box { grid-template-columns: minmax(200px, .58fr) minmax(0, 1.42fr); }

html.viewport-fit-compact #view-calculator #calc-dap-box { grid-template-columns: minmax(112px, .18fr) minmax(0, 1.82fr); }

html.viewport-fit-compact #view-calculator #calc-ref-box > .postbox-title,
html.viewport-fit-compact #view-calculator #calc-dap-box > .postbox-title {
  min-height: 100%;
  border-bottom: 0;
  border-right: 1px solid var(--line);
}

html.viewport-fit-compact #view-calculator #calc-dap-box > .postbox-title { border-right-color: rgba(249,115,22,.18); }

html.viewport-fit-compact #view-calculator #calc-ref-box .title-muted { display: none; }

html.viewport-fit-compact #view-calculator #calc-ref-box > .postbox-body,
html.viewport-fit-compact #view-calculator #calc-dap-box > .postbox-body {
  align-self: center;
}

html.viewport-fit-tight { --esak-topbar-height: 54px; }

html.viewport-fit-tight .admin-topbar { height: var(--esak-topbar-height); padding-left: 18px; padding-right: 16px; }

html.viewport-fit-tight .admin-main { padding-top: 7px; padding-bottom: 7px; }

html.viewport-fit-tight .topbar-tag { display: none; }

html.viewport-fit-tight .topbar-nav { padding: 2px; }

html.viewport-fit-tight .top-nav-item.nav-item { min-height: 36px; padding-inline: 10px; }

html.viewport-fit-tight .utility-btn { min-height: 30px; }

html.viewport-fit-tight #view-calculator .calc-panel-head { min-height: 48px; padding: 6px 10px; }

html.viewport-fit-tight #view-calculator .calc-panel-icon { width: 31px; height: 31px; font-size: 14px; }

html.viewport-fit-tight #view-calculator .calc-panel-head h2 { font-size: 15px; }

html.viewport-fit-tight #view-calculator .tutorial-start-btn { min-height: 29px; }

html.viewport-fit-tight #view-calculator #esak-form { gap: 6px; padding: 6px; }

html.viewport-fit-tight #view-calculator .postbox-title { min-height: 32px; padding: 4px 8px; }

html.viewport-fit-tight #view-calculator .postbox-body { padding: 6px 8px; }

html.viewport-fit-tight #view-calculator .box-description,
html.viewport-fit-tight #view-calculator .unit-text,
html.viewport-fit-tight #view-calculator .action-note {
  display: none;
}

html.viewport-fit-tight #view-calculator .form-grid { gap: 5px 8px; }

html.viewport-fit-tight #view-calculator label { margin-bottom: 2px; font-size: 9.5px; }

html.viewport-fit-tight #view-calculator .input-shell { height: 32px; }

html.viewport-fit-tight #view-calculator .select-btn { min-height: 35px; }

html.viewport-fit-tight #view-calculator .geometry-stack { gap: 5px; }

html.viewport-fit-tight #view-calculator #calc-patient-box .patient-body { padding-top: 5px; padding-bottom: 5px; }

html.viewport-fit-tight #view-calculator .dap-shell { height: 34px; }

html.viewport-fit-tight #view-calculator #calc-btn { min-height: 34px; font-size: 12px; }

html.viewport-fit-ultra { --esak-topbar-height: 50px; }

html.viewport-fit-ultra .admin-topbar { height: var(--esak-topbar-height); }

html.viewport-fit-ultra .admin-main { padding-top: 5px; padding-bottom: 5px; }

html.viewport-fit-ultra #view-calculator .calc-panel-head { min-height: 43px; padding: 5px 9px; }

html.viewport-fit-ultra #view-calculator .section-kicker { display: none; }

html.viewport-fit-ultra #view-calculator .calc-panel-icon { width: 29px; height: 29px; }

html.viewport-fit-ultra #view-calculator #esak-form { gap: 5px; padding: 5px; }

html.viewport-fit-ultra #view-calculator .postbox-title { min-height: 29px; padding: 3px 7px; }

html.viewport-fit-ultra #view-calculator .postbox-title h2 { font-size: 11.5px; }

html.viewport-fit-ultra #view-calculator .step-no { min-width: 26px; height: 20px; font-size: 8.5px; }

html.viewport-fit-ultra #view-calculator .postbox-body { padding: 5px 7px; }

html.viewport-fit-ultra #view-calculator .input-shell { height: 30px; }

html.viewport-fit-ultra #view-calculator .select-btn { min-height: 32px; padding-block: 3px; }

html.viewport-fit-ultra #view-calculator .dap-shell { height: 32px; }

html.viewport-fit-ultra #view-calculator #calc-btn { min-height: 32px; }

html.content-page-active,
html.content-page-active body {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
}

@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  html.viewport-fit-compact,
  html.viewport-fit-tight,
  html.viewport-fit-ultra {
    --esak-topbar-height: 70px;
  }
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .admin-shell { grid-template-rows: 54px minmax(0, 1fr); }

  .admin-topbar { height: 54px; padding-left: 20px; padding-right: 18px; gap: 14px; }

  .logo-mark { width: 34px; height: 34px; border-radius: 10px; }

  .logo-mark img { width: 28px; height: 28px; }

  .top-nav-item.nav-item { min-height: 37px; padding-inline: 11px; }

  .utility-btn { min-height: 34px; padding-inline: 11px; }

  .admin-main { padding: 12px 16px 16px; }

  #view-calculator { width: 100%; max-width: none; }

  #view-calculator .dashboard-grid.layout-wide {
    grid-template-columns: minmax(720px, 1.64fr) minmax(470px, .96fr);
    gap: 16px;
    min-height: calc(100dvh - var(--esak-topbar-height) - 28px);
  }

  #view-calculator .calc-panel-head { min-height: 62px; padding: 10px 16px; }

  #view-calculator .calc-panel-icon { width: 38px; height: 38px; }

  #view-calculator .tutorial-start-btn { min-height: 36px; padding-inline: 12px; }

  #view-calculator #esak-form { gap: 11px; padding: 13px 14px 14px; }

  #view-calculator .postbox-title { min-height: 43px; padding: 7px 12px; }

  #view-calculator .step-no { min-width: 31px; height: 24px; }

  #view-calculator .postbox-body { padding: 11px 12px 12px; }

  #view-calculator .box-description { margin-bottom: 8px; }

  #view-calculator .form-grid { gap: 9px 10px; }

  #view-calculator label { margin-bottom: 4px; }

  #view-calculator .input-shell { height: 40px; }

  #view-calculator .select-btn { min-height: 48px; padding: 6px 9px; }

  #view-calculator .geometry-stack { gap: 9px; }

  #view-calculator #calc-patient-box .patient-body { padding-top: 9px; padding-bottom: 9px; }

  #view-calculator .dap-body { gap: 12px; }

  #view-calculator .dap-shell { height: 44px; }

  #view-calculator #calc-btn { min-height: 44px; }

  #view-calculator .result-head { min-height: 68px; padding: 12px 18px; }

  #view-calculator .result-body { padding: 18px; gap: 13px; }

  #view-calculator .result-number { min-height: 132px; padding: 20px 18px 18px; align-items: center; }

  #view-calculator .result-toggle-btn { min-height: 42px; }

  html.viewport-fit-compact #view-calculator #calc-ref-box,
  html.viewport-fit-compact #view-calculator #calc-dap-box,
  html.viewport-fit-tight #view-calculator #calc-ref-box,
  html.viewport-fit-tight #view-calculator #calc-dap-box,
  html.viewport-fit-ultra #view-calculator #calc-ref-box,
  html.viewport-fit-ultra #view-calculator #calc-dap-box {
    display: block;
  }

  html.viewport-fit-compact #view-calculator #calc-ref-box > .postbox-title,
  html.viewport-fit-compact #view-calculator #calc-dap-box > .postbox-title,
  html.viewport-fit-tight #view-calculator #calc-ref-box > .postbox-title,
  html.viewport-fit-tight #view-calculator #calc-dap-box > .postbox-title,
  html.viewport-fit-ultra #view-calculator #calc-ref-box > .postbox-title,
  html.viewport-fit-ultra #view-calculator #calc-dap-box > .postbox-title {
    min-height: unset;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  html.viewport-fit-compact #view-calculator #calc-dap-box > .postbox-title,
  html.viewport-fit-tight #view-calculator #calc-dap-box > .postbox-title,
  html.viewport-fit-ultra #view-calculator #calc-dap-box > .postbox-title {
    border-bottom-color: rgba(249,115,22,.18);
  }

  html.viewport-fit-compact #view-calculator #calc-ref-box .title-muted,
  html.viewport-fit-tight #view-calculator #calc-ref-box .title-muted,
  html.viewport-fit-ultra #view-calculator #calc-ref-box .title-muted {
    display: inline;
  }

  html.viewport-fit-compact { --esak-topbar-height: 50px; }

  html.viewport-fit-compact .admin-shell { grid-template-rows: 50px minmax(0,1fr); }

  html.viewport-fit-compact .admin-topbar { height: 50px; padding-left: 18px; padding-right: 16px; }

  html.viewport-fit-compact .admin-main { padding-top: 8px; padding-bottom: 10px; padding-left: 14px; padding-right: 14px; }

  html.viewport-fit-compact #view-calculator .dashboard-grid { gap: 12px; }

  html.viewport-fit-compact #view-calculator .calc-panel-head { min-height: 56px; padding: 7px 13px; }

  html.viewport-fit-compact #view-calculator .calc-panel-icon { width: 36px; height: 36px; }

  html.viewport-fit-compact #view-calculator #esak-form { padding: 9px 11px 10px; }

  html.viewport-fit-compact #view-calculator .postbox-title { min-height: 39px; padding: 5px 10px; }

  html.viewport-fit-compact #view-calculator .postbox-body { padding: 8px 10px 9px; }

  html.viewport-fit-compact #view-calculator .box-description { margin-bottom: 5px; }

  html.viewport-fit-compact #view-calculator .form-grid { gap: 7px 9px; }

  html.viewport-fit-compact #view-calculator label { margin-bottom: 3px; }

  html.viewport-fit-compact #view-calculator .input-shell { height: 38px; }

  html.viewport-fit-compact #view-calculator .select-btn { min-height: 44px; padding: 5px 8px; }

  html.viewport-fit-compact #view-calculator .geometry-stack { gap: 7px; }

  html.viewport-fit-compact #view-calculator #calc-patient-box .patient-body { padding-top: 7px; padding-bottom: 7px; }

  html.viewport-fit-compact #view-calculator .dap-shell { height: 41px; }

  html.viewport-fit-compact #view-calculator #calc-btn { min-height: 41px; }

  html.viewport-fit-compact #view-calculator .unit-text,
  html.viewport-fit-compact #view-calculator .action-note {
    font-size: 9px;
  }

  html.viewport-fit-tight { --esak-topbar-height: 48px; }

  html.viewport-fit-tight .admin-shell { grid-template-rows: 48px minmax(0,1fr); }

  html.viewport-fit-tight .admin-topbar { height: 48px; }

  html.viewport-fit-tight .admin-main { padding-top: 6px; padding-bottom: 8px; padding-left: 12px; padding-right: 12px; }

  html.viewport-fit-tight .topbar-tag { display: none; }

  html.viewport-fit-tight #view-calculator .calc-panel-head { min-height: 52px; padding: 6px 11px; }

  html.viewport-fit-tight #view-calculator #esak-form { padding: 7px 9px 8px; }

  html.viewport-fit-tight #view-calculator .postbox-title { min-height: 36px; padding: 4px 9px; }

  html.viewport-fit-tight #view-calculator .postbox-body { padding: 6px 9px 7px; }

  html.viewport-fit-tight #view-calculator .box-description,
  html.viewport-fit-tight #view-calculator .unit-text,
  html.viewport-fit-tight #view-calculator .action-note {
    display: none;
  }

  html.viewport-fit-tight #view-calculator .form-grid { gap: 6px 8px; }

  html.viewport-fit-tight #view-calculator .input-shell { height: 36px; }

  html.viewport-fit-tight #view-calculator .select-btn { min-height: 41px; }

  html.viewport-fit-tight #view-calculator .geometry-stack { gap: 6px; }

  html.viewport-fit-tight #view-calculator .dap-shell { height: 39px; }

  html.viewport-fit-tight #view-calculator #calc-btn { min-height: 39px; font-size: 12.5px; }

  html.viewport-fit-ultra { --esak-topbar-height: 46px; }

  html.viewport-fit-ultra .admin-shell { grid-template-rows: 46px minmax(0,1fr); }

  html.viewport-fit-ultra .admin-topbar { height: 46px; }

  html.viewport-fit-ultra .admin-main { padding-top: 4px; padding-bottom: 6px; padding-left: 10px; padding-right: 10px; }

  html.viewport-fit-ultra #view-calculator .calc-panel-head { min-height: 49px; padding: 5px 10px; }

  html.viewport-fit-ultra #view-calculator #esak-form { padding: 6px 8px; }

  html.viewport-fit-ultra #view-calculator .postbox-title { min-height: 34px; padding: 3px 8px; }

  html.viewport-fit-ultra #view-calculator .postbox-body { padding: 5px 8px 6px; }

  html.viewport-fit-ultra #view-calculator .input-shell { height: 35px; }

  html.viewport-fit-ultra #view-calculator .select-btn { min-height: 39px; }

  html.viewport-fit-ultra #view-calculator .dap-shell { height: 38px; }

  html.viewport-fit-ultra #view-calculator #calc-btn { min-height: 38px; }
}

@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .admin-shell { grid-template-rows: 70px minmax(0,1fr); }

  .admin-topbar { height: 70px; }
}

:root { --esak-ui-label: 13px; --esak-ui-copy: 12.5px; --esak-ui-small: 11.5px; --esak-ui-card-title: 15.5px; }

#view-calculator .calc-panel-head h2,
#view-calculator .postbox-title h2,
#view-calculator label,
#view-calculator .select-btn strong,
#view-calculator .select-btn span,
#view-calculator .input-unit,
#view-calculator .unit-badge,
#view-calculator #calc-btn span,
.top-nav-label,
.utility-btn {
  white-space: nowrap;
}

#view-calculator .postbox-heading { min-width: 0; flex-wrap: nowrap; }

#view-calculator .postbox-title h2 { overflow: hidden; text-overflow: ellipsis; }

#view-calculator .box-description,
#view-calculator .unit-text,
#view-calculator .action-note,
#view-calculator .result-note,
#view-calculator .result-footer-note {
  text-wrap: pretty;
}

#calc-ref-box { container-type: inline-size; container-name: esak-reference-card; }

@container esak-reference-card (max-width: 560px) {
  #calc-ref-box .title-muted { display: none !important; }
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .topbar-title { font-size: 18px; }

  .topbar-tag { font-size: 12.5px; }

  .top-nav-label { font-size: clamp(13.5px, .82vw, 15px); }

  .utility-btn { font-size: 12.5px; }

  #view-calculator .section-kicker { font-size: 10.5px; }

  #view-calculator .calc-panel-head h2 { font-size: clamp(19px, 1.25vw, 21px); }

  #view-calculator .tutorial-start-btn { font-size: 12.5px; }

  #view-calculator .postbox-title h2 { font-size: var(--esak-ui-card-title); }

  #view-calculator .step-no { font-size: 10.5px; }

  #view-calculator .box-description { font-size: var(--esak-ui-copy); }

  #view-calculator label { font-size: var(--esak-ui-label); }

  #view-calculator label sub { font-size: 10px; }

  #view-calculator .input-shell input { font-size: 14px; }

  #view-calculator .input-unit { font-size: 11.5px; }

  #view-calculator .select-btn strong { font-size: 13px; }

  #view-calculator .select-btn span { font-size: 10.5px; }

  #view-calculator .unit-badge { font-size: 10.5px; }

  #view-calculator .dap-shell .dap-input { font-size: 16.5px; }

  #view-calculator .unit-text { font-size: 11.5px; }

  #view-calculator .action-note { font-size: 10.5px; }

  #view-calculator #calc-btn { font-size: 14.5px; }

  #view-calculator .result-head h2 { font-size: 18px; }

  #view-calculator .result-kicker { font-size: 10.5px; }

  #view-calculator .dose-label { font-size: 11.5px; }

  #view-calculator .result-note { font-size: 12px; }

  #view-calculator .result-toggle-btn { font-size: 12px; }

  #view-calculator .result-footer-note { font-size: 10.5px; }

  html.viewport-fit-compact #view-calculator .section-kicker { font-size: 10px; }

  html.viewport-fit-compact #view-calculator .tutorial-start-btn { font-size: 12px; }

  html.viewport-fit-compact #view-calculator .postbox-body { padding-top: 7px; padding-bottom: 8px; }

  html.viewport-fit-tight #view-calculator .postbox-body { padding-top: 5px; padding-bottom: 6px; }

  html.viewport-fit-ultra #view-calculator .postbox-body { padding-top: 4px; padding-bottom: 5px; }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .topbar-tag { display: none; }

  #view-calculator .action-note { display: none; }

  #view-calculator .postbox-title h2 { font-size: 15px; }

  #view-calculator label { font-size: 12.5px; }
}

@media (max-width: 899px) {
}

@media (max-width: 480px) {
}

@media (max-width: 380px) {
  .topbar-nav { gap: 2px; padding: 3px; border-radius: 12px; }

  .top-nav-item.nav-item { min-height: 37px; padding-inline: 4px; border-radius: 8px; }

  .top-nav-label { letter-spacing: -.015em; }
}

@media (max-width: 340px) {
  .top-nav-item.nav-item { min-height: 36px; padding-inline: 2px; }
}

:root { --type-body: 16px; --type-ui: 14.5px; --type-small: 13px; --type-label: 14.5px; --type-input: 15.5px; --type-card-title: 16.5px; --type-section-title: 21px; }

body { font-size: var(--type-body); }

.topbar-title { font-size: 20px; }

.topbar-tag { font-size: 14px; }

.utility-btn { font-size: 14px; }

.page-eyebrow,
.section-kicker {
  font-size: 11.5px;
}

.page-title h1 { font-size: clamp(28px, 2.5vw, 36px); }

.page-title p { font-size: 15.5px; }

#view-calculator .calc-panel-head h2 { font-size: clamp(21px, 1.3vw, 23px); }

#view-calculator .tutorial-start-btn { font-size: 14px; }

#view-calculator .box-description { line-height: 1.5; }

#view-calculator label { font-size: var(--type-label); line-height: 1.35; }

#view-calculator label sub { font-size: 11px; }

#view-calculator .dap-shell .dap-input { font-size: 17px; }

#view-calculator .unit-text { font-size: 12.5px; line-height: 1.45; }

#view-calculator .action-note { font-size: 12.5px; line-height: 1.45; }

#view-calculator .admin-btn.compact { font-size: 12.5px; }

#view-calculator .result-kicker { font-size: 11.5px; }

#view-calculator .result-note { font-size: 13.5px; line-height: 1.5; }

#view-calculator .formula-strip { font-size: 12.5px; }

#view-calculator .formula-strip strong { font-size: 13px; }

#view-calculator .metric span { font-size: 11.5px; }

#view-calculator .metric strong { font-size: 13.5px; }

#view-calculator .warning-msg,
#view-calculator .step-row {
  font-size: 12.5px;
}

.content-hero h1 { font-size: clamp(30px, 3.15vw, 44px); }

.content-hero p { font-size: 15.5px; line-height: 1.65; }

.guide-step h2 { font-size: 17px; }

.guide-step p { font-size: 14.5px; line-height: 1.65; }

.content-card h2 { font-size: 18px; }

.content-card p,
.clean-list li {
  font-size: 14.5px;
  line-height: 1.65;
}

.inline-action { font-size: 14px; }

.feature-index { font-size: 12.5px; }

.formula-card h2 { font-size: 20px; }

.formula-card p { font-size: 14.5px; line-height: 1.65; }

.disclaimer-card h2 { font-size: 17px; }

.disclaimer-card p { font-size: 14.5px; line-height: 1.65; }

.usage-section-heading h2 { font-size: 21px; }

.usage-section-heading p { font-size: 14.5px; line-height: 1.6; }

.parameter-pill strong { font-size: 14.5px; }

.parameter-pill small { font-size: 12.5px; }

.formula-title-line h3 { font-size: 16.5px; }

.term-list dt { font-size: 12.5px; }

.term-list dd { font-size: 14px; line-height: 1.65; }

.rule-icon { font-size: 10.5px; }

.usage-rule-card h3 { font-size: 15.5px; }

.usage-rule-card p { font-size: 14px; line-height: 1.65; }

.validation-note strong { font-size: 14.5px; }

.validation-note p { font-size: 14px; line-height: 1.6; }

.usage-disclaimer p { font-size: 14.5px; line-height: 1.75; }

.tour-step-badge { font-size: 11.5px; }

.tour-popup-body h3 { font-size: 19px; }

.tour-popup-body p,
.tour-popup-body li {
  font-size: 14px;
  line-height: 1.65;
}

.tour-btn { font-size: 13.5px; }

.tour-step-status { font-size: 11.5px; }

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  html.viewport-fit-compact #view-calculator .calc-panel-head h2 { font-size: 20px; }

  html.viewport-fit-compact #view-calculator .postbox-title h2 { font-size: 16px; }

  html.viewport-fit-compact #view-calculator .step-no { font-size: 11px; }

  html.viewport-fit-compact #view-calculator .box-description { font-size: 13px; }

  html.viewport-fit-compact #view-calculator label { font-size: 13.5px; }

  html.viewport-fit-compact #view-calculator .input-shell input { font-size: 15px; }

  html.viewport-fit-compact #view-calculator .input-unit { font-size: 12px; }

  html.viewport-fit-compact #view-calculator .select-btn strong { font-size: 13.5px; }

  html.viewport-fit-compact #view-calculator .select-btn span { font-size: 11.5px; }

  html.viewport-fit-compact #view-calculator .unit-text { font-size: 12px; }

  html.viewport-fit-compact #view-calculator .action-note { font-size: 11.5px; }

  html.viewport-fit-compact #view-calculator #calc-btn { font-size: 15px; }

  html.viewport-fit-tight #view-calculator .calc-panel-head h2,
  html.viewport-fit-ultra #view-calculator .calc-panel-head h2 {
    font-size: 19px;
  }

  html.viewport-fit-tight #view-calculator .postbox-title h2,
  html.viewport-fit-ultra #view-calculator .postbox-title h2 {
    font-size: 15.5px;
  }

  html.viewport-fit-tight #view-calculator label,
  html.viewport-fit-ultra #view-calculator label {
    font-size: 13.5px;
  }

  html.viewport-fit-tight #view-calculator .input-shell input,
  html.viewport-fit-ultra #view-calculator .input-shell input {
    font-size: 14.5px;
  }

  html.viewport-fit-tight #view-calculator .input-unit,
  html.viewport-fit-ultra #view-calculator .input-unit {
    font-size: 11.5px;
  }

  html.viewport-fit-tight #view-calculator .select-btn strong,
  html.viewport-fit-ultra #view-calculator .select-btn strong {
    font-size: 13px;
  }

  html.viewport-fit-tight #view-calculator .select-btn span,
  html.viewport-fit-ultra #view-calculator .select-btn span {
    font-size: 11px;
  }

  html.viewport-fit-tight #view-calculator #calc-btn,
  html.viewport-fit-ultra #view-calculator #calc-btn {
    font-size: 14.5px;
  }

  html.viewport-fit-compact #view-calculator #esak-form { gap: 8px; }

  html.viewport-fit-tight #view-calculator #esak-form { gap: 6px; }

  html.viewport-fit-ultra #view-calculator #esak-form { gap: 5px; }
}

@media (max-width: 899px) {
  body { font-size: 16px; }

  .topbar-title { font-size: 19px; }

  .topbar-tag { font-size: 13.5px; }

  .top-nav-label { font-size: clamp(12.5px, 3vw, 14px); }

  .utility-btn { font-size: 13px; }

  #view-calculator .section-kicker { font-size: 10.5px; }

  #view-calculator .calc-panel-head h2 { font-size: clamp(19px, 4.8vw, 22px); }

  #view-calculator .tutorial-start-btn { font-size: 13px; }

  #view-calculator .postbox-title h2 { font-size: 16px; }

  #view-calculator .step-no { font-size: 11px; }

  #view-calculator .box-description { font-size: 14px; }

  #view-calculator label { font-size: 14.5px; }

  #view-calculator .input-shell input { font-size: 16px; }

  #view-calculator .input-unit { font-size: 12.5px; }

  #view-calculator .select-btn strong { font-size: 14px; }

  #view-calculator .select-btn span { font-size: 12px; }

  #view-calculator .unit-text { font-size: 13px; }

  #view-calculator .action-note { font-size: 13px; }

  #view-calculator #calc-btn { font-size: 15.5px; }

  .content-hero p,
  .guide-step p,
  .content-card p,
  .clean-list li,
  .formula-card p,
  .disclaimer-card p,
  .usage-section-heading p,
  .term-list dd,
  .usage-rule-card p,
  .validation-note p,
  .usage-disclaimer p,
  .tour-popup-body p,
  .tour-popup-body li {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .top-nav-label { font-size: 12px; }

  #view-calculator .postbox-title h2 { font-size: 15.5px; }

  #view-calculator label { font-size: 14.5px; }

  #view-calculator .select-btn strong { font-size: 13.5px; }

  #view-calculator .select-btn span { font-size: 11.5px; }
}

@media (max-width: 380px) {
  .top-nav-label { font-size: 11.5px; }
}

@media (max-width: 340px) {
  .top-nav-label { font-size: 11px; }
}

@media (max-width: 899px) {
  .page-quick-links {
    top: calc(var(--esak-topbar-height) + 8px);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    overflow: visible;
    padding: 8px;
  }

  .quick-link { flex: 0 1 auto; min-width: 0; max-width: 100%; padding-inline: 12px; white-space: normal; text-align: center; line-height: 1.25; }
}

@media (max-width: 680px) {
  .hero-chip-row { gap: 8px; }

  .hero-chip { min-height: 32px; font-size: 11.5px; }

  .page-quick-links { border-radius: 14px; gap: 7px; }

  .quick-link { min-height: 40px; padding: 7px 11px; font-size: clamp(11.5px, 3.45vw, 13px); }
}

@media (max-width: 420px) {
  .page-quick-links { padding: 7px; gap: 6px; }

  .quick-link { min-height: 38px; padding-inline: 10px; font-size: 12px; }
}

@media (max-width: 340px) {
  .quick-link { padding-inline: 9px; font-size: 11.5px; }
}

.content-tab-panel[hidden] { display: none !important; }

.content-tabs { margin-bottom: 14px; }

.content-tab { position: relative; isolation: isolate; }

.content-tab::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary);
  opacity: 0;
  transform: scaleX(.45);
  transition: opacity .18s ease, transform .18s ease;
}

.content-tab.active::after { opacity: 1; transform: scaleX(1); }

.show-all-tab { margin-left: 0; border-style: dashed; }

.show-all-tab.active { background: var(--surface-tint); }

.content-tab-panel.tab-panel-enter { animation: contentTabEnter .28s ease both; }

@keyframes contentTabEnter {
  from { opacity: .35; transform: translateY(8px); }

  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .content-tab-panel.tab-panel-enter { animation: none; }

  .content-tab::after { transition: none; }
}

@media (max-width: 680px) {
  .content-page .page-quick-links.content-tabs {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(37, 99, 235, .08);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--primary-soft) 32%, var(--surface)));
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
    backdrop-filter: none;
  }

  .content-page .content-tabs .quick-link.content-tab {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.92);
    color: var(--text-strong);
    font-size: clamp(12.5px, 3.45vw, 13.5px);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
    transform: none;
  }

  .content-page .content-tabs .quick-link.content-tab:hover { transform: none; }

  .content-page .content-tabs .quick-link.content-tab.active {
    border-color: rgba(37, 99, 235, .22);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
  }

  .content-page .content-tabs .content-tab::after { display: none; }

  .content-page .content-tabs .show-all-tab { grid-column: 1 / -1; min-height: 40px; border-style: dashed; background: transparent; color: var(--muted); box-shadow: none; }

  .content-page .content-tabs .show-all-tab.active { border-style: solid; background: rgba(255,255,255,.88); color: var(--primary); box-shadow: 0 4px 12px rgba(15, 23, 42, .04); }
}

@media (max-width: 360px) {
  .content-page .page-quick-links.content-tabs { grid-template-columns: 1fr; gap: 8px; padding: 9px; }

  .content-page .content-tabs .quick-link.content-tab { min-height: 43px; font-size: 12.5px; }

  .content-page .content-tabs .show-all-tab { grid-column: auto; }
}

@media (min-width: 1025px) {
  #view-calculator .dashboard-grid.layout-wide { grid-template-columns: minmax(0, 1.72fr) minmax(360px, 0.92fr); gap: clamp(16px, 1vw, 20px); }
}

#view-calculator .field label { color: var(--text-strong); }

#view-calculator .step-no { font-size: 13px; }

#view-calculator .action-row { width: 100%; }

#view-calculator #calc-btn { justify-content: space-between; }

#view-calculator .result-placeholder {
  place-items: center;
  border: 1px dashed rgba(37, 99, 235, .22);
  background: linear-gradient(180deg, rgba(37, 99, 235, .03), rgba(37, 99, 235, .01));
  color: var(--muted);
}

#view-calculator .result-placeholder strong { color: var(--text-strong); }

#view-calculator .result-card.has-result .result-placeholder { display: none !important; }

@media (max-width: 1024px) {
  #view-calculator .dap-body { grid-template-columns: 1fr; }

  #view-calculator #calc-btn { width: 100%; }
}

@media (max-width: 768px) {
  #view-calculator .input-shell { height: 44px; }

  #view-calculator .select-btn { min-height: 52px; }
}

.topbar-nav { gap: 6px; }

.top-nav-item.nav-item { width: 100%; min-height: 42px; padding: 0 14px; border-radius: 12px; }

.top-nav-item.nav-item.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent); }

.top-nav-label { font-size: 14px; font-weight: 700; line-height: 1.1; letter-spacing: 0; }

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
  .topbar-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }

  .top-nav-item.nav-item { min-height: 40px; padding: 0 10px; border-radius: 10px; }

  .top-nav-label { font-size: 12.5px; }
}

#view-calculator .result-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

#view-calculator .result-card.result-compact:not(.has-result) .result-placeholder { display: none !important; }

@media (min-width: 1080px) {
  #view-calculator .dashboard-grid.layout-wide { grid-template-columns: minmax(0, 1.66fr) minmax(340px, .90fr); gap: clamp(16px, 1vw, 20px); align-items: start; }

  #view-calculator .dashboard-grid.layout-wide .workbench,
  #view-calculator .dashboard-grid.layout-wide .result-card {
    height: auto;
  }

  #view-calculator .dashboard-grid.layout-wide .result-stack { display: block; height: auto; position: sticky; top: calc(var(--esak-topbar-height) + 14px); align-self: start; }
}

#view-calculator .workbench { overflow: visible; }

#view-calculator .calc-panel-head { min-height: 76px; padding: 15px 18px; }

#view-calculator #esak-form { gap: 14px; padding: 15px; }

#view-calculator .postbox { border-radius: 16px; }

#view-calculator .postbox-title { min-height: 52px; padding: 10px 14px; }

#view-calculator .postbox-heading { align-items: center; }

#view-calculator .postbox-title h2 { min-height: 24px; display: inline-flex; align-items: center; font-size: clamp(16px, .98vw, 17.5px); line-height: 1.2; }

#view-calculator .step-no { min-width: 34px; height: 28px; border-radius: 9px; }

#view-calculator .postbox-body { padding: 14px; }

#view-calculator .box-description { margin: 0 0 10px; color: #334155; font-size: 12px; font-weight: 500; }

#view-calculator .field label { margin-bottom: 6px; line-height: 1.25; }

#view-calculator .input-shell { height: 45px; border-radius: 13px; }

#view-calculator .segmented { gap: 10px; }

#view-calculator .select-btn { min-height: 54px; border-radius: 13px; }

#view-calculator .select-btn strong { font-size: 13.5px; }

#view-calculator .select-btn span { font-size: 10.5px; }

#view-calculator #geometry-stack { gap: 12px; }

#view-calculator #calc-patient-box { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--primary-soft)), var(--surface)); }

#view-calculator #calc-patient-box .patient-body { padding-top: 14px; padding-bottom: 14px; }

#view-calculator .dap-panel { box-shadow: 0 1px 0 rgba(226, 85, 98, .06); }

#view-calculator .dap-panel .postbox-title { background: linear-gradient(90deg, color-mix(in srgb, var(--dap-accent-soft) 78%, white), var(--surface)); }

#view-calculator .unit-badge { font-size: 10px; }

#view-calculator .dap-body { grid-template-columns: 1fr; gap: 10px; }

#view-calculator #calc-btn {
  width: 100%;
  min-height: 49px;
  padding-inline: 18px;
  border-radius: 13px;
  background: linear-gradient(135deg, #ea676d, #dd535c);
  box-shadow: 0 10px 22px rgba(221, 83, 92, .18);
  font-size: 15px;
}

#view-calculator #calc-btn:hover { background: linear-gradient(135deg, #df5d66, #d04752); box-shadow: 0 12px 24px rgba(221, 83, 92, .22); }

#view-calculator .result-card { border-radius: 18px; }

#view-calculator .result-head { min-height: 78px; padding: 16px 18px; }

#view-calculator .result-head h2 { font-size: 18.5px; }

#view-calculator .result-body { display: flex; flex-direction: column; gap: 12px; padding: 16px; }

#view-calculator .dose-label { font-size: 10.5px; }

#view-calculator .result-number { min-height: 138px; padding: 18px 16px 16px; }

#view-calculator .result-detail-region {
  display: grid;
  gap: 12px;
  overflow: hidden;
  max-height: 520px;
  opacity: 1;
  transition: max-height .28s ease, opacity .2s ease, margin .28s ease;
}

#view-calculator .result-card.result-compact .result-detail-region { max-height: 0; opacity: 0; margin-top: -4px; pointer-events: none; }

#view-calculator .result-placeholder { flex: 0 0 auto; min-height: 98px; gap: 7px; padding: 14px 14px; border-radius: 14px; }

#view-calculator .result-placeholder strong { font-size: 13.5px; }

#view-calculator .result-placeholder span { max-width: 30ch; font-size: 12px; line-height: 1.5; }

#view-calculator .warning-msg,
#view-calculator .calc-summary {
  display: block;
}

#view-calculator .calc-summary { overflow: hidden; border-radius: 12px; }

#view-calculator .step-row { padding: 9px 11px; font-size: 11px; }

#view-calculator .result-toggle-btn { min-height: 40px; border-radius: 11px; font-size: 12px; }

#view-calculator .result-footer-note { padding: 11px 16px 13px; font-size: 11px; }

@media (max-width: 1079px) {
  #view-calculator .dashboard-grid.layout-wide,
  #view-calculator .dashboard-grid {
    align-items: start;
  }

  #view-calculator .dashboard-grid.layout-wide .result-stack { position: static; height: auto; }

  #view-calculator .dashboard-grid.layout-wide .result-card,
  #view-calculator .dashboard-grid.layout-wide .workbench {
    height: auto;
  }
}

@media (max-width: 1024px) {
  #view-calculator #esak-form,
  #view-calculator .workbench.form-wide #esak-form {
    gap: 12px;
    padding: 13px;
  }

  #view-calculator .postbox-title { min-height: 50px; }

  #view-calculator .postbox-title h2 { font-size: 16px; }

  #view-calculator .input-shell { height: 44px; }

  #view-calculator .select-btn { min-height: 52px; }

  #view-calculator #calc-btn { min-height: 48px; background: linear-gradient(135deg, #ea676d, #dd535c); box-shadow: 0 10px 20px rgba(221, 83, 92, .16); }

  #view-calculator #calc-btn:hover { background: linear-gradient(135deg, #df5d66, #d04752); box-shadow: 0 12px 22px rgba(221, 83, 92, .2); }
}

@media (max-width: 768px) {
  #view-calculator .calc-panel-head { min-height: 72px; }

  #view-calculator .postbox-title h2 { min-height: 0; font-size: 15.5px; line-height: 1.25; }

  #view-calculator .box-description { font-size: 11.75px; }

  #view-calculator .result-number { min-height: 124px; }

  #view-calculator .result-placeholder { min-height: 92px; }
}

@media (max-width: 480px) {
  #view-calculator .calc-panel-head { padding: 14px 14px; }

  #view-calculator #esak-form { padding: 12px; gap: 11px; }

  #view-calculator .postbox-title,
  #view-calculator .postbox-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  #view-calculator .input-shell { height: 44px; }

  #view-calculator .input-shell input { font-size: 16px; }

  #view-calculator .result-body { padding: 14px; }

  #view-calculator .result-number span { font-size: clamp(42px, 11vw, 64px); }

  #view-calculator .result-placeholder strong { font-size: 13px; }

  #view-calculator .result-placeholder span { font-size: 11.5px; }
}

#view-calculator .calc-summary:empty,
#view-calculator .warning-msg:empty {
  display: none !important;
}

#view-calculator .select-btn.active {
  border-color: rgba(37,99,235,.34);
  background: color-mix(in srgb, var(--primary-soft) 78%, var(--surface));
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.04);
}

#view-calculator #calc-btn:focus-visible,
#view-calculator .result-toggle-btn:focus-visible,
#view-calculator .select-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  outline-offset: 2px;
}

.usage-hero-copy > .page-eyebrow,
.about-hero-copy > .page-eyebrow {
  display: none !important;
}

.content-hero h1 { color: var(--text-strong) !important; text-shadow: none !important; -webkit-text-stroke: 0 transparent; filter: none !important; }

.usage-hero .content-hero h1,
.about-hero .content-hero h1,
.usage-hero h1,
.about-hero h1 {
  color: #000000 !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  paint-order: normal;
  filter: none !important;
}

.usage-hero h1,
.about-hero h1 {
  color: var(--primary) !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  filter: none !important;
}

.calc-panel-head-copy.no-kicker { display: flex; align-items: center; }

.calc-panel-head-copy.no-kicker > div { display: flex; align-items: center; }

.calc-panel-head-copy.no-kicker .section-kicker,
.calc-panel-head-copy.no-kicker .calc-panel-icon {
  display: none !important;
}

.calc-panel-head-copy.no-kicker h2 { margin: 0; }

.panel-heading-copy.no-kicker { gap: 0; }

.panel-heading-copy.no-kicker h2 { margin: 0; }

.topbar-nav { box-sizing: border-box; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

.top-nav-item.nav-item,
html.viewport-fit-compact .top-nav-item.nav-item,
html.viewport-fit-tight .top-nav-item.nav-item,
html.viewport-fit-ultra .top-nav-item.nav-item {
  box-sizing: border-box;
  width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 14px !important;
  border-width: 0 !important;
  border-radius: 12px !important;
}

.top-nav-item.nav-item.active { border-width: 0 !important; }

.top-nav-label,
html.viewport-fit-compact .top-nav-label,
html.viewport-fit-tight .top-nav-label,
html.viewport-fit-ultra .top-nav-label {
  font-size: 14px !important;
  line-height: 1 !important;
  font-weight: 700 !important;
}

@media (min-width: 1181px) {
  .topbar-nav { width: 468px !important; gap: 6px !important; padding: 4px !important; }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .topbar-nav { width: 348px !important; gap: 4px !important; padding: 4px !important; }

  .top-nav-item.nav-item,
  html.viewport-fit-compact .top-nav-item.nav-item,
  html.viewport-fit-tight .top-nav-item.nav-item,
  html.viewport-fit-ultra .top-nav-item.nav-item {
    padding-inline: 8px !important;
  }
}

@media (max-width: 899px) {
  .topbar-nav { width: 100% !important; gap: 4px !important; padding: 4px !important; }

  .top-nav-item.nav-item,
  html.viewport-fit-compact .top-nav-item.nav-item,
  html.viewport-fit-tight .top-nav-item.nav-item,
  html.viewport-fit-ultra .top-nav-item.nav-item {
    height: 41px !important;
    min-height: 41px !important;
    max-height: 41px !important;
    padding-inline: 8px !important;
    border-radius: 10px !important;
  }

  .top-nav-label,
  html.viewport-fit-compact .top-nav-label,
  html.viewport-fit-tight .top-nav-label,
  html.viewport-fit-ultra .top-nav-label {
    font-size: clamp(11.5px, 2.7vw, 13px) !important;
  }
}

@media (max-width: 380px) {
  .top-nav-item.nav-item,
  html.viewport-fit-compact .top-nav-item.nav-item,
  html.viewport-fit-tight .top-nav-item.nav-item,
  html.viewport-fit-ultra .top-nav-item.nav-item {
    height: 39px !important;
    min-height: 39px !important;
    max-height: 39px !important;
    padding-inline: 3px !important;
  }

  .top-nav-label,
  html.viewport-fit-compact .top-nav-label,
  html.viewport-fit-tight .top-nav-label,
  html.viewport-fit-ultra .top-nav-label {
    font-size: 10.75px !important;
  }
}

@media (min-width: 1181px) {
  html,
  html.viewport-fit-compact,
  html.viewport-fit-tight,
  html.viewport-fit-ultra {
    --esak-topbar-height: 70px !important;
  }

  .admin-shell,
  html.viewport-fit-compact .admin-shell,
  html.viewport-fit-tight .admin-shell,
  html.viewport-fit-ultra .admin-shell {
    grid-template-rows: 70px minmax(0, 1fr) !important;
  }

  .admin-topbar,
  html.viewport-fit-compact .admin-topbar,
  html.viewport-fit-tight .admin-topbar,
  html.viewport-fit-ultra .admin-topbar {
    height: 70px !important;
    grid-template-columns: minmax(260px, 1fr) auto auto !important;
    gap: 20px !important;
    padding: 0 22px 0 28px !important;
  }

  .logo-mark,
  html.viewport-fit-compact .logo-mark,
  html.viewport-fit-tight .logo-mark,
  html.viewport-fit-ultra .logo-mark {
    width: 38px !important;
    height: 38px !important;
    border-radius: 11px !important;
  }

  .logo-mark img,
  html.viewport-fit-compact .logo-mark img,
  html.viewport-fit-tight .logo-mark img,
  html.viewport-fit-ultra .logo-mark img {
    width: 31px !important;
    height: 31px !important;
  }

  .topbar-title,
  html.viewport-fit-compact .topbar-title,
  html.viewport-fit-tight .topbar-title,
  html.viewport-fit-ultra .topbar-title {
    display: inline !important;
    font-size: 20px !important;
  }

  .topbar-tag,
  html.viewport-fit-compact .topbar-tag,
  html.viewport-fit-tight .topbar-tag,
  html.viewport-fit-ultra .topbar-tag {
    display: inline !important;
    font-size: 14px !important;
  }

  .topbar-nav,
  html.viewport-fit-compact .topbar-nav,
  html.viewport-fit-tight .topbar-nav,
  html.viewport-fit-ultra .topbar-nav {
    width: 468px !important;
    height: 50px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
    padding: 4px !important;
    border-radius: 15px !important;
  }

  .top-nav-item.nav-item,
  html.viewport-fit-compact .top-nav-item.nav-item,
  html.viewport-fit-tight .top-nav-item.nav-item,
  html.viewport-fit-ultra .top-nav-item.nav-item {
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 14px !important;
    border-radius: 12px !important;
  }

  .top-nav-label,
  html.viewport-fit-compact .top-nav-label,
  html.viewport-fit-tight .top-nav-label,
  html.viewport-fit-ultra .top-nav-label {
    font-size: 14px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
  }

  .utility-btn,
  html.viewport-fit-compact .utility-btn,
  html.viewport-fit-tight .utility-btn,
  html.viewport-fit-ultra .utility-btn {
    min-height: 36px !important;
    padding: 0 12px !important;
    font-size: 14px !important;
  }
}

@media (min-width: 900px) and (max-width: 1180px) {
  html,
  html.viewport-fit-compact,
  html.viewport-fit-tight,
  html.viewport-fit-ultra {
    --esak-topbar-height: 70px !important;
  }

  .admin-shell,
  html.viewport-fit-compact .admin-shell,
  html.viewport-fit-tight .admin-shell,
  html.viewport-fit-ultra .admin-shell {
    grid-template-rows: 70px minmax(0, 1fr) !important;
  }

  .admin-topbar,
  html.viewport-fit-compact .admin-topbar,
  html.viewport-fit-tight .admin-topbar,
  html.viewport-fit-ultra .admin-topbar {
    height: 70px !important;
    gap: 12px !important;
    padding-inline: 18px !important;
  }

  .topbar-title,
  html.viewport-fit-compact .topbar-title,
  html.viewport-fit-tight .topbar-title,
  html.viewport-fit-ultra .topbar-title {
    display: inline !important;
    font-size: 18px !important;
  }

  .topbar-nav,
  html.viewport-fit-compact .topbar-nav,
  html.viewport-fit-tight .topbar-nav,
  html.viewport-fit-ultra .topbar-nav {
    width: 348px !important;
    height: 48px !important;
    padding: 4px !important;
    gap: 4px !important;
  }

  .top-nav-item.nav-item,
  html.viewport-fit-compact .top-nav-item.nav-item,
  html.viewport-fit-tight .top-nav-item.nav-item,
  html.viewport-fit-ultra .top-nav-item.nav-item {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
  }

  .top-nav-label,
  html.viewport-fit-compact .top-nav-label,
  html.viewport-fit-tight .top-nav-label,
  html.viewport-fit-ultra .top-nav-label {
    font-size: 13px !important;
  }

  .utility-btn,
  html.viewport-fit-compact .utility-btn,
  html.viewport-fit-tight .utility-btn,
  html.viewport-fit-ultra .utility-btn {
    min-height: 36px !important;
    font-size: 13px !important;
  }
}

.language-menu { position: relative; flex: 0 0 auto; }

.lang-icon { font-size: 14px; line-height: 1; }

.lang-caret { transform: translateY(-1px); }

.language-trigger[aria-expanded="true"] .lang-caret { transform: rotate(180deg) translateY(1px); }

.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  min-width: 148px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 16px 32px rgba(15, 23, 42, .12), 0 2px 8px rgba(15, 23, 42, .06);
}

.language-option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.language-option:hover { background: var(--surface-soft); }

.language-option.active { background: color-mix(in srgb, var(--primary-soft) 45%, white); color: var(--primary); }

.language-option-label { font-size: 14px; font-weight: 700; }

.language-option-code { font-size: 13px; font-weight: 700; color: var(--muted); }

.language-option.active .language-option-code { color: currentColor; }

@media (max-width: 768px) {
  .language-dropdown { min-width: 136px; top: calc(100% + 6px); }

  .language-option { min-height: 40px; padding-inline: 10px; }

  .language-option-label { font-size: 13px; }

  .language-option-code { font-size: 12px; }
}

.lang-icon { width: 18px; height: 18px; display: inline-grid; place-items: center; flex: 0 0 auto; }

.lang-icon svg { width: 18px; height: 18px; display: block; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 768px) {
  .lang-icon,
  .lang-icon svg {
    width: 16px;
    height: 16px;
  }
}

.language-trigger { min-width: 70px; gap: 6px; justify-content: center; color: var(--primary); }

.lang-current { font-size: 14px; font-weight: 800; line-height: 1; letter-spacing: .01em; color: currentColor; }

.lang-caret { font-size: 11px; line-height: 1; opacity: .9; color: currentColor; }

@media (max-width: 768px) {
  .language-trigger { min-width: 64px; gap: 5px; }

  .lang-current { font-size: 13px; }
}

@media (min-width: 769px) and (max-width: 1199px) {
}

@media (min-width: 481px) and (max-width: 768px) {
}

@media (max-width: 480px) {
}

@media (max-width: 360px) {
  #view-calculator .result-number small { padding-inline: 8px; }
}

@media (min-width: 769px) and (max-width: 1199px) {
}

@media (min-width: 481px) and (max-width: 768px) {
  #view-calculator .result-number small { margin-bottom: 5px; }
}

@media (max-width: 480px) {
}

@media (max-width: 360px) {
}

@media (min-width: 769px) and (max-width: 1199px) {
  #view-calculator .result-number small { min-width: 62px; min-height: 38px; padding: 8px 13px; font-size: clamp(17px, 1.45vw, 19px); }
}

@media (min-width: 481px) and (max-width: 768px) {
  #view-calculator .result-number small { min-width: 64px; min-height: 40px; padding: 9px 14px; font-size: clamp(18px, 2.6vw, 20px); }
}

@media (max-width: 480px) {
  #view-calculator .result-number small { min-width: 68px; min-height: 42px; margin-bottom: 0; padding: 10px 15px; font-size: clamp(19px, 5.6vw, 22px); font-weight: 800; }
}

@media (max-width: 393px) {
  #view-calculator .result-number small { min-width: 64px; min-height: 40px; padding: 9px 13px; font-size: clamp(18px, 5.3vw, 20px); }
}

@media (max-width: 360px) {
  #view-calculator .result-number small { min-width: 60px; min-height: 38px; padding: 8px 12px; font-size: 17px; }
}

#view-calculator .result-number small { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; letter-spacing: -.02em; white-space: nowrap; }

@media (max-width: 480px) {
}

@media (max-width: 393px) {
}

@media (max-width: 360px) {
  #view-calculator .result-number { --result-value-size: clamp(38px, 10.2vw, 54px); --result-unit-size: clamp(30px, 8.16vw, 43px); }
}

@media (max-width: 680px) {
  .about-page .page-quick-links.content-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .about-page .content-tabs .show-all-tab {
    grid-column: auto;
    min-height: 44px;
    border-style: solid;
    background: rgba(255,255,255,.92);
    color: var(--text-strong);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  }

  .about-page .content-tabs .show-all-tab.active {
    border-color: rgba(37, 99, 235, .22);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
  }
}

@media (max-width: 360px) {
  .about-page .page-quick-links.content-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 9px; }

  .about-page .content-tabs .quick-link.content-tab { min-height: 42px; font-size: 12px; padding: 8px 10px; }

  .about-page .content-tabs .show-all-tab { grid-column: auto; }
}

@media (max-width: 899px) {
  .tour-popup { width: min(390px, calc(100vw - 24px)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

  .tour-popup-body { min-height: 0; }
}

@media (max-width: 480px) {
  .tour-popup { border-radius: 15px; }

  .tour-popup-head { padding: 10px 12px 7px; }

  .tour-popup-body { padding: 12px 13px 13px; }

  .tour-popup-footer { padding: 9px 10px 10px; }
}

.result-kicker { max-width: 100%; line-height: 1.25; }

@media (max-width: 768px) {
  .result-kicker { font-size: 12px; letter-spacing: .08em; }
}

@media (max-width: 480px) {
  .result-kicker { font-size: 11px; letter-spacing: .06em; }
}

#view-calculator { width: 100%; max-width: 1680px; margin-inline: auto; }

@media (min-width: 1600px) {
  .admin-main { padding-left: clamp(32px, 2.3vw, 48px); padding-right: clamp(32px, 2.3vw, 48px); }

  #view-calculator { width: min(100%, 1680px); }
}

@media (min-width: 1025px) and (max-width: 1599px) {
  .admin-main { padding-left: clamp(20px, 2vw, 28px); padding-right: clamp(20px, 2vw, 28px); }

  #view-calculator { max-width: none; }
}

@media (min-width: 681px) and (max-width: 1024px) {
  .admin-main { padding-left: clamp(16px, 2.5vw, 22px); padding-right: clamp(16px, 2.5vw, 22px); }
}

@media (max-width: 680px) {
  .admin-main { padding-left: clamp(10px, 3vw, 14px); padding-right: clamp(10px, 3vw, 14px); }
}

#view-calculator .result-number span { font-size: var(--result-value-size); }

#view-calculator .result-number small { min-width: auto; min-height: auto; padding: 0; margin-bottom: 0; background: transparent; color: var(--primary); }

@media (max-width: 480px) {
  #view-calculator .result-number { gap: 10px; align-items: center; }
}

@media (max-width: 393px) {
}

#view-calculator .result-number { --result-value-size: clamp(54px, 4.6vw, 82px); --result-unit-size: clamp(38px, 3.22vw, 57px); }

#view-calculator .result-number small { font-size: var(--result-unit-size); line-height: 1; font-weight: 800; }

@media (max-width: 480px) {
  #view-calculator .result-number { --result-value-size: clamp(42px, 11vw, 64px); --result-unit-size: clamp(29px, 7.7vw, 45px); }
}

@media (max-width: 393px) {
  #view-calculator .result-number { --result-value-size: clamp(40px, 10.6vw, 58px); --result-unit-size: clamp(28px, 7.42vw, 41px); }
}

:root { --classic-sidebar: #111923; --classic-sidebar-end: #0b121b; --classic-topbar: #1d2327; --hybrid-topbar-height: 48px; --hybrid-sidebar-width: 232px; }

.admin-shell {
  min-height: 100vh !important;
  display: grid !important;
  grid-template-columns: var(--hybrid-sidebar-width) minmax(0, 1fr) !important;
  grid-template-rows: var(--hybrid-topbar-height) minmax(0, 1fr) !important;
}

.admin-topbar {
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
  height: var(--hybrid-topbar-height) !important;
  min-height: var(--hybrid-topbar-height) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 0 14px 0 16px !important;
  color: #f0f0f1 !important;
  background: var(--classic-topbar) !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.admin-topbar .topbar-left,
.admin-topbar .topbar-right {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
}

.admin-topbar .topbar-left { gap: 10px !important; overflow: hidden; }

.admin-topbar .topbar-right { gap: 7px !important; flex: 0 0 auto; }

.admin-topbar .logo-mark {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(255,255,255,.34) !important;
  background: rgba(255,255,255,.06) !important;
}

.admin-topbar .logo-mark img { width: 22px !important; height: 22px !important; }

.admin-topbar .topbar-brand-copy { gap: 12px !important; }

.admin-topbar .topbar-title { color: #fff !important; font-size: 14px !important; font-weight: 800 !important; }

.admin-topbar .topbar-tag { max-width: min(68vw, 860px); color: #c3c4c7 !important; border-left: 1px solid rgba(255,255,255,.18); padding-left: 12px; font-size: 12px !important; }

.admin-topbar .utility-btn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  border-radius: 9px !important;
  background: rgba(255,255,255,.06) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.admin-topbar .utility-btn:hover { background: rgba(255,255,255,.12) !important; transform: none !important; }

.admin-sidebar {
  grid-column: 1 !important;
  grid-row: 2 !important;
  position: sticky !important;
  top: var(--hybrid-topbar-height) !important;
  align-self: start !important;
  width: var(--hybrid-sidebar-width) !important;
  height: calc(100vh - var(--hybrid-topbar-height)) !important;
  overflow: auto !important;
  color: #c3c4c7 !important;
  background: linear-gradient(180deg, var(--classic-sidebar), var(--classic-sidebar-end)) !important;
  border-left: 0 !important;
  border-right: 1px solid rgba(0,0,0,.38) !important;
  z-index: 30;
}

.brand-panel { padding: 18px 16px 14px !important; border-bottom: 1px solid rgba(255,255,255,.08) !important; }

.brand-name { margin: 0 0 2px !important; color: #fff !important; font-size: 20px !important; font-weight: 800 !important; letter-spacing: -.4px !important; }

.brand-sub { margin: 0 !important; color: #9aa4af !important; font-size: 12px !important; }

.side-nav { display: block !important; padding: 8px 0 !important; }

.admin-sidebar .nav-item {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #c3c4c7 !important;
  box-shadow: none !important;
  text-align: left !important;
  padding: 11px 18px !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  white-space: normal !important;
  transition: background-color .16s ease, color .16s ease !important;
}

.admin-sidebar .nav-item:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }

.admin-sidebar .nav-item.active {
  color: #fff !important;
  font-weight: 700 !important;
  background: linear-gradient(270deg, #2563eb, #2271b1) !important;
  box-shadow: inset 4px 0 0 rgba(255,255,255,.26) !important;
}

.admin-sidebar .nav-item.active::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--bg);
}

.sidebar-note {
  margin: 16px !important;
  padding: 12px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.04) !important;
  color: #aab5c2 !important;
  font-size: 12px !important;
}

.sidebar-note strong { display: block; margin-bottom: 4px; color: #fff; }

.admin-main { grid-column: 2 !important; grid-row: 2 !important; min-width: 0 !important; width: auto !important; max-width: none !important; padding: 18px 20px 34px !important; }

@media (min-width: 1360px) {
  .dashboard-grid.layout-wide { grid-template-columns: minmax(650px, 1.5fr) minmax(390px, .9fr) !important; gap: clamp(14px, 1.05vw, 20px) !important; }
}

@media (max-width: 899px) {
  :root { --hybrid-topbar-height: 54px; }

  .admin-shell { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: var(--hybrid-topbar-height) auto minmax(0, 1fr) !important; }

  .admin-topbar { grid-column: 1 !important; grid-row: 1 !important; padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)) !important; }

  .admin-topbar .topbar-tag { display: none !important; }

  .admin-sidebar {
    grid-column: 1 !important;
    grid-row: 2 !important;
    position: static !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,.34) !important;
  }

  .brand-panel, .sidebar-note { display: none !important; }

  .side-nav { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; padding: 0 !important; }

  .admin-sidebar .nav-item {
    min-height: 46px !important;
    justify-content: center !important;
    padding: 9px 8px !important;
    text-align: center !important;
    font-size: 13px !important;
    border-right: 1px solid rgba(255,255,255,.06) !important;
  }

  .admin-sidebar .nav-item.active { box-shadow: inset 0 -3px 0 rgba(255,255,255,.28) !important; background: linear-gradient(180deg, #2563eb, #2271b1) !important; }

  .admin-sidebar .nav-item.active::after { display: none !important; }

  .admin-main { grid-column: 1 !important; grid-row: 3 !important; padding: 14px 10px 28px !important; }
}

@media (max-width: 560px) {
  .admin-topbar .topbar-brand-copy { gap: 0 !important; }

  .admin-topbar .topbar-title { font-size: 13px !important; }

  .admin-topbar .utility-btn { padding-inline: 8px !important; font-size: 11px !important; }

  .admin-sidebar .nav-item { font-size: 12px !important; line-height: 1.25 !important; }
}

@media (min-width: 900px) {
  .admin-main { padding: 18px clamp(18px, 2vw, 28px) 34px !important; }

  .admin-main > .view-panel,
  .admin-main > .content-page,
  .admin-main > #view-calculator,
  .admin-main > #view-guide,
  .admin-main > #view-about {
    width: min(100%, 1120px) !important;
    margin-inline: auto !important;
  }

  .content-page { width: min(100%, 1120px) !important; }
}

@media (min-width: 900px) and (max-width: 1280px) {
  #view-calculator .dashboard-grid.layout-wide { grid-template-columns: minmax(0, 1.52fr) minmax(320px, .86fr) !important; gap: 16px !important; }

  #view-calculator .result-number span { font-size: clamp(52px, 4.8vw, 78px); }
}

@media (min-width: 1281px) {
  #view-calculator .dashboard-grid.layout-wide { grid-template-columns: minmax(0, 1.58fr) minmax(340px, .88fr) !important; }
}

@media (min-width: 900px) {
  .admin-shell {
    position: relative !important;
    background: linear-gradient(
        90deg,
        var(--classic-sidebar) 0,
        var(--classic-sidebar) var(--hybrid-sidebar-width),
        transparent var(--hybrid-sidebar-width),
        transparent 100%
      ) !important;
  }

  .admin-sidebar {
    position: sticky !important;
    left: auto !important;
    top: var(--hybrid-topbar-height) !important;
    bottom: auto !important;
    align-self: start !important;
    height: calc(100dvh - var(--hybrid-topbar-height)) !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

@media (max-width: 899px) {
  .admin-shell { background: var(--bg) !important; }
}

html.tour-open.tour-stacked-layout,
body.tour-open.tour-stacked-layout {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.tour-popup { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

@media (min-width: 900px) {
  #view-calculator .postbox-title { min-height: 48px; padding-block: 8px; }

  #view-calculator .postbox-body { padding: 12px 13px 13px; }

  #view-calculator .input-shell { border-radius: 11px; }

  #view-calculator .input-shell input { padding-inline: 11px; }

  #view-calculator .input-unit { padding-right: 11px; font-size: 12px; }

  #view-calculator #calc-ref-box .postbox-body > .form-grid { width: min(100%, 820px); margin-inline: auto; gap: 12px; }

  #view-calculator #calc-patient-box .patient-body > .field,
  #view-calculator #bucky_dist_group {
    width: min(100%, 420px);
  }

  #view-calculator #calc-dap-box .dap-body { grid-template-columns: minmax(340px, 1fr) minmax(220px, 280px); align-items: end; gap: 14px; }

  #view-calculator #calc-dap-box .dap-shell { height: 44px; }

  #view-calculator #calc-btn { min-height: 44px; height: 44px; }
}

@media (min-width: 900px) and (max-width: 1080px) {
  #view-calculator #calc-ref-box .postbox-body > .form-grid { width: 100%; }

  #view-calculator #calc-dap-box .dap-body { grid-template-columns: minmax(0, 1fr) minmax(200px, 240px); }
}

@media (max-width: 899px) {
  #view-calculator #calc-ref-box .postbox-body > .form-grid,
  #view-calculator #calc-patient-box .patient-body > .field,
  #view-calculator #bucky_dist_group {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  #view-calculator #calc-dap-box .dap-body { grid-template-columns: 1fr; }
}

#view-calculator .req-mark { color: var(--dap-accent); font-weight: 700; }

#view-calculator .field label { align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }

#view-calculator .input-shell { transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease; }

#view-calculator .input-shell input { font-size: 16px; font-weight: 600; color: var(--text-strong); }

#view-calculator .input-shell input::placeholder { color: #94a3b8; font-weight: 400; opacity: 1; }

#view-calculator .input-unit { font-size: 13px; font-weight: 600; }

#view-calculator .box-description,
#view-calculator .select-btn span,
#view-calculator .result-footer-note {
  color: var(--muted-2);
}

#view-calculator .input-shell.is-filled { background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft)); }

#view-calculator .input-shell:focus-within {
  border-color: color-mix(in srgb, var(--primary) 70%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

#view-calculator .input-shell.has-error { border-color: #dc2626 !important; background: #fff7f7; box-shadow: 0 0 0 4px rgba(220, 38, 38, .08); }

#view-calculator .field-error { margin: 6px 2px 0; color: #dc2626; font-size: 12.5px; line-height: 1.35; font-weight: 500; }

#view-calculator input[type="number"]::-webkit-outer-spin-button,
#view-calculator input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#view-calculator input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

@media (min-width: 900px) {
  #view-calculator .calc-panel-head h2 { font-size: 23px; line-height: 1.2; }

  #view-calculator .postbox-title h2 { font-size: 16px; font-weight: 700; }

  #view-calculator .input-shell { height: 44px; }

  #view-calculator .input-shell input { font-size: 16px; }
}

@media (max-width: 899px) {
  #view-calculator .panel-helper-note { font-size: 12px; }

  #view-calculator .field label { font-size: 13.5px; }

  #view-calculator .input-shell input,
  #view-calculator .input-shell input::placeholder {
    font-size: 15.5px;
  }
}

#view-calculator .field label { display: block; }

#view-calculator .field label sub { font-size: 0.74em; line-height: 0; vertical-align: sub; }

#view-calculator .field label .req-mark { margin-left: 2px; }

#view-calculator .panel-heading-copy.no-kicker { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }

#view-calculator .panel-heading-copy.no-kicker h2 { margin: 0; }

#view-calculator .panel-helper-note {
  margin: 0 0 0 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-2);
  font-size: 12.75px;
  font-weight: 500;
  white-space: nowrap;
}

#view-calculator .panel-helper-note .req-mark,
#view-calculator .field label .req-mark {
  color: #e64980;
}

@media (max-width: 640px) {
  #view-calculator .panel-heading-copy.no-kicker { align-items: flex-start; gap: 4px 8px; }

  #view-calculator .panel-helper-note { flex-basis: 100%; margin-left: 0; white-space: normal; }
}

@media (min-width: 900px) and (orientation: landscape) {
  .admin-sidebar {
    position: fixed !important;
    left: 0 !important;
    top: var(--hybrid-topbar-height) !important;
    bottom: 0 !important;
    width: var(--hybrid-sidebar-width) !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .admin-main { grid-column: 2 !important; }
}

#view-calculator .input-shell input,
#view-calculator .result-number span,
#view-calculator .metric strong,
#view-calculator .step-row .val {
  font-family: var(--thai);
  font-variant-numeric: tabular-nums;
}

#view-calculator .result-number span { letter-spacing: -0.025em; line-height: .94; }
