/* ==========================================================================
   拉麵落單系統 — Minimalist Clean White + Pro KDS Dark Theme
   All bugs fixed. Tablet-optimized Kitchen Display System.
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-dark: #1a1a1a;
  --border-color: #475569; /* used by dark KDS toolbar buttons */
  --text: #1e293b;
  --text-muted: #64748b;
  --red: #c02626;
  --red-hover: #a81c1c;
  --red-light: #fef2f2;
  --red-border: #fca5a5;
  --gold: #b45309;
  --green: #16a34a;
  --blue: #2563eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang HK", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.modal-open { overflow: hidden; }

/* ===== Utility Classes ===== */
.text-red { color: var(--red); font-weight: 800; }
.text-amber { color: var(--gold); }
.mt-sm { margin-top: 6px; }

/* ===== Header ===== */
.app-header {
  background: #fff;
  border-bottom: 2px solid var(--border-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--red);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 2px 4px rgba(192,38,38,0.3);
  flex-shrink: 0;
}

.brand-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.brand-subtitle { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }

.nav-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.nav-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn.active { background: #fff; color: var(--red); box-shadow: var(--shadow-sm); }
.nav-btn:hover:not(.active) { color: var(--text); }
.nav-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ===== Main Wrapper ===== */
.main-wrapper {
  width: 100%;
}

/* ===== Guest View ===== */
#guest-view { 
  display: none; 
  max-width: 800px;
  margin: 20px auto;
  padding: 0 16px;
}
#guest-view.active { display: block; }

/* ===== Guest Order Tracking ===== */
#track-view { display: none; max-width: 620px; margin: 24px auto; padding: 0 16px; }
#track-view.active { display: block; animation: trackFadeIn 0.35s ease-out; }

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

.track-card {
  background: var(--card-bg);
  border: 2px solid var(--border-dark);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
  padding: 32px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.track-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--red) 0%, var(--gold) 50%, var(--green) 100%);
}

/* Hero Header */
.track-hero-header {
  margin-bottom: 24px;
}

.success-ring-container {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.success-icon-ring {
  width: 64px;
  height: 64px;
  background: #dcfce7;
  border: 3px solid var(--green);
  color: var(--green);
  font-size: 32px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.15);
  animation: successPulse 2s infinite;
}

@keyframes successPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); transform: scale(1.04); }
}

.track-hero-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.track-hero-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.track-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  padding: 6px 16px;
  border-radius: var(--radius-full);
}

.track-badge-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-number-badge {
  display: inline-block;
  background: var(--red);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 900;
  padding: 2px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(192, 38, 38, 0.25);
}

/* Stepper Container */
.track-stepper-container {
  margin: 28px 0 24px;
  padding: 0 8px;
}

.track-stepper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.track-progress-line-bg {
  position: absolute;
  top: 26px;
  left: 12.5%;
  right: 12.5%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  z-index: 0;
}

.track-progress-line-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green) 0%, var(--red) 100%);
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.track-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.track-dot-wrapper {
  position: relative;
  background: var(--card-bg);
  border-radius: 50%;
  padding: 4px;
}

.track-dot {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: #f1f5f9;
  border: 2px solid var(--border);
  position: relative;
  filter: grayscale(0.8);
  opacity: 0.6;
  transition: all 0.35s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.track-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  line-height: 1.25;
  transition: color 0.3s;
}

.track-label small {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
}

.track-step.done .track-dot {
  background: #dcfce7;
  border-color: var(--green);
  filter: none;
  opacity: 1;
  transform: scale(1.02);
}

.track-step.active .track-dot {
  background: #fff5f5;
  border-color: var(--red);
  filter: none;
  opacity: 1;
  transform: scale(1.15);
  animation: stepGlow 1.6s infinite ease-in-out;
}

.track-step.done .track-label,
.track-step.active .track-label {
  color: var(--text);
  font-weight: 900;
}

@keyframes stepGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(192, 38, 38, 0); }
}

