/* =====================================================================
   BOLD PIZZERIA — design system
   Direction: "char and brass." The room is dark walnut and blackened steel;
   the only warmth is fire. Brass is the house metal. Ember is reserved
   exclusively for one job — telling you something is running late.
   Signature: the heat scale. Every ticket, run and station carries a bar
   whose fill and colour are driven by elapsed time against its target, so
   lateness is a material on screen, not a badge.
   ===================================================================== */

:root {
  --char:   #17120F;
  --slab:   #211A16;
  --slab-2: #2C231D;
  --edge:   #3A2F27;
  --bone:   #F0EAE0;
  --bone-d: #A79A8B;
  --brass:  #C89B3C;
  --brass-d:#8A6B26;
  --basil:  #7A9A4E;
  --ember:  #D8462A;

  --r: 4px;
  --gap: 16px;
  --shadow: 0 12px 32px rgba(0,0,0,.45);

  --display: "Instrument Serif", Georgia, serif;
  --body: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--char);
  color: var(--bone);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------- type */
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .01em; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.02; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
.eyebrow {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--brass);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--bone-d); }
.small { font-size: .82rem; }
a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- chrome */
.topbar {
  display: flex; align-items: center; gap: var(--gap);
  padding: 12px 20px; background: var(--slab);
  border-bottom: 1px solid var(--edge); position: sticky; top: 0; z-index: 40;
}
.brand { font-family: var(--display); font-size: 1.35rem; letter-spacing: .02em; }
.brand b { color: var(--brass); font-weight: 400; }
.spacer { flex: 1; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 96px; }

/* ---------------------------------------------------------- panels */
.panel {
  background: var(--slab); border: 1px solid var(--edge);
  border-radius: var(--r); padding: 18px;
}
.panel + .panel { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* -------------------------------------------------------- controls */
button, .btn {
  font-family: var(--body); font-size: .9rem; font-weight: 600;
  padding: 10px 16px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--brass-d); background: transparent; color: var(--brass);
  transition: background .12s ease, color .12s ease;
}
button:hover, .btn:hover { background: rgba(200,155,60,.12); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 2px;
}
.btn-solid { background: var(--brass); color: var(--char); border-color: var(--brass); }
.btn-solid:hover { background: #DDB055; }
.btn-ghost { border-color: var(--edge); color: var(--bone-d); }
.btn-danger { border-color: var(--ember); color: var(--ember); }
.btn-danger:hover { background: rgba(216,70,42,.12); }
.btn-lg { padding: 15px 22px; font-size: 1rem; }
.btn-block { display: block; width: 100%; }
button[disabled] { opacity: .35; cursor: not-allowed; }

input, select, textarea {
  font-family: var(--body); font-size: .95rem; width: 100%;
  padding: 10px 12px; border-radius: var(--r);
  background: var(--char); color: var(--bone); border: 1px solid var(--edge);
}
label { display: block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase;
        color: var(--bone-d); margin-bottom: 5px; font-family: var(--mono); }
.field { margin-bottom: 12px; }

/* ------------------------------------------------------------ tags */
.tag {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 2px; border: 1px solid var(--edge); color: var(--bone-d);
}
.tag-brass { border-color: var(--brass-d); color: var(--brass); }
.tag-basil { border-color: var(--basil); color: var(--basil); }
.tag-ember { border-color: var(--ember); color: var(--ember); }

/* ============================================================ HEAT
   The signature. --heat runs 0 (just fired) → 1 (at target) → >1 (late).
   Colour and fill both move, so a line cook reads the room at a glance. */
.heat {
  position: relative; width: 6px; border-radius: 3px;
  background: var(--edge); overflow: hidden; flex: 0 0 6px; align-self: stretch;
}
.heat::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(min(var(--heat, 0), 1) * 100%);
  background: var(--heat-color, var(--brass));
  transition: height .8s linear, background .8s linear;
}
.heat-bar { height: 4px; width: 100%; border-radius: 2px; background: var(--edge); overflow: hidden; }
.heat-bar > i { display: block; height: 100%; width: calc(min(var(--heat,0),1) * 100%);
                background: var(--heat-color, var(--brass)); transition: width .8s linear; }
