:root {
  --font-display: 'Zodiak', 'Georgia', serif;
  --font-body: 'Satoshi', 'Helvetica Neue', Arial, sans-serif;

  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1e2528;
  --ink-2: #4a5458;
  --ink-3: #737c80;
  --line: #dedad1;
  --line-2: #ebe8e1;

  --accent: #1f5a63;        /* deep teal */
  --accent-ink: #ffffff;
  --accent-soft: #e3eeef;

  --current: #8a5a1c;       /* amber-brown for current program */
  --current-soft: #f6eddf;
  --proposed: #1f5a63;      /* teal for proposed program */
  --proposed-soft: #e3eeef;

  --danger: #a3342c;
  --ok: #2f6b3a;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(30, 37, 40, .06), 0 2px 8px rgba(30, 37, 40, .04);

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .04em;
  flex-shrink: 0;
}
.brand h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); line-height: 1.15; margin: 0; }
.brand-sub { margin: 2px 0 0; font-size: var(--text-sm); color: var(--ink-3); }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.record-picker select {
  min-width: 220px; max-width: 320px; padding: 8px 32px 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: var(--text-sm);
}

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: var(--text-sm); font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #cbc6ba; }
.btn:focus-visible, .step:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #184a52; border-color: #184a52; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: var(--text-xs); }

.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(30,37,40,.12); padding: 6px;
}
.menu-panel button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 4px; font-size: var(--text-sm); cursor: pointer; }
.menu-panel button:hover { background: var(--surface-2); }
.menu-panel .danger { color: var(--danger); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 0; }

