/* =========================================================
   FORNO & BRASA - HIGH-TECH KITCHEN DISPLAY SYSTEM (KDS)
   Aerospace / Culinary Mission Control Interface
   ========================================================= */

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

:root {
  --bg-hud: #07090e;
  --bg-card: #0e131d;
  --bg-card-header: #131b29;
  --bg-surface-elevated: #182234;
  --border-hud: #1e293b;
  --border-focus: #ff5722;

  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.45);
  --color-yellow: #f59e0b;
  --color-yellow-glow: rgba(245, 158, 11, 0.45);
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.6);
  --color-brand: #ff5722;
  --color-cyan: #00d6ff;
  --color-cyan-glow: rgba(0, 214, 255, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition-fast: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

html, body.kds-body {
  height: 100%;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

body.kds-body {
  background-color: var(--bg-hud);
  color: var(--text-main);
  font-family: var(--font-main);
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(255, 87, 34, 0.08) 0%, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* =========================================================
   KDS HUD HEADER (Arquitetura 2 Camadas)
   ========================================================= */
.kds-header {
  background: rgba(14, 19, 29, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--border-hud);
  padding: 8px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.fire-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 14px rgba(255, 87, 34, 0.8));
  animation: flicker 2s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
@keyframes flicker {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 14px rgba(255, 87, 34, 0.8)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 22px rgba(255, 152, 0, 0.9)); }
}

.brand-titles {
  min-width: 0;
  flex: 1;
}

.brand-titles h1 {
  font-size: clamp(15px, 1.8vw, 22px);
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #fff;
  background: linear-gradient(135deg, #ff5722 0%, #ff9800 60%, #ffc107 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(255, 87, 34, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  margin: 0;
}

.brand-titles .sub {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-hud);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-yellow);
  flex-shrink: 0;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 12px #10b981;
}

.status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 12px #ef4444;
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.kds-clock {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  color: #ffb74d;
  background: rgba(255, 183, 77, 0.1);
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 183, 77, 0.35);
  box-shadow: 0 0 12px rgba(255, 183, 77, 0.2);
  white-space: nowrap;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.audio-toggle-btn, .refresh-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-hud);
  color: var(--text-main);
  padding: 0 12px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 12px;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

.audio-toggle-btn:hover, .refresh-btn:hover {
  background: #25334c;
  border-color: rgba(255, 255, 255, 0.2);
}

.refresh-btn.logout-btn {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 0 12px;
  height: 34px;
}

.refresh-btn.logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
}

.header-right .pwa-header-install-btn,
.pwa-header-install-btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  height: 34px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  background: rgba(224, 86, 36, 0.15) !important;
  border: 1px solid rgba(224, 86, 36, 0.45) !important;
  color: #ff9466 !important;
  font-family: var(--font-main, 'Outfit', sans-serif) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  outline: none !important;
  transition: var(--transition-fast, all 0.2s ease) !important;
  user-select: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  box-sizing: border-box !important;
}

.header-right .pwa-header-install-btn:hover,
.pwa-header-install-btn:hover {
  background: rgba(224, 86, 36, 0.3) !important;
  border-color: rgba(224, 86, 36, 0.8) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.header-right .pwa-header-install-btn svg,
.pwa-header-install-btn svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  fill: none !important;
  flex-shrink: 0 !important;
}

/* Station Nav Filter Bar (Trilho Horizontal Touch) */
.station-nav-bar {
  width: 100%;
  overflow: hidden;
}

.station-nav {
  display: flex;
  background: #090d15;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-hud);
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}

.station-nav::-webkit-scrollbar {
  display: none;
}

.station-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 800;
  transition: var(--transition-fast);
  flex-shrink: 0;
  white-space: nowrap;
}

