/*
 * NuTrak app shell — layered on top of broadsheet.css.
 *
 * The page-level type override comes from the design prototype: Broadsheet's
 * own face is Source Serif, but this composition sets Plus Jakarta Sans
 * throughout. Everything else here is the mobile shell the prototype drew
 * inside a device frame — now the whole viewport.
 */

/* Self-hosted variable font (latin subset) — no third-party request. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-heading: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-heading-weight: 700;

  /* Corner radius for the soft cards, as a multiple of the system token. */
  --card-radius: calc(var(--radius-lg) * 3);

  /* Height of the fixed tab bar, so scroll containers can clear it. */
  --tabbar-height: 68px;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.025em; }

body {
  margin: 0;
  background: var(--color-bg);
  font-feature-settings: "ss01" 1;
  -webkit-font-smoothing: antialiased;
  /* Stop iOS Safari inflating text in landscape. */
  -webkit-text-size-adjust: 100%;
}

/* Scrollable strips that shouldn't show a bar (visit dates, metric chips). */
.scr { -ms-overflow-style: none; scrollbar-width: none; }
.scr::-webkit-scrollbar { display: none; }

/* ── App shell ──────────────────────────────────────────────────────────── */

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* The design is a phone layout; centre it rather than stretching on a
     desktop browser, which consultants do use for the report screen. */
  max-width: 520px;
  margin-inline: auto;
  background: var(--color-bg);
  position: relative;
}

.app-body {
  flex: 1;
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 24px);
}

/* ── Header block — the one dark surface ────────────────────────────────── */

.app-header {
  background: var(--color-accent-900);
  color: var(--color-bg);
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 22px 26px;
  border-bottom-left-radius: calc(var(--radius-lg) * 6);
  border-bottom-right-radius: calc(var(--radius-lg) * 6);
}

.app-header a { color: var(--color-accent-200); }

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.header-chip {
  all: unset;
  cursor: pointer;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, #f3f2f2 16%, transparent);
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  color: inherit;
  text-decoration: none;
}
.header-chip:hover { background: color-mix(in srgb, #f3f2f2 28%, transparent); }

.header-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--color-accent-700);
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
}

.header-kicker {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-300);
}

.header-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero { display: flex; align-items: flex-end; gap: 18px; margin-top: 24px; }
.hero-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-accent-300); margin-bottom: 2px;
}
.hero-figure {
  font-family: var(--font-heading); font-weight: 600; font-size: 54px;
  line-height: 0.9; font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
}
.hero-note { font-size: 13px; color: var(--color-accent-200); }
.hero-trend { font-size: 12px; color: var(--color-accent-300); }

.programme-pill {
  display: inline-flex; align-items: center; margin-top: 16px;
  padding: 5px 12px; border-radius: 99px;
  background: color-mix(in srgb, #f3f2f2 14%, transparent);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}

/* ── Content ────────────────────────────────────────────────────────────── */

.content { padding: 20px 18px; }

.soft {
  border-radius: var(--card-radius);
  background: var(--color-surface);
}

.row-button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--card-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  min-height: 44px;
  text-decoration: none;
  color: inherit;
}
.row-button:hover { background: var(--color-neutral-200); }

.stack { display: flex; flex-direction: column; gap: 10px; }

/* Visit strip and metric chips */
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.visit-chip {
  all: unset; cursor: pointer; flex: none; width: 54px; text-align: center;
  padding: 9px 0; border-radius: var(--card-radius);
  background: var(--color-surface); color: var(--color-text);
  text-decoration: none;
}
.visit-chip[aria-current="true"] { background: var(--color-accent); color: var(--color-bg); }
.visit-chip .mon { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.72; }
.visit-chip .day {
  font-family: var(--font-heading); font-weight: 600; font-size: 19px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}

.pill-group {
  display: flex; gap: 4px; padding: 4px;
  background: var(--color-neutral-200); border-radius: 99px;
}
.pill {
  all: unset; cursor: pointer; flex: 1; text-align: center; padding: 9px 0;
  border-radius: 99px; font-family: var(--font-heading); font-weight: 600;
  font-size: 14px; color: var(--color-neutral-700); text-decoration: none;
}
.pill[aria-selected="true"] { background: var(--color-bg); color: var(--color-text); }

.chip {
  all: unset; cursor: pointer; flex: none; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--color-divider); font-size: 12px; color: var(--color-text);
}
.chip[aria-pressed="true"] {
  background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg);
}

/* Headline indicators grid — the reading and its band, colour-coded to match
   the session report's scorecard. Replaced the percentage rings, which read
   100% for anything already inside its band. */
.indicators { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.indicator-card {
  padding: 14px 13px;
  border-radius: var(--card-radius); background: var(--color-surface);
}
.indicator-label {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-neutral-600); margin-bottom: 3px;
}
.indicator-value {
  font-family: var(--font-heading); font-weight: 600; font-size: 26px;
  font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: -0.02em;
}
.indicator-unit { font-size: 10px; color: var(--color-neutral-600); }
.indicator-change {
  font-size: 10.5px; color: var(--color-neutral-600); margin-top: 6px;
}

/* Roster status dot — the client's weight band at a glance. Tones match the
   report's tags via Band::dotClass(); warn is hollow for the same reason its
   tag is an outline, so only a genuine risk shouts. The band is also named in
   the row's meta line, so colour never carries the meaning alone. */
.status-dot {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  margin-inline: 15px; /* centres it in the 44px the ring used to occupy */
}
.dot-good { background: var(--color-accent); }
.dot-bad { background: var(--color-accent-2-500); }
.dot-warn { border: 2.5px solid var(--color-accent); }
.dot-none { background: var(--color-neutral-300); }

/* Floating record button */
.fab {
  all: unset; cursor: pointer; position: fixed;
  right: max(20px, calc((100vw - 520px) / 2 + 20px));
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 16px);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--color-accent); color: var(--color-bg);
  display: grid; place-items: center; box-shadow: var(--shadow-lg);
  font-size: 28px; line-height: 1; text-decoration: none; z-index: 20;
}
.fab:hover { background: var(--color-accent-600); }

/* Tab bar — fixed, clearing the iPhone home indicator */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  max-width: 520px; margin-inline: auto;
  display: flex; padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tab {
  all: unset; cursor: pointer; flex: 1; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 0; color: var(--color-neutral-600); text-decoration: none;
}
.tab[aria-current="page"] { color: var(--color-accent); }
.tab span {
  font-family: var(--font-heading); font-weight: 600; font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* Forms — the pill-rounded inputs the prototype uses */
.input-lg {
  min-height: 48px;
  border-radius: var(--card-radius);
  padding-inline: 14px;
}
.btn-pill { border-radius: 99px; min-height: 50px; font-size: 15px; }

.field-error { font-size: 11px; color: var(--color-accent-2-700); margin-top: 4px; }

.notice {
  padding: 10px 14px; border-radius: var(--card-radius);
  background: var(--color-accent-100); color: var(--color-accent-800);
  font-size: 13px; margin-bottom: 14px;
}

/* Report scale bar */
.scale-track { display: flex; height: 9px; margin: 11px 0 5px; border-radius: 99px; overflow: hidden; }
.scale-marker-wrap { position: relative; height: 14px; margin-bottom: 2px; }
.scale-marker {
  position: absolute; top: -16px; width: 3px; height: 19px; border-radius: 99px;
  background: var(--color-accent); transform: translateX(-1.5px);
}
.scale-band {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-accent-700); white-space: nowrap;
}
.scale-ends {
  display: flex; justify-content: space-between; font-size: 10px;
  color: var(--color-neutral-600); margin-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
