/*
 * Aqualytix — "Calm Scientific Instrument" design system.
 * See docs/design-system.md. Structure comes from background zones, type and
 * space — not cards. Rules: (1) no cards/outlines/shadows on content, groups
 * are separated by background value + 1px hairline dividers; (2) the teal
 * accent marks only the primary action and active nav — all other color is
 * status severity; (3) one type family (IBM Plex Sans), figures use tabular-nums.
 */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces & structure */
  --surface-page: #ffffff;
  --surface-card: #ffffff;
  --surface-muted: #eceef0;
  --divider: rgba(26, 35, 33, 0.08);
  --divider-strong: rgba(26, 35, 33, 0.16);
  --divider-top: inset 0 1px 0 rgba(26, 35, 33, 0.08);
  --divider-bottom: inset 0 -1px 0 rgba(26, 35, 33, 0.08);

  /* Text ramp */
  --text-primary: #18211f;
  --text-secondary: #586663;
  --text-muted: #5d6a67;
  --text-tertiary: #93a09c;
  --text-faint: #8c9794;
  --figure-muted: #aab4b0;
  --eyebrow: #7c8a87;

  /* Accent — single brand color (primary action + active nav only) */
  --accent: #0f6e64;
  --accent-soft: #e6efed;
  --accent-button-text: #e1e6e3;

  /* Status / severity */
  --critical: #b0291f;
  --critical-soft: #f6e7e5;
  --warning: #936100;
  --warning-soft: #f5ecd9;
  --healthy: #2f7a4d;
  --healthy-soft: #e4efe8;

  /* Inactive controls */
  --icon-inactive-fill: #cdd4d1;
  --icon-inactive-text: #9aa6a2;
  --separator-dot: #c2cbc7;

  /* Radii */
  --radius-button: 10px;
  --radius-logo: 7px;
  --radius-icon: 6px;
  --radius-pill: 100px;

  /* Type family — one only: IBM Plex Sans. Numbers get tabular figures. */
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-ui);

  --shell-max: 1180px;
}

/* ── Base & typography ───────────────────────────────────────────────────── */
* { box-sizing: border-box; }
turbo-frame { display: block; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

a { color: var(--accent); }

strong { color: var(--text-primary); font-weight: 600; }

/* Numeric figures align in columns via tabular figures (single sans family) */
.mono, .stat-tile__value, .metric__value, .station-card__code, .dash-row__sub,
.nav-badge, .reading__time, .age, .report-card__date {
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--eyebrow);
}

/* ── App shell ───────────────────────────────────────────────────────────── */
.app-shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface-card);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 66px;
  padding: 0 32px;
  background: var(--surface-card);
  box-shadow: var(--divider-bottom);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.app-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-logo);
  background: var(--accent);
  color: #fff;
}
.app-logo svg { display: block; }

.app-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: 28px;
  margin-right: auto;
  height: 100%;
}
.app-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
}
.app-nav__link:hover { color: var(--text-primary); }
.app-nav__link--active { color: var(--accent); font-weight: 600; }
.app-nav__link--active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-badge {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--critical);
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}
.app-user { font-size: 13px; color: var(--text-secondary); }
.app-role {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
/* Role is identity, not status — keep it neutral (no severity color). */
.app-role--admin, .app-role--analyst, .app-role--field { background: var(--accent-soft); }

.app-signout button, .app-signout {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
}
.app-signout button:hover, .app-signout:hover { color: var(--accent); }

.app-main {
  padding: 34px 40px 80px;
}

/* ── Flash ───────────────────────────────────────────────────────────────── */
.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-button);
  margin-bottom: 1.25rem;
  font-size: 14px;
  font-weight: 500;
}
.flash--alert { background: var(--critical-soft); color: var(--critical); }
.flash--notice { background: var(--healthy-soft); color: var(--healthy); }

