/* Public pages and the admin panel (server/src/admin/views.ts) in the extension's look (extension/src/styles/tokens.css,
   ui/ui.css): flat colours, 3 px ink borders, hard shadows, Archivo Black and Atkinson Hyperlegible Next served by the
   server itself (routes/pages.ts). Light only, like the extension (its night desk is opt-in, never the system setting).
   No transitions or animations, so nothing needs a reduced-motion variant. */

/* Same rules as tools/fonts.ts writes for the extension; unicode-range as in each package's 400.css/700.css. */
@font-face {
  font-family: 'Archivo Black';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/fonts/archivo-black-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo Black';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/fonts/archivo-black-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/fonts/atkinson-hyperlegible-next-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Copies of the extension's tokens: same names and values (server/test/pages.test.ts), and no other colour. */
:root {
  --ink: #111111; --paper: #fff8e7; --white: #ffffff; --yellow: #ffd23f; --pink: #ff7aa2; --blush: #ff9eb5;
  --red: #ff3b3b; --sky: #4cc9f0; --tan: #e9b872; --orange: #ff9f43; --cocoa: #7a4a2a;
  --font-display: 'Archivo Black', system-ui, sans-serif;
  --font-ui: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'DejaVu Sans Mono', monospace;
  --border: 3px; --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  --shadow-offset: 4px;
  --shadow-none: 0 0 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
  --shadow-danger: var(--shadow-offset) var(--shadow-offset) 0 var(--red);
  --ring-halo: 0 0 0 9px var(--yellow);
  --target: 44px;
  --gutter: 16px;
  color-scheme: light;
}
/* A control's own resting shadow; not inherited, so a focused link never picks up its container's. */
@property --elev { syntax: '*'; inherits: false; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.5 var(--font-ui); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; letter-spacing: 0.01em; overflow-wrap: break-word; }
h1 { margin: 0 0 12px; font-size: 2rem; }
h2 { margin: 32px 0 8px; font-size: 1.35rem; }
h3 { margin: 24px 0 8px; font-size: 1.1rem; }
p, ul, ol { margin: 0 0 12px; }
li + li { margin-top: 4px; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
strong, b, th, label { font-weight: 700; }
img, svg { max-width: 100%; }
::selection { background-color: var(--yellow); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: var(--elev, var(--shadow-none)), var(--ring-halo); }

/* Layout: brand on the desk, the page on one white card, links below. body.wide is for the panel's tables. */
header, main, footer { width: min(760px, 100% - 2 * var(--gutter)); margin-inline: auto; }
body.wide :is(header, main, footer) { width: min(1100px, 100% - 2 * var(--gutter)); }
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 24px; }
header form { margin: 0; }
/* Sign out sits in the nav, white like the extension's secondary buttons, so only the current page is yellow. */
header form button { background: var(--white); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--target); font-family: var(--font-display); font-size: 1.5rem; text-decoration: none; }
.brand img { transform: rotate(-6deg); }
main { position: relative; margin-block: 24px 40px; padding: 28px; background: var(--white); border: var(--border) solid var(--ink); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
main > :last-child { margin-bottom: 0; }
footer { display: flex; flex-wrap: wrap; gap: 0 20px; padding-bottom: 40px; font-weight: 700; }
footer a { display: inline-flex; align-items: center; min-height: var(--target); }

/* Panel navigation: pill links, the current one a yellow label stuck on askew (the extension's header). */
nav { display: flex; flex-wrap: wrap; gap: 8px; }
nav a {
  --elev: var(--shadow-sm);
  display: inline-flex; align-items: center; min-height: var(--target); padding: 4px 16px;
  border: var(--border) solid var(--ink); border-radius: var(--radius-pill); background: var(--white); box-shadow: var(--elev);
  font-weight: 700; text-decoration: none;
}
nav a[aria-current='page'] { background: var(--yellow); transform: rotate(-2deg); }
/* The server's host beside the brand, so prod and staging cannot be confused; nav and Sign out sit on the right. */
.tag { margin-right: auto; display: inline-block; padding: 2px 10px; border: var(--border) solid var(--ink); border-radius: var(--radius-pill); background: var(--sky); font-size: 0.875rem; font-weight: 700; overflow-wrap: anywhere; }

/* Text */
.meta { margin-top: 0; font-weight: 700; }
.lead { font-size: 1.2rem; font-weight: 700; }
.small { font-size: 0.875rem; }
.box { margin: 20px 0; padding: 12px 20px 8px; background: var(--yellow); border: var(--border) solid var(--ink); border-radius: var(--radius); overflow-wrap: anywhere; }
.box h2 { margin-top: 4px; }
.code { padding: 12px 16px; border: var(--border) dashed var(--ink); border-radius: var(--radius); font: 700 1.1rem/1.4 var(--font-mono); overflow-wrap: anywhere; }
code { font-family: var(--font-mono); font-size: 0.9em; overflow-wrap: anywhere; }
pre { margin: 0 0 16px; padding: 12px 16px; border: var(--border) dashed var(--ink); border-radius: var(--radius); background: var(--paper); font: 0.9rem/1.45 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 10px; border: 2px solid var(--ink); text-align: left; vertical-align: top; }
th { background: var(--pink); }
/* The panel's cells hold ids and free text: they wrap anywhere rather than scroll; headings never break mid-word. */
body.wide td { overflow-wrap: anywhere; }

/* Buttons: yellow with a hard shadow; pressed, they sink into it (no transition). */
.button, button {
  --elev: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--target); padding: 8px 24px;
  border: var(--border) solid var(--ink); border-radius: var(--radius); background: var(--yellow); color: var(--ink); box-shadow: var(--elev);
  font: 1rem/1.15 var(--font-display); letter-spacing: 0.02em; text-align: center; text-decoration: none; cursor: pointer;
}
@media (hover: hover) {
  .button:hover, button:hover, nav a:hover { --elev: var(--shadow-lg); transform: translate(-2px, -2px); }
}
.button:active, button:active, nav a:active { --elev: var(--shadow-none); transform: translate(var(--shadow-offset), var(--shadow-offset)); }
.button--big { padding: 14px 32px; font-size: 1.3rem; }

