/* LanternLit: shared tokens, base, chrome (masthead/footer) and the app-page class vocabulary.
   Loaded by every page. Marketing-only layout lives in site.css.
   Identity: a shop at night (deep "night" blue) and the one warm light left on (lantern amber).
   Type: Barlow Condensed for display (truck-door / road-sign lettering), Barlow for reading. */

@font-face { font-family: "Barlow"; src: url("/assets/fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/assets/fonts/barlow-600.woff2") format("woff2"); font-weight: 500 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/assets/fonts/barlow-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/assets/fonts/barlow-condensed-600.woff2") format("woff2"); font-weight: 500 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/assets/fonts/barlow-condensed-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("/assets/fonts/roboto-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", "Arial Narrow", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* brand constants (same in both schemes) */
  --lamp: #F5A83B;        /* lantern amber: primary actions, the glow */
  --lamp-hi: #FFC56B;
  --lamp-edge: #D48717;
  --on-lamp: #1A1206;
  --glow: rgba(245, 168, 59, .26);

  /* night surfaces (masthead, hero, bands) and page surfaces. Dark is the default theme;
     theme.js sets data-theme="light" on <html> only when the visitor chose light. */
  --night-text: #E9EDF3;
  --night-muted: #A9B4C4;
  --night: #070C17;
  --night-2: #111B2E;
  --night-line: #22304A;
  --bg: #0B1220;
  --surface: #121B2C;
  --surface-2: #19243A;
  --text: #E7ECF2;
  --muted: #A3AEBE;
  --line: #26324A;
  --line-strong: #3A4864;
  --accent-ink: #F5A83B;
  --tint: rgba(245, 168, 59, .10);
  --ok: #6FD39A;   --ok-bg: rgba(111, 211, 154, .12);
  --warn: #F5C26B; --warn-bg: rgba(245, 194, 107, .12);
  --bad: #FF8A7A;  --bad-bg: rgba(255, 138, 122, .12);
  --info: #8CB8F2; --info-bg: rgba(140, 184, 242, .12);
  --on-bad: #1E0A06;
  --focus: #FFC56B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -20px rgba(0, 0, 0, .7);

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --container: 1140px;
  --gutter: 16px;
}

:root[data-theme="light"] {
  color-scheme: light;
  /* night chrome stays night; page surfaces turn to day */
  --night: #0D1626;
  --night-2: #16223A;
  --night-line: #26334D;

  --bg: #F2F4F5;
  --surface: #FFFFFF;
  --surface-2: #E9EDF0;
  --text: #142033;
  --muted: #4E5A6B;
  --line: #D6DCE2;
  --line-strong: #AEB8C3;
  --accent-ink: #8F4F00;  /* amber dark enough for text on light */
  --tint: rgba(245, 168, 59, .13);

  --ok: #1D7A46;   --ok-bg: #E2F2E8;
  --warn: #8F4F00; --warn-bg: #FCEFD9;
  --bad: #B42318;  --bad-bg: #FBE7E4;
  --info: #1F5FAD; --info-bg: #E3EDF9;
  --on-bad: #FFFFFF;

  --focus: #1F5FAD;
  --shadow: 0 1px 2px rgba(13, 22, 38, .05), 0 12px 32px -18px rgba(13, 22, 38, .28);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 16px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
main { flex: 1 0 auto; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -.005em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 7vw, 3.25rem); }
h2 { font-size: clamp(1.75rem, 5vw, 2.25rem); }
h3 { font-size: 1.375rem; font-weight: 600; line-height: 1.15; }
h4 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { padding-left: 1.25em; margin: 0 0 1em; }
li + li { margin-top: .35em; }
img, svg { max-width: 100%; }
strong { font-weight: 700; }
small, .small { font-size: .9rem; line-height: 1.5; }
hr, .divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; height: 0; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--lamp); text-decoration-thickness: 2px; text-underline-offset: .2em; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--lamp); color: var(--on-lamp); }
code, .mono { font-family: var(--font-mono); font-size: .92em; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--lamp); color: var(--on-lamp); padding: 10px 16px; border-radius: var(--radius); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }
.narrow { width: 100%; max-width: 560px; margin-inline: auto; }
.container.narrow { max-width: calc(560px + 2 * var(--gutter)); }
.stack > * { margin-block: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; } }
.spacer { height: 32px; }
.page-head { margin: 36px 0 28px; }
.page-head h1 { margin-bottom: 8px; }
.page-head > p.muted { font-size: 1.125rem; margin: 0; max-width: 40rem; }
.page-head > .row { margin-top: 20px; }