.station-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.station-tab.active {
  background: linear-gradient(135deg, #ff5722, #ff9800);
  color: #fff;
  box-shadow: 0 2px 14px rgba(255, 87, 34, 0.5);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 900;
}

/* =========================================================
   SLA METRICS BAR
   ========================================================= */
.sla-bar {
  background: #0b0f18;
  border-bottom: 1px solid var(--border-hud);
  padding: 7px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-sizing: border-box;
}

.sla-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.stat-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-indicator.green { background: var(--color-green); box-shadow: 0 0 10px var(--color-green); }
.stat-indicator.yellow { background: var(--color-yellow); box-shadow: 0 0 10px var(--color-yellow); }
.stat-indicator.red { background: var(--color-red); box-shadow: 0 0 12px var(--color-red); }

.sla-stat strong {
  font-family: var(--font-mono);
  font-size: 15px;
  color: #fff;
}

/* =========================================================
   TICKETS CONTAINER GRID (Viewport Scroll Area)
   ========================================================= */
.tickets-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  grid-auto-rows: max-content;
  gap: 16px;
  align-items: start;
  box-sizing: border-box;
}

/* Ticket Card */
.ticket-card {
  background: var(--bg-card);
  border: 2px solid var(--border-hud);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  position: relative;
}

.ticket-card:hover {
  transform: translateY(-4px);
}

/* SLA Dynamic Glow Borders */
.ticket-card.sla-normal {
  border-color: var(--color-green);
  box-shadow: 0 0 18px var(--color-green-glow);
}
.ticket-card.sla-normal .ticket-header {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.2) 0%, #131b29 100%);
}

.ticket-card.sla-warning {
  border-color: var(--color-yellow);
  box-shadow: 0 0 20px var(--color-yellow-glow);
}
.ticket-card.sla-warning .ticket-header {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.25) 0%, #131b29 100%);
}

.ticket-card.sla-alert {
  border-color: var(--color-red);
  box-shadow: 0 0 24px var(--color-red-glow);
  animation: pulse-kds-alert 1.5s infinite ease-in-out;
}
.ticket-card.sla-alert .ticket-header {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.3) 0%, #131b29 100%);
}

@keyframes pulse-kds-alert {
  0% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 32px rgba(239, 68, 68, 0.9); }
  100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
}

/* Ticket Header */
.ticket-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-hud);
}

.ticket-id-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticket-number {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.ticket-type {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.type-delivery {
  background: rgba(0, 214, 255, 0.2);
  color: #00d6ff;
  border: 1px solid #00d6ff;
}

.type-balcao {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
  border: 1px solid #ff9800;
}

.type-mesa {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid #10b981;
}

.type-totem {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border: 1px solid #f472b6;
}

/* SLA Dynamic Timer */
.ticket-timer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.timer-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.timer-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.timer-sub {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #94a3b8;
  margin-top: 2px;
}

.timer-waiting { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
.timer-preparing { color: #34d399; text-shadow: 0 0 8px rgba(52, 211, 153, 0.4); }

.timer-green { color: #10b981; text-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.timer-yellow { color: #f59e0b; text-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.timer-red { color: #ef4444; font-weight: 900; text-shadow: 0 0 12px rgba(239, 68, 68, 0.8); animation: blink 1s infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Customer Section */
.ticket-customer-info {
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 18px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-hud);
}

.customer-name {
  font-weight: 800;
  color: #e2e8f0;
}

.order-timestamp {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 700;
}

/* =========================================================
   TICKET MULTI-STAGE SECTOR PIPELINE
   ========================================================= */
.ticket-pipeline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pipeline-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  transition: var(--transition-fast);
}

.pipeline-chip.done {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.pipeline-chip.active {
  background: linear-gradient(135deg, rgba(255, 87, 34, 0.3), rgba(255, 152, 0, 0.3));
  border: 1px solid #ff5722;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 87, 34, 0.35);
  animation: pulseActiveChip 1.8s infinite ease-in-out;
}

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

.pipeline-chip.waiting {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.chip-indicator {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 900;
}

.chip-title {
  white-space: nowrap;
}

.pipeline-arrow {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 900;
  opacity: 0.7;
}

/* Ticket Items Body */
.ticket-items {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: min-content;
}

.ticket-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  transition: var(--transition-fast);
  cursor: default;
}

/* Modo Fila: apenas itens com Ficha Técnica são interativos para consulta */
.ticket-card[data-status="recebido"] .ticket-item[data-has-recipe="true"] {
  cursor: pointer;
}
.ticket-card[data-status="recebido"] .ticket-item[data-has-recipe="true"]:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 214, 255, 0.4);
}

/* Modo Fila: itens sem Ficha Técnica (ex: Coca-Cola 2L) não são interativos */
.ticket-card[data-status="recebido"] .ticket-item:not([data-has-recipe="true"]) {
  cursor: default;
}

/* Modo Em Preparo: todos os itens podem ser clicados para ações (Constar como feito / Ficha) */
.ticket-card[data-status="em_preparo"] .ticket-item {
  cursor: pointer;
}
.ticket-card[data-status="em_preparo"] .ticket-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(16, 185, 129, 0.4);
}

.ticket-item.done {
  opacity: 0.35;
  text-decoration: line-through;
  background: rgba(0, 0, 0, 0.5);
}

.item-main-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.item-qty-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.item-qty {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  color: #ff9800;
  background: rgba(255, 152, 0, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.item-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
}

.item-station-tag {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  letter-spacing: 0.5px;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
}

.item-station-tag.forno, .item-station-tag.pizzas {
  background: rgba(255, 87, 34, 0.25);
  color: #ff7043;
  border: 1px solid rgba(255, 87, 34, 0.5);
}

.item-station-tag.chapa {
  background: rgba(255, 152, 0, 0.25);
  color: #ffb74d;
  border: 1px solid rgba(255, 152, 0, 0.5);
}

.item-station-tag.churrasqueira, .item-station-tag.churrasco {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.item-station-tag.fogao, .item-station-tag.cozinha {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.5);
}

.item-station-tag.sushi {
  background: rgba(45, 212, 191, 0.25);
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.5);
}

.item-station-tag.bar, .item-station-tag.bebidas {
  background: rgba(168, 85, 247, 0.25);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.5);
}

