/* Broadstairs Records Hub — Sambrook's brand design system.
   Matches the sambrooksbrewery.co.uk look: white banners, bold black uppercase menu/buttons (Jost),
   Assistant for text/headings, blue kept only as a logo accent.
   Mobile-first, high contrast, large touch targets for wet/bright/gloved brewery-floor use.
   Traffic-light + pass/fail colours are deliberately universal (never restyled into brand colours). */

/* Brand fonts, bundled locally (SIL OFL) — no external requests. */
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/Assistant-400.woff2') format('woff2'); }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/Assistant-600.woff2') format('woff2'); }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/Assistant-700.woff2') format('woff2'); }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 800; font-display: swap; src: url('/static/fonts/Assistant-800.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/Jost-500.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/Jost-700.woff2') format('woff2'); }

:root {
  /* Brand blues. --brand is a deeper shade of the logo blue, used where white text sits (AA contrast);
     --brand-bright is the actual logo blue, used for accents/active states. Sampled/confirmed vs logo. */
  --brand: #336490;         /* logo blue darkened for AA white-text contrast (header, buttons) */
  --brand-dark: #27506f;    /* hover / active */
  --brand-bright: #478bc8;  /* the exact Sambrook's logo blue — accents, active states */
  --brand-tint: #e9f1f8;
  --ink-ring: #14181c;          /* the logo's black ring — used for strong text/borders */

  /* Warm neutrals */
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --border: #dcd8d1;
  --border-strong: #c3beb4;
  --ink: #1b2026;
  --muted: #5b6470;

  /* Universal status colours — keep recognisable, do NOT brand-tint */
  --green: #16803c;
  --green-bg: #e5f4ea;
  --amber: #b45309;
  --amber-bg: #fdf0dd;
  --red: #c02626;
  --red-bg: #fbe7e6;
  --grey: #6b7280;
  --grey-bg: #eceae6;

  --pass: var(--green);
  --pass-bg: var(--green-bg);
  --fail: var(--red);
  --fail-bg: var(--red-bg);

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(20, 24, 28, 0.10), 0 1px 2px rgba(20, 24, 28, 0.06);
  --shadow-lg: 0 6px 24px rgba(20, 24, 28, 0.12);
  --tap: 48px;                  /* minimum touch target */
  --maxw: 720px;                /* mobile-first content column */

  --ink-strong: #14181c;      /* near-black for headings, menu, buttons — the site's black */
  --font-sans: 'Assistant', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: 'Assistant', -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ui: 'Jost', 'Assistant', -apple-system, "Segoe UI", Roboto, sans-serif; /* uppercase menu + buttons */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); color: var(--ink-strong); line-height: 1.12; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 800; text-transform: uppercase; letter-spacing: .005em; }
h3 { font-size: 1.05rem; font-weight: 700; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

/* Layout ------------------------------------------------------------------ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1080px; margin: 0 auto; padding: 16px; }

/* Header — white banner, bold black menu (matches sambrooksbrewery.co.uk) ---- */
.appbar {
  background: var(--surface);
  color: var(--ink-strong);
  border-bottom: 2px solid var(--ink-strong);
  position: sticky; top: 0; z-index: 50;
}
.appbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 14px; display: flex; align-items: center; gap: 12px; }
.appbar a { color: var(--ink-strong); text-decoration: none; }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-lockup img, .brand-lockup svg { width: 42px; height: 42px; display: block; flex: 0 0 auto; object-fit: contain; }
.brand-name { font-family: var(--font-head); font-weight: 800; text-transform: uppercase; letter-spacing: .01em; font-size: 1.02rem; line-height: 1.05; white-space: nowrap; }
.brand-sub { font-family: var(--font-sans); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .72rem; color: var(--muted); }
/* On small phones, show the logo only — the wordmark would crowd the user/sign-out block. */
@media (max-width: 600px) {
  .brand-lockup > span { display: none; }
}
.appbar-spacer { flex: 1; }
.appbar-user { font-size: .82rem; text-align: right; line-height: 1.2; color: var(--ink); }
.appbar-user .role { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .66rem; font-family: var(--font-ui); font-weight: 700; }
.appbar-signout {
  font-family: var(--font-ui); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  font-size: .74rem; border: 2px solid var(--ink-strong); border-radius: 8px; padding: 8px 12px; white-space: nowrap;
}
.appbar-signout:hover { background: var(--ink-strong); color: #fff !important; }

/* Primary nav — bold black uppercase */
.topnav { background: var(--surface); border-top: 1px solid var(--border); }
.topnav-inner { max-width: 1080px; margin: 0 auto; padding: 0 8px; display: flex; gap: 2px; overflow-x: auto; }
.topnav a {
  color: var(--ink-strong); text-decoration: none; padding: 12px 14px; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem;
  border-bottom: 3px solid transparent;
}
.topnav a:hover { border-bottom-color: var(--ink-strong); }
.topnav a.active { border-bottom-color: var(--brand-bright); }

/* Cards ------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.stack > * + * { margin-top: 12px; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 20px;
  font-family: var(--font-ui); font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
  text-decoration: none; text-align: center; line-height: 1.1;
}
.btn-primary { background: var(--ink-strong); color: #fff; border-color: var(--ink-strong); }
.btn-primary:hover { background: #000; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink-strong); border-color: var(--ink-strong); }
.btn-secondary:hover { background: var(--ink-strong); color: #fff; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #a01f1f; }
.btn-ghost { background: transparent; color: var(--ink-strong); border-color: transparent; }
.btn-ghost:hover { text-decoration: underline; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 56px; font-size: 1rem; letter-spacing: .06em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms — one question / tight group per block, big fields ------------------ */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: .85rem; margin: 2px 0 8px; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  font-size: 1.05rem; font-family: var(--font-sans);
  border: 2px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus { outline: 3px solid var(--brand-bright); outline-offset: 1px; border-color: var(--brand); }
.textarea { min-height: 96px; resize: vertical; }
.input-affix { display: flex; align-items: stretch; }
.input-affix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-affix .affix { display: flex; align-items: center; padding: 0 14px; border: 2px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-2); color: var(--muted); font-weight: 600; }