/* Status Banner */
.track-status-banner {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--red);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  text-align: left;
  transition: all 0.3s ease;
}

.track-status-banner.status-new { border-left-color: var(--blue); background: #f0f9ff; }
.track-status-banner.status-cooking { border-left-color: var(--red); background: #fff5f5; }
.track-status-banner.status-served { border-left-color: var(--gold); background: #fffbe6; }
.track-status-banner.status-completed { border-left-color: var(--green); background: #f0fdf4; }

.track-status-text {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.5;
}

.track-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-block;
  margin-top: 2px;
}

/* Japanese Ramen Ticket Summary */
.ramen-ticket-container {
  text-align: left;
  margin-bottom: 24px;
}

.ramen-ticket {
  background: #fffdf9;
  border: 2px solid var(--border-dark);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
}

.ticket-header {
  background: var(--border-dark);
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ticket-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-header-stamp {
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.ticket-body {
  padding: 16px;
}

.ticket-guest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1.5px dashed var(--border);
  margin-bottom: 14px;
}

.ticket-guest-name {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text);
}

.ticket-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-ramen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.ticket-badge {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ticket-badge-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ticket-badge-val {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--text);
}

.ticket-badge-val.val-highlight {
  color: var(--red);
}

.ticket-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.ticket-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.84rem;
  font-weight: 700;
}

.ticket-item-timing {
  font-size: 0.72rem;
  background: #e2e8f0;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.ticket-remarks {
  background: #fffbe6;
  border: 1px dashed #ffe58f;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.84rem;
  color: #8c6b00;
  font-weight: 700;
}

.ticket-footer-rip {
  height: 8px;
  background: radial-gradient(circle, transparent 4px, #fffdf9 4px);
  background-size: 12px 12px;
  background-position: -6px -6px;
  background-repeat: repeat-x;
  border-top: 1px dashed var(--border);
}

/* Actions */
.track-actions {
  display: flex;
  justify-content: center;
}

.track-new-btn {
  background: var(--border-dark);
  color: #ffffff;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.track-new-btn:hover {
  background: #2d3748;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.track-new-btn:active {
  transform: translateY(1px);
}

/* ===== Ramen Sheet ===== */
.ramen-sheet {
  background: var(--card-bg);
  border: 2px solid var(--border-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.sheet-banner {
  background: #fff;
  border-bottom: 2px solid var(--border-dark);
  padding: 20px 24px;
  text-align: center;
}

.sheet-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.sheet-title h1 { font-size: 1.5rem; font-weight: 900; color: var(--text); }
.sheet-title .badge { background: var(--border-dark); color: #fff; font-size: 0.82rem; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
.sheet-subtitle { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); }
.sheet-notice { margin-top: 12px; padding: 8px 12px; background: #fffbe6; border: 1px dashed #ffe58f; border-radius: var(--radius-sm); font-size: 0.8rem; color: #8c6b00; font-weight: 600; display: inline-block; }

/* ===== Guest Info ===== */
.guest-info-section { padding: 20px 24px; border-bottom: 1.5px solid var(--border); background: #fafafa; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-weight: 700; font-size: 0.92rem; display: flex; align-items: center; gap: 6px; }
.required-star { color: var(--red); }

.text-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.text-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,38,38,0.15); }
.text-input:hover { border-color: #cbd5e1; }

/* ===== Sections ===== */
.section-title {
  background: var(--border-dark);
  color: #fff;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.option-row {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-row:last-child { border-bottom: none; }

.option-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.option-name-zh { font-size: 1rem; font-weight: 800; }
.option-name-en { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.option-recommendation { font-size: 0.72rem; color: var(--red); font-weight: 600; background: var(--red-light); padding: 2px 8px; border-radius: var(--radius-full); }

/* ===== Chip Buttons ===== */
.option-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }

.chip-btn {
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 10px 6px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 46px;
  justify-content: center;
}
.chip-btn .sub-text { font-size: 0.72rem; font-weight: 400; color: var(--text-muted); margin-top: 1px; }
.chip-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.chip-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.chip-btn:active { transform: scale(0.97); }
.chip-btn.selected { border-color: var(--red); background: var(--red-light); color: var(--red); font-weight: 800; box-shadow: 0 0 0 1px var(--red); }
.chip-btn.selected .sub-text { color: var(--red); font-weight: 600; }

/* ===== Refill Section ===== */
.refill-card-group { padding: 16px 24px; background: #fcfcfc; border-bottom: 1.5px solid var(--border); }
.refill-notice-banner { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 14px; text-align: center; }

.refill-item { background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; }
.refill-item:last-child { margin-bottom: 0; }
.refill-header { display: flex; align-items: center; justify-content: space-between; }

.refill-checkbox-label { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 0.95rem; cursor: pointer; user-select: none; }
.refill-checkbox-label input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--red); cursor: pointer; }

.refill-texture-options { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); transition: opacity 0.2s ease; }
.refill-texture-options.disabled { opacity: 0.35; pointer-events: none; }

/* ===== Side Menu ===== */
.side-menu-container { padding: 16px 24px; border-bottom: 1.5px solid var(--border); }

.side-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: #fff;
  flex-wrap: wrap;
  gap: 8px;
}
.side-item-card:last-child { margin-bottom: 0; }
.side-item-info { display: flex; flex-direction: column; min-width: 0; }
.side-item-title { font-weight: 700; font-size: 0.92rem; }
.side-item-sub { font-size: 0.72rem; color: var(--text-muted); }
.side-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== Counter ===== */
.counter-control { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.counter-btn { width: 40px; height: 40px; border: none; background: #f1f5f9; color: var(--text); font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: background 0.15s; }
.counter-btn:hover { background: #e2e8f0; }
.counter-btn:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.counter-btn:active { background: #cbd5e1; }
.counter-value { width: 36px; text-align: center; font-weight: 700; font-size: 0.95rem; }
.counter-unit { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }

/* ===== Timing Select ===== */
.timing-select { display: flex; background: #f1f5f9; padding: 3px; border-radius: var(--radius-sm); gap: 2px; }
.timing-btn {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.timing-btn.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 700; }
.timing-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

/* ===== Remarks ===== */
.remarks-section { padding: 16px 24px; background: #fafafa; }
.textarea-input { width: 100%; padding: 12px 14px; border: 2px solid var(--border); border-radius: var(--radius-md); font-family: inherit; font-size: 0.88rem; resize: vertical; min-height: 64px; }
.textarea-input:focus { outline: none; border-color: var(--red); }

/* ===== Submit Button ===== */
.sheet-actions { padding: 20px 24px; text-align: center; border-top: 2px solid var(--border-dark); }

.submit-order-btn {
  width: 100%;
  max-width: 400px;
  padding: 16px 24px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(192,38,38,0.35);
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.submit-order-btn:hover { background: var(--red-hover); transform: translateY(-1px); }
.submit-order-btn:active { transform: translateY(1px); }
.submit-order-btn:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.submit-order-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-dark);
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.25s;
}
.modal-overlay.active .modal-card { transform: scale(1); }
.modal-card h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 4px; }
.modal-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.modal-card p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 12px; }

.success-icon { width: 60px; height: 60px; background: #dcfce7; color: var(--green); font-size: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.order-number-badge { display: inline-block; background: var(--red-light); color: var(--red); font-size: 1.4rem; font-weight: 900; padding: 6px 16px; border-radius: var(--radius-md); margin: 8px 0 12px; border: 1px dashed var(--red-border); }
.order-summary-box { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; text-align: left; margin: 12px 0; font-size: 0.85rem; max-height: 200px; overflow-y: auto; }
.order-summary-box ul { padding-left: 18px; margin: 4px 0; }
.order-summary-box li { margin: 2px 0; }

.primary-btn {
  background: var(--border-dark); color: #fff; border: none;
  padding: 12px 24px; font-size: 1rem; font-weight: 700;
  border-radius: var(--radius-md); cursor: pointer; width: 100%;
  transition: background 0.2s;
}
.primary-btn:hover { background: #334155; }
.primary-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.secondary-btn { background: #e2e8f0; color: #334155; }
.secondary-btn:hover { background: #cbd5e1; }

.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--text-muted); font-size: 0.8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.pin-input-field { text-align: center; font-size: 1.2rem; letter-spacing: 0.2em; }
.pin-error-msg { color: var(--red); font-size: 0.85rem; font-weight: 700; display: none; margin: 8px 0; }
.pin-btn-row { display: flex; gap: 8px; margin-top: 12px; }
.modal-emoji { font-size: 40px; margin-bottom: 10px; }

/* ==========================================================================
   KITCHEN DISPLAY SYSTEM (KDS) — Pro Dark Theme for Tablet
   ========================================================================== */

/* Kitchen view fills the viewport below the sticky header (tuned for 1280x800) */
#kitchen-view { display: none; }
#kitchen-view.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 58px);
  padding: 10px 14px 12px;
  overflow: hidden;
}

/* Strict isolation: Never display track-view or guest-view when kitchen-view is active */
#kitchen-view.active ~ #track-view,
#kitchen-view.active ~ #guest-view,
body:has(#kitchen-view.active) #track-view,
body:has(#kitchen-view.active) #guest-view,
body:has(#tab-kitchen.active) #track-view,
body:has(#tab-kitchen.active) #guest-view {
  display: none !important;
}

/* KDS Toolbar */
.kitchen-toolbar {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.kitchen-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
}
/* Toolbar action buttons sit inline (override .primary-btn full width) */
.kitchen-toolbar > div:last-child { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.kitchen-toolbar .primary-btn { width: auto; }

.kds-stat {
  background: #334155;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.kds-stat-num { font-size: 1.4rem; font-weight: 900; color: #f1f5f9; line-height: 1; }
.kds-stat-label { font-size: 0.7rem; font-weight: 600; color: #94a3b8; margin-top: 2px; }

/* Toolbar buttons (audio toggle + clear/sign-out use .primary-btn inline styles) */
.audio-toggle-btn {
  background: #334155;
  border: 1px solid #475569;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.15s;
  white-space: nowrap;
}
.audio-toggle-btn.active { background: #065f46; color: #a7f3d0; border-color: #10b981; }
.audio-toggle-btn:hover { background: #475569; color: #f1f5f9; }
.audio-toggle-btn:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }

/* Live connection indicator */
.kds-conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.kds-conn-on { background: #065f46; color: #a7f3d0; border: 1px solid #10b981; }
.kds-conn-off { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }

/* Kanban board — 4 equal columns filling remaining height */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

.kanban-column {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.column-header {
  padding: 10px 14px;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.column-header.new-stage { background: #dc2626; }
.column-header.cooking-stage { background: #b45309; }
.column-header.served-stage { background: #1d4ed8; }
.column-header.completed-stage { background: #475569; }

.column-count {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  min-width: 26px;
  text-align: center;
}

/* Each column scrolls independently so all four stay in view */
.column-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.column-cards::-webkit-scrollbar { width: 8px; }
.column-cards::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
.column-cards::-webkit-scrollbar-track { background: transparent; }

/* ===== KDS Order Card ===== */
.kds-card {
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  transition: transform 0.15s, border-color 0.3s;
  animation: kdsCardIn 0.3s ease-out;
}
@keyframes kdsCardIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.kds-card:hover { transform: scale(1.01); }

/* Urgency border colors */
.kds-card.kds-normal { border-left: 4px solid #22c55e; }
.kds-card.kds-warning { border-left: 4px solid #f59e0b; }
.kds-card.kds-urgent { border-left: 4px solid #ef4444; animation: urgentPulse 2s infinite; }

@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* New order flash */
.kds-card-new { border-color: #dc2626; animation: kdsCardIn 0.3s ease-out, newFlash 1.5s ease-in-out 2; }
@keyframes newFlash {
  0%, 100% { background: #0f172a; }
  50% { background: #1c1917; }
}

.kds-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.kds-guest-name { font-size: 1.15rem; font-weight: 900; color: #f8fafc; }
.kds-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.kds-order-id { font-size: 0.75rem; font-weight: 700; color: #94a3b8; }
.kds-time { font-size: 0.72rem; color: #64748b; }

.kds-elapsed {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
  padding: 2px 8px;
  background: #1e293b;
  border-radius: 4px;
  display: inline-block;
}
.kds-urgent .kds-elapsed { background: #7f1d1d; color: #fca5a5; }
.kds-warning .kds-elapsed { background: #78350f; color: #fde68a; }

/* Specs */
.kds-specs { margin-bottom: 8px; }
.kds-spec-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 4px;
  font-size: 0.82rem;
}
.kds-spec-label { color: #64748b; font-weight: 600; }
.kds-spec-value { color: #e2e8f0; font-weight: 700; }

.kds-texture-highlight {
  background: #422006;
  border: 1px solid #854d0e;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.kds-texture-label { font-size: 0.72rem; font-weight: 800; color: #fde68a; text-transform: uppercase; letter-spacing: 0.05em; }
.kds-texture-value { font-size: 1.1rem; font-weight: 900; color: #fef3c7; }

.kds-refill { font-size: 0.8rem; font-weight: 700; color: #f87171; margin: 6px 0; padding: 4px 8px; background: #1e293b; border-radius: 4px; }

.kds-sides { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.kds-side-pill {
  background: #1e3a5f;
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.kds-side-pill small { display: block; font-size: 0.65rem; color: #60a5fa; opacity: 0.8; }

.kds-remarks {
  padding: 6px 10px;
  background: #422006;
  border-left: 3px solid #d97706;
  font-size: 0.78rem;
  color: #fde68a;
  font-weight: 600;
  border-radius: 0 4px 4px 0;
  margin: 6px 0;
}

/* Action Buttons — Large Touch Targets */
.kds-actions { display: flex; gap: 6px; margin-top: 10px; }

.kds-action-btn {
  flex: 1;
  border: none;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s, transform 0.1s;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.kds-action-btn:hover { opacity: 0.9; }
.kds-action-btn:active { transform: scale(0.97); }
.kds-action-btn:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }

.kds-btn-cook { background: #b45309; }
.kds-btn-serve { background: #1d4ed8; }
.kds-btn-done { background: #15803d; }
.kds-btn-delete { background: #7f1d1d; flex: 0 0 48px; padding: 0; font-size: 1rem; }

.kds-completed-label { font-size: 0.82rem; color: #4ade80; font-weight: 700; }

/* Empty State */
.kds-empty-state {
  text-align: center;
  padding: 40px 16px;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  #kitchen-view.active { height: auto; overflow: visible; }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .kanban-column { min-height: 60vh; }
  .column-cards { overflow-y: auto; }
}

@media (max-width: 600px) {
  .header-container { justify-content: center; }
  .main-wrapper { padding: 0 8px; margin: 12px auto; }
  .sheet-banner { padding: 16px; }
  .sheet-title h1 { font-size: 1.25rem; }
  .option-row, .refill-card-group, .side-menu-container, .remarks-section, .sheet-actions { padding: 12px 16px; }
  .option-chips { grid-template-columns: repeat(3, 1fr); }
  .side-item-card { flex-direction: column; align-items: stretch; }
  .side-controls { justify-content: flex-start; }
  .kitchen-toolbar { flex-direction: column; align-items: stretch; }
  .kanban-board { grid-template-columns: 1fr; }
  .kanban-column { min-height: auto; }
  .column-cards { max-height: none; }
}