/* ── Buttons & text actions ──────────────────────────────────────────────── */
/* Base = secondary text action: accent text, no fill (desktop). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: var(--radius-button);
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { text-decoration: underline; }
.btn--primary {
  background: var(--accent);
  color: #fff;
  padding: 11px 18px;
}
.btn--primary:hover { filter: brightness(1.06); text-decoration: none; }
.btn--ghost { color: var(--text-muted); }
.btn--ghost:hover { color: var(--accent); }
.btn--danger { color: var(--critical); }
.btn--block { display: flex; width: 100%; }

.quick-actions { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.5rem; }
.quick-actions--admin { margin-bottom: 1rem; }

/* ── Page heads ──────────────────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; font-size: 32px; }
.page-head--sub {
  margin-top: 2.5rem;
  align-items: baseline;
  box-shadow: var(--divider-bottom);
  padding-bottom: 0.6rem;
}
.page-head--sub h2 { margin: 0; font-size: 20px; }
.breadcrumb { margin: 0 0 0.4rem; font-size: 12px; }
.breadcrumb a { color: var(--text-tertiary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard__greeting { margin-bottom: 1.75rem; }
.dashboard__greeting h1 { margin: 0 0 0.3rem; font-size: 32px; }
.dashboard__lead { margin: 0; color: var(--text-secondary); font-size: 15px; }
.dashboard__lead .app-role { margin-left: 0.35rem; }

/* Flat stat strip — figures, no boxes */
.stat-tiles {
  list-style: none;
  margin: 0 0 2rem;
  padding: 1.6rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  box-shadow: var(--divider-top);
}
.stat-tile { display: flex; flex-direction: column; gap: 0.55rem; }
.stat-tile__value {
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  color: var(--figure-muted);
}
.stat-tile__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.stat-tile--alert .stat-tile__value,
.stat-tile--alert .stat-tile__label { color: var(--critical); }
.stat-tile--warning .stat-tile__value,
.stat-tile--warning .stat-tile__label { color: var(--warning); }

/* Reporter detail zone: alerts (wide) + stations (narrow) */
.dashboard__detail {
  display: grid;
  gap: 2.5rem 4rem;
}
@media (min-width: 860px) {
  .dashboard__detail { grid-template-columns: 1.5fr 1fr; }
}

.dashboard__section { margin-bottom: 2rem; }
.dashboard__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.6rem;
  box-shadow: var(--divider-bottom);
}
.dashboard__section-head h2 { margin: 0; font-size: 20px; }
.dashboard__count {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--critical);
}
.dashboard__more { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.dashboard__more:hover { text-decoration: underline; }
.dashboard__cta { margin-top: 1rem; }

/* Hairline-divided rows (alerts, stations needing attention) */
.dash-rows { list-style: none; margin: 0; padding: 0; }
.dash-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  box-shadow: var(--divider-bottom);
}
.dash-rows .dash-row:last-child { box-shadow: none; }
.dash-row__main { flex: 1; min-width: 0; }
.dash-row__link { display: block; text-decoration: none; color: inherit; }
.dash-row__link:hover .dash-row__title { color: var(--accent); }
.dash-row__title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--text-primary);
}
.dash-row__sub { font-size: 12px; font-weight: 400; color: var(--text-tertiary); }
.dash-row__meta {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 0.3rem;
  font-size: 13px;
  color: var(--text-secondary);
}
.dash-row__empty { color: var(--accent); }
.dash-row__action { flex-shrink: 0; align-self: center; }