/* Big tappable choice tiles (branching selects, yes/no) */
.choices { display: grid; gap: 10px; }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px;
  border: 2px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  font-size: 1.05rem; font-weight: 600; cursor: pointer; text-align: left;
}
.choice:hover { border-color: var(--brand); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected, .choice:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.choice .desc { font-weight: 400; font-size: .82rem; color: var(--muted); }

/* Standalone checkbox (keep me signed in, filters, active) — visible native box, touch-sized */
.check { display: inline-flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 4px; font-weight: 600; cursor: pointer; }
.check input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--brand); flex: 0 0 auto; }

/* Badges & status --------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .01em; }
.badge-pass, .badge-within { background: var(--green-bg); color: var(--green); }
.badge-fail, .badge-reclean, .badge-outside { background: var(--red-bg); color: var(--red); }
.badge-na { background: var(--grey-bg); color: var(--grey); }
.badge-void { background: var(--grey-bg); color: var(--grey); text-transform: uppercase; }

.light { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }
.light-red { background: var(--red); }
.light-amber { background: var(--amber); }
.light-green { background: var(--green); }
.light-grey { background: var(--grey); }
.pill { display:inline-flex; align-items:center; gap:7px; padding:5px 11px; border-radius:999px; font-weight:700; font-size:.82rem; }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-grey { background: var(--grey-bg); color: var(--grey); }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; background: var(--surface); }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 700; color: var(--ink); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.void td { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--red); }

/* Alerts ------------------------------------------------------------------ */
.alert { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; border: 1px solid; font-size: .95rem; }
.alert-info { background: var(--brand-tint); border-color: var(--brand-bright); color: var(--brand-dark); }
.alert-warn { background: var(--amber-bg); border-color: var(--amber); color: #7a3d06; }
.alert-error { background: var(--red-bg); border-color: var(--red); color: #7f1d1d; }
.alert-success { background: var(--green-bg); border-color: var(--green); color: #14532d; }

/* Auth screen ------------------------------------------------------------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; text-align: center; }
.auth-logo img, .auth-logo svg { width: 92px; height: 92px; object-fit: contain; }

/* Utility ----------------------------------------------------------------- */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.text-red { color: var(--red); } .text-green { color: var(--green); } .text-brand { color: var(--brand); }
.hide { display: none !important; }
kbd, code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; }

@media (min-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 24px 16px; }
}

/* Vessel summary (tank farm) ---------------------------------------------------------------------
   Status colours reuse the universal traffic-light palette; "bright" beer uses the logo blue as a
   fourth, distinct state. Each vessel is drawn as a conical fermenter with its fill level shown. */
.vtotals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0; }
@media (max-width: 560px) { .vtotals { grid-template-columns: repeat(2, 1fr); } }
.vtile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.vtile .lab { color: var(--muted); font-size: .78rem; margin-bottom: 2px; }
.vtile .big { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--ink-strong); line-height: 1.05; }
.vtile .big i { font-size: .8rem; font-weight: 700; color: var(--muted); font-style: normal; margin-left: 3px; }
.vtile.rough .big { color: var(--amber); }
.vtile.bright .big { color: var(--brand-bright); }
.vbar { height: 7px; border-radius: 6px; background: var(--border); overflow: hidden; margin-top: 8px; }
.vbar > i { display: block; height: 100%; }

