/* ───────────────────────────────────────────────────────────
   DermaHelp · HelpyDoc Clinical — design tokens & primitives
   Clinical navy/teal on warm white. Newsreader / IBM Plex.
   ─────────────────────────────────────────────────────────── */

:root {
  /* surface & ink — warm neutrals, very low chroma */
  --bg:        #F4F2EC;
  --surface:   #FFFFFF;
  --surface-2: #FAF8F3;
  --surface-3: #F0EDE5;
  --ink:       #1B2730;
  --muted:     #5C6970;
  --faint:     #93999C;
  --line:      #E6E2D8;
  --line-cool: #DCE2E6;

  /* brand */
  --navy:      #1C3B59;
  --navy-700:  #234A6E;
  --navy-900:  #122636;
  --teal:      #11787F;
  --teal-600:  #14878F;
  --teal-tint: #E4F0F0;
  --navy-tint: #E7EDF3;

  /* triage / semantic — muted clinical */
  --safe:      #2C8A57;  --safe-tint:   #E5F1E9;
  --watch:     #B9821B;  --watch-tint:  #F6EEDC;
  --urgent:    #BC4632;  --urgent-tint: #F7E4DF;

  /* type */
  --serif: "Newsreader", Georgia, serif;
  --sans:  "IBM Plex Sans", -apple-system, system-ui, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, monospace;

  /* radii / shadow */
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px;
  --sh-1: 0 1px 2px rgba(18,38,54,0.05), 0 2px 8px rgba(18,38,54,0.04);
  --sh-2: 0 4px 14px rgba(18,38,54,0.08), 0 1px 3px rgba(18,38,54,0.06);
  --sh-3: 0 18px 44px rgba(18,38,54,0.16), 0 4px 12px rgba(18,38,54,0.08);
}

* { box-sizing: border-box; }

/* ── screen scaffold ───────────────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  animation: scr-in .42s cubic-bezier(.22,.9,.27,1);
}
/* ambient depth on light screens — warm teal/navy glow + faint clinical grid */
.screen:not(.dark) {
  background:
    radial-gradient(125% 52% at 6% -6%, rgba(17,120,127,0.07) 0%, transparent 46%),
    radial-gradient(120% 50% at 104% -2%, rgba(28,59,89,0.08) 0%, transparent 44%),
    var(--bg);
}
.screen:not(.dark)::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(28,59,89,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28,59,89,0.028) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 62%);
          mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 62%);
}
.screen > * { position: relative; z-index: 1; }
@keyframes scr-in { from { transform: translateY(10px); } to { transform: none; } }

.scr-head {
  flex-shrink: 0;
  padding: 58px 20px 12px;
  display: flex; align-items: flex-end; gap: 12px;
}
.scr-head.dark { color: #fff; }
.scr-body { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.scr-body::-webkit-scrollbar { width: 0; }
.scr-pad { padding: 4px 20px 28px; }
.scr-foot {
  flex-shrink: 0;
  padding: 12px 20px calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, rgba(244,242,236,0));
  display: flex; flex-direction: column; gap: 9px;
}

/* dark variant body */
.screen.dark { background: var(--navy-900); color: #fff; }
.screen.dark .scr-foot { background: linear-gradient(to top, var(--navy-900) 62%, rgba(18,38,54,0)); }

/* ── type helpers ──────────────────────────────────────────── */
.h-lg   { font-family: var(--serif); font-weight: 460; font-size: 30px; line-height: 1.08; letter-spacing: -.01em; }
.h-md   { font-family: var(--serif); font-weight: 460; font-size: 23px; line-height: 1.14; letter-spacing: -.01em; }
.h-sm   { font-family: var(--serif); font-weight: 500; font-size: 18px; line-height: 1.2; }
.t-lead { font-size: 15.5px; line-height: 1.5; color: var(--muted); }
.t-body { font-size: 14.5px; line-height: 1.5; }
.t-sm   { font-size: 13px; line-height: 1.45; color: var(--muted); }
.t-xs   { font-size: 11.5px; line-height: 1.4; color: var(--faint); }
.mono   { font-family: var(--mono); font-variant-ligatures: none; }
.eyebrow{ font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 500; white-space: nowrap; }
.eyebrow.muted { color: var(--faint); }
.num    { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── card ──────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FCFAF5 100%);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(18,38,54,0.04), 0 8px 22px -10px rgba(18,38,54,0.14);
  border: 1px solid rgba(230,226,216,0.9);
}
.card.flat { box-shadow: none; }
.card-pad { padding: 16px; }

/* ── buttons ───────────────────────────────────────────────── */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--sans); font-size: 15.5px; font-weight: 500;
  border-radius: 14px; padding: 14px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform .12s ease, filter .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--sh-2); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: var(--sh-2); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-soft { background: var(--surface); color: var(--navy); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.btn-soft:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .42; cursor: not-allowed; }

/* ── pills / badges ────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 999px;
  font-family: var(--sans);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pill-mono { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; }
.tag-safe   { background: var(--safe-tint);   color: var(--safe);   }
.tag-watch  { background: var(--watch-tint);  color: #8a6212;       }
.tag-urgent { background: var(--urgent-tint); color: var(--urgent); }
.tag-navy   { background: var(--navy-tint);   color: var(--navy);   }
.tag-teal   { background: var(--teal-tint);   color: var(--teal);   }
.tag-neutral{ background: var(--surface-3);   color: var(--muted);  }

/* ── hairline rows ─────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 12px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.hr-cool { height: 1px; background: var(--line-cool); border: 0; margin: 0; }

/* ── image placeholder (lesion / clinical photo) ───────────── */
.imgph {
  position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(135deg, #ECE8DF 0 9px, #F3F0E8 9px 18px);
  border: 1px solid var(--line); border-radius: var(--r-md);
  display: flex; align-items: flex-end;
}
.imgph .imgph-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .03em;
  color: #8d857a; background: rgba(255,255,255,0.82);
  padding: 3px 7px; border-radius: 6px; margin: 8px;
  display: inline-flex; align-items: center; gap: 5px;
}
.imgph.skin {
  background:
    radial-gradient(120% 90% at 60% 35%, #D9B49A 0%, #C99C7E 45%, #B98463 100%);
}
.imgph.skin .imgph-label { background: rgba(20,12,8,0.5); color: #fff; }

/* ── quality meter ─────────────────────────────────────────── */
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.4,1,.4,1); }

