/* B.LAB ProWin — design tokens.
   Taken from the official B.LAB design system (Zone C, screen set). House rules that
   matter here: NO shadows in any medium — elevation is border, tint and whitespace;
   no gradients in brand colour; 44px minimum touch target; 8px spacing base.

   DEVIATION, deliberate: the design system loads Inter from Google Fonts. This app is
   offline-first, so a runtime CDN is not allowed — Inter is replaced by the device's own
   UI font (Roboto on Android), which costs zero bytes and is close in character. Begum
   is self-hosted for headings only, font-display:swap, never blocking first paint. */

@font-face {
  font-family: "Begum";
  src: url("fonts/Begum-Regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Begum";
  src: url("fonts/Begum-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  /* ---- brand ---- */
  --navy:        #16234C;
  --white:       #FFFFFF;
  --bg:          #F0F2F9;
  --border:      #E7EBF0;
  --ink:         #231F20;
  --muted:       #656A6F;
  --accent:      #3E5EAB;

  /* ---- platform ground tints (identify, never rank) ---- */
  --agebiome:    #FDE5DC;
  --neurobiome:  #FCE0F5;
  --chronolift:  #D4EDFE;
  --nutrilayer:  #D8F6E5;
  --dermaai:     #E1E5E8;

  /* ---- semantic ---- */
  --error:       #B3261E;
  --ok:          #1F6B3B;
  --warn:        #8A5A00;

  /* ---- type ---- */
  --font-editorial: "Begum", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --size-h1: 1.5rem;  --size-h2: 1.125rem; --size-body: 1rem;
  --size-small: 0.875rem; --size-caption: 0.75rem;
  --ls-eyebrow: 0.08em;

  /* ---- space, radius, layout ---- */
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px;
  --r-xs: 4px; --r-sm: 8px; --r-md: 16px; --r-lg: 24px;
  --touch: 44px;
  --header: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* our own display rules would otherwise beat the UA's [hidden] */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--size-body); line-height: 1.6;
  overscroll-behavior-y: none;
}
body { padding-bottom: env(safe-area-inset-bottom); }

h1, h2, h3 { font-family: var(--font-editorial); font-weight: 500; line-height: 1.25; margin: 0; }
h1 { font-size: var(--size-h1); letter-spacing: -0.01em; }
h2 { font-size: var(--size-h2); }

.eyebrow {
  font-size: var(--size-caption); font-weight: 600;
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: var(--size-small); }
.caption { font-size: var(--size-caption); }
.num { font-variant-numeric: tabular-nums; }

/* ---- app frame ---- */
.top {
  position: sticky; top: 0; z-index: 20;
  min-height: var(--header);
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3);
  padding-top: calc(var(--s2) + env(safe-area-inset-top));
}
.top .logo { height: 22px; width: auto; display: block; flex: none; }
.top .back {
  display: flex; align-items: center; justify-content: center;
  min-width: var(--touch); min-height: var(--touch); margin-left: calc(var(--s3) * -1);
  color: var(--white); text-decoration: none; font-size: 1.4rem; line-height: 1;
}
main { padding: var(--s3); max-width: 720px; margin: 0 auto; }

/* ---- surfaces ---- */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--s3);
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
}

/* ---- controls (44px floor everywhere) ---- */
button, .btn {
  font: inherit; font-weight: 600;
  min-height: var(--touch); padding: 0 var(--s4);
  border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--navy); color: var(--white);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2); text-decoration: none;
}
button:disabled, .btn[aria-disabled="true"] { background: var(--border); color: var(--muted); cursor: default; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-block { width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

label { display: block; margin-bottom: var(--s3); }
label > span { display: block; margin-bottom: var(--s1); }
input, textarea {
  font: inherit; width: 100%; min-height: var(--touch);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--white); color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; }

/* ---- status strip ---- */
.status {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--size-caption); color: var(--muted);
  padding: var(--s2) var(--s3); background: var(--white); border-bottom: 1px solid var(--border);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.status[data-offline="true"] .dot { background: var(--warn); }

/* ---- toast ---- */
.toast {
  position: fixed; left: var(--s3); right: var(--s3); bottom: var(--s3); z-index: 40;
  background: var(--navy); color: var(--white);
  border-radius: var(--r-sm); padding: var(--s3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  font-size: var(--size-small);
}
.toast button { min-height: 36px; padding: 0 var(--s3); background: var(--white); color: var(--navy); }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(8px); opacity: 0; } }
}