/* ── Severity tags & chips (status color only) ───────────────────────────── */
.chip {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.chip--fresh { color: var(--healthy); }
.chip--stale, .chip--critical { color: var(--critical); }
.chip--flagged, .chip--warning { color: var(--warning); }

.badge {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.badge--flagged { color: var(--warning); }

.age { font-size: 12px; color: var(--text-tertiary); }

/* ── Station list (hairline rows) ────────────────────────────────────────── */
.station-list { list-style: none; margin: 0; padding: 0; }
.station-card { box-shadow: var(--divider-bottom); }
.station-list .station-card:last-child { box-shadow: none; }
.station-card__link {
  display: block;
  padding: 16px 0;
  text-decoration: none;
  color: inherit;
}
.station-card__link:hover .station-card__name { color: var(--accent); }
.station-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.station-card__name { font-weight: 600; font-size: 16px; color: var(--text-primary); }
.station-card__code { font-size: 12px; color: var(--text-tertiary); }
.station-card__meta {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 13px;
  color: var(--text-secondary);
}
.station-card__empty { color: var(--accent); }
.station-card__chips { display: flex; gap: 0.85rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ── Station detail ──────────────────────────────────────────────────────── */
.station-code { font-size: 16px; color: var(--text-tertiary); font-weight: 400; }
.station-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.1rem 1.5rem;
  margin: 0 0 1rem;
  padding: 1.4rem 0;
  box-shadow: var(--divider-top), var(--divider-bottom);
}
.station-facts dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.station-facts dd {
  margin: 0.35rem 0 0;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ── Readings (hairline rows) ────────────────────────────────────────────── */
/* Readings footer: per-page control + pagination */
.reading-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
}
.per-page { display: flex; align-items: center; gap: 0.4rem; }
.per-page__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 0.2rem;
}
.per-page__option {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.per-page__option:hover { color: var(--accent); }
.per-page__option--active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Pagy pagination nav */
.pagy.series-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-left: auto;
}
.pagy.series-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-button);
  background: var(--surface-card);
}
.pagy.series-nav a:hover { border-color: var(--accent); color: var(--accent); }
.pagy.series-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-button-text);
  font-weight: 600;
}
.pagy.series-nav a[aria-disabled="true"] {
  color: var(--text-faint);
  border-color: var(--divider);
  pointer-events: none;
}

/* Readings table */
.reading-table-wrap { overflow-x: auto; }
.reading-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.reading-table thead th {
  padding: 0 0.75rem 0.6rem;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
  box-shadow: var(--divider-bottom);
}
.reading-table__num { text-align: right; }
.reading-table__unit { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-tertiary); }

.reading-row > td { padding: 0.7rem 0.75rem; box-shadow: var(--divider-bottom); }
.reading-row__time { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.reading-row__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  white-space: nowrap;
}
.reading-row__num--derived { color: var(--accent); }
.reading-row__by { color: var(--text-tertiary); font-size: 13px; white-space: nowrap; }
.reading-row--flagged .reading-row__time { color: var(--warning); }

/* Notes hang under their reading, without a divider between the two rows. */
.reading-row:has(+ .reading-row__notes-row) > td { box-shadow: none; }
.reading-row__notes { padding: 0 0.75rem 0.7rem; box-shadow: var(--divider-bottom); }
.reading-row__notes-row .reading-row__notes { font-size: 13px; color: var(--text-secondary); }