/* ── progress dots / stepper ───────────────────────────────── */
.steps { display: flex; gap: 6px; align-items: center; }
.steps > i { height: 4px; border-radius: 999px; background: var(--line-cool); transition: all .4s ease; flex: 1; }
.steps > i.on { background: var(--teal); }
.steps > i.done { background: var(--navy); }

/* probability bar (differential) */
.prob { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prob > i { display: block; height: 100%; border-radius: 999px; background: var(--navy); }

/* ── tab bar ───────────────────────────────────────────────── */
.tabbar {
  flex-shrink: 0; display: flex; padding: 8px 14px calc(20px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.82); backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-top: 1px solid rgba(220,226,230,0.8);
}
.tabbar button {
  flex: 1; background: none; border: 0; cursor: pointer; padding: 6px 0 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--sans); font-size: 10px; color: var(--faint); font-weight: 500;
}
.tabbar button.on { color: var(--navy); }

/* ── misc ──────────────────────────────────────────────────── */
.lift { transition: transform .14s ease, box-shadow .2s ease; }
.lift:active { transform: scale(.985); }
.press { transition: transform .12s ease; }
.press:active { transform: scale(.96); }
.fade-in { animation: scr-in .5s ease both; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse-ring { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { opacity:.7; transform: scale(.96);} 70%{opacity:0; transform: scale(1.12);} 100%{opacity:0;} }

.seg {
  display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px;
}
.seg button {
  border: 0; background: none; cursor: pointer; padding: 6px 13px; border-radius: 999px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--muted);
  transition: all .18s ease;
}
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--sh-1); }

.checkbox {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-cool);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all .15s ease; background: #fff;
}
.checkbox.on { background: var(--teal); border-color: var(--teal); }

/* ═══════════════════════════════════════════════════════════════
   v2 visual layer — depth, brand color, hero moments
   ═══════════════════════════════════════════════════════════════ */

/* ── branded icon chips (replace flat gray) ─────────────────── */
.chip {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 13px;
}
.chip-navy {
  background: linear-gradient(155deg, var(--navy-700) 0%, var(--navy) 100%);
  box-shadow: 0 5px 13px -5px rgba(28,59,89,0.55), inset 0 1px 0 rgba(255,255,255,0.14);
}
.chip-teal {
  background: linear-gradient(155deg, var(--teal-600) 0%, var(--teal) 100%);
  box-shadow: 0 5px 13px -5px rgba(17,120,127,0.55), inset 0 1px 0 rgba(255,255,255,0.2);
}
.chip-soft {
  background: linear-gradient(155deg, #EEF3F7 0%, var(--navy-tint) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 0 0 1px rgba(28,59,89,0.05);
}
.chip-tealsoft {
  background: linear-gradient(155deg, #EDF6F6 0%, var(--teal-tint) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 0 0 1px rgba(17,120,127,0.08);
}

/* ── hero panel (navy gradient + clinical grid texture) ─────── */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 88% -10%, rgba(17,120,127,0.5) 0%, transparent 52%),
    linear-gradient(158deg, var(--navy-700) 0%, var(--navy) 46%, var(--navy-900) 100%);
  color: #fff;
  box-shadow: 0 18px 40px -16px rgba(18,38,54,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(110% 80% at 80% 0%, #000 0%, transparent 70%);
          mask-image: radial-gradient(110% 80% at 80% 0%, #000 0%, transparent 70%);
}
.hero > * { position: relative; z-index: 1; }

/* crosshair reticle decoration */
.reticle { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,0.18); }

/* ── section header accent rule ─────────────────────────────── */
.accent-rule {
  height: 3px; width: 30px; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--teal-600));
}

/* ── triage hero banner ─────────────────────────────────────── */
.triage-hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl);
  padding: 18px 18px 16px;
  box-shadow: 0 14px 34px -16px rgba(18,38,54,0.4);
}
.triage-hero::before {
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 150px; height: 150px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0.16;
}
.triage-hero::after {
  content: ""; position: absolute; right: 6px; top: 6px;
  width: 96px; height: 96px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0.12;
}
.triage-urgent { background: linear-gradient(150deg, #FCEBE6 0%, #F7DDD6 100%); color: var(--urgent); }
.triage-watch  { background: linear-gradient(150deg, #FAF2E0 0%, #F4E7CC 100%); color: #9a6c14; }
.triage-safe   { background: linear-gradient(150deg, #E9F4ED 0%, #DCEEE3 100%); color: var(--safe); }

/* medallion (icon coin) */
.medallion {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; box-shadow: 0 4px 12px -4px rgba(18,38,54,0.22);
}

/* ── confidence ring sweep ──────────────────────────────────── */
.ring-track { stroke: rgba(255,255,255,0.16); }
.ring-fill { transition: stroke-dashoffset 1.1s cubic-bezier(.4,1,.4,1); transform: rotate(-90deg); transform-origin: center; }

/* avatar with subtle brand gradient */
.avatar {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; color: var(--navy);
  background: linear-gradient(155deg, #EEF3F7 0%, var(--navy-tint) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), inset 0 0 0 1px rgba(28,59,89,0.06);
}
