/* Heronys Mr Valet back office: the concierge ledger.
   Brand tokens of the mobile app (mobile/src/theme/tokens.ts). Warm grey ramp, hairline borders,
   ONE accent (amber): today's bars, the current page, the focus ring. No gradients, no glow.
   4px grid. Radii nest: card 8, control 4, chip 3. Tabular figures where numbers line up. */

@font-face { font-family: "Archivo"; font-weight: 400; font-display: swap; src: url("fonts/Archivo_400Regular.ttf") format("truetype"); }
@font-face { font-family: "Archivo"; font-weight: 500; font-display: swap; src: url("fonts/Archivo_500Medium.ttf") format("truetype"); }
@font-face { font-family: "Archivo"; font-weight: 600 700; font-display: swap; src: url("fonts/Archivo_600SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Cinzel"; font-weight: 400; font-display: swap; src: url("fonts/Cinzel_400Regular.ttf") format("truetype"); }

:root {
  --pearl: #F2F1F1; --surface: #FAFAFA; --line: #E6E4E2; --line-strong: #B5AAA0; --control: #9A8D84;
  --ink: #2A2829; --text-2: #555458; --text-3: #73685F; --accent: #D97706; --accent-soft: #EDB36F;
  --success: #10B981; --danger: #B42318; --danger-bg: #FDECEA;
  --font: "Archivo", "Segoe UI", Tahoma, system-ui, -apple-system, Roboto, sans-serif;
  --display: "Cinzel", "Times New Roman", Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, Menlo, monospace;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --side: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--pearl); color: var(--ink); font: 400 14px/1.5 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--line-strong); transition: color 120ms var(--ease); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { flex: none; vertical-align: -3px; }
.strong { font-weight: 600; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 4px; z-index: 10; }
.skip:focus { left: 8px; }

/* brand */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.emblem { width: 22px; height: 24px; background: currentColor; -webkit-mask: url("emblem.svg") center / contain no-repeat; mask: url("emblem.svg") center / contain no-repeat; }
.wordmark { font: 400 17px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }

/* app frame */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 0 8px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; height: 56px; padding: 0 12px; text-decoration: none; }
.side nav p { margin: 20px 12px 6px; font-size: 12px; color: var(--text-3); }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 4px; color: var(--text-2); text-decoration: none; }
.side nav a:hover { background: var(--pearl); color: var(--ink); }
.side nav a.on { background: var(--line); color: var(--ink); font-weight: 500; box-shadow: inset 2px 0 0 var(--accent); }
.main { display: flex; flex-direction: column; min-width: 0; }
.top { height: 56px; display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; font-size: 13px; }
.who .muted { font-size: 12px; }
main#main { padding: 24px; flex: 1; max-width: 1280px; width: 100%; }
.foot { padding: 16px 24px 24px; color: var(--text-3); font-size: 12px; }