.item-station-tag.sobremesa {
  background: rgba(236, 72, 153, 0.25);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.5);
}

.item-station-tag.expedicao {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

/* Customizations */
.item-customizations {
  margin-top: 8px;
  padding-left: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customization-badge {
  display: inline-block;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
}

.item-observations {
  margin-top: 8px;
  background: rgba(239, 68, 68, 0.2);
  border-left: 4px solid #ef4444;
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  font-weight: 800;
  color: #fca5a5;
}

/* Bump Action Footer */
.ticket-footer {
  padding: 14px 18px;
  background: #0a0e16;
  border-top: 1px solid var(--border-hud);
}

.bump-btn {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4);
  transition: var(--transition-fast);
}

.bump-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.6);
}

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

.bump-btn.preparing {
  background: linear-gradient(135deg, #ff5722, #ea580c);
  box-shadow: 0 4px 18px rgba(255, 87, 34, 0.4);
}

.bump-btn.preparing:hover {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  box-shadow: 0 6px 24px rgba(255, 87, 34, 0.6);
}

/* Empty State Centralizado (Zero Scroll na Fila Vazia) */
.tickets-empty {
  grid-column: 1 / -1;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  box-sizing: border-box;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(255, 87, 34, 0.4));
}

.tickets-empty h2 {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
}

/* =========================================================
   KDS Item Actions & Recipe Technical Sheet Modals
   ========================================================= */

.kds-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: kdsFadeIn 0.18s ease;
}

@keyframes kdsFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.kds-modal-card {
  width: 100%;
  max-width: 480px;
  background: #0d121f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 87, 34, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: kdsPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.kds-modal-card.kds-modal-lg {
  max-width: 720px;
}

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

.kds-modal-header {
  padding: 18px 22px;
  background: #090d16;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.kds-modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kds-modal-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 87, 34, 0.2);
  color: #ff7043;
  border: 1px solid rgba(255, 87, 34, 0.4);
}

.kds-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.3;
}

.kds-modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kds-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.kds-modal-close:hover {
  color: #ffffff;
}

.kds-modal-body {
  padding: 22px;
  max-height: 68vh;
  overflow-y: auto;
}

.kds-item-action-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kds-btn-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.kds-btn-action:hover {
  transform: translateY(-2px);
}

.kds-btn-action .btn-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
}

.kds-btn-action .btn-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kds-btn-action .btn-action-text strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.kds-btn-action .btn-action-text small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-action-done {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.btn-action-done .btn-action-icon {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-action-done:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.25);
}

.btn-action-recipe {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.btn-action-recipe .btn-action-icon {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.btn-action-recipe:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.25);
}

