:root {
  color-scheme: light;
  --ink: #281c19;
  --muted: #786c68;
  --line: #eee4df;
  --paper: #fff;
  --canvas: #f7f3f0;
  --brand: #7c271c;
  --brand-dark: #5e1c14;
  --accent: #f6e6d9;
  --good: #236b48;
  --ticket-width: 58mm;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { width: min(1100px, 100% - 32px); margin: 0 auto; padding: 30px 0 60px; }
.login-card { width: min(420px, 100%); margin: 7vh auto; padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 18px 50px #30160e12; }
.brand-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 16px; background: var(--brand); color: white; font-weight: 900; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(25px, 5vw, 36px); letter-spacing: -.04em; }
h2 { margin-bottom: 4px; font-size: 22px; }
.muted { color: var(--muted); }
.login-card form { display: grid; gap: 10px; margin-top: 25px; }
label { font-size: 14px; font-weight: 700; }
input[type="password"] { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #d7cbc5; border-radius: 12px; background: #fff; }
.button { min-height: 42px; padding: 9px 14px; border: 1px solid transparent; border-radius: 12px; font-size: 14px; font-weight: 800; transition: background .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.primary { background: var(--brand); color: white; }
.primary:hover { background: var(--brand-dark); }
.secondary { border-color: var(--line); background: white; color: var(--ink); }
.quiet { background: transparent; color: var(--muted); }
.sound-button { border-color: #f1c17a; background: #fff5df; color: #71470e; }
.sound-button.enabled { border-color: #b8dfc9; background: #e8f5ed; color: var(--good); }
.button.enabled { border-color: #b8dfc9; background: #e8f5ed; color: var(--good); }
.error { min-height: 18px; margin: 0; color: #a32b21; font-size: 13px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 4px 0 24px; border-bottom: 1px solid var(--line); }
.topbar p.muted { margin-bottom: 0; font-size: 14px; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.notice { margin: 16px 0 0; padding: 12px 14px; border: 1px solid #f1d7a4; border-radius: 12px; background: #fff8e9; color: #68460d; font-size: 14px; }
.app-notice { border-color: #d9e8ed; background: #f0f8fa; color: #284f5a; }
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 14px; }
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 13px; background: #eee8e3; }
.tab { padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; }
.tab.active { background: white; color: var(--brand); box-shadow: 0 1px 3px #24150f15; }
.count { color: var(--muted); font-size: 13px; font-weight: 700; }
.orders { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; gap: 14px; }
.order { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: 0 5px 18px #30160e08; }
.order.is-new { border-color: #e9c38f; box-shadow: 0 0 0 2px #f5e3c9, 0 8px 22px #30160e0b; }
.order-head { display: flex; justify-content: space-between; gap: 14px; padding: 16px 17px 12px; border-bottom: 1px solid #f2ece8; }
.order-head h2 { margin: 0 0 4px; font-size: 17px; }
.order-time { color: var(--muted); font-size: 12px; }
.badge { align-self: flex-start; padding: 5px 9px; border-radius: 999px; background: var(--accent); color: var(--brand); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.badge.received { background: #e8f5ed; color: var(--good); }
.badge.completed { background: #eee; color: #666; }
.order-body { padding: 14px 17px; }
.order-items { margin: 0; padding: 0; list-style: none; }
.order-items li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.item-name { font-weight: 750; }
.item-note, .customer-note, .addon { color: var(--muted); font-size: 12px; }
.addon { padding-left: 18px; }
.customer-block { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13px; }
.customer-block p { margin: 4px 0; }
.customer-address { overflow-wrap: anywhere; }
.total-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 16px; font-weight: 900; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 17px 16px; }
.order-actions .button { flex: 1 1 auto; }
.empty { margin: 45px 0; color: var(--muted); text-align: center; }
.dialog { width: min(440px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 20px 70px #20100c38; }
.dialog::backdrop { background: #1b100dbb; }
.dialog form { padding: 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f2eeeb; color: var(--ink); font-size: 24px; line-height: 1; }
.radio-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; font-weight: 700; }
.radio-row input { accent-color: var(--brand); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(420px, calc(100% - 36px)); padding: 12px 15px; border-radius: 12px; background: #281c19; color: white; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.test-print-container { display: none; }
.test-label { display: block; margin-bottom: 4px; color: #a32b21; font-size: 10px; font-weight: 900; letter-spacing: .05em; }

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 1100px); padding-top: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .top-actions .button { flex: 1 1 auto; }
  .board-toolbar { align-items: flex-start; flex-direction: column; }
}

@media print {
  @page { size: auto; margin: 0; }
  :root { --ticket-width: 58mm; }
  body { width: var(--ticket-width); min-width: var(--ticket-width); margin: 0; background: white; color: #000; font: 9pt/1.25 Arial, sans-serif; }
  body * { visibility: hidden !important; }
  body[data-print-order] .order.printing,
  body[data-print-order] .order.printing * { visibility: visible !important; }
  body[data-print-order] .order:not(.printing) { display: none !important; }
  body[data-print-order] .shell { width: var(--ticket-width); margin: 0; padding: 0; }
  body[data-print-order] .order.printing { width: var(--ticket-width); border: 0; border-radius: 0; box-shadow: none; }
  body[data-print-order] .order.printing .order-head,
  body[data-print-order] .order.printing .order-body { padding: 2mm 1.5mm; }
  body[data-print-order] .order.printing .order-head { border-bottom: 1px dashed #000; }
  body[data-print-order] .order.printing .order-head h2 { font-size: 12pt; }
  body[data-print-order] .order.printing .order-actions,
  body[data-print-order] .order.printing .badge { display: none !important; }
  body[data-print-order] .order.printing .customer-block { margin-top: 2mm; padding-top: 2mm; }
  body[data-print-order] .order.printing .total-line { font-size: 11pt; }
  body[data-print-order="test"] .shell { display: none !important; }
  body[data-print-order="test"] #test-print-container { display: block !important; position: absolute; top: 0; left: 0; width: var(--ticket-width); }
  body[data-print-order="test"] #test-print-container .order.printing { display: block !important; width: var(--ticket-width); border: 0; border-radius: 0; box-shadow: none; }
}