/* Forms: a row is a label over its field; a checkbox row sits on one line. */
form { margin: 0 0 16px; }
.row { display: grid; gap: 6px; margin: 0 0 16px; }
.row:has(> input[type='checkbox']) { display: flex; align-items: center; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
input:not([type='checkbox'], [type='radio'], [type='hidden']), select, textarea {
  --elev: var(--shadow-sm);
  width: 100%; min-height: 48px; padding: 8px 12px;
  border: var(--border) solid var(--ink); border-radius: var(--radius); background: var(--white); color: var(--ink); box-shadow: var(--elev);
  font: inherit; line-height: 1.3;
}
textarea { min-height: 96px; resize: vertical; }
input[type='number'] { max-width: 10rem; }
/* Wide panel pages keep forms and facts at a readable width; tables use the whole card. */
body.wide main > :is(form, .facts) { max-width: 720px; }
/* A chunky box like the extension's; the tick is a rotated corner, not a colour. */
input[type='checkbox'] {
  --elev: var(--shadow-sm);
  appearance: none; flex: none; display: grid; place-content: center; width: 30px; height: 30px; margin: 0;
  border: var(--border) solid var(--ink); border-radius: var(--radius-sm); background: var(--white); box-shadow: var(--elev); cursor: pointer;
}
input[type='checkbox']:checked { background: var(--yellow); }
input[type='checkbox']:checked::before { content: ''; width: 14px; height: 8px; margin-top: -4px; border-left: var(--border) solid var(--ink); border-bottom: var(--border) solid var(--ink); transform: rotate(-45deg); }

/* Panel: count tiles (<strong> holds the number), a message after an action, a danger zone. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 16px; margin: 0 0 24px; padding: 0; list-style: none; }
.tile { margin: 0; padding: 12px 16px; border: var(--border) solid var(--ink); border-radius: var(--radius); background: var(--yellow); box-shadow: var(--shadow); font-weight: 700; }
.tile:nth-child(3n + 2) { background: var(--pink); }
.tile:nth-child(3n) { background: var(--sky); }
/* A failing check is red (ink on red is 5.3:1), and its value says Fail, so colour is not the only sign. */
.tile.bad { background: var(--red); }
.tile strong { display: block; font: 2rem/1.1 var(--font-display); }
.tile small { display: block; font-size: 0.875rem; }
.flash { margin: 0 0 16px; padding: 8px 12px; border: var(--border) solid var(--ink); border-radius: var(--radius); background: var(--sky); font-weight: 700; }
.danger { margin: 24px 0 16px; padding: 16px; border: var(--border) solid var(--red); border-radius: var(--radius); box-shadow: var(--shadow-danger); }
/* Hidden fields come first, so the box's heading is its first h2, not its first child. */
.danger > :is(:first-child, h2:first-of-type) { margin-top: 0; }
.danger button { background: var(--red); }
/* Report and account details: a label column and a value column. */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 16px; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* A custom sticker drawn as rects (palette order of shared/src/custom-stickers.ts CUSTOM_PALETTE; 0 is not drawn). */
.sticker-grid { display: block; height: auto; margin: 8px 0 16px; border: var(--border) solid var(--ink); border-radius: var(--radius-sm); background: var(--paper); shape-rendering: crispEdges; }
.p1 { fill: var(--ink); }
.p2 { fill: var(--white); }
.p3 { fill: var(--paper); }
.p4 { fill: var(--yellow); }
.p5 { fill: var(--pink); }
.p6 { fill: var(--blush); }
.p7 { fill: var(--red); }
.p8 { fill: var(--sky); }
.p9 { fill: var(--tan); }
.p10 { fill: var(--orange); }
.p11 { fill: var(--cocoa); }

/* Home page: a stamp slapped on the card's corner, a row of stickers at the foot. */
.hero { position: relative; margin-bottom: 24px; }
.hero h1, .hero .lead { padding-right: 112px; }
.hero .sticker { position: absolute; top: -64px; right: -48px; width: 132px; height: auto; transform: rotate(8deg); }
.stickers { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; margin: 24px 0 0; }
.stickers img { width: 96px; height: auto; transform: rotate(-8deg); }
.stickers img:nth-child(2) { transform: rotate(5deg) translateY(8px); }
.stickers img:nth-child(3) { transform: rotate(-3deg); }

/* Until the card is wide enough, the stamp hangs off its corner less, so it never pushes the page sideways. */
@media (max-width: 840px) {
  .hero .sticker { right: -24px; }
}

/* Panel tables stack below 900 px: one bordered block per row, each cell labelled by its column (views.ts sets
   data-label), so no word is split to fit a column. */
@media (max-width: 900px) {
  body.wide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  body.wide :is(table, tbody, tr, td) { display: block; }
  body.wide tr { margin: 0 0 12px; border: 2px solid var(--ink); border-radius: var(--radius-sm); }
  body.wide td { border: 0; padding: 4px 10px; }
  body.wide td::before { content: attr(data-label); display: block; font-size: 0.8rem; font-weight: 700; }
}

@media (max-width: 600px) {
  main { margin-top: 16px; padding: 20px; }
  th, td { padding: 6px; }
  h1 { font-size: 1.6rem; }
  .hero h1 { padding-right: 72px; }
  .hero .lead { padding-right: 0; }
  .hero .sticker { top: -44px; right: -12px; width: 84px; }
  .stickers img { width: 72px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile strong { font-size: 1.6rem; }
}
