@font-face { font-family: "Peckham Press"; src: url("/static/fonts/PeckhamPress.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Neuzeit Grotesk"; src: url("/static/fonts/NeuzeitGrotesk-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Neuzeit Grotesk"; src: url("/static/fonts/NeuzeitGrotesk-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #1C1C1C; --surface: #242424; --surface2: #2B2B2B; --field: #1C1C1C;
  --ink: #E4E2DD; --muted: #A3A09A; --faint: #8A8780; --line: #333333; --line2: #3A3A3A;
  --red: #CA0013; --blue: #006FA5; --amber: #EFA832; --amberbg: #2E2A20;
  --display: "Peckham Press", "Archivo", "Arial Black", sans-serif;
  --font: "Neuzeit Grotesk", "League Spartan", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #1C1C1C; } }
:root[data-theme="dark"] { --bg: #1C1C1C; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--amber); }
a:hover { color: #F6C46A; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--amber) 70%, transparent); outline-offset: 2px; }

.display { font-family: var(--display); font-stretch: 125%; font-weight: 900; text-transform: uppercase; line-height: 1.02; letter-spacing: -0.01em; margin: 0; }
.eyebrow { font-size: 12px; font-weight: 900; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }

/* Brand mark */
.mark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark svg { width: 30px; height: 30px; }
.mark b { font-family: var(--display); font-stretch: 125%; font-weight: 900; font-size: 19px; }
.mark .tag { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--amber); }

/* Admin shell */
.topbar { height: 68px; padding: 0 clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); position: sticky; top: 0; background: var(--bg); z-index: 20; }
.topbar nav { display: flex; gap: 6px; flex-grow: 1; overflow-x: auto; }
.topbar nav a { padding: 10px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.topbar nav a.on { color: var(--ink); background: #2A2A2A; font-weight: 700; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.page { max-width: 1340px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 48px) 80px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.pagehead h1 { font-size: clamp(32px, 5vw, 44px); }

/* Cards and forms */
.card { background: var(--surface); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; min-width: 0; }
label.f .opt { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line2); border-radius: 8px; padding: 0 12px; height: 44px; width: 100%; font-size: 15px; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }

.btn { font: inherit; font-weight: 900; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; border: 0; border-radius: 8px; height: 48px; padding: 0 22px; background: var(--red); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line2); text-transform: none; letter-spacing: 0; font-weight: 700; }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.dashed { background: transparent; color: var(--ink); border: 1px dashed #4A4A4A; text-transform: none; letter-spacing: 0; font-weight: 700; height: 40px; padding: 0 14px; align-self: flex-start; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 6px; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; background: #333; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border: 0; cursor: pointer; text-decoration: none; }
.iconbtn.red { background: var(--red); color: #fff; }
.iconbtn:hover { color: var(--ink); filter: brightness(1.15); }
.iconbtn.red:hover { color: #fff; }
.xbtn { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; flex-shrink: 0; }

.seg { display: inline-flex; background: var(--surface); border-radius: 10px; padding: 4px; gap: 4px; }
.card .seg { background: var(--field); }
.seg button { height: 38px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg.amber button[aria-pressed="true"] { background: var(--amber); color: var(--bg); }

.switchrow { display: flex; align-items: center; gap: 14px; }
.switchrow > div { flex-grow: 1; }
.switch { width: 48px; height: 28px; border-radius: 999px; border: 0; padding: 3px; background: #3A3A3A; display: flex; justify-content: flex-start; cursor: pointer; flex-shrink: 0; }
.switch[aria-checked="true"] { background: var(--red); justify-content: flex-end; }
.switch span { width: 22px; height: 22px; border-radius: 50%; background: #fff; display: block; }

.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; display: inline-block; }
.pill.amber { background: var(--amber); color: var(--bg); }
.pill.blue { background: var(--blue); color: #fff; }
.pill.line { border: 1px solid var(--line2); color: var(--muted); }
.warn { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--amber); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); font-weight: 700; padding: 12px 18px; border-radius: 10px; z-index: 100; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100% - 32px); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 12px; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal .sheet { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100% - 24px); overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
.modal .sheet h2 { margin: 0; font-size: 20px; }
.modal .sheet > * { flex-shrink: 0; }
.sigpad { background: #F4F2EC; border-radius: 10px; width: 100%; height: 170px; touch-action: none; display: block; cursor: crosshair; }
.agreement-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; background: var(--field); border-radius: 10px; padding: 16px; max-height: 28vh; overflow: auto; }

/* Optical centring: trims the font's built-in space above caps and below the baseline,
   so text sits dead centre in pills, tabs and buttons (League Spartan sits low otherwise). */
.pill { padding: 6px 10px; line-height: 1; text-box: trim-both cap alphabetic; }
.btn, .seg button { text-box: trim-both cap alphabetic; }
@supports not (text-box: trim-both cap alphabetic) {
  .pill { padding: 5px 10px 4px; }
  .btn, .seg button { padding-top: 2px; }
}

/* ---------- Phones and small tablets ---------- */
.grid > *, .layout > *, .col > *, .card > * { min-width: 0; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar { display: none; }
.mobile-save { display: none; }
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 8px; }
  .topbar nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .topbar nav a { padding: 10px 12px; }
  .topbar .who { margin-left: auto; }
  .topbar .who #who { display: none; }
  .page { padding-top: 20px; }
  .pagehead { margin-bottom: 18px; }
  .pagehead > div:last-child:not(:first-child) { width: 100%; }
  .card { padding: 18px 16px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .switch { width: 52px; height: 30px; }
  .switch span { width: 24px; height: 24px; }
  input, select, textarea { font-size: 16px; } /* stops iPhone zooming in on fields */
  .mobile-save { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
  body.has-mobile-save .page { padding-bottom: 110px; }
}

/* Settings gear next to Log Out */
.topbar .who { display: flex; align-items: center; gap: 10px; }
.gearbtn { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #3A3A3A; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; flex-shrink: 0; }
.gearbtn:hover, .gearbtn.on { color: var(--ink); border-color: var(--line2); background: #2A2A2A; }
.topbar nav { justify-content: flex-start; }
@media (max-width: 760px) { .topbar nav { display: grid; grid-template-columns: repeat(4, 1fr); } .topbar nav a { text-align: center; } }

/* Keep the top bar within the screen: the email shrinks first, then hides */
.topbar nav { min-width: 0; }
.topbar .who { flex-shrink: 0; }
.topbar .who #who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1280px) { .topbar .who #who { display: none; } }
