:root {
  /* Design refresh (2026-08-06): Option A — cool slate neutrals + a single vivid teal
     accent, replacing the original warm amber/brown palette (Josh: "not really
     appetizing"). Every pair below re-verified by computed relative-luminance contrast,
     not eyeballed — see the /scratchpad note in the design refresh plan for the method. */
  --ground: #14181c;
  --surface: #1b2126;
  --surface-raised: #232a31;
  --border: #3a434c;
  --text: #eef2f5;
  --text-muted: #9aa7b3;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --in: #4ade80;
  --danger: #e07a63;
  --focus: #5eead4;
  --radius: 10px;
}

[data-theme='light'] {
  --ground: #f4f6f8;
  --surface: #ffffff;
  --surface-raised: #eef1f4;
  --border: #d7dee4;
  --text: #1a2126;
  --text-muted: #5c6b78;
  /* #0f9d90 reaches 5.16:1 against the hardcoded near-black button/skip-link text
     (#14181c) — comfortable margin above WCAG AA's 4.5:1. #0f766e (accent-strong) reaches
     5.47:1 both as pill-admin/link text against --surface AND as the .btn-primary:hover
     background against the white text now used there (see that rule below) — this also
     fixes a real pre-existing bug: the old accent-strong (#8f5314) only reached 2.82:1
     against the button's fixed black text on hover, an AA failure the Tier 5 pass never
     caught because it only audited static states, not :hover. */
  --accent: #0f9d90;
  --accent-strong: #0f766e;
  --in: #227a4d;
  --danger: #a3402f;
  --focus: #0f766e;
}

/* Design refresh (2026-08-06): Lato, self-hosted per SDD §4.1 (no build step, no CDN
   dependency) — files pulled once from Google Fonts and committed to
   public/assets/fonts/, not loaded from fonts.gstatic.com at runtime. Only the weights
   actually used (400 body, 700/900 headings) — no italics, no latin-ext subset (English
   only). */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/lato-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/lato-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/lato-900.woff2') format('woff2');
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--ground);
  color: var(--text);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #14181c;
  padding: 0.75rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

/* Real logo art (design refresh, 2026-08-06) already carries its own color/shape — the
   gradient tile above was designed to hold a plain emoji glyph, and stacking it behind
   the actual mark just doubled up the teal for no reason. Dropped only when an <img> is
   present so the emoji-glyph empty-shell/header states (unrelated feature icons, e.g. the
   🥡 "no meal today" illustration) keep their original tile treatment unchanged. */
.brand-mark:has(img) {
  background: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

h1, h2, h3 {
  font-family: inherit;
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: 1.6rem; margin: 0 0 0.35rem; font-weight: 900; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 0 0 0.75rem; }

.subtitle {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease;
}

input[type='text']:hover:not(:focus-visible),
input[type='email']:hover:not(:focus-visible),
input[type='password']:hover:not(:focus-visible),
input[type='number']:hover:not(:focus-visible),
select:hover:not(:focus-visible),
textarea:hover:not(:focus-visible) {
  border-color: var(--text-muted);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.field-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
}

button:active, .btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #14181c;
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Real pre-existing bug fixed here (see the accent-strong comment above): the old
   amber accent-strong only reached 2.82:1 against fixed black text on hover, under AA.
   Switching the hover text to --surface (white in light mode, near-black in dark mode)
   keeps the button's own text theme-aware and >=4.5:1 against accent-strong in both
   themes, instead of assuming black text always reads on any hover background. */
.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--surface);
  box-shadow: 0 4px 14px rgba(45, 212, 191, 0.3);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-block { width: 100%; }

.theme-toggle {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 1rem;
}

.muted { color: var(--text-muted); }

.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
}

.pill-admin {
  color: var(--accent-strong);
  border-color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Design refresh (2026-08-06) originally added a color-mix() accent tint here as a
   progressive enhancement. Removed during the Phase 9 Tier 3 accessibility pass: computed
   contrast (not eyeballed) showed the tint dropped light-mode .pill-admin text to 4.17:1 —
   under WCAG AA's 4.5:1 minimum for body text, a real regression this pass caught. Even the
   lowest tint percentage that restored AA (5%) left only a razor-thin 4.59:1 margin, not
   worth keeping for a purely decorative touch — the plain solid background above already
   passes comfortably (5.47:1 light, 10.99:1 dark) and needs no enhancement. */

.nav-badge {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-strong, #0f766e);
  margin-left: 0.3rem;
  vertical-align: middle;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }

.crew-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crew-list li {
  border-bottom: 1px solid var(--border);
}
.crew-list li:last-child { border-bottom: none; }

.crew-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0.1rem;
  text-decoration: none;
  color: var(--text);
}

.toast-region {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
  width: min(90vw, 420px);
}

.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.toast.is-error { border-color: var(--danger); color: var(--danger); }

.empty-shell {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-shell .brand-mark {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 2rem;
  margin: 0 auto 1rem;
}

.invite-code {
  /* Dead 'Source Code Pro' reference removed (design refresh plan §2 cleanup note) —
     nothing ever loaded that font, it was silently falling back to ui-monospace anyway. */
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  background: var(--surface-raised);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0.5rem 0.2rem;
  color: var(--text-muted);
}

.tabs button[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.install-banner .install-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

nav.app-nav {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

nav.app-nav a {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

nav.app-nav a.active,
nav.app-nav a[aria-current='page'] {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.restaurant-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.restaurant-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}

.restaurant-card h2 {
  margin-bottom: 0.35rem;
}

.restaurant-card-address {
  margin: 0 0 0.5rem;
}

/* Design refresh (2026-08-06): extra attention on the Verdict card per Josh's request —
   this is the app's emotional payoff moment (SDD: the reveal is the point of the whole
   Chewtime). Deliberately scoped to VISUAL treatment only — the SDD's slot-machine roll
   mechanic itself is a separate, already-deferred Tier 5 backlog item Josh hasn't decided
   on (see PHASE-8-BACKLOG.md); this is a static-card entrance polish, not that mechanic. */
.verdict-card {
  position: relative;
  overflow: hidden;
  border-color: var(--accent);
  box-shadow: 0 8px 28px rgba(15, 157, 136, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: verdict-reveal 0.45s ease-out;
}

.verdict-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.verdict-card .pill-admin {
  background: var(--accent);
  color: #14181c;
  border-color: var(--accent);
  text-transform: uppercase;
  font-size: 0.72rem;
}

.verdict-card h1 {
  /* Solid color first — this is the real color used if background-clip: text isn't
     supported (@supports below only *adds* the gradient, never removes this fallback),
     so the heading is never invisible. Already >=4.5:1 against --surface in both themes
     (verified: dark 10.99:1, light 5.47:1 — see the accent-strong contrast note above),
     comfortably over AA's 3:1 minimum for large text too. */
  color: var(--accent-strong);
  font-size: 1.9rem;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .verdict-card h1 {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

@keyframes verdict-reveal {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}

legend {
  padding: 0 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 400;
  margin-right: 0.75rem;
}

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