/* Galactic Medical client forms. Brand mirrored from galactic-medical-website/tailwind.config.mjs.
   All color lives in tokens; a form config may override --accent or pick theme: "dark". */
[hidden] { display: none !important; }
:root {
  /* Light is the default look (Joel, 2026-09-27). A form config can set theme: "dark". */
  --grad: linear-gradient(135deg, #6366f1, #2dd4bf);
  --on-grad: #000212;
  --bg: #f6f7fb;
  --bg-glow-1: rgba(99, 102, 241, 0.10);
  --bg-glow-2: rgba(45, 212, 191, 0.08);
  --header: rgba(246, 247, 251, 0.88);
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(79, 70, 229, 0.45);
  --text: #0f1222;
  --text-2: #3f4763;
  --muted: #5d6685;
  --placeholder: #8a92ad;
  --accent: #4f46e5;
  --link: #4338ca;
  --ok: #0f766e;
  --ok-soft: rgba(15, 118, 110, 0.18);
  --chip-on: rgba(79, 70, 229, 0.10);
  --warn: #b45309;
  --err: #b91c1c;
  --sk: rgba(15, 23, 42, 0.07);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000212;
  --bg-glow-1: rgba(99, 102, 241, 0.16);
  --bg-glow-2: rgba(45, 212, 191, 0.07);
  --header: rgba(0, 2, 18, 0.86);
  --surface: #0a0c1f;
  --surface-2: #11142b;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(129, 140, 248, 0.45);
  --text: #f7f8f8;
  --text-2: #b4bcd0;
  --muted: #8f9cc2;
  --placeholder: #6f7aa0;
  --accent: #818cf8;
  --link: #828fff;
  --ok: #2dd4bf;
  --ok-soft: rgba(45, 212, 191, 0.25);
  --chip-on: rgba(94, 106, 210, 0.22);
  --grad: linear-gradient(135deg, #6366f1, #2dd4bf);
  --on-grad: #000212;
  --warn: #fbbf24;
  --err: #f87171;
  --sk: rgba(255, 255, 255, 0.06);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: 96px; }
body {
  background: var(--bg);
  background-image: radial-gradient(900px 500px at 85% -10%, var(--bg-glow-1), transparent 60%),
                    radial-gradient(700px 400px at -10% 20%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 400 17px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
h1, h2, legend, .brand span { font-family: "Space Grotesk", Inter, sans-serif; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: var(--header); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand svg { width: 48px; height: 48px; flex: none; }
.brand span { font-weight: 700; font-size: 22px; letter-spacing: -0.015em; white-space: nowrap; }
.status { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; line-height: 1.3; color: var(--text-2); }
.progress-text { white-space: nowrap; font-variant-numeric: tabular-nums; }
.save-state { font-size: 13px; min-height: 17px; white-space: nowrap; transition: opacity 0.3s; }
.save-state[data-state="idle"] { opacity: 0; }
.save-state[data-state="saving"] { color: var(--muted); }
.save-state[data-state="saved"] { color: var(--ok); }
.save-state[data-state="saved"]::before { content: "✓ "; }
.save-state[data-state="error"] { color: var(--warn); }
.bar { height: 3px; background: var(--sk); }
.bar-fill { height: 100%; width: 0; background: var(--grad); transition: width 0.3s ease; }

/* loading skeleton */
.loading { padding: 44px 0 0; }
.sk { background: var(--sk); border-radius: 8px; margin-bottom: 14px; animation: pulse 1.4s ease-in-out infinite; }
.sk-eyebrow { width: 220px; height: 14px; }
.sk-title { width: 80%; height: 38px; margin-bottom: 20px; }
.sk-line { width: 100%; height: 16px; }
.sk-line.short { width: 65%; margin-bottom: 30px; }
.sk-card { height: 150px; border-radius: 16px; margin-top: 18px; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* intro */
.intro { padding: 44px 0 12px; }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 16px; font-weight: 700; text-wrap: balance; }
h2 { font-size: 22px; line-height: 1.3; margin: 0 0 6px; font-weight: 600; letter-spacing: -0.01em; }
.lede { color: var(--text-2); font-size: 18px; margin: 0 0 18px; text-wrap: pretty; }
.notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.notes li { position: relative; padding-left: 22px; color: var(--text-2); font-size: 16px; }
.notes li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.notes li.warn { color: var(--text); }
.notes li.warn::before { background: var(--warn); }
.me { margin: 18px 0 0; font-size: 15px; color: var(--muted); }
.me strong { color: var(--text); font-weight: 600; }
.linkish { position: relative; font: inherit; font-size: inherit; color: var(--link); background: none; border: 0; padding: 4px 2px; margin: -4px -2px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; border-radius: 4px; }
.linkish::after { content: ""; position: absolute; inset: -7px 0; }
.linkish:hover { color: var(--text); }
.linkish:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* cards */
.card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 22px 22px 20px; margin: 18px 0 0; min-width: 0; transition: border-color 0.2s; }
.card:focus-within { border-color: var(--line-strong); }
legend { float: left; width: 100%; padding: 0; font-size: 20px; font-weight: 600; line-height: 1.35; margin-bottom: 6px; display: flex; align-items: flex-start; gap: 10px; }
legend + * { clear: both; }
.legend-text { flex: 1; text-wrap: pretty; }
.n { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-top: 1px; border-radius: 8px; background: var(--grad); color: var(--on-grad); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; transition: box-shadow 0.2s; }
.q.answered .n { box-shadow: 0 0 0 3px var(--ok-soft); }
.opt { flex: none; font: 500 13px Inter, sans-serif; color: var(--muted); margin-top: 5px; }
.why { margin: 0 0 14px; color: var(--text-2); font-size: 15px; text-wrap: pretty; }
.why strong { color: var(--text); }
.by { margin: 12px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.by::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }

/* inputs */
input, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-top: 10px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 110px; }
.q.optional textarea { min-height: 80px; }
.num { max-width: 180px; font-variant-numeric: tabular-nums; }

/* chips (radio/checkbox) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chips span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 15px; font-weight: 500; transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.chips label:hover span { border-color: var(--line-strong); color: var(--text); }
.chips input:checked + span { background: var(--chip-on); border-color: var(--accent); color: var(--text); }
.chips span::before { content: "✓"; display: inline-block; width: 0.8em; margin-right: 6px; color: var(--ok); font-weight: 700; opacity: 0; scale: 0.25; filter: blur(4px); transition-property: opacity, scale, filter; transition-duration: 300ms; transition-timing-function: cubic-bezier(0.2, 0, 0, 1); }
.chips input:checked + span::before { opacity: 1; scale: 1; filter: blur(0); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* uploads */
.uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 18px; min-height: 104px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); cursor: pointer; transition: border-color 0.15s; }
.drop:hover, .drop:focus-within { border-color: var(--accent); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; padding: 0; width: 100%; height: 100%; }
.drop-title { font-weight: 600; font-size: 15px; }
.drop-status { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.drop-by { font-size: 13px; color: var(--muted); }
.drop-by:empty { display: none; }
.drop-remove { position: relative; z-index: 1; align-self: flex-start; font-size: 14px; margin-top: 6px; }
.drop.has-file { border-style: solid; border-color: var(--ok); }
.drop.has-file .drop-status { color: var(--ok); font-weight: 500; }
.drop.busy { border-style: solid; }
.drop.busy .drop-status { color: var(--text-2); }
.drop.busy .drop-status::after { content: ""; display: inline-block; width: 11px; height: 11px; margin-left: 8px; vertical-align: -1px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.drop.bad { border-color: var(--err); }
.drop.bad .drop-status { color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }

/* finish */
.finish { margin-top: 28px; padding: 26px 22px; text-align: center; border-color: var(--line-strong); }
.finish-summary { margin: 0 0 4px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.finish-open { margin: 0 0 4px; color: var(--muted); font-size: 15px; line-height: 1.9; }
.finish-open a { display: inline-block; padding: 10px 2px; margin: -10px -2px; line-height: 1.4; }
.notified { margin: 14px auto 0; max-width: 520px; padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--text); font-size: 15px; }
.notified.fresh { animation: pop 0.35s ease-out; }
@keyframes pop { from { transform: scale(0.97); opacity: 0.4; } }
.primary { font: 600 17px "Space Grotesk", Inter, sans-serif; color: var(--on-grad); background: var(--grad); border: 0; border-radius: 12px; padding: 15px 34px; min-height: 52px; margin-top: 18px; cursor: pointer; transition: transform 0.12s ease, filter 0.15s; }
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: scale(0.98); }
.primary:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.primary[disabled] { filter: grayscale(0.6) brightness(0.85); cursor: progress; transform: none; }
.fine { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.err { color: var(--err); font-weight: 500; margin: 14px auto 0; max-width: 540px; }

/* name dialog */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); padding: 28px 24px 24px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 2, 18, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog p { margin: 0 0 4px; color: var(--text-2); font-size: 15px; }
dialog input { margin-top: 14px; font-size: 18px; }
dialog .err { margin: 8px 0 0; text-align: left; }
dialog .primary { width: 100%; margin-top: 16px; }

/* whole-page states */
.state { padding: 90px 0 40px; text-align: center; }
.state p { color: var(--text-2); font-size: 18px; max-width: 520px; margin: 0 auto; }

.foot { padding: 40px 16px 32px; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .uploads { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .finish { padding: 22px 16px; }
  .brand span { font-size: 19px; }
  .brand svg { width: 42px; height: 42px; }
  .top-inner { height: 64px; }
  legend { font-size: 18px; }
  .primary { width: 100%; }
}
@media (max-width: 400px) { .brand span { font-size: 17px; } .brand svg { width: 36px; height: 36px; } .status { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* recovered-edit conflict note + file-error dismiss */
.conflict { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--warn); color: var(--text-2); font-size: 14px; }
.conflict .linkish { font-size: 14px; }
.drop-dismiss { position: relative; z-index: 1; align-self: flex-start; font-size: 14px; margin-top: 6px; }
.conflict-row { margin: 0; }
.conflict-row + .conflict-row { margin-top: 8px; }
