:root {
  --red: #ef2630;
  --red-d: #c91822;
  --red-soft: rgba(239, 38, 48, 0.16);
  --yellow: #ffdc13;
  --dark: #120a08;
  --sidebar-bg: #170d0a;
  --sidebar-hover: rgba(255, 220, 19, 0.08);
  --bg: #120a08;
  --card: #190f0c;
  --card-alt: #1b110d;
  --border: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(255, 220, 19, 0.18);
  --text: #fff9e8;
  --muted: #b9aaa0;
  --green: #19bb35;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --font: 'Nunito', 'Trebuchet MS', system-ui, -apple-system, sans-serif;
  --display: 'Barlow Condensed', Impact, 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: #3d2419 #120a08; }
body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(120, 37, 12, 0.22), transparent 46%);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

/* ==================== LOGIN ==================== */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #120a08;
  background-image: radial-gradient(ellipse at 50% 18%, rgba(180, 50, 18, 0.28), transparent 55%),
    repeating-linear-gradient(177deg, #1a0c08 0 3px, #24100a 4px, #150905 7px, #2b130a 9px, #1a0b07 13px);
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 430px;
  background: #1b100c;
  border: 1px solid rgba(255, 220, 19, 0.45);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.login-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid #fff0a0;
  color: #111;
  font-size: 26px;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 #6f170d;
}
.login-box h1 {
  font: 900 2rem/0.95 var(--display);
  margin: 0;
  text-transform: uppercase;
  color: #fff8e3;
}
.login-box p.sub {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 0.85rem;
}
.demo-creds {
  background: #140b08;
  border: 1px dashed rgba(255, 220, 19, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #e5d6c8;
  margin-bottom: 16px;
}
.demo-creds b { color: var(--yellow); }
.demo-creds code {
  background: #261610;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ==================== LAYOUT PRINCIPAL ==================== */
.admin-shell {
  display: flex;
  min-height: 100dvh;
  width: 100%;
  background-color: #120a08;
  color: #fff9e8;
}
.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 50;
  transition: transform 0.25s ease;
}
.sb-brand {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sb-brand-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sb-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--yellow);
  display: grid;
  place-items: center;
  font-size: 23px;
  box-shadow: 0 2px 0 #6f170d;
  flex-shrink: 0;
}
.sb-title {
  margin: 0;
  font: 900 19px/1.1 var(--display);
  text-transform: uppercase;
  color: #fff8e3;
}
.sb-sub {
  display: block;
  font-size: 11px;
  color: var(--yellow);
  font-weight: 700;
}
.sb-close {
  display: none;
  background: none;
  border: 0;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}
.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sb-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #d8c8bc;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}
.sb-btn-left {
  display: flex;
  align-items: center;
  gap: 9px;
}
.sb-ico {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.sb-btn:hover {
  background: rgba(255, 220, 19, 0.08);
  color: #fff;
}
.sb-btn.active {
  background: rgba(255, 220, 19, 0.18);
  color: var(--yellow);
  font-weight: 800;
}
.sb-pill {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}
.sb-pill.badge-warn {
  background: #f59e0b;
  color: #111;
}
.sb-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ==================== ÁREA PRINCIPAL & TOPBAR ==================== */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(18, 10, 8, 0.95);
  border-bottom: 1px solid rgba(255, 220, 19, 0.15);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
  gap: 14px;
  flex-wrap: wrap;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
}
.page-title {
  margin: 0;
  font: 900 24px/1 var(--display);
  text-transform: uppercase;
  color: #fff6e5;
  letter-spacing: 0.02em;
}
.page-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.status-chip {
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-chip.open {
  background: rgba(25, 187, 53, 0.2);
  color: #4ade80;
  border-color: #19bb35;
}
.status-chip.closed {
  background: rgba(239, 38, 48, 0.2);
  color: #f87171;
  border-color: #ef2630;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.user-chip {
  background: #231610;
  border: 1px solid rgba(255, 220, 19, 0.25);
  color: var(--yellow);
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}
.audio-banner {
  background: #3b230b;
  color: #fde68a;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255, 220, 19, 0.3);
  font-size: 0.83rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.workspace {
  flex: 1;
  padding: 24px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
}

/* ==================== KPI CARDS (ESTILO DO PRINT) ==================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #1b110d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.kpi-card:not(:has(.kpi-icon)) {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(255, 220, 19, 0.12);
  color: var(--yellow);
  flex-shrink: 0;
}
.kpi-card.green .kpi-icon {
  background: rgba(25, 187, 53, 0.15);
  color: #4ade80;
}
.kpi-card.red .kpi-icon {
  background: rgba(239, 38, 48, 0.15);
  color: #f87171;
}
.kpi-info small, .kpi-card .lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #a49488;
}
.kpi-info strong, .kpi-card .val {
  display: block;
  font: 800 25px/1.1 var(--display);
  color: #fffdf5;
  margin-top: 3px;
}
.kpi-info span, .kpi-card .meta {
  display: block;
  font-size: 11px;
  color: #88786c;
  margin-top: 2px;
}

/* ==================== PAINÉIS E GRIDS ==================== */
.platform-two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.panel-card {
  background: #190f0c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.platform-two-col .panel-card {
  margin-bottom: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-head h2, .panel-head h3 {
  margin: 0;
  font: 800 19px/1 var(--display);
  text-transform: uppercase;
  color: #fff4dc;
  letter-spacing: 0.02em;
}

/* ==================== FORMULÁRIOS E BOTÕES ==================== */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.input, select, textarea {
  padding: 9px 12px;
  border: 1px solid #442a1a;
  border-radius: 6px;
  font: inherit;
  background: #140b08;
  color: #fff9e8;
}
.input::placeholder, textarea::placeholder {
  color: #7d6b5d;
}
.input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--yellow);
  border-color: var(--yellow);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 12px;
  font-weight: 700;
  color: #d8c8bc;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: 700 12.5px var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--yellow);
  color: #140b08;
  border-color: var(--yellow);
  font-weight: 800;
}
.btn-primary:hover {
  background: #ffe54c;
}
.btn-secondary {
  background: #231610;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5d6c8;
}
.btn-secondary:hover {
  background: #311e17;
  color: #fff;
  border-color: rgba(255, 220, 19, 0.35);
}
.btn-success {
  background: #15803d;
  color: #fff;
  border-color: #16a34a;
}
.btn-warning {
  background: #d97706;
  color: #fff;
}
.btn-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border-color: #7f1d1d;
}
.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}
.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

