/* ═══════════════════════════════════════════════════════════════
   NiuFlow 智能调度引擎 — "Izakaya Control Tower" Design System
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700;800&display=swap');

/* ── Design Tokens ── */
:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --card:      #222222;
  --border:    #333333;
  --text:      #f0ece4;
  --muted:     #888880;
  --accent:    #e8823a;
  --accent2:   #c0632a;
  --green:     #2dd881;
  --yellow:    #ffb020;
  --red:       #ff4d4d;
  --blue:      #5b9cf6;
  --radius:    12px;
  --radius-sm: 8px;

  /* Typography */
  --font-body: 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Shadows */
  --shadow-card:  0 2px 8px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.2);
  --shadow-modal: 0 20px 60px rgba(0,0,0,.55), 0 4px 16px rgba(0,0,0,.3);
  --shadow-glow-green:  0 0 12px rgba(45,216,129,.35), 0 0 4px rgba(45,216,129,.2);
  --shadow-glow-yellow: 0 0 12px rgba(255,176,32,.35), 0 0 4px rgba(255,176,32,.2);
  --shadow-glow-red:    0 0 12px rgba(255,77,77,.4), 0 0 4px rgba(255,77,77,.25);
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  min-height: 100vh;
  position: relative;
}

/* Subtle noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

body > * { position: relative; z-index: 1; }

/* ══════════════════════════════════════
   Top Navigation
   ══════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  background: linear-gradient(180deg, #1e1e1e 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}
.logo span {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  margin-left: 8px;
  font-family: var(--font-body);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.auth-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
}
.auth-meta {
  display: grid;
  gap: 2px;
  line-height: 1.1;
}
.auth-user {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.auth-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  transition: all .15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.nav-tab:hover { color: var(--text); background: var(--card); }
.nav-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(232,130,58,.3);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
  margin-left: 8px;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Role dot (colored indicator next to auth role) */
.role-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.role-dot.waiter   { background: var(--blue); box-shadow: 0 0 4px var(--blue); }
.role-dot.grill    { background: var(--accent); box-shadow: 0 0 4px var(--accent); }
.role-dot.manager  { background: var(--green); box-shadow: 0 0 4px var(--green); }

/* ══════════════════════════════════════
   Screens
   ══════════════════════════════════════ */
.screen {
  display: none;
  padding: 24px;
  min-height: calc(100vh - 56px);
}
.screen.active { display: block; }

/* ══════════════════════════════════════
   Public Status Board
   ══════════════════════════════════════ */
.public-board {
  max-width: 1600px;
  margin: 0 auto;
  padding: 8px 2px 24px;
}

.public-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 16px;
}

.public-title {
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #ffe3c8;
}

.public-subtitle {
  margin-top: 6px;
  color: #d8c7b4;
  font-size: 15px;
}