/* ---------- text ---------- */
.muted { color: var(--muted); }
.lead { font-size: 1.1875rem; line-height: 1.55; color: var(--muted); max-width: 40rem; }
.eyebrow { display: block; font: 600 .8125rem/1.3 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 8px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; box-shadow: var(--shadow); }
@media (min-width: 640px) { .card { padding: 28px; } }
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: 1.5rem; margin: 0 0 12px; }
.auth-card {
  position: relative; overflow: hidden; width: 100%; max-width: 440px; margin: 48px auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 36px 24px 28px;
  box-shadow: var(--shadow);
}
.auth-card::before { /* the lamp left on: warm light falling from the card's top edge */
  content: ""; position: absolute; inset: 0 0 auto; height: 140px; pointer-events: none;
  background: radial-gradient(55% 100% at 50% 0%, rgba(245, 168, 59, .14), transparent);
  border-top: 1px solid rgba(245, 168, 59, .35); border-radius: 20px 20px 0 0;
}
.auth-card > * { position: relative; }
.auth-card h1 { font-size: 2.25rem; }
.auth-card > :last-child { margin-bottom: 0; }
@media (min-width: 480px) { .auth-card { padding: 44px 40px 36px; } }
.empty { border: 1.5px dashed var(--line-strong); border-radius: var(--radius-l); padding: 36px 20px; text-align: center; color: var(--muted); }
.empty > :last-child { margin-bottom: 0; }
.empty h2, .empty h3 { color: var(--text); }
.callout { background: var(--tint); border: 1px solid color-mix(in srgb, var(--lamp) 40%, transparent); border-left: 4px solid var(--lamp); border-radius: var(--radius); padding: 14px 18px; }
.callout > :last-child { margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 600 1.0625rem/1.2 var(--font-body); text-decoration: none; text-align: center;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--lamp); border-color: var(--lamp-edge); color: var(--on-lamp); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary:hover { background: var(--lamp-hi); color: var(--on-lamp); }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); color: var(--on-bad); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 1rem; }
/* Google sign-in, per Google's branding guidelines: neutral button, multicolor G on the left, Roboto Medium. */
.btn-google {
  background: #131314; border: 1px solid #8E918F; color: #E3E3E3; border-radius: 999px;
  font: 500 1rem/1.25 "Roboto", var(--font-body); letter-spacing: .01em; gap: 12px; padding: 0 20px 0 16px;
}
.btn-google:hover { background: #1E1F20; color: #E3E3E3; }
.btn-google svg { width: 20px; height: 20px; }
:root[data-theme="light"] .btn-google { background: #FFFFFF; border-color: #747775; color: #1F1F1F; }
:root[data-theme="light"] .btn-google:hover { background: #F2F4F7; color: #1F1F1F; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 18px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .help { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
.input {
  display: block; width: 100%; min-height: 48px; padding: 10px 14px;
  font: 400 1.0625rem/1.4 var(--font-body); color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { min-height: 120px; resize: vertical; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat;
}
.check { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 18px; cursor: pointer; line-height: 1.45; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--lamp-edge); cursor: pointer; }
.field-error { color: var(--bad); font-weight: 600; font-size: .95rem; margin: 6px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }

/* ---------- status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font: 600 .8125rem/1.3 var(--font-body); white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.flash { border-radius: var(--radius); padding: 14px 16px 14px 18px; margin: 0 0 20px; border: 1px solid var(--line); border-left-width: 4px; background: var(--surface); }
.flash > :last-child { margin-bottom: 0; }
.flash-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); border-left-color: var(--ok); }
.flash-error { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); border-left-color: var(--bad); }
.flash-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); border-left-color: var(--info); }

/* ---------- data ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); margin: 0 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.table th, .table td { text-align: left; padding: 12px 16px; vertical-align: top; }
.table th { font-weight: 600; font-size: .875rem; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table td { border-top: 1px solid var(--line); }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 24px; margin: 0 0 16px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .95rem; padding-top: 10px; }
.kv dd { margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.kv dd:last-of-type { border-bottom: 0; }
@media (min-width: 520px) {
  .kv { grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: 0 24px; }
  .kv dt, .kv dd { padding: 11px 0; border-bottom: 1px solid var(--line); }
  .kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
}
.steps { list-style: none; padding: 0; margin: 0 0 20px; counter-reset: step; }
.steps li { position: relative; counter-increment: step; padding: 2px 0 22px 48px; margin: 0; color: var(--muted); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font: 700 1rem/1 var(--font-display);
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--muted);
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: var(--line); }
.steps li.done { color: var(--text); }
.steps li.done::before { content: ""; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1220' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/16px no-repeat; border-color: var(--ok); }
.steps li.done::after { background: var(--ok); }
.steps li.current { color: var(--text); font-weight: 600; }
.steps li.current::before { border-color: var(--lamp-edge); background: var(--lamp); color: var(--on-lamp); box-shadow: 0 0 0 5px var(--glow); }
:root[data-theme="light"] .steps li.done::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }

/* ---------- chrome: masthead ---------- */
.masthead { --focus: var(--lamp-hi); background: var(--night); color: var(--night-text); border-bottom: 1px solid var(--night-line); position: relative; z-index: 10; }
.masthead-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--night-text); text-decoration: none; font: 700 1.625rem/1 var(--font-display); letter-spacing: .005em; padding: 6px 0; }
.brand:hover { color: #FFFFFF; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav form { display: contents; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--night-muted); text-decoration: none; font: 500 1.0625rem/1 var(--font-body);
  background: none; border: 0; cursor: pointer;
}
.nav-link:hover { color: var(--night-text); background: rgba(255, 255, 255, .06); }
.nav-link[aria-current="page"] { color: var(--night-text); box-shadow: inset 0 -2px 0 var(--lamp); border-radius: 0; }
.nav .btn-primary { margin-left: 8px; }
.nav-user { color: var(--night-muted); font-size: .95rem; padding: 0 10px; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide-sm { display: none; }
@media (min-width: 860px) { .hide-sm { display: inline-flex; } }
@media (max-width: 380px) { .brand { font-size: 1.4rem; } .brand .mark { width: 26px; height: 26px; } .nav-link { padding: 0 9px; } }

/* ---------- chrome: footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; padding: 40px 0 28px; margin-top: auto; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer .brand { color: var(--text); font-size: 1.5rem; }
.footer .brand .mark { color: var(--text); }
.footer h2 { font: 600 1rem/1.3 var(--font-body); color: var(--text); margin: 0 0 10px; letter-spacing: 0; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li + li { margin-top: 8px; }
.footer a { text-decoration-color: color-mix(in srgb, var(--lamp) 60%, transparent); }
.footer-blurb { max-width: 26rem; margin: 12px 0 0; }
.footer-legal { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 20px; font-size: .875rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.footer-legal p { margin: 0; }

/* light/dark switch: shown by theme.js (hidden without JS); the label names the theme it switches to */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 10px; margin: -6px 0;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted);
  font: 500 .875rem/1 var(--font-body); cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.theme-toggle svg { width: 16px; height: 16px; flex: none; }
.theme-toggle > span { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle > .to-dark, :root[data-theme="light"] .theme-toggle > .to-light { display: none; }
:root[data-theme="light"] .theme-toggle > .to-dark { display: inline-flex; }
.theme-toggle .to-light svg { color: var(--lamp); }
.theme-toggle .to-dark svg { color: var(--accent-ink); }

/* ---------- app pages ---------- */
body.app main.container { padding-top: 8px; padding-bottom: 56px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.footer-links li + li { margin-top: 0; }
body.app .footer { padding: 24px 0 20px; }
body.app .footer-legal { margin-top: 16px; padding-top: 14px; }

/* Keep nav labels on one line on phones; tight padding below 480px so Account, Admin, Sign out fit at 360px. */
.nav-link { white-space: nowrap; }
@media (max-width: 479px) { .nav-link { padding: 0 8px; font-size: 1rem; } .masthead-bar { gap: 4px; } .nav .btn-primary { margin-left: 4px; } }
@media (max-width: 374px) { .nav-link { padding: 0 6px; font-size: .9375rem; } }
/* Data tables scroll sideways inside .table-wrap on phones instead of crushing cells. */
.table td.mono, .table td .badge { white-space: nowrap; }
@media (max-width: 599px) { .table { min-width: 520px; } }

/* portal pages built as .narrow.stack: same breathing room under the header as the sign-in card */
body.app main.container > .narrow.stack { padding-top: 40px; }
.empty h1 { color: var(--text); }
.empty + p.small { text-align: center; }
