/* beerwithme.tech — system fonts only (no font CDN), WCAG 2.1 AA contrast, visible focus. */
:root {
  --bg: #FDF8ED;
  --card: #FFFFFF;
  --text: #1A1408;
  --muted: #6B5D3D;      /* 6.1:1 on --bg */
  --brand: #965A0B;      /* 5.3:1 on --bg */
  --accent: #C67C14;
  --on-accent: #1A1408;  /* 5.5:1 on --accent */
  --border: #DDD0B0;
  --danger: #A8301F;
  --ok: #157A37;
  --focus: #1A56DB;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120E; --card: #1E1B14; --text: #FDF8ED; --muted: #C4B898; --brand: #F5C86A;
    --accent: #E8A735; --on-accent: #1A1408; --border: #3D3520; --danger: #FF8A7A; --ok: #6EE7A0; --focus: #93C5FD;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--card); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; top: .5rem; }
.site-header, main, .site-footer { max-width: 46rem; margin: 0 auto; padding: 1rem 1.25rem; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.lang { font-weight: 600; }
main { padding-top: 1.5rem; padding-bottom: 2.5rem; }
main:focus { outline: none; }
h1 { font-size: 2rem; line-height: 1.2; margin: .5rem 0 1rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .25rem; }
.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }
.callout { border-left: 4px solid var(--accent); background: var(--card); padding: .75rem 1rem; border-radius: 6px; }
blockquote { border-left: 4px solid var(--accent); background: var(--card); padding: .75rem 1rem; border-radius: 6px; margin: 1rem 0; }
blockquote p { margin: 0; }
.preview { max-width: 46rem; margin: 1rem auto 0; padding: .5rem 1rem; background: var(--card); border: 2px dashed var(--danger); color: var(--danger); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .95rem; }
th, td { border: 1px solid var(--border); padding: .5rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--card); }
.link-list li { margin: .35rem 0; }
.button, button {
  display: inline-block; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px;
  padding: .75rem 1.5rem; min-height: 44px; text-decoration: none;
}
button[disabled] { opacity: .6; cursor: progress; }
.form { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin: 1rem 0; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input[type="text"], .field input[type="email"], .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--muted); border-radius: 8px; padding: .6rem .7rem; min-height: 44px;
}
.field.checkbox { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; }
.field.checkbox input { width: 1.4rem; height: 1.4rem; margin-top: .2rem; }
.field.checkbox label { font-weight: 400; }
.field.checkbox .error { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }
.req { color: var(--muted); font-weight: 400; font-size: .9rem; }
.error { color: var(--danger); font-weight: 600; margin: .3rem 0 0; }
[aria-invalid="true"] { border-color: var(--danger) !important; border-width: 2px !important; }
.status:empty { display: none; }
.status { margin-top: 1rem; padding: .75rem 1rem; border-radius: 8px; border: 2px solid var(--ok); }
.status-error { border-color: var(--danger); }
.site-footer { border-top: 1px solid var(--border); font-size: .95rem; color: var(--muted); }
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-footer a[aria-current="page"] { font-weight: 700; text-decoration: none; color: var(--text); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Admin statistics page (/admin). Chart colours: validated categorical pair (blue, orange) + one-hue blue
   heat scale, light and dark selected separately (dataviz palette; CVD ΔE ≥ 24 on both card surfaces). */
.field input[type="password"] {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--muted); border-radius: 8px; padding: .6rem .7rem; min-height: 44px;
}
:root {
  --s1: #2a78d6; --s2: #eb6834; --grid: #ECE4D0; --axis: #C9BC9A; --ink2: #4F4530;
  --q0: transparent; --q1: #cde2fb; --q2: #9ec5f4; --q3: #6da7ec; --q4: #2a78d6; --q5: #184f95;
  --q-ink-dark: #0b0b0b; --q-ink-light: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s1: #3987e5; --s2: #d95926; --grid: #2E2818; --axis: #4A4128; --ink2: #DCD2B8;
    --q1: #0d366b; --q2: #184f95; --q3: #256abf; --q4: #5598e7; --q5: #9ec5f4;
    --q-ink-dark: #FDF8ED; --q-ink-light: #0b0b0b;
  }
}
@media (min-width: 64rem) { main:has(#admin-dash:not([hidden])) { max-width: 72rem; } }
#admin-dash { transition: opacity .15s; }
#admin-dash.is-loading .dash-section, #admin-dash.is-loading .kpis { opacity: .5; }
.small { font-size: .85rem; }
button.secondary, button.range { background: var(--card); color: var(--text); border: 1px solid var(--border); padding: .45rem .9rem; font-weight: 600; min-height: 40px; }
button.secondary:hover, button.range:hover { border-color: var(--muted); }
button.range[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
button.small-btn { min-height: 32px; padding: .2rem .75rem; font-size: .85rem; }
.toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin: 0 0 .5rem; padding: .6rem 0; background: var(--bg); border-bottom: 1px solid var(--border);
}
.toolbar-label { font-weight: 700; margin-right: .25rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.toolbar-gap { flex: 1 1 auto; }
.jump { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: .25rem 0 1rem; font-size: .95rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .6rem; margin: 0 0 1.5rem; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .1rem; }
.kpi-label { color: var(--ink2); font-size: .85rem; font-weight: 600; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; }
.kpi-note { color: var(--muted); font-size: .8rem; }
.dash-section { margin-top: 2rem; }
.dash-section > h2 { margin: 0 0 .25rem; padding-top: .5rem; scroll-margin-top: 4.5rem; }
.dash-section > p { margin: 0 0 1rem; max-width: 52rem; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem 1.1rem; margin: 0 0 1rem; }
.panel h3 { font-size: 1.1rem; margin: 0 0 .2rem; }
.panel .desc { color: var(--ink2); font-size: .9rem; margin: 0 0 .6rem; max-width: 52rem; line-height: 1.45; }
@media (min-width: 64rem) {
  #sec-activity, #sec-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  #sec-activity .panel, #sec-insights .panel { margin: 0; min-width: 0; }
  #activity-retention, #insights-retention, #insights-actions { grid-column: 1 / -1; }
}
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--ink2); }
.legend:empty { display: none; }
.legend .key { display: inline-block; width: 1rem; height: 3px; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
.key.s1, .tip-key.s1 { background: var(--s1); }
.key.s2, .tip-key.s2 { background: var(--s2); }
.chart { position: relative; margin: .4rem 0 .2rem; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline-offset: 4px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid.base, .chart .tick { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1, .chart .end.s1, .chart .hover-dot.s1 { stroke: var(--s1); }
.chart .line.s2, .chart .end.s2, .chart .hover-dot.s2 { stroke: var(--s2); }
.chart .end.s1, .chart .hover-dot.s1 { fill: var(--s1); }
.chart .end.s2, .chart .hover-dot.s2 { fill: var(--s2); }
.chart .end, .chart .hover-dot { stroke: var(--card); stroke-width: 2; }
.chart .area.s1 { fill: var(--s1); opacity: .1; }
.chart .end-label { fill: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .cross { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip {
  position: absolute; pointer-events: none; min-width: 9rem; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: .45rem .6rem; font-size: .85rem; line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.tip-head { color: var(--muted); font-size: .8rem; margin-bottom: .15rem; }
.tip-row { display: flex; align-items: center; gap: .45rem; white-space: nowrap; }
.tip-row strong { font-variant-numeric: tabular-nums; }
.tip-key { display: inline-block; width: .9rem; height: 3px; border-radius: 2px; }
.empty { color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; padding: 1rem; text-align: center; margin: .25rem 0; }
.bars { list-style: none; padding: 0; margin: .2rem 0 .4rem; }
.bars li { display: grid; grid-template-columns: minmax(6rem, 13rem) 1fr minmax(4.5rem, auto); gap: .75rem; align-items: center; margin: .3rem 0; font-size: .92rem; }
.bar-label { overflow-wrap: anywhere; }
.bar-track { display: block; height: 14px; }
.bar-fill { display: block; height: 100%; width: 0; min-width: 2px; background: var(--s1); border-radius: 0 4px 4px 0; }
.bar-value { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 30rem) { .bars li { grid-template-columns: 1fr auto; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }
.tbl-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin: .8rem 0 .35rem; }
.table-wrap.scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-wrap.scroll.tall { max-height: 26rem; }
table.data { margin: 0; font-size: .875rem; line-height: 1.35; border-collapse: separate; border-spacing: 0; }
table.data th, table.data td { border: 0; border-bottom: 1px solid var(--grid); padding: .35rem .65rem; white-space: nowrap; vertical-align: middle; }
table.data thead th { position: sticky; top: 0; z-index: 1; background: var(--card); border-bottom: 1px solid var(--axis); font-weight: 700; font-size: .8rem; color: var(--ink2); }
table.data tbody th { background: transparent; font-weight: 500; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover td, table.data tbody tr:hover th { background: color-mix(in srgb, var(--s1) 7%, transparent); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.zero { color: var(--muted); }
table.data tfoot th, table.data tfoot td { position: sticky; background: var(--card); font-weight: 700; border-bottom: 0; line-height: 1.25rem; }
table.data tfoot tr:first-child th, table.data tfoot tr:first-child td { border-top: 1px solid var(--axis); bottom: 1.95rem; }
table.data tfoot tr:last-child th, table.data tfoot tr:last-child td { bottom: 0; font-weight: 500; color: var(--ink2); }
table.data tfoot tr:only-child th, table.data tfoot tr:only-child td { bottom: 0; font-weight: 700; color: var(--text); }
.heat td.q0 { background: var(--q0); color: var(--muted); }
.heat td.q1, .scale-step.q1 { background: var(--q1); color: var(--q-ink-dark); }
.heat td.q2, .scale-step.q2 { background: var(--q2); color: var(--q-ink-dark); }
.heat td.q3, .scale-step.q3 { background: var(--q3); color: var(--q-ink-dark); }
.heat td.q4, .scale-step.q4 { background: var(--q4); color: var(--q-ink-light); }
.heat td.q5, .scale-step.q5 { background: var(--q5); color: var(--q-ink-light); }
.heat td.none { background: transparent; }
table.heat td { border-bottom: 2px solid var(--card); border-right: 2px solid var(--card); }
.scale { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.scale-step { font-size: .75rem; padding: .1rem .45rem; border-radius: 4px; font-variant-numeric: tabular-nums; }
.scale-step.q0 { border: 1px solid var(--border); color: var(--muted); }