.storage-note { background: #fff6e0; border-bottom: 1px solid #ecd9a6; color: #6b5313; font-size: var(--text-sm); padding: 8px 28px; }

/* ---------- Steps ---------- */
.steps {
  display: flex; gap: 4px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.step {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; border: 0; background: none; cursor: pointer;
  font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap;
}
.step:hover { color: var(--ink); }
.step[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.step-n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700;
  background: var(--line-2); color: var(--ink-2);
}
.step[aria-current="page"] .step-n { background: var(--accent); color: var(--accent-ink); }
.step[hidden] { display: none; }
.step-guide { margin-left: auto; }

/* ---------- Main ---------- */
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px; outline: none; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); margin: 0; line-height: 1.2; }
.section-head p { margin: 4px 0 0; color: var(--ink-2); font-size: var(--text-sm); max-width: 70ch; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.card h3 { font-size: var(--text-lg); font-weight: 700; margin: 0 0 4px; }
.card .card-sub { margin: 0 0 16px; color: var(--ink-3); font-size: var(--text-sm); }

.grid { display: grid; gap: 14px 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: var(--text-sm); transition: border-color .15s, background .15s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #cbc6ba; }
.field input:focus, .field select:focus, .field textarea:focus { background: var(--surface); border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 64px; }
.field .hint { font-size: var(--text-xs); color: var(--ink-3); }

.mode-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-option { position: relative; display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: var(--surface-2); }
.mode-option:hover { border-color: #cbc6ba; }
.mode-option input { position: absolute; opacity: 0; }
.mode-option strong { display: block; font-size: var(--text-sm); }
.mode-option small { display: block; color: var(--ink-3); font-size: var(--text-xs); margin-top: 2px; }
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.goal-preview { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: var(--text-sm); }
.goal-preview b { display: block; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 2px; }

/* ---------- Plan header ---------- */
.plan-banner { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: 999px; }
.plan-banner.current { background: var(--current-soft); color: var(--current); }
.plan-banner.proposed { background: var(--proposed-soft); color: var(--proposed); }

/* ---------- IPF table ---------- */
.ipf-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.ipf-scroll { overflow-x: auto; }
.ipf { width: 100%; border-collapse: collapse; min-width: 1180px; font-size: var(--text-sm); }
.ipf th { background: #ecebe6; color: var(--ink); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: bottom; }
.ipf thead tr:first-child th { text-align: center; }
.ipf th .th-q { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-3); font-size: var(--text-xs); margin-top: 2px; }
.ipf th:last-child { border-right: 0; }
.ipf td { padding: 8px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); vertical-align: top; }
.ipf td:last-child { border-right: 0; }
.ipf tbody tr:hover td { background: #fcfbf8; }
.ipf .col-order { width: 64px; text-align: center; }
.ipf .col-actions { width: 44px; }
.ipf textarea, .ipf input, .ipf select {
  width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 7px; border-radius: 4px; font-size: var(--text-sm); line-height: 1.35;
}
.ipf textarea { resize: none; min-height: 34px; overflow: hidden; display: block; }
.ipf textarea:hover, .ipf input:hover, .ipf select:hover { border-color: var(--line); }
.ipf textarea:focus, .ipf input:focus, .ipf select:focus { border-color: var(--accent); background: var(--surface); }
.ipf ::placeholder { color: #a8adaf; }
.ipf .stack { display: flex; flex-direction: column; gap: 4px; }
.ipf .inline { display: flex; align-items: center; gap: 4px; }
.ipf .inline input { width: 62px; text-align: right; }
.ipf .unit { font-size: var(--text-xs); color: var(--ink-3); white-space: nowrap; }
.ratio-chip { display: inline-block; font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); background: var(--line-2); padding: 2px 7px; border-radius: 999px; margin-left: 4px; }
.week-chip { font-size: var(--text-xs); color: var(--ink-3); padding-left: 7px; }

.order-num { width: 28px; height: 28px; margin: 4px auto 6px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: var(--text-xs); }
.order-ctrls { display: flex; justify-content: center; gap: 2px; }
.icon-btn { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 4px; cursor: pointer; color: var(--ink-3); }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn.del:hover { color: var(--danger); background: #f7e4e2; }
.icon-btn svg { width: 15px; height: 15px; }

.ipf tfoot td { background: var(--surface-2); font-weight: 700; font-size: var(--text-sm); border-top: 1px solid var(--line); }
.ipf-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); font-size: var(--text-base); margin-bottom: 4px; }
.empty p { margin: 0 auto 14px; max-width: 52ch; font-size: var(--text-sm); }

/* ---------- Intensity metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.metric .m-label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.metric .m-value { font-size: var(--text-xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.metric .m-note { font-size: var(--text-xs); color: var(--ink-3); }

/* ---------- Compare ---------- */
.compare-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.compare-table th, .compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.compare-table thead th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.compare-table th.c-cur { color: var(--current); }
.compare-table th.c-pro { color: var(--proposed); }
.compare-table td.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.delta { font-size: var(--text-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.delta.up { background: #e3f0e5; color: var(--ok); }
.delta.down { background: #f7e4e2; color: var(--danger); }
.delta.same { background: var(--line-2); color: var(--ink-3); }

.side-by-side { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mini-ipf { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
.mini-ipf th, .mini-ipf td { border: 1px solid var(--line-2); padding: 6px 7px; text-align: left; vertical-align: top; }
.mini-ipf th { background: #ecebe6; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.mini-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.mini-head h4 { margin: 0; font-size: var(--text-base); }

.decision { border-top: 1px solid var(--line-2); padding-top: 16px; margin-top: 16px; }
.decision:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.decision h4 { margin: 0 0 4px; font-size: var(--text-base); }
.decision p.q-help { margin: 0 0 10px; font-size: var(--text-sm); color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 10px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 7px 16px; font-size: var(--text-sm); font-weight: 500; border-right: 1px solid var(--line); background: var(--surface-2); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Guide ---------- */
.guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.guide h3 { margin-top: 0; }
.guide ul, .guide ol { margin: 0; padding-left: 20px; font-size: var(--text-sm); color: var(--ink-2); }
.guide li { margin-bottom: 6px; }
.guide dt { font-weight: 700; font-size: var(--text-sm); margin-top: 10px; }
.guide dd { margin: 2px 0 0; font-size: var(--text-sm); color: var(--ink-2); }

/* ---------- Footer / toast / dialog ---------- */
.footer { padding: 18px 28px 26px; color: var(--ink-3); font-size: var(--text-xs); border-top: 1px solid var(--line); background: var(--surface); }
.footer p { margin: 2px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(30,37,40,.45); display: grid; place-items: center; z-index: 70; padding: 20px; }
.dialog-backdrop[hidden] { display: none; }
.dialog { background: var(--surface); border-radius: var(--radius); padding: 22px; max-width: 440px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.dialog h2 { margin: 0 0 8px; font-size: var(--text-lg); }
.dialog p { margin: 0 0 18px; color: var(--ink-2); font-size: var(--text-sm); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8a2b24; border-color: #8a2b24; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-by-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .guide { grid-template-columns: 1fr; }
  .mode-options { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar, .steps, .footer, .storage-note { padding-left: 16px; padding-right: 16px; }
  main { padding: 18px 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .record-picker select { min-width: 0; width: 100%; }
  .record-picker { flex: 1 1 100%; }
  .step-guide { margin-left: 0; }
  .card { padding: 16px; }
  .compare-table th, .compare-table td { padding: 8px 6px; }

  /* IPF rows become cards */
  .ipf { min-width: 0; }
  .ipf thead { display: none; }
  .ipf, .ipf tbody, .ipf tr, .ipf td, .ipf tfoot { display: block; width: 100%; }
  .ipf tbody tr { border-bottom: 1px solid var(--line); padding: 10px 6px; position: relative; }
  .ipf td { border: 0; padding: 4px 6px; }
  .ipf td[data-label]::before { content: attr(data-label); display: block; font-size: var(--text-xs); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
  .ipf .col-order { width: auto; display: flex; align-items: center; gap: 10px; text-align: left; }
  .ipf .col-order .order-num { margin: 0; }
  .ipf .col-actions { position: absolute; top: 12px; right: 8px; width: auto; }
  .ipf textarea, .ipf input, .ipf select { border-color: var(--line); background: var(--surface-2); }
  .ipf tfoot tr { display: flex; justify-content: space-between; }
  .ipf tfoot td { border: 0; width: auto; }
  .ipf tfoot td:empty { display: none; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: letter landscape; margin: 0.4in; }
  body { background: #fff; }
  .topbar-actions, .steps, .storage-note, .section-actions, .icon-btn, .order-ctrls, .ipf-foot .btn, .toast, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .card, .ipf-wrap, .metric { box-shadow: none; break-inside: avoid; }
  .ipf { min-width: 0; }
  .ipf textarea, .ipf input, .ipf select { border: 0; padding: 0; }
}

/* ---------- Suggestion dropdown ---------- */
.suggest { position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(30,37,40,.14); padding: 4px; max-height: 260px; overflow-y: auto; max-width: 340px; }
.suggest[hidden] { display: none; }
.suggest-h { font-size: var(--text-xs); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px 4px; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 4px; font-size: var(--text-sm); cursor: pointer; }
.suggest button:hover, .suggest button:focus { background: var(--accent-soft); outline: none; }
@media print { .suggest { display: none !important; } }

.ipf .min-sel { width: 70px; }
.ipf .prog-meta { white-space: normal; line-height: 1.35; }
.ipf select[data-field="materials"] { min-width: 180px; }
.side-by-side { grid-template-columns: minmax(0, 1fr) !important; }
.side-by-side > .card { min-width: 0; }

/* Intervention Integrity and Supports Observation */
.obs-toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.obs-toolbar select { min-width: 220px; }
.obs-key { font-size: var(--text-sm); color: var(--ink-3); margin: 0 0 12px; }
.obs-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.obs-head .order-num { flex: none; }
.obs-planned { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.obs-planned dt { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.obs-planned dd { margin: 2px 0 0; font-size: var(--text-sm); }
.obs-checks { display: flex; flex-direction: column; }
.obs-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: var(--text-sm); }
.obs-check .seg { margin: 0; flex: none; }
.seg-sm span { padding: 5px 12px; font-size: var(--text-xs); }
.obs-min { width: 90px; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.obs-supports { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; }
.obs-sup { display: flex; gap: 8px; align-items: center; font-size: var(--text-sm); cursor: pointer; }
.obs-sup input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 760px) {
  .obs-planned, .obs-supports { grid-template-columns: 1fr; }
  .obs-check { flex-direction: column; align-items: flex-start; }
}
.obs-head .order-num { margin: 2px 0 0; }
.obs-head > div { flex: 1; text-align: left; }
.obs-head h3 { margin: 0; }

/* License gate (shared license.js markup) */
body.gated .topbar, body.gated .steps, body.gated main, body.gated .footer, body.gated .storage-note { display: none !important; }
#gate { padding: 56px 20px 72px; }
#gate .auth.gate { max-width: 700px; margin: 0 auto; }
#gate .brand { display: block; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--accent); }
#gate .brand small { display: block; font-family: var(--font-body); font-size: var(--text-xs); font-weight: 400; color: var(--ink-3); margin-top: 2px; }
#gate .card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }
#gate h1 { font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.25; margin: 0 0 8px; }
#gate .muted { color: var(--ink-2); }
#gate .small { font-size: var(--text-xs); }
#gate form { display: flex; flex-direction: column; gap: 12px; }
#gate .field { display: flex; flex-direction: column; gap: 4px; }
#gate .field label { font-size: var(--text-xs); font-weight: 500; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
#gate .field input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
#gate #gateBtn { align-self: flex-start; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding: 10px 22px; font-weight: 600; }
#gate #gateBtn:hover { background: #184a52; }
#gate .btn.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
#gate .alert { border-radius: 6px; padding: 12px 14px; font-size: var(--text-sm); margin: 12px 0; border: 1px solid transparent; }
#gate .alert.ok { background: #e6f1e7; color: var(--ok); border-color: #c4dcc7; }
#gate .alert.err { background: #f7e4e1; color: var(--danger); border-color: #e7c3bb; }
#gate .alert.warn { background: #f7ecd3; color: #5c4600; border-color: #ead7a8; }
#gate .alert.info { background: var(--accent-soft); color: var(--accent); border-color: #c4d9dc; }
.gate-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.tier { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface-2); color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.tier-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.tier-name { font-weight: 700; font-size: var(--text-sm); line-height: 1.25; }
.tier-price { font-size: var(--text-xl); font-weight: 700; color: var(--accent); }
.tier-who { font-size: var(--text-xs); color: var(--ink-2); }
.tier-buy { font-size: var(--text-xs); font-weight: 700; color: var(--accent); margin-top: auto; padding-top: 6px; }
.gate-foot { margin-top: 16px; font-size: var(--text-sm); color: var(--ink-3); }
.gate-foot a { color: var(--accent); }
.lic-dialog { border: 1px solid var(--line); border-radius: 10px; padding: 22px; max-width: 520px; width: calc(100% - 32px); font-family: var(--font-body); }
.lic-dialog::backdrop { background: rgba(20, 25, 35, .4); }
.lic-dialog h2 { font-family: var(--font-display); }
.lic-dialog .muted { color: var(--ink-2); } .lic-dialog .small { font-size: var(--text-xs); }
.lic-dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.lic-dialog .btn:not(.secondary) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lic-list { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: var(--text-sm); }
.lic-list dt { color: var(--ink-3); } .lic-list dd { margin: 0; }
@media (max-width: 640px) { .gate-tiers { grid-template-columns: 1fr; } #gate { padding-top: 28px; } }
@media print { #gate { display: none; } }