.vlegend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 2px; font-size: .82rem; color: var(--muted); }
.vlegend span { display: inline-flex; align-items: center; gap: 6px; }
.vdot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.vdot.v-bright { background: var(--brand-bright); }
.vdot.v-rough { background: var(--amber); }
.vdot.v-clean { background: var(--green); }
.vdot.v-dirty { background: var(--red); }

.vgrp-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }

.vboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.vessel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 10px 6px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  text-decoration: none; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
.vessel:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.vessel .v-name { font-family: var(--font-ui); font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; color: var(--ink-strong); }
.tank-wrap { height: 82px; display: flex; align-items: flex-end; justify-content: center; margin: 3px auto 5px; }
.tank-svg { display: block; color: var(--border-strong); }
.tank-large { width: 52px; height: 76px; }
.tank-medium { width: 48px; height: 70px; }
.tank-small { width: 44px; height: 64px; }
.tank-svg .bg { fill: var(--surface-2); }
.tank-svg .liquid { fill: currentColor; opacity: .32; }
.tank-svg .outline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.vessel.v-bright .tank-svg { color: var(--brand-bright); }
.vessel.v-rough .tank-svg { color: var(--amber); }
.vessel.v-clean .tank-svg { color: var(--green); }
.vessel.v-dirty .tank-svg { color: var(--red); }
.vessel .v-vol { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.vessel .v-vol i { font-size: .72rem; font-weight: 700; color: var(--muted); font-style: normal; margin-left: 2px; }
.vessel .v-beer { font-size: .74rem; line-height: 1.2; color: var(--muted); }
.vessel .v-status { font-size: .82rem; font-weight: 700; }
.vessel.v-clean .v-status { color: var(--green); }
.vessel.v-dirty .v-status { color: var(--red); }

/* Vessel detail */
.vstate { border-left: 5px solid var(--border-strong); }
.vstate.v-bright { border-left-color: var(--brand-bright); }
.vstate.v-rough { border-left-color: var(--amber); }
.vstate.v-clean { border-left-color: var(--green); }
.vstate.v-dirty { border-left-color: var(--red); }
.v-pill { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 20px; background: var(--grey-bg); color: var(--ink); }
.v-pill-lg { font-size: .8rem; padding: 5px 11px; }
.vstate.v-bright .v-pill { background: var(--brand-bright); color: #fff; }
.vstate.v-rough .v-pill { background: var(--amber); color: #fff; }
.vstate.v-clean .v-pill { background: var(--green); color: #fff; }
.vstate.v-dirty .v-pill { background: var(--red); color: #fff; }

.vactions { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.act { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink-strong); font-weight: 700; }
.act:hover { border-color: var(--border-strong); background: var(--surface-2); }
.act .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-size: 1.05rem; flex: 0 0 auto; }
.act .lbl { display: flex; flex-direction: column; }
.act .lbl small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.act .arw { margin-left: auto; color: var(--muted); font-size: 1.2rem; }

.readout { border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px; background: var(--surface-2); color: var(--ink); }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix .input { flex: 1; }
.input-suffix > span { color: var(--muted); font-weight: 700; }

.vchip { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 20px; background: var(--grey-bg); color: var(--ink); }
.vchip.v-bright { background: var(--brand-tint); color: var(--brand-dark); }
.vchip.v-rough { background: var(--amber-bg); color: var(--amber); }
.vchip.v-clean { background: var(--green-bg); color: var(--green); }
.vchip.v-dirty { background: var(--red-bg); color: var(--red); }

/* Vessel capacity editor (Settings) */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 6px; }
.cap-item label { display: block; font-family: var(--font-ui); font-weight: 700; font-size: .82rem; letter-spacing: .02em; margin-bottom: 3px; }
.cap-item .input-suffix > span { font-size: .82rem; }
.cap-item .input { padding: 8px 10px; }

/* Beer colour markers + palette picker (Settings) */
.beer-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(20,24,28,0.15); }
.beer-colour-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.beer-colour-row:last-of-type { border-bottom: none; }
.beer-colour-row .beer-name { font-weight: 700; min-width: 150px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 7px; cursor: pointer; border: 2px solid var(--border); position: relative; display: inline-flex; align-items: center; justify-content: center; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:has(input:checked) { border-color: var(--ink-strong); box-shadow: 0 0 0 2px var(--surface) inset; }
.swatch-none { background: var(--surface-2); color: var(--muted); font-size: .8rem; }
