:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --surface: #fff;
  --ink: #17243b;
  --muted: #5e6d83;
  --line: #dce4ef;
  --accent: #245bd6;
  --accent-fill: var(--accent);
  --on-accent: white;
  --accent-soft: #eaf1ff;
  --orange: #a44c2c;
  --orange-soft: #fff0e6;
  --accent-hover: #1b46ab;
  --accent-border: #adc3f1;
  --accent-on-muted: #e7efff;
  --surface-soft: #eef2f8;
  --panel-bg: #f9fbff;
  --focus: #245bd6;
  --success: #237247;
  --radius: 14px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea, .button { font: inherit; color: inherit; }
button, .button {
  min-height: 46px; border: 1px solid var(--line); border-radius: 9px;
  background: white; padding: 10px 15px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; text-decoration: none; line-height: 1.3;
}
button:hover, .button:hover { background: var(--accent-soft); border-color: var(--accent-border); }
button.primary, .button.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
button.primary:hover { background: var(--accent-hover); }
button.danger { color: #ab3728; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px;
}
button:disabled { cursor: default; opacity: .5; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; font-weight: 720; letter-spacing: -.8px; }
h2 { font-size: 18px; letter-spacing: -.3px; }
h3 { font-size: 16px; }
small, .hint, .count { font-size: 12px; color: var(--muted); line-height: 1.5; }
.app-header { background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 4; }
.topbar, nav, main, footer { max-width: 1440px; margin: auto; padding-inline: clamp(16px, 3.5vw, 48px); }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-block: 12px; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 17px; letter-spacing: -.5px; }
.brand small { display: block; font-weight: 500; letter-spacing: 0; font-size: 12px; margin-top: 2px; }
.monogram { background: var(--accent-fill); color: var(--on-accent); border-radius: 12px; font-size: 21px; padding: 11px 8px; letter-spacing: -1.6px; }
.monogram span { color: var(--accent-on-muted); }
.header-actions, .actions, .bar, .filters, .subhead, .dialoghead, .page-heading, .section-heading { display: flex; align-items: center; gap: 10px; }
.header-actions { flex-wrap: wrap; }
.station-label { font-size: 11px; display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.station-label select { min-height: 30px; padding: 3px 20px 3px 0; border: 0; background: white; color: var(--ink); font-size: 13px; font-weight: 600; }
nav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: thin; }
nav button { min-height: 49px; padding: 12px 2px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); white-space: nowrap; background: none; }
nav button[aria-current=page] { border-bottom-color: var(--accent); color: var(--accent); }
.nav-count { padding: 2px 6px; font-size: 11px; background: var(--orange-soft); color: var(--orange); border-radius: 5px; }
main { min-height: 75vh; padding-top: 24px; padding-bottom: 40px; }
.page-heading { justify-content: space-between; margin-bottom: 22px; }
.eyebrow { color: var(--muted); font-size: 12px; margin-bottom: 4px; font-weight: 500; }
.local { font-size: 11px; color: var(--muted); }
.local::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #75936e; margin-right: 6px; }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 12px; scrollbar-width: thin; }
.day { flex: 0 0 77px; flex-direction: column; gap: 2px; min-height: 84px; padding: 9px 5px; font-size: 12px; font-weight: 500; }
.day strong { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.day small { font-size: 10px; }
.day[aria-pressed=true] { color: var(--on-accent); background: var(--accent-fill); border-color: var(--accent-fill); box-shadow: 0 3px 8px #14233b18; }
.day[aria-pressed=true] small { color: var(--accent-on-muted); }
.datepick { flex: 0 0 157px; justify-content: center; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 14px 0 20px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.pills button { border: 0; background: transparent; min-height: 42px; color: var(--muted); padding: 9px 13px; font-size: 13px; }
.pills button[aria-pressed=true] { background: white; color: var(--accent); box-shadow: 0 1px 4px #14233b12; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { padding: 10px 16px; background: white; border: 1px solid var(--line); border-radius: 12px; min-width: 105px; }
.stat strong { font-size: 22px; display: block; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.green strong { color: var(--success); }
.stat.orange strong { color: var(--orange); }
.subhead { justify-content: space-between; margin: 23px 0 12px; }
.section-heading { padding: 17px 20px; border-bottom: 1px solid var(--line); justify-content: space-between; }
.list, .panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.order { display: grid; grid-template-columns: 63px minmax(0, 1fr) auto; gap: 14px; padding: 19px 20px; }
.order + .order { border-top: 1px solid var(--line); }
.time { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.4px; padding-top: 3px; }
.order-body { min-width: 0; }
.order-name { min-height: 34px; padding: 0 0 6px; border: 0; background: transparent; justify-content: flex-start; text-align: left; font-size: 16px; letter-spacing: -.3px; gap: 8px; }
.order-name:hover { color: var(--accent); background: none; }
.order-name small { font-size: 10px; font-weight: 500; letter-spacing: 0; }
.order-items { display: grid; gap: 6px; line-height: 1.5; font-size: 13px; }
.order-items strong { font-weight: 600; }
.qty { font-weight: 650; color: var(--ink); }
.item-note { color: var(--muted); font-size: 12px; display: block; margin-left: 0; }
.meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 9px; font-size: 11px; color: var(--muted); }
.site { border-radius: 5px; padding: 3px 7px; font-size: 10px; font-weight: 650; }
.site.lucca { background: #f5e9df; color: #99552c; }
.site.marlia { background: #eaf3ec; color: var(--success); }
.order-end { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; max-width: 190px; text-align: right; }
.order-end button { font-size: 12px; min-height: 44px; padding: 9px 12px; background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ready { color: var(--success); }
.badge.transit { color: var(--orange); }
.money { font-size: 12px; color: var(--muted); }
.money strong { color: var(--ink); }
.role-note { font-size: 10px; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 16px; min-width: 0; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.summary-row:last-child { border-bottom: 0; }
.summary-row strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.panel-content { padding: 16px 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; background: var(--panel-bg); }
.table td, .table th { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: right; }
.table td:first-child, .table th:first-child { text-align: left; }
.table tr:last-child td { border-bottom: 0; }
.table td small { display: block; font-size: 11px; }
.day-heading { background: var(--panel-bg); padding: 10px 20px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.day-heading:first-child { border-top: 0; }
.callout { background: #fff4e8; border: 1px solid #f0dcc4; padding: 12px 16px; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; font-size: 13px; }
.callout button { background: transparent; border-color: #e3c8ac; }
.empty { padding: 30px 20px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.warning { background: var(--orange-soft); color: #8d4426; border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.summary, .infobox { background: var(--accent-soft); border-radius: 10px; padding: 14px; line-height: 1.7; font-size: 13px; }
.break { white-space: pre-line; overflow-wrap: anywhere; }
.group { display: grid; gap: 10px; margin: 12px 0; }
.line { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; font-size: 13px; }
.line strong { font-size: 15px; }
.line:last-child { border-bottom: 0; }
.bar, .actions, .filters, .detailmeta { flex-wrap: wrap; }
.bar { justify-content: space-between; }
.detailmeta { display: flex; align-items: center; gap: 12px; }
dialog { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(640px, 100%); max-width: 100%; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--panel-bg); color: var(--ink); overflow-y: auto; box-shadow: -12px 0 60px #14233b20; }
dialog::backdrop { background: #17243b4d; backdrop-filter: blur(2px); }
.dialoghead { position: sticky; top: 0; z-index: 3; background: white; padding: 16px 24px; justify-content: space-between; border-bottom: 1px solid var(--line); }
#body { padding: 20px 24px 24px; }
label { display: grid; align-content: start; gap: 6px; font-size: 12px; font-weight: 600; min-width: 0; }
input, textarea, select { width: 100%; min-width: 0; min-height: 46px; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 16px; }
textarea { min-height: 80px; resize: vertical; }
.filters input, .filters select { width: auto; }
fieldset { min-width: 0; border: 1px solid var(--line); background: white; border-radius: 12px; padding: 16px; margin: 0; }
legend { padding: 0 6px; font-size: 13px; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wide { grid-column: 1 / -1; }
.choices { display: flex; gap: 6px; flex-wrap: wrap; }
.choices button { min-height: 44px; padding: 8px 12px; font-size: 12px; border-radius: 8px; }
.choices button[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.choice-field { display: grid; gap: 7px; }
.field-label { font-size: 12px; font-weight: 600; }
.quick-products { display: flex; gap: 6px; overflow-x: auto; }
.quick-products button { flex: 0 0 auto; font-size: 11px; padding: 8px 10px; min-height: 44px; }
.savebar { position: sticky; bottom: -24px; z-index: 2; background: white; padding: 14px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
details { border-top: 1px solid var(--line); }
details summary { cursor: pointer; min-height: 46px; padding: 14px 0; font-size: 13px; font-weight: 600; }
.inlinecheck { display: flex; align-items: center; gap: 8px; }
.inlinecheck input { width: 20px; min-height: 24px; }
.ticket { padding: 18px; border: 1px dashed #a1b3a2; background: white; margin-bottom: 12px; color: #18271d; }
.ticket h3 { font-size: 22px; margin-bottom: 8px; }
.ticket p { margin: 6px 0; }
footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); gap: 12px; padding-block: 18px; font-size: 11px; color: var(--muted); }
footer button { background: none; font-size: 11px; }
#notice { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 10; max-width: 90vw; padding: 12px 20px; border-radius: 10px; background: var(--ink); color: white; box-shadow: 0 4px 20px #14233b25; font-size: 13px; }
#notice:empty, #printArea { display: none; }
@media (max-width: 1050px) {
  .split { grid-template-columns: 270px minmax(0, 1fr); gap: 14px; }
  .split .order { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 16px; }
  .split .order-end { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; text-align: left; }
  .split .role-note { display: none; }
  .header-actions { gap: 7px; }
  .brand { font-size: 15px; }
}
@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding-block: 10px; }
  .header-actions { flex: 1 1 100%; justify-content: flex-end; }
  .station-label { margin-right: auto; }
  nav { gap: 20px; }
  .split { grid-template-columns: 1fr; }
  .local { display: none; }
  .split .order { grid-template-columns: 58px minmax(0, 1fr) auto; }
  .split .order-end { grid-column: auto; flex-direction: column; align-items: flex-end; }
  .table td, .table th { padding: 9px 14px; }
  .stats { flex: 1; }
  .stat { flex: 1; }
}
@media (max-width: 540px) {
  :root { font-size: 14px; }
  .topbar, nav, main, footer { padding-inline: 16px; }
  .brand small { display: none; }
  .monogram { padding: 8px 7px; font-size: 18px; }
  .header-actions button { padding-inline: 10px; font-size: 12px; }
  .station-label select { font-size: 11px; max-width: 113px; }
  nav { gap: 22px; }
  nav button { font-size: 12px; }
  main { padding-top: 18px; }
  h1 { font-size: 23px; }
  .page-heading { margin-bottom: 16px; }
  .order, .split .order { grid-template-columns: 47px minmax(0, 1fr); padding: 14px; gap: 8px; }
  .time { font-size: 15px; }
  .order-end, .split .order-end { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; max-width: none; text-align: left; gap: 8px; }
  .order-name { flex-wrap: wrap; font-size: 15px; gap: 4px; }
  .role-note { display: none; }
  .grid { grid-template-columns: 1fr; }
  .stat { padding: 10px 12px; min-width: 85px; }
  .stat strong { font-size: 20px; }
  .subhead h2 { font-size: 16px; }
  .dialoghead { padding: 12px 16px; }
  #body { padding: 16px; }
  .savebar { bottom: -16px; }
  .filters { width: 100%; }
  .filters input, .filters select { width: 100%; }
}
@media print {
  body > * { display: none !important; }
  body > #printArea { display: block !important; }
  dialog::backdrop { background: white; }
  .ticket { width: 90mm; max-width: 100%; break-inside: avoid; }
  @page { margin: 10mm; }
}