/* ── Trend charts ────────────────────────────────────────────────────────── */
.trends { display: block; margin-top: 2.5rem; }
.trends > .page-head--sub { margin-top: 0; }
.trends__title { font-size: 20px; margin: 0; }
.chart-window { display: flex; gap: 0.4rem; }
.chart-window__option {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.chart-window__option:hover { color: var(--accent); }
.chart-window__option--active {
  color: var(--accent);
  background: var(--accent-soft);
}
.chart-range { margin: 0.9rem 0 0.2rem; }
.chart-range__row { display: flex; align-items: center; gap: 0.6rem; }
.chart-range__label {
  margin: 0.5rem 0 0;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.chart-range__step {
  flex: none;
  width: 1.6rem;
  text-align: center;
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
  user-select: none;
}
.chart-range__step:hover { color: var(--text-primary); }
.chart-range__step--disabled { color: var(--text-tertiary); cursor: default; }

/* Range brush: a track spanning the full reading history with a draggable
   selection box marking the visible window. */
.chart-brush__track {
  position: relative;
  flex: 1;
  height: 26px;
  border-radius: 6px;
  background: var(--accent-soft);
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}
.chart-brush__track--inert { background: var(--surface-muted); opacity: 0.5; cursor: default; }
.chart-brush__selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent);
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
}
.chart-brush__selection:active { cursor: grabbing; }
.chart-brush__selection:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.chart-card { padding: 1.25rem 0; box-shadow: var(--divider-bottom); }
.chart-card:last-child { box-shadow: none; }
.chart-card__title { margin: 0 0 0.9rem; font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.chart-card__unit { color: var(--text-tertiary); font-weight: 400; font-size: 12px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form { max-width: 520px; }
.form--entry { max-width: 440px; }
.field { margin-bottom: 1.1rem; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 0.35rem; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="datetime-local"],
.field input[type="month"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-button);
  font-size: 15px;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--surface-card);
}
/* Numeric inputs use tabular figures so digits line up */
.field input[type="number"],
.field input[type="datetime-local"],
.field input[type="month"] { font-variant-numeric: tabular-nums; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form--entry .field input { font-size: 1.1rem; padding: 0.7rem 0.75rem; }
.field__hint { margin: 0.35rem 0 0; font-size: 12px; color: var(--text-tertiary); }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.75rem; }
.form--entry .form-actions { flex-direction: column-reverse; align-items: stretch; }

.form-errors {
  background: var(--critical-soft);
  border-radius: var(--radius-button);
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
}
.form-errors__title { margin: 0 0 0.35rem; font-weight: 600; color: var(--critical); font-family: var(--font-ui); }
.form-errors ul { margin: 0; padding-left: 1.1rem; color: var(--critical); font-size: 14px; }

.empty-state { color: var(--text-tertiary); }

/* ── Auth (no nav/tab chrome) ────────────────────────────────────────────── */
.auth-card {
  max-width: 360px;
  margin: 4rem auto;
  padding: 0 1rem;
}
.auth-card h1 { margin: 0 0 1.5rem; font-size: 28px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 0.35rem; }
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin: 0 0 1rem;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-button);
  font-size: 15px;
  font-family: var(--font-ui);
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-card input[type="submit"] {
  width: 100%;
  padding: 0.7rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-button);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
}
.auth-card a { color: var(--accent); }

/* ── Alerts (Phase 2 — hairline rows) ────────────────────────────────────── */
.alert-section { margin-top: 2rem; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  box-shadow: var(--divider-bottom);
}
.alert-list .alert-card:last-child { box-shadow: none; }
.alert-card--acknowledged { opacity: 0.6; }
.alert-card__head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.alert-card__title { font-weight: 600; color: var(--text-primary); }
.alert-card__detail { margin: 0.35rem 0; color: var(--text-secondary); font-size: 14px; }
.alert-card__meta {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-tertiary);
}
.alert-card__station { color: var(--accent); text-decoration: none; }
.alert-card__station:hover { text-decoration: underline; }
.alert-card__main { flex: 1; min-width: 0; }
.alert-card__action { flex-shrink: 0; align-self: center; }

/* ── Reports (Phase 2) ───────────────────────────────────────────────────── */
.report-form-card { padding: 1.5rem 0; margin-bottom: 2rem; box-shadow: var(--divider-bottom); }
.report-form-card__title { margin: 0 0 1.1rem; font-size: 18px; }
.report-form { max-width: none; }
.report-form__stations { border: none; padding: 0; margin: 0 0 0.5rem; }
.report-form__stations legend { font-weight: 600; font-size: 13px; color: var(--text-primary); padding: 0; }
.report-form__station { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; font-weight: 400; }
.report-form__station input { width: auto; }

.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 1.25rem;
  margin: 0 0 1.25rem;
  background: var(--surface-muted);
  border-radius: var(--radius-button);
}
.logo-preview__img { max-width: 320px; max-height: 120px; object-fit: contain; }
.logo-preview .empty-state { margin: 0; }