.is-cool { --heat-color: var(--brass-d); }
.is-warm { --heat-color: var(--brass); }
.is-due  { --heat-color: #E08A2E; }
.is-late { --heat-color: var(--ember); }
.is-late .ticket-no { color: var(--ember); }

/* --------------------------------------------------------- tickets */
.ticket {
  display: flex; gap: 12px; background: var(--slab);
  border: 1px solid var(--edge); border-radius: var(--r); padding: 14px;
}
.ticket.is-late { border-color: var(--ember); }
.ticket-body { flex: 1; min-width: 0; }
.ticket-no { font-family: var(--mono); font-size: .95rem; letter-spacing: .06em; color: var(--brass); }
.ticket-clock { font-family: var(--mono); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.line { padding: 7px 0; border-top: 1px solid var(--edge); }
.line:first-of-type { border-top: none; }
.line-qty { font-family: var(--mono); color: var(--brass); margin-right: 8px; }
.line-mods { font-size: .8rem; color: var(--bone-d); padding-left: 22px; }
.line-note { font-size: .8rem; color: var(--ember); padding-left: 22px; }
.line.done { opacity: .35; text-decoration: line-through; }

/* ----------------------------------------------------------- stats */
.stat { background: var(--slab); border: 1px solid var(--edge); border-radius: var(--r); padding: 16px; }
.stat .k { font-family: var(--mono); font-size: .66rem; letter-spacing: .18em;
           text-transform: uppercase; color: var(--bone-d); }
.stat .v { font-family: var(--display); font-size: 2.1rem; line-height: 1.1; margin-top: 4px; }
.stat .v small { font-family: var(--mono); font-size: .8rem; color: var(--bone-d); }

/* ---------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-family: var(--mono); font-size: .66rem; letter-spacing: .14em;
     text-transform: uppercase; color: var(--bone-d); padding: 8px 10px; border-bottom: 1px solid var(--edge); }
td { padding: 9px 10px; border-bottom: 1px solid var(--edge); }
tr:hover td { background: var(--slab-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ menu */
.dish { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--edge); cursor: pointer; }
.dish:hover .dish-name { color: var(--brass); }
.dish-name { font-family: var(--display); font-size: 1.25rem; }
.dish-price { font-family: var(--mono); color: var(--brass); white-space: nowrap; }
.dish-desc { color: var(--bone-d); font-size: .88rem; max-width: 56ch; }
.dish.sold-out { opacity: .4; cursor: not-allowed; }

/* ----------------------------------------------------------- modal */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,7,5,.72); display: none;
            align-items: center; justify-content: center; z-index: 90; padding: 20px; }
.sheet-bg.open { display: flex; }
.sheet { background: var(--slab); border: 1px solid var(--edge); border-radius: var(--r);
         max-width: 560px; width: 100%; max-height: 88vh; overflow: auto;
         padding: 24px; box-shadow: var(--shadow); }

/* ----------------------------------------------------------- toast */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
         background: var(--slab-2); border: 1px solid var(--brass-d); color: var(--bone);
         padding: 12px 20px; border-radius: var(--r); opacity: 0; pointer-events: none;
         transition: opacity .2s, transform .2s; z-index: 120; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-color: var(--ember); }

/* ------------------------------------------------------ empty state */
.empty { text-align: center; padding: 56px 20px; color: var(--bone-d); }
.empty h3 { color: var(--bone); }

/* --------------------------------------------------------- keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 280px; }
.keypad button { padding: 20px; font-family: var(--mono); font-size: 1.3rem; }

@media (max-width: 640px) {
  .wrap { padding: 16px 14px 88px; }
  .panel { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after { transition: none !important; animation: none !important; }
}
