/* GateRunner console styles (ADR 0013). Shared by the merchant and operations consoles and kept byte-identical
   (tests/integration/console-theme.test.ts). The color tokens match the mobile app (apps/mobile/native/src/ui/
   theme.ts, ADR 0011/0012; GR-56 colors ADR 0040). Light by default; dark follows the system unless the person picks a theme, which
   app.js stores as data-theme on <html>. No inline styles or scripts, so the strict console CSP still applies. */
:root {
  --base: #15171C; --base-raised: #252830; --on-base: #D9DBE0;
  --accent: #DA291C; --accent-soft: #FDE8E4; --accent-ink: #9E1B10; --on-accent: #FFFFFF; --accent-on-base: #FF6F5E;
  --bg: #FAF6F2; --surface: #FFFFFF; --sunken: #F2EDE8; --line: #EAE2DB; --line-strong: #D6CCC4;
  --ink: #15171C; --body: #33363D; --muted: #5E5A57; --faint: #8C8884;
  --primary: #15171C; --on-primary: #FFFFFF;
  --success: #1E7A4F; --success-soft: #E3F4EA; --warning: #9A6100; --warning-soft: #FDF1D9;
  --danger: #B42318; --danger-soft: #FDE8E6; --info: #1D5C8C; --info-soft: #E4EFF8;
  --shadow: 0 4px 16px rgba(21, 23, 28, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --base: #1C1F25; --base-raised: #2A2E36; --on-base: #CDD0D6;
    --accent: #FF6F5E; --accent-soft: #3A1A16; --accent-ink: #FFA597; --on-accent: #101216;
    --bg: #101216; --surface: #1A1D22; --sunken: #14161A; --line: #2B2F37; --line-strong: #3B404A;
    --ink: #F3F3F4; --body: #CDCFD4; --muted: #A5A8B0; --faint: #767A83;
    --primary: #F3F3F4; --on-primary: #101216;
    --success: #5CD39A; --success-soft: #0F2E20; --warning: #F2B84B; --warning-soft: #33270C;
    --danger: #FF8A80; --danger-soft: #3A1714; --info: #7DB8F0; --info-soft: #0F2840;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --base: #1C1F25; --base-raised: #2A2E36; --on-base: #CDD0D6;
  --accent: #FF6F5E; --accent-soft: #3A1A16; --accent-ink: #FFA597; --on-accent: #101216;
  --bg: #101216; --surface: #1A1D22; --sunken: #14161A; --line: #2B2F37; --line-strong: #3B404A;
  --ink: #F3F3F4; --body: #CDCFD4; --muted: #A5A8B0; --faint: #767A83;
  --primary: #F3F3F4; --on-primary: #101216;
  --success: #5CD39A; --success-soft: #0F2E20; --warning: #F2B84B; --warning-soft: #33270C;
  --danger: #FF8A80; --danger-soft: #3A1714; --info: #7DB8F0; --info-soft: #0F2840;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--body); }
body { margin: 0; min-height: 100vh; background: var(--bg); }

/* Header: graphite (base) in both themes, like the app. */
header { background: var(--base); color: #fff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Brand (GR-56, ADR 0040): the gate-pin badge from /brand, inlined as an SVG data URI (img-src allows data:). */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.03em; color: #fff; }
.brand .word-accent { color: var(--accent-on-base); margin-left: -10px; }
.brand .mark { width: 30px; height: 30px; border-radius: 7px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='256' height='256' role='img' aria-label='GateRunner'%3E%3Ctitle%3EGateRunner%3C/title%3E%3Crect width='100' height='100' rx='22' fill='%2315171C'/%3E%3Cg%3E%3Cdefs%3E%3CclipPath id='p'%3E%3Cpath d='M50 90 C36 74 22 62 22 42 a28 28 0 0 1 56 0 C78 62 64 74 50 90 Z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cpath d='M50 90 C36 74 22 62 22 42 a28 28 0 0 1 56 0 C78 62 64 74 50 90 Z' fill='%23DA291C'/%3E%3Cg clip-path='url(%23p)'%3E%3Cg transform='translate(50 44) scale(.74) translate(-50 -44)'%3E%3Crect x='23' y='23' width='54' height='6' rx='2' fill='%2315171C'/%3E%3Crect x='26' y='29' width='3.5' height='30' fill='%2315171C'/%3E%3Crect x='70.5' y='29' width='3.5' height='30' fill='%2315171C'/%3E%3Crect x='43' y='35' width='14' height='24' fill='%2315171C'/%3E%3Crect x='46' y='38' width='8' height='7' rx='1' fill='%23DA291C'/%3E%3Crect x='29.5' y='45' width='13.5' height='5' fill='%23FFFFFF'/%3E%3Crect x='34' y='45' width='4' height='5' fill='%2315171C'/%3E%3Crect x='57' y='45' width='13.5' height='5' fill='%23FFFFFF'/%3E%3Crect x='62' y='45' width='4' height='5' fill='%2315171C'/%3E%3Crect x='23' y='58' width='54' height='3.5' rx='1.75' fill='%2315171C'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E") center / cover no-repeat; display: inline-block; }
.brand .role { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-style: normal; font-weight: 700; color: var(--on-base); font-size: 14px; letter-spacing: 0; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.tag { font-size: 11px; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 5px 10px; font-weight: 800; letter-spacing: .02em; }
.theme-toggle { background: transparent; color: var(--on-base); border: 1.5px solid var(--base-raised); padding: 7px 12px; font-size: 13px; }
.theme-toggle:hover { color: #fff; border-color: var(--on-base); }

main { max-width: 900px; margin: 0 auto; padding: 28px 16px 64px; }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 6px; color: var(--ink); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; color: var(--muted); font-weight: 800; }
p { line-height: 1.5; color: var(--body); margin: 6px 0; }
b, strong { color: var(--ink); }
a { color: var(--info); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 16px 0; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid .panel { margin: 0; }
.stat { font-size: 34px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.space { justify-content: space-between; }
.muted, small { color: var(--muted); font-size: 13px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; background: var(--surface); }
.money { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink); }
.hidden { display: none !important; }
.row h2 { margin: 0; }
.toolbar { margin: 12px 0 14px; }
#orders > h2 { margin: 24px 0 4px; }

/* Status pills: tone carries meaning, the text always says it. */
.pill { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; letter-spacing: .02em; background: var(--sunken); color: var(--body); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* Forms */
label { display: block; font-weight: 700; font-size: 13px; color: var(--body); }
input, select, textarea { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: 12px; font: inherit; margin: 6px 0 14px; background: var(--surface); color: var(--ink); }
input::placeholder { color: var(--faint); }
input[type="checkbox"] { display: inline-block; width: auto; min-height: 0; margin: 0 8px 0 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

/* Buttons: primary (graphite / near-white in dark), accent (red), secondary, danger. */
button { background: var(--primary); color: var(--on-primary); border: 1.5px solid var(--primary); border-radius: 12px; padding: 10px 16px; min-height: 44px; cursor: pointer; font: inherit; font-weight: 800; }
button.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.secondary { background: var(--surface); color: var(--primary); border-color: var(--line-strong); }
button.warn { background: var(--surface); color: var(--danger); border-color: var(--danger); }
button:hover { filter: brightness(1.05); }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

/* Notices */
.notice { padding: 12px 14px; border-radius: 12px; background: var(--success-soft); color: var(--success); border-left: 4px solid var(--success); margin: 12px 0; font-weight: 600; }
.notice.error, p.error { background: var(--danger-soft); color: var(--danger); border-left: 4px solid var(--danger); padding: 10px 12px; border-radius: 10px; }
.unread { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--primary); margin-right: 6px; vertical-align: middle; }

@media (prefers-reduced-motion: no-preference) { button, .item { transition: filter .12s, border-color .12s; } }
@media (max-width: 520px) { h1 { font-size: 25px; } .panel { padding: 16px; } main { padding: 18px 12px 48px; } .stat { font-size: 28px; } }

/* GR-42 kitchen mode (merchant console): bigger touch targets and a loud new-order banner. */
.kitchen-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line-strong); margin: 12px 0; }
.kitchen-bar .muted { margin: 0; }
.alarm { cursor: pointer; padding: 18px; border-radius: 14px; background: #B42318; color: #fff; font-size: 22px; font-weight: 900; text-align: center; margin: 12px 0; }
@media (prefers-reduced-motion: no-preference) { .alarm { animation: alarm-pulse 1s ease-in-out infinite; } @keyframes alarm-pulse { 50% { opacity: .65; } } }
body.kitchen main button { min-height: 60px; padding: 14px 22px; font-size: 19px; border-radius: 14px; }
body.kitchen .panel b { font-size: 18px; }