.signatory-list { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.signatory-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  box-shadow: var(--divider-bottom);
}
.signatory-list__name { font-weight: 600; color: var(--text-primary); }
.signatory-list__position { color: var(--text-secondary); }
.signatory-list__position::before { content: "·"; margin: 0 0.5rem; color: var(--text-tertiary); }
.signatory-form .field { max-width: 420px; }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 13px; }

.report-history { margin-top: 1rem; }
.report-history h2 { font-size: 20px; }
.report-list { list-style: none; margin: 0; padding: 0; }
.report-card { box-shadow: var(--divider-bottom); }
.report-list .report-card:last-child { box-shadow: none; }
.report-card__link { display: block; padding: 16px 0; text-decoration: none; color: inherit; }
.report-card__link:hover .report-card__period { color: var(--accent); }
.report-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.report-card__period { font-weight: 600; font-size: 16px; color: var(--text-primary); }
.report-card__date { font-size: 12px; color: var(--text-tertiary); }
.report-card__meta {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 0.35rem;
  font-size: 13px;
  color: var(--text-secondary);
}
.report-downloads { display: flex; gap: 1.25rem; flex-wrap: wrap; }

.report-stations { margin: 1.5rem 0; }
.report-station-table thead th.reading-table__num { text-align: right; }
.report-station-table thead th:first-child,
.report-station-table .reading-row__time { min-width: 200px; }
.report-station-table .reading-row__time { white-space: normal; }
.report-station-table .reading-row__time .station-code { white-space: nowrap; }
.report-station-table .reading-row__time .chip { margin-left: 0.5rem; }

/* ── Accounts (Phase 3) ──────────────────────────────────────────────────── */
.user-list { list-style: none; margin: 0; padding: 0; }
.user-card { padding: 16px 0; box-shadow: var(--divider-bottom); }
.user-list .user-card:last-child { box-shadow: none; }
.user-card--inactive { opacity: 0.6; }
.user-card__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.user-card__email { font-weight: 600; color: var(--text-primary); word-break: break-all; }
.user-card__you {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-left: 0.4rem;
}
.user-card__tags { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.user-card__actions { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.75rem; }
.user-card__actions .btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Sync status pill (header) ───────────────────────────────────────────── */
.sync-status {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.sync-status[hidden] { display: none; }
.sync-status--offline { background: var(--surface-muted); color: var(--text-muted); }
.sync-status--syncing { background: var(--accent-soft); color: var(--accent); }
.sync-status--failed { background: var(--critical-soft); color: var(--critical); }

/* ── Mobile bottom tab bar ───────────────────────────────────────────────── */
.tab-bar { display: none; }

@media (max-width: 720px) {
  .app-header { padding: 0 18px; }
  .app-nav { display: none; }            /* primary nav moves to bottom tabs */
  .app-header__user { margin-left: auto; } /* nav carried the spacer; replace it */
  .app-user { display: none; }
  .app-main { padding: 22px 18px 96px; } /* room for the fixed tab bar */
  .page-head h1, .dashboard__greeting h1 { font-size: 24px; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); gap: 1.4rem 1rem; }
  .stat-tile__value { font-size: 32px; }
  .page-head--sub h2, .dashboard__section-head h2, .trends__title { font-size: 18px; }

  .tab-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    justify-content: space-around;
    padding-top: 13px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    height: 74px;
    background: var(--surface-card);
    box-shadow: var(--divider-top);
  }
  .tab-bar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--icon-inactive-text);
    font-size: 10px;
    font-weight: 400;
  }
  .tab-bar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-icon);
    color: var(--icon-inactive-fill);
  }
  .tab-bar__item--active { color: var(--accent); font-weight: 600; }
  .tab-bar__item--active .tab-bar__icon { color: var(--accent); }
  .tab-bar__badge {
    font-size: 9px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--critical);
  }
}
