/* Forensic Lab — design system. Soft structuralism: bright white, iOS widget geometry, double-bezel
   cards, ultra-diffused shadows, spring motion (transform/opacity only). */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-tint: #f6f7f9;
  --ink: #0b0b0f;
  --ink-2: #55565c;
  --ink-3: #8e8e94;
  --hair: rgba(15, 23, 42, 0.06);
  --hair-2: rgba(15, 23, 42, 0.10);
  --accent: #0a6cff;
  --accent-soft: rgba(10, 108, 255, 0.09);
  --series-1: #2a78d6;
  --good: #0ca30c;
  --good-ink: #0b7a0b;
  --good-soft: rgba(12, 163, 12, 0.09);
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --warn-soft: rgba(250, 178, 25, 0.14);
  --crit: #d03b3b;
  --crit-ink: #b42323;
  --crit-soft: rgba(208, 59, 59, 0.09);
  --shadow-1: 0 1px 1px rgba(16, 24, 40, 0.02), 0 8px 24px -10px rgba(16, 24, 40, 0.07);
  --shadow-2: 0 2px 4px rgba(16, 24, 40, 0.03), 0 24px 56px -20px rgba(16, 24, 40, 0.16);
  --r-shell: 30px;
  --r-core: 24px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --out: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Geist", system-ui, sans-serif;
  --mono: "SF Mono", "Geist Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.knob .ic, .close .ic, .decision .di .ic { width: 16px; height: 16px; }
.drop .ic, .phone-empty .ic, .empty .ic { width: 28px; height: 28px; color: var(--ink-3); margin-bottom: 8px; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}
/* Fixed ambient light — never on scrolling content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(10, 108, 255, 0.07), transparent 60%),
    radial-gradient(800px 600px at 105% 110%, rgba(122, 92, 255, 0.06), transparent 60%),
    radial-gradient(600px 400px at 70% 10%, rgba(12, 163, 12, 0.035), transparent 60%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
::selection { background: var(--accent-soft); }

/* ---------- typography ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2); background: rgba(15, 23, 42, 0.04); box-shadow: inset 0 0 0 1px var(--hair);
}
.h-display { font-size: clamp(32px, 3.4vw, 46px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 650; margin: 14px 0 0; }
.h-title { font-size: 22px; letter-spacing: -0.02em; font-weight: 640; margin: 0; }
.h-sub { color: var(--ink-2); font-size: 15px; margin: 8px 0 0; max-width: 60ch; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }

/* ---------- double-bezel cards ---------- */
.shell {
  position: relative;
  border-radius: var(--r-shell);
  padding: 6px;
  background: rgba(15, 23, 42, 0.025);
  box-shadow: inset 0 0 0 1px var(--hair);
  transition: transform 600ms var(--spring);
}
.core {
  position: relative;
  height: 100%;
  border-radius: var(--r-core);
  background: #fff;
  padding: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--shadow-1);
}
.shell.lift::after {
  content: ""; position: absolute; inset: 6px; border-radius: var(--r-core);
  box-shadow: var(--shadow-2); opacity: 0; transition: opacity 600ms var(--spring); pointer-events: none;
}
.shell.lift:hover { transform: translateY(-3px); }
.shell.lift:hover::after { opacity: 1; }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  border: 0; border-radius: 999px; padding: 6px 6px 6px 20px; min-height: 46px;
  font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; text-decoration: none;
  background: var(--ink); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 10px 24px -12px rgba(11, 11, 15, 0.55);
  transition: transform 450ms var(--spring), box-shadow 450ms var(--spring), opacity 300ms var(--out);
}
.btn .knob {
  width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14);
  transition: transform 500ms var(--spring);
}
.btn:hover .knob { transform: translate(2px, -1px) scale(1.06); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.light { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair-2), var(--shadow-1); }
.btn.light .knob { background: rgba(15, 23, 42, 0.05); }
.btn.blue { background: var(--accent); box-shadow: 0 10px 24px -12px rgba(10, 108, 255, 0.7); }
.btn.sm { min-height: 36px; padding: 4px 4px 4px 14px; font-size: 13px; gap: 8px; }
.btn.sm .knob { width: 28px; height: 28px; }
.btn.plain { padding: 0 16px; }

.chip {
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap;
  background: rgba(15, 23, 42, 0.05); color: var(--ink-2);
}
.chip svg { width: 13px; height: 13px; }
.chip.good { background: var(--good-soft); color: var(--good-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.crit { background: var(--crit-soft); color: var(--crit-ink); }
.chip.blue { background: var(--accent-soft); color: var(--accent); }

.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; background: var(--ink-3); }
.dot.good { background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 4px var(--crit-soft); }

/* ---------- inputs (iOS inset grouped) ---------- */
.group { border-radius: 18px; background: var(--bg-tint); box-shadow: inset 0 0 0 1px var(--hair); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 52px; position: relative; }
.row + .row::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--hair); }
.row label { font-size: 14px; color: var(--ink-2); min-width: 112px; }
.row input, .row select {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 14px 0; font-size: 15px; text-align: right;
}
.row input::placeholder { color: var(--ink-3); }
.field {
  width: 100%; border: 0; outline: none; padding: 16px 18px; border-radius: 16px; font-size: 15.5px;
  background: var(--bg-tint); box-shadow: inset 0 0 0 1px var(--hair);
  transition: box-shadow 350ms var(--spring), background 350ms var(--spring);
}
.field:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }

/* ---------- segmented control ---------- */
.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(15, 23, 42, 0.05); }
.seg button { position: relative; isolation: isolate; border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: color 300ms var(--out), transform 450ms var(--spring); }
.seg button::before { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 4px 12px -4px rgba(16,24,40,.12); opacity: 0; transform: scale(.86); transition: opacity 300ms var(--out), transform 550ms var(--spring); }
.seg button:active { transform: scale(.96); }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg button[aria-pressed="true"]::before { opacity: 1; transform: none; }

/* ---------- reveal choreography ---------- */
[data-reveal] { opacity: 0; transform: translateY(22px); filter: blur(6px); }
[data-reveal].in { opacity: 1; transform: none; filter: blur(0); transition: opacity 900ms var(--out), transform 1000ms var(--spring), filter 900ms var(--out); transition-delay: var(--d, 0ms); }

/* ---------- toasts (iOS banners) ---------- */
.toasts { position: fixed; z-index: 40; top: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 0 0 1px var(--hair), var(--shadow-2);
  animation: toast-in 650ms var(--spring) both;
}
.toast.out { animation: toast-out 420ms var(--out) both; }
.toast .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.toast b { display: block; font-size: 13.5px; }
.toast span { font-size: 13px; color: var(--ink-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-16px) scale(0.98); } }

/* ---------- misc ---------- */
.spinner { width: 18px; height: 18px; border-radius: 999px; border: 2px solid rgba(15,23,42,.12); border-top-color: var(--accent); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(100deg, rgba(15,23,42,.04) 30%, rgba(15,23,42,.08) 50%, rgba(15,23,42,.04) 70%); background-size: 300% 100%; animation: shimmer 1.6s var(--out) infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
}