.public-updated {
  font-size: 13px;
  color: #ffe3c8;
  background: rgba(232, 130, 58, 0.18);
  border: 1px solid rgba(232, 130, 58, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
}

.public-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid #2f3d38;
  border-radius: 14px;
  background: linear-gradient(160deg, #17201d 0%, #111715 100%);
}

.public-console-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.public-console-title {
  color: #f5efe7;
  font-size: 16px;
  font-weight: 700;
}

.public-console-desc {
  color: #aab9b3;
  font-size: 13px;
  line-height: 1.5;
}

.public-console-link {
  color: #8feec7;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.public-console-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.public-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.public-stat {
  background: linear-gradient(155deg, #1b2623 0%, #14201c 100%);
  border: 1px solid #29463d;
  border-radius: 12px;
  padding: 12px 14px;
}

.public-stat-label {
  color: #a8c7bc;
  font-size: 13px;
}

.public-stat-value {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.2vw, 32px);
  font-weight: 800;
  color: #c8ffe7;
}

.public-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.public-column {
  border: 1px solid #3a2b22;
  border-radius: 14px;
  background: linear-gradient(160deg, #201711 0%, #17100d 100%);
  min-height: 340px;
  overflow: hidden;
}

.public-column-head {
  background: linear-gradient(180deg, #34231b 0%, #281b15 100%);
  color: #ffd3ad;
  font-weight: 700;
  font-size: 18px;
  padding: 12px 14px;
  border-bottom: 1px solid #4a3326;
}

.public-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.public-item {
  background: #111a17;
  border: 1px solid #263b35;
  border-radius: 10px;
  padding: 10px;
}

.public-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.public-table {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  color: #8feec7;
}

.public-eta {
  margin-top: 6px;
  color: #d8e9e1;
  font-size: 16px;
  font-weight: 600;
}

.public-status {
  font-size: 12px;
  color: #ffe3c8;
  border: 1px solid #8f5e3f;
  border-radius: 999px;
  padding: 2px 8px;
  align-self: center;
  white-space: nowrap;
}

.public-dish {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: #f5efe7;
}

.public-meta {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  color: #a8b6b0;
  font-size: 13px;
}

.public-served {
  margin-top: 10px;
  border: 1px solid #2f473f;
  border-radius: 12px;
  background: linear-gradient(180deg, #13201c 0%, #0f1815 100%);
  padding: 10px 12px;
}

.public-served-head {
  color: #a8c7bc;
  font-size: 13px;
  margin-bottom: 6px;
}

.public-served-list {
  color: #d5efe3;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.public-empty {
  color: #9ca8a2;
  text-align: center;
  padding: 12px;
  font-size: 14px;
}

.public-chip {
  background: rgba(143, 238, 199, 0.1);
  border: 1px solid rgba(143, 238, 199, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
}

/* ══════════════════════════════════════
   Section Headers
   ══════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 24px;
  text-align: center;
  font-family: var(--font-mono);
}
.badge.green  { background: var(--green); }
.badge.yellow { background: var(--yellow); color: #222; }
.badge.red    { background: var(--red); }

.section-spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-actions {
  display: flex;
  gap: 8px;
}

/* ══════════════════════════════════════
   WAITER SCREEN
   ══════════════════════════════════════ */
.waiter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: linear-gradient(165deg, #1d1d1d 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.panel-head {
  padding: 14px 20px;
  background: linear-gradient(145deg, #282828 0%, var(--card) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}
.panel-head .icon { font-size: 18px; }

/* ── Task Row ── */
.task-list { padding: 8px; }
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: all .2s;
  position: relative;
  animation: fadeSlideIn 0.3s ease both;
}
.task-row.warn {
  border-color: var(--yellow);
  background: rgba(255,176,32,.07);
}
.task-row.crit {
  border-color: var(--red);
  background: rgba(255,77,77,.08);
}
.task-row.exiting {
  opacity: 0;
  transform: translateX(40px);
}

.table-no {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
  font-family: var(--font-mono);
}
.task-info { flex: 1; }
.task-name { font-size: 16px; font-weight: 600; }
.task-qty  { font-size: 13px; color: var(--muted); margin-top: 2px; }

.timer {
  font-size: 15px;
  font-weight: 700;
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.timer.warn {
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255,176,32,.3);
}
.timer.crit {
  color: var(--red);
  text-shadow: 0 0 10px rgba(255,77,77,.4);
  animation: criticalPulse 1.5s ease-in-out infinite;
}
.timer.ticking {
  animation: tickPulse 0.15s ease;
}

/* ── Buttons ── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: var(--font-body);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(.96); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-green  { background: var(--green); color: #fff; }
.btn-green:hover { background: #24b86d; }
.btn-ghost  { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { background: rgba(255,77,77,.15); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: rgba(255,77,77,.25); }

/* Pool-waiting rows: READY_FOR_GRILL_POOL shown read-only in waiter left column */
.task-row.pool-waiting { opacity: 0.72; }
.pool-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 600;
  background: rgba(232,130,58,.15); color: var(--accent);
  white-space: nowrap;
}
.btn-undo {
  background: rgba(91,156,246,.12);
  color: var(--blue);
  border: 1px solid var(--blue);
  font-size: 12px;
  padding: 5px 10px;
  min-height: 32px;
}
.btn-undo .countdown {
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.btn-row { display: flex; gap: 6px; align-items: center; }

/* ══════════════════════════════════════
   GRILL SCREEN
   ══════════════════════════════════════ */
.grill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.candidate-card {
  background: linear-gradient(155deg, #262626 0%, var(--card) 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: var(--shadow-card);
  animation: fadeSlideIn 0.3s ease both;
}
.candidate-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-card), 0 0 12px rgba(232,130,58,.12);
}
.candidate-card.priority-1 { border-color: rgba(232,130,58,.5); }

.candidate-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.priority-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
}
.p1 { background: rgba(232,130,58,.2); color: var(--accent); }
.p2 { background: rgba(91,156,246,.15); color: var(--blue); }
.candidate-reason {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
}

.candidate-items { margin-bottom: 14px; }
.candidate-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.candidate-item-row:last-child { border-bottom: none; }

.table-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

.more-hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
}
.more-hint:hover { color: var(--text); }

/* ── Active Batch ── */
.active-batch {
  background: linear-gradient(155deg, #1a2a1f 0%, var(--card) 100%);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card), var(--shadow-glow-green);
  animation: fadeSlideIn 0.3s ease both;
}
.active-batch-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.grill-timer {
  font-size: 32px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  font-family: var(--font-mono);
  text-shadow: var(--shadow-glow-green);
}
.grill-timer.warn {
  color: var(--yellow);
  text-shadow: var(--shadow-glow-yellow);
}
.grill-timer.crit {
  color: var(--red);
  text-shadow: var(--shadow-glow-red);
  animation: criticalPulse 1.5s ease-in-out infinite;
}

.distrib-hint {
  background: rgba(232,130,58,.08);
  border: 1px solid rgba(232,130,58,.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
  margin: 12px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.distrib-hint .icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.distrib-list { line-height: 1.8; }

/* ══════════════════════════════════════
   ADMIN SCREEN
   ══════════════════════════════════════ */
.admin-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.timeline-card {
  background: linear-gradient(155deg, #262626 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.timeline-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.timeline-table {
  width: 100%;
  border-collapse: collapse;
}
.timeline-table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-family: var(--font-mono);
  font-weight: 500;
}
.timeline-table td {
  padding: 10px 10px;
  font-size: 14px;
  border-bottom: 1px solid rgba(51,51,51,.5);
  vertical-align: middle;
}
.timeline-table tr:last-child td { border-bottom: none; }
.timeline-table tr {
  cursor: pointer;
  transition: background .15s;
}
.timeline-table tr:hover { background: rgba(232,130,58,.04); }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.pill-served  { background: rgba(45,216,129,.15); color: var(--green); }
.pill-grill   { background: rgba(232,130,58,.15); color: var(--accent); }
.pill-pool    { background: rgba(91,156,246,.15); color: var(--blue); }
.pill-cancel  { background: rgba(136,136,128,.15); color: var(--muted); }

.duration-bar-wrap { display: flex; align-items: center; gap: 8px; }
.duration-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  flex: 1;
  position: relative;
  overflow: hidden;
}
.duration-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s;
}
.fill-green  { background: var(--green); }
.fill-yellow { background: var(--yellow); }
.fill-red    { background: var(--red); }

.duration-val {
  font-size: 13px;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
  font-family: var(--font-mono);
}

/* ── SLA Cards ── */
.sla-card {
  background: linear-gradient(155deg, #262626 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.sla-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-family: var(--font-mono);
  font-weight: 500;
}
.sla-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}
.sla-row:last-child { margin-bottom: 0; }
.sla-label { color: var(--muted); }
.sla-val {
  font-weight: 700;
  font-family: var(--font-mono);
}
.sla-val.good { color: var(--green); }
.sla-val.warn { color: var(--yellow); }
.sla-val.crit { color: var(--red); }

/* ── SLA Config Form ── */
.sla-config-form {
  display: grid;
  gap: 10px;
}
.sla-config-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.sla-config-row label { color: var(--muted); }
.sla-config-row input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-mono);
  text-align: center;
}

/* ── Gap Risk Banner ── */
.gap-banner {
  background: rgba(255,77,77,.08);
  border: 1px solid var(--red);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  animation: bannerSlide 0.4s ease both;
  box-shadow: 0 0 16px rgba(255,77,77,.1);
}
.gap-banner .icon { font-size: 20px; }
.gap-banner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
  animation: bannerPulse 2s ease-in-out infinite;
}

/* ── Session Detail Drill-Down ── */
.session-detail-expand {
  animation: slideDown 0.25s ease;
  background: rgba(232,130,58,.03);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px 20px;
  margin-top: -10px;
  margin-bottom: 10px;
}
.pipeline-bar {
  display: flex;
  align-items: center;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
  margin: 8px 0;
}
.pipeline-segment {
  height: 100%;
  transition: width 0.3s;
}
.pipeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ── Admin Menu Table ── */
.menu-table {
  width: 100%;
  border-collapse: collapse;
}
.menu-table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
  font-weight: 500;
}
.menu-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid rgba(51,51,51,.5);
  vertical-align: middle;
}
.menu-table tr:last-child td { border-bottom: none; }
.menu-table tr:hover { background: rgba(232,130,58,.04); }

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background .2s;
  border: none;
}
.toggle-switch.active { background: var(--green); }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.toggle-switch.active::after { transform: translateX(18px); }

