:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --blue-zone: #0284c7;
  --red-zone: #dc2626;
  --history-zone: #334155;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow: hidden; /* Mantém a tela travada sem scroll na TV */
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- CABEÇALHO --- */
header {
  background-color: #0b1120;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #334155;
  flex-shrink: 0;
}

.header-title h1 { 
  font-size: clamp(1.2rem, 2vw, 1.8rem); 
  text-transform: uppercase; 
  letter-spacing: 1px; 
}

.header-title span { 
  font-size: clamp(0.85rem, 1.2vw, 1rem); 
  color: #94a3b8; 
}

.status-bar { 
  display: flex; 
  gap: 15px; 
  align-items: center; 
}

.badge { 
  padding: 6px 14px; 
  border-radius: 20px; 
  font-weight: bold; 
  font-size: clamp(0.75rem, 1vw, 0.85rem); 
  letter-spacing: 0.5px;
}

.badge-online { background-color: #16a34a; color: white; }
.badge-offline { background-color: var(--red-zone); color: white; }

header button {
  padding: 8px 14px; 
  background: #334155; 
  color: #fff; 
  border: none; 
  border-radius: 6px; 
  cursor: pointer; 
  font-weight: bold;
  font-size: clamp(0.8rem, 1vw, 0.95rem);
  transition: background 0.2s;
}

header button:hover {
  background: #475569;
}

/* --- CONTAINER KANBAN: 3 COLUNAS FIXAS LADO A LADO --- */
.kds-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Força exatamente 3 colunas iguais */
  gap: 15px;
  padding: 15px 20px;
  flex: 1;
  width: 100%;
  height: calc(100vh - 75px);
  overflow: hidden;
}

.column {
  background-color: #141e33;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
}

.column-header {
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  font-weight: bold;
  font-size: clamp(0.95rem, 1.3vw, 1.2rem);
  margin-bottom: 12px;
  text-transform: uppercase;
  color: white;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.col-prep .column-header { background-color: var(--blue-zone); }
.col-late .column-header { background-color: var(--red-zone); }
.col-hist .column-header { background-color: var(--history-zone); }

.orders-list { 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  overflow-y: auto; 
  padding-right: 4px; 
  flex: 1;
}

/* Estilização da barra de rolagem interna das colunas */
.orders-list::-webkit-scrollbar {
  width: 6px;
}
.orders-list::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}
.orders-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* --- CARDS DE PEDIDOS --- */
.order-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 6px solid #64748b;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.col-prep .order-card { border-left-color: var(--blue-zone); }
.col-late .order-card { border-left-color: var(--red-zone); background-color: #2a1518; }
.col-hist .order-card { border-left-color: #64748b; opacity: 0.75; }

.card-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 6px; 
}

.order-num { 
  font-size: clamp(1.2rem, 1.8vw, 1.6rem); 
  font-weight: bold; 
  color: #38bdf8; 
}

.col-late .order-num { color: #f87171; }

.timer { 
  font-size: clamp(1.1rem, 1.5vw, 1.3rem); 
  font-weight: bold; 
  font-family: monospace; 
}

.items-list { 
  margin: 8px 0; 
  font-size: clamp(0.9rem, 1.2vw, 1.05rem); 
}

.item-row { 
  display: flex; 
  justify-content: space-between; 
  padding: 3px 0; 
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1); 
}

.order-obs { 
  background-color: #0f172a; 
  padding: 6px 8px; 
  border-radius: 4px; 
  font-size: clamp(0.8rem, 1vw, 0.9rem); 
  color: #fca5a5; 
  margin-top: 6px; 
  word-break: break-word;
}

/* --- APENAS EM CELULARES MUITO PEQUENOS (< 768px) AS COLUNAS EMPILHAM --- */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }
  .kds-container {
    grid-template-columns: 1fr; /* Empilha apenas no celular */
    height: auto;
    overflow: visible;
  }
  .column {
    height: auto;
    max-height: none;
  }
}
/* --- CONTADORES DO CABEÇALHO --- */
.header-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background-color: #1e293b;
  border: 1px solid #334155;
}

.counter-label {
  font-size: clamp(0.75rem, 1vw, 0.85rem);
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
}

.counter-value {
  font-size: clamp(1rem, 1.4vw, 1.3rem);
  font-weight: bold;
  font-family: monospace;
}

.count-prep .counter-value {
  color: #38bdf8;
}

.count-late {
  border-color: rgba(220, 38, 38, 0.4);
}

.count-late .counter-value {
  color: #f87171;
}