/* page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font: 400 24px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 8px; color: var(--text-3); font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }

/* buttons and controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); font: 500 13.5px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color 120ms var(--ease), border-color 120ms var(--ease); }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #3B3A3C; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-quiet { border-color: transparent; background: none; color: var(--text-2); }
.btn-quiet:hover { border-color: var(--line-strong); }
.btn-block { width: 100%; min-height: 40px; }
.link { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; }
.link:hover { text-decoration-color: currentColor; }
.link-danger { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=search], select { height: 36px; padding: 0 10px; border: 1px solid var(--control); border-radius: 4px; background: var(--surface); color: var(--ink); font: 400 14px var(--font); min-width: 0; }
input:hover, select:hover { border-color: var(--ink); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.field input { width: 100%; height: 40px; }
.hint { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.alert { border: 1px solid var(--danger); background: var(--danger-bg); color: var(--danger); border-radius: 4px; padding: 10px 12px; margin-bottom: 16px; }
.alert-ok { border-color: #A7D7C5; background: #ECF8F3; color: #0B6B4B; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; min-width: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 16px 16px 8px; }
.card h2, .card-title { font: 600 15px/1.3 var(--font); }
.card-title { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.photo + .card-title { border-top: 1px solid var(--line); }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.card-foot a { text-decoration: none; font-weight: 500; }
.card-form { padding: 20px; max-width: 560px; }
.card-form h2 { margin-bottom: 8px; }
.card-form > p { margin-bottom: 16px; }
.pad { padding: 16px; }
.empty { padding: 40px 16px; text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid2 .card-form { max-width: none; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.stack { min-width: 0; }

/* overview */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.tile-l { font-size: 13px; color: var(--text-2); }
.tile-v { font: 500 26px/1.2 var(--font); margin: 4px 0; }
.unit { font-size: 14px; color: var(--text-3); font-weight: 400; }
.tile-n { font-size: 12.5px; color: var(--text-3); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.k { width: 10px; height: 10px; display: inline-block; }
.k-in { background: var(--accent); } .k-out { background: var(--accent-soft); } .k-lw { border: 1px solid var(--text-2); }
.chart { display: block; width: 100%; height: auto; padding: 0 8px; }
.c-in { fill: var(--accent); } .c-out { fill: var(--accent-soft); }
.c-lw { fill: none; stroke: var(--text-2); stroke-width: 1; }
.c-axis { stroke: var(--ink); stroke-width: 1; } .c-grid { stroke: var(--line); stroke-width: 1; }
.c-now { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.c-t { fill: var(--text-3); font: 400 10px var(--font); }
.split { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.split > div { padding: 12px 16px; border-left: 1px solid var(--line); }
.split > div:first-child { border-left: 0; }
.rank li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--text-2); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #F6F5F4; }
td a.strong { text-decoration: none; } td a.strong:hover { text-decoration: underline; }
.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; margin-right: 16px; }
.plate { display: inline-block; font: 600 12.5px/1 var(--mono); letter-spacing: .08em; padding: 5px 7px; border: 1.5px solid var(--ink); border-left-width: 3px; border-radius: 3px; background: #fff; text-transform: none; }
.tier { font-size: 12px; font-weight: 600; letter-spacing: .04em; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 3px; }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font: 400 14px var(--font); letter-spacing: 0; text-transform: none; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.s-retrieval_requested::before { background: var(--accent); }
.s-retrieving::before { background: none; border: 1.5px solid var(--accent); }
.s-delivered::before { background: var(--success); }
.s-off::before, .s-cancelled::before { background: var(--line-strong); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters input[type=search] { flex: 1 1 200px; }
.count { margin-left: auto; color: var(--text-3); font-size: 13px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager .muted { margin-right: auto; font-size: 13px; }

/* visit detail */
.photo { display: flex; background: var(--line); min-height: 180px; max-height: 420px; align-items: center; justify-content: center; }
.photo img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.photo-none { flex-direction: column; gap: 8px; color: var(--text-3); background: #EFEEED; }
.kv { padding: 4px 16px 8px; }
.kv > div { display: grid; grid-template-columns: minmax(120px, 2fr) 3fr; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--text-2); }
.log li { display: grid; grid-template-columns: 132px 1fr; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.rating { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.star-on { fill: var(--ink); } .star-off { color: var(--line-strong); }

/* sign in */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-side { background: var(--ink); color: #fff; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .emblem { width: 34px; height: 37px; } .auth-side .wordmark { font-size: 20px; }
.auth-side .rule { display: block; width: 48px; height: 1px; background: var(--control); margin-bottom: 24px; }
.auth-side .display { font: 400 26px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 16px; }
.auth-side p { color: #D4D3DB; max-width: 320px; }
.fine { font-size: 12.5px; color: var(--text-3); }
.auth-side .fine { color: #B5AAA0; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h1 { font: 400 26px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.auth-box > .muted { margin: 6px 0 24px; color: var(--text-2); }
.auth-box .fine { margin-top: 24px; }
.notice { max-width: 480px; margin: 20vh auto; padding: 24px; text-align: center; }
.notice h1 { font: 400 24px var(--display); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 12px; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; display: flex; align-items: center; padding: 0 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .side nav { display: flex; gap: 4px; }
  .side nav p { display: none; }
  .side nav a { white-space: nowrap; }
  .side nav a.on { box-shadow: inset 0 -2px 0 var(--accent); }
  main#main { padding: 16px; }
  .top { padding: 0 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 24px; gap: 24px; }
  .auth-side > div { display: none; } .auth-side .fine { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .split { grid-template-columns: repeat(2, 1fr); }
  .split > div:nth-child(3) { border-left: 0; } .split > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .log li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

td a.strong, td.mono { white-space: nowrap; }