.kds-modal-footer {
  padding: 14px 22px;
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
}

.kds-btn-secondary {
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kds-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* Ficha Técnica Table */
.kds-recipe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.kds-recipe-table th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.recipe-tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.recipe-tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.recipe-tr td {
  padding: 12px;
  vertical-align: middle;
}

.recipe-ing-name {
  font-weight: 700;
  color: #ffffff;
}

.recipe-ing-cat {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.recipe-dose {
  font-family: var(--font-mono);
}

.dose-val {
  font-size: 1rem;
  font-weight: 800;
  color: #fb923c;
}

.dose-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.flavor-tag {
  display: block;
  font-size: 0.72rem;
  color: #38bdf8;
  font-family: inherit;
}

.kds-ing-stock {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.kds-ing-stock.ok {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.kds-ing-stock.low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.mandatory-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.mandatory-tag.yes {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.mandatory-tag.no {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
}

.recipe-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-weight: 600;
}

.kds-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 87, 34, 0.2);
  border-top-color: #ff5722;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.recipe-empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.recipe-empty h4 {
  font-size: 1rem;
  color: #e2e8f0;
  margin: 8px 0 4px;
}

/* =========================================================
   CONTENÇÃO E ANTI-OVERFLOW DE COMANDAS
   ========================================================= */
.ticket-card {
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.ticket-header,
.ticket-customer-info,
.ticket-pipeline,
.ticket-items,
.ticket-footer {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.item-main-row,
.item-qty-name {
  min-width: 0;
}

.item-name {
  min-width: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.item-observations {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* =========================================================
   SUÍTE DE RESPONSIVIDADE MULTI-DISPOSITIVO - KDS
   ========================================================= */

/* Widescreen & TV Displays (>= 1200px) */
@media (min-width: 1200px) {
  .tickets-container {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 18px;
    padding: 18px 22px 28px;
  }
}

/* Tablets, Monitores Compactos & Smart Displays (768px até 1199px)
   Dispositivos: iPad Mini (768x1024), Surface Pro 7 (912x1368), Nest Hub (1024x600) */
@media (max-width: 1199px) and (min-width: 768px) {
  .kds-header {
    padding: 7px 12px 5px;
    gap: 5px;
  }

  .header-main-row {
    gap: 8px;
    align-items: center;
  }

  .header-left {
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .brand-badge {
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .brand-titles {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .brand-titles h1 {
    font-size: clamp(14px, 1.6vw, 18px);
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
    margin: 0;
  }

  .brand-titles .sub {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Oculta texto longo de status e exibe apenas o ponto verde luminoso (libera 110px) */
  .connection-status {
    padding: 4px 8px;
    font-size: 10px;
    flex-shrink: 0;
  }

  .connection-status .status-text {
    display: none !important;
  }

  .connection-status .status-dot {
    margin: 0;
  }

  .header-right {
    gap: 5px;
    flex-shrink: 0;
    align-items: center;
  }

  .kds-clock {
    font-size: 13.5px;
    padding: 3px 8px;
    letter-spacing: -0.3px;
  }

  /* Oculta texto "Som Ativo" e exibe apenas o ícone de sino (libera 65px) */
  .audio-toggle-btn {
    padding: 0 9px;
    height: 32px;
  }

  .audio-toggle-btn .audio-text {
    display: none !important;
  }

  .refresh-btn {
    padding: 0 9px;
    height: 32px;
  }

  /* Oculta botão de instalar PWA em tablets para priorizar o HUD */
  body.kds-body .header-right .pwa-header-install-btn,
  body.kds-body .header-right #btnKdsInstallPwa,
  body.kds-body .pwa-header-install-btn,
  .pwa-header-install-btn {
    display: none !important;
  }

  .refresh-btn.logout-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  /* No master nav, oculta badge GERENTE mantendo apenas "Módulos" (libera 50px) */
  #fb-master-nav-trigger.in-header {
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    gap: 4px !important;
  }

  #fb-master-nav-trigger .trigger-badge {
    display: none !important;
  }

  .sla-bar {
    padding: 5px 12px;
    gap: 6px 12px;
    font-size: 11px;
  }

  /* SEMPRE 2 COLUNAS em 768px - 1199px (Nest Hub 1024px ganha ~480px por card!) */
  .tickets-container {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 10px 12px 20px;
    gap: 12px;
  }
}

/* Smartphones & Telas Compactas (<= 767px, incluindo iPhone SE 375x667 e Galaxy A55 360x800) */
@media (max-width: 767px) {
  .kds-header {
    padding: 5px 8px 4px;
    gap: 4px;
  }

  .header-main-row {
    gap: 5px;
    align-items: center;
  }

  .header-left {
    gap: 6px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .brand-badge {
    gap: 6px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .fire-icon {
    font-size: 20px;
    flex-shrink: 0;
  }

  #kdsBrandLogo {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0;
  }

  .brand-titles {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .brand-titles h1 {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin: 0;
  }

  .brand-titles .sub {
    display: none !important; /* Oculta subtítulo no mobile */
  }

  .connection-status {
    padding: 3px 6px;
    font-size: 10px;
    flex-shrink: 0;
  }

  .connection-status .status-text {
    display: none !important; /* Apenas o ponto verde luminoso no mobile */
  }

  .connection-status .status-dot {
    margin: 0;
  }

  .header-right {
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
  }

  .kds-clock {
    font-size: 11.5px;
    padding: 2px 5px;
    letter-spacing: -0.3px;
  }

  @media (max-width: 480px) {
    .kds-clock {
      display: none !important; /* Oculta relógio no mobile estreito (status bar nativa do celular já tem relógio) liberando 60px para o nome da loja */
    }
  }

  .audio-toggle-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .audio-toggle-btn .audio-text {
    display: none !important; /* Apenas ícone de som no mobile */
  }

  .refresh-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Oculta botão Instalar App no mobile com máxima especificidade */
  body.kds-body .header-right .pwa-header-install-btn,
  body.kds-body .header-right #btnKdsInstallPwa,
  body.kds-body .pwa-header-install-btn,
  .pwa-header-install-btn {
    display: none !important;
  }

  .refresh-btn.logout-btn {
    height: 32px;
    padding: 0 8px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Botão Módulos compacto (30x30px ícone) no mobile estreito */
  #fb-master-nav-trigger.in-header {
    height: 30px !important;
    width: 30px !important;
    min-width: 30px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #fb-master-nav-trigger.in-header .trigger-label,
  #fb-master-nav-trigger.in-header .trigger-badge {
    display: none !important;
  }

  #fb-master-nav-trigger.in-header .trigger-svg,
  #fb-master-nav-trigger.in-header svg {
    display: flex !important;
    width: 15px !important;
    height: 15px !important;
  }

  /* Station navigation bar */
  .station-nav-bar {
    padding: 4px 6px;
  }

  .station-nav {
    padding: 2px 2px;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .station-nav::-webkit-scrollbar {
    display: none;
  }

  .station-tab {
    padding: 6px 11px;
    font-size: 11.5px;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .station-tab .tab-icon svg {
    width: 13px;
    height: 13px;
  }

  .tab-badge {
    padding: 1px 6px;
    font-size: 10px;
  }

  /* SLA Bar: HUD 1 linha enxuta */
  .sla-bar {
    padding: 5px 12px;
    gap: 8px;
    font-size: 11px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sla-bar::-webkit-scrollbar {
    display: none;
  }

  .sla-stat {
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .sla-stat.normal .stat-label,
  .sla-stat.warning .stat-label,
  .sla-stat.alert .stat-label {
    display: none !important; /* Mostra apenas o ponto colorido + contador */
  }

  .sla-stat strong {
    font-size: 12px;
  }

  .sla-stat.average {
    margin-left: auto;
  }

  .sla-stat.average .stat-label {
    display: none !important;
  }

  .sla-stat.average::before {
    content: '⏱️ Média:';
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 700;
  }

  .sla-stat.average strong {
    font-size: 11.5px;
  }

  /* =========================================================
     TICKETS CONTAINER & CARDS - MOBILE COM RESPIRO E ROLAGEM
     Visual espaçoso, não-aglomerado e com rolagem suave natural
     ========================================================= */
  .tickets-container {
    grid-template-columns: 1fr;
    grid-auto-rows: max-content !important;
    padding: 16px 12px 100px; /* 100px de respiro no rodapé para rolagem confortável */
    gap: 20px; /* Espaçamento generoso entre cada comanda */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }

  .ticket-card {
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    min-height: auto;
    height: auto !important;
    touch-action: pan-y;
  }

  .ticket-header {
    padding: 13px 16px;
  }

  .ticket-id-wrap {
    gap: 8px;
  }

  .ticket-number {
    font-size: 21px;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .ticket-type {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
  }

  .ticket-timer {
    align-items: flex-end;
  }

  .timer-value {
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
  }

  /* Oculta textos secundários do timer no mobile para despoluir */
  .timer-label,
  .timer-sub {
    display: none !important;
  }

  .ticket-customer-info {
    padding: 8px 16px;
    font-size: 12.5px;
  }

  .ticket-pipeline {
    padding: 7px 14px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .ticket-pipeline::-webkit-scrollbar {
    display: none;
  }

  .pipeline-chip {
    padding: 3px 8px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .ticket-items {
    padding: 14px 16px;
    gap: 10px;
  }

  .ticket-item {
    padding: 11px 13px;
    border-radius: 10px;
  }

  .item-main-row {
    gap: 8px;
  }

  .item-qty-name {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .item-qty {
    font-size: 15px;
    padding: 2px 7px;
    border-radius: 6px;
  }

  .item-name {
    font-size: 14px;
    line-height: 1.3;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .item-station-tag {
    font-size: 9.5px !important;
    padding: 3px 7px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    letter-spacing: 0.3px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .item-customizations {
    margin-top: 6px;
    gap: 5px;
  }

  .customization-badge {
    font-size: 10.5px;
    padding: 2px 6px;
  }

  .item-observations {
    font-size: 11px;
    margin-top: 6px;
    padding: 4px 8px;
  }

  .ticket-footer {
    padding: 12px 16px;
  }

  .bump-btn {
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 900;
    border-radius: 10px;
    letter-spacing: 0.5px;
  }

  .empty-icon {
    font-size: 44px;
    margin-bottom: 10px;
  }

  .tickets-empty h2 {
    font-size: 18px;
  }

  .tickets-empty p {
    font-size: 12px;
  }

  /* Modais em Bottom Sheet */
  .kds-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .kds-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 20px 20px 0 0 !important;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
}

/* =========================================================
   DISPOSITIVOS COM ALTURA REDUZIDA (<= 700px) - APENAS TABLETS/DESKTOPS
   Exemplo: Nest Hub (1024x600), Monitores POS compactos (768px+)
   NÃO AFETA SMARTPHONES PORTRAIT (iPhone SE, etc.)
   ========================================================= */
@media (max-height: 700px) and (min-width: 768px) {
  .kds-header {
    padding: 4px 10px 3px !important;
    gap: 3px !important;
  }

  .station-nav-bar {
    padding: 2px 4px !important;
  }

  .station-tab {
    padding: 4px 8px !important;
    font-size: 10.5px !important;
  }

  .sla-bar {
    padding: 3px 10px !important;
    font-size: 10px !important;
  }

  .tickets-container {
    padding: 6px 10px 16px !important;
    gap: 8px !important;
  }

  .ticket-card {
    border-radius: 10px !important;
  }

  .ticket-header {
    padding: 7px 10px !important;
  }

  .ticket-number {
    font-size: 17px !important;
  }

  .timer-value {
    font-size: 15px !important;
  }

  .ticket-customer-info {
    padding: 4px 10px !important;
    font-size: 11px !important;
  }

  .ticket-pipeline {
    padding: 3px 8px !important;
    gap: 3px !important;
  }

  .pipeline-chip {
    padding: 1px 5px !important;
    font-size: 9px !important;
  }

  .ticket-items {
    padding: 6px 8px !important;
    gap: 5px !important;
  }

  .ticket-item {
    padding: 5px 8px !important;
    border-radius: 6px !important;
  }

  .item-name {
    font-size: 12.5px !important;
  }

  .item-station-tag {
    font-size: 8.5px !important;
    padding: 1px 5px !important;
  }

  .ticket-footer {
    padding: 6px 8px !important;
  }

  .bump-btn {
    padding: 7px 10px !important;
    font-size: 12.5px !important;
    border-radius: 6px !important;
  }
}