/* ==================== TABELAS (ESTILO DO PRINT) ==================== */
.table-wrap {
  overflow-x: auto;
  background: #170d0a;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
th {
  padding: 12px 14px;
  background: #20130e;
  color: var(--yellow);
  font: 800 13px/1 var(--display);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.03em;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e5d8cc;
  vertical-align: middle;
}
tr:hover td {
  background: rgba(255, 220, 19, 0.04);
}

/* ==================== BADGES DE STATUS ==================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.st-novo { background: #3b82f6; color: #fff; }
.st-confirmado { background: #6366f1; color: #fff; }
.st-em_preparo { background: #f59e0b; color: #111; }
.st-pronto { background: #10b981; color: #fff; }
.st-saiu_para_entrega { background: #8b5cf6; color: #fff; }
.st-entregue { background: #15803d; color: #fff; }
.st-cancelado { background: #dc2626; color: #fff; }

/* ==================== COZINHA / KDS ==================== */
.kds-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.kds-col {
  background: #170d0a;
  border: 1px solid rgba(255, 220, 19, 0.15);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kds-col-h {
  font: 800 18px/1 var(--display);
  text-transform: uppercase;
  color: var(--yellow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.kds-ticket {
  background: #1c110e;
  border: 1px solid #442a1a;
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  padding: 14px;
  color: #f3e8d9;
}

/* ==================== IMPRESSÃO TÉRMICA / BOBINA ==================== */
.bobina-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  align-items: start;
}
.bobina-paper {
  background: #FFFDF7;
  color: #000;
  font-family: 'Courier New', Courier, monospace;
  margin: 0 auto;
  padding: 16px 14px;
  border-radius: 4px;
  border: 1px dashed #666;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  white-space: pre-wrap;
  word-break: break-word;
}
.bobina-paper.w58 { width: 245px; }
.bobina-paper.w80 { width: 330px; }
.bobina-paper.fs-small { font-size: 11px; }
.bobina-paper.fs-normal { font-size: 12.5px; }
.bobina-paper.fs-large { font-size: 14.5px; font-weight: 700; }
.bobina-paper.ls-compact { line-height: 1.15; }
.bobina-paper.ls-normal { line-height: 1.35; }
.bobina-paper.ls-relaxed { line-height: 1.6; }

/* ==================== MODAL & TOASTS ==================== */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }
.modal-box {
  background: #1c110d;
  border: 1px solid var(--yellow);
  color: #fff9e8;
  border-radius: 10px;
  width: 100%;
  max-width: 680px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.9);
}
.modal-box h3 {
  font: 800 22px/1 var(--display);
  text-transform: uppercase;
  color: #fff6e5;
}
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-toast {
  background: #21130d;
  color: #fff9e8;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 220, 19, 0.3);
  border-left: 4px solid var(--yellow);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  font-size: 0.85rem;
  font-weight: 700;
}

.pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.pass-wrap .input {
  width: 100%;
  padding-right: 44px;
}
.btn-toggle-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #ffdc13;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 6px;
  user-select: none;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-toggle-eye:hover {
  opacity: 0.85;
  transform: translateY(-50%) scale(1.1);
}
.btn-toggle-eye:focus-visible {
  outline: 2px solid #ffdc13;
}

@media (max-width: 960px) {
  .platform-two-col { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-102%);
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.85);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-close, .menu-toggle { display: inline-grid; place-items: center; }
  .bobina-layout { grid-template-columns: 1fr; }
}