/* ── Empty States ── */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 15px;
}
.empty .icon {
  font-size: 36px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(136,136,128,.08);
  animation: emptyPulse 3s ease-in-out infinite;
}

/* ── Toast ── */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  animation: slideUp .25s ease;
  white-space: nowrap;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.info    { border-color: var(--blue);  color: var(--blue); }
.toast.error   { border-color: var(--red);   color: var(--red); }

/* ══════════════════════════════════════
   Modal
   ══════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: min(520px, 100%);
  background: linear-gradient(165deg, #222 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.25s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-body {
  padding: 20px;
  display: grid;
  gap: 14px;
}
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 13px;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color .15s;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,130,58,.15);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 20px;
}

/* Login modal polish */
.login-brand {
  text-align: center;
  padding: 8px 0 4px;
}
.login-brand-text {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(232,130,58,.3);
}
.login-brand-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.login-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ══════════════════════════════════════
   Keyframe Animations
   ══════════════════════════════════════ */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes criticalPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@keyframes bannerSlide {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bannerPulse {
  0%, 100% { box-shadow: 0 0 4px var(--red); }
  50% { box-shadow: 0 0 12px var(--red); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 300px; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes tickPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes emptyPulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ══════════════════════════════════════
   Responsive — Tablet / Small Screens
   ══════════════════════════════════════ */
@media (max-width: 900px) {
  .waiter-grid, .grill-grid, .admin-grid {
    grid-template-columns: 1fr;
  }
  .public-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .public-grid {
    grid-template-columns: 1fr;
  }
  .public-console {
    flex-direction: column;
    align-items: stretch;
  }
  .public-console-actions {
    justify-content: stretch;
  }
  .topbar {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .auth-chip {
    order: 3;
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  .nav-tabs {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}

/* ── Phone ── */
@media (max-width: 600px) {
  .screen { padding: 16px; }
  .public-title {
    font-size: 30px;
  }
  .public-subtitle {
    font-size: 13px;
  }
  .public-table {
    font-size: 18px;
  }
  .public-dish {
    font-size: 16px;
  }

  .grill-timer {
    font-size: 38px;
    letter-spacing: 3px;
  }
  .timer {
    font-size: 17px;
  }
  .table-no {
    font-size: 26px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 15px;
  }
  .btn-row {
    flex-direction: column;
    width: 100%;
  }

  .section-header h2 { font-size: 16px; }

  .candidate-card,
  .active-batch,
  .sla-card,
  .timeline-card {
    padding: 14px 16px;
  }

  .modal {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ── Micro (small phones) ── */
@media (max-width: 400px) {
  .nav-tab {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 48px;
  }
  /* Show only emoji on very small screens */
  .nav-tab span.tab-label { display: none; }

  .topbar { padding: 10px 12px; gap: 8px; }
  .logo span { display: none; }
  .logo { font-size: 18px; }

  .task-row { padding: 10px 12px; gap: 8px; }
  .table-no { font-size: 20px; min-width: 36px; }
  .task-name { font-size: 14px; }
}

/* ══════════════════════════════════════
   Keyboard / Physical Button Navigation
   ══════════════════════════════════════ */

/* Focused item ring — applied to task rows, candidate cards, active batch cards */
.kbd-focused {
  box-shadow: 0 0 0 2px var(--accent);
  background: rgba(232, 130, 58, 0.07);
  /* box-shadow instead of border to avoid layout shift */
}

/* Active zone column header */
.section-header.zone-active h2 {
  color: var(--text);
}
.section-header.zone-active {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
  transition: border-color 0.1s, opacity 0.1s;
}

/* Inactive zone column header */
.section-header.zone-inactive {
  opacity: 0.55;
  transition: opacity 0.1s;
}

/* Station-specific shell behavior */
body.station-public .auth-chip,
body.station-public #logout-btn {
  display: none !important;
}

body.station-public .topbar {
  justify-content: space-between;
}

body.station-public .nav-tabs {
  display: none !important;
}

body.station-public .logo span {
  color: #d2b59b;
}
