/* ===========================================================
   Sistema de Restaurante - Estilos principales
   Paleta: terracota calido + carbon oscuro + acentos ambar
   =========================================================== */

:root {
  --brand-50: #fff4ed;
  --brand-100: #ffe4d3;
  --brand-400: #ff9a5a;
  --brand-500: #ff7a30;
  --brand-600: #f0611a;
  --brand-700: #c74c11;
  --ink-900: #1c1917;
  --ink-800: #292524;
  --ink-700: #3f3a37;
  --ink-500: #6b6560;
  --ink-300: #d6d0ca;
  --ink-100: #f5f2ef;
  --surface: #ffffff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0891b2;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 8px 30px rgba(28, 25, 23, 0.06);
  --shadow-card: 0 2px 10px rgba(28, 25, 23, 0.06);
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--ink-100);
  color: var(--ink-900);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------- Layout general del panel ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--ink-900) 0%, #14110f 100%);
  color: #f5efe9;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform .25s ease;
}

.app-sidebar .brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar .brand .logo-dot {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff; flex-shrink: 0;
}
.app-sidebar .brand strong { font-size: 1.02rem; letter-spacing: .2px; }
.app-sidebar .brand small { display: block; color: #b7afa6; font-size: .72rem; }

.app-sidebar .nav-scroll { flex: 1; overflow-y: auto; padding: 1rem .75rem; }
.app-sidebar .nav-section-title {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: #857c73; margin: 1rem .6rem .4rem;
}
.app-sidebar .nav-link {
  color: #d8d1c8; padding: .62rem .8rem; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: .7rem; font-size: .89rem; font-weight: 500;
  margin-bottom: .18rem; transition: background .15s ease, color .15s ease;
}
.app-sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; box-shadow: 0 4px 14px rgba(240, 97, 26, .35);
}

.app-sidebar .user-box {
  margin: .75rem; padding: .8rem; border-radius: var(--radius-md);
  background: rgba(255,255,255,.05); display: flex; align-items: center; gap: .6rem;
}
.app-sidebar .user-box .avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand-500);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff;
  flex-shrink: 0; text-transform: uppercase;
}
.app-sidebar .user-box .meta { overflow: hidden; }
.app-sidebar .user-box .meta strong { display: block; font-size: .83rem; color: #fff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.app-sidebar .user-box .meta span { font-size: .72rem; color: #b7afa6; }

.app-main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.app-topbar {
  background: var(--surface); border-bottom: 1px solid var(--ink-300);
  padding: .85rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1020;
}
.app-topbar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.app-topbar .subtitle { font-size: .8rem; color: var(--ink-500); }

.app-content { padding: 1.5rem; flex: 1; }

.sidebar-toggle-btn { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .sidebar-toggle-btn { display: inline-flex; }
}

/* ---------- Tarjetas ---------- */
.card-app {
  background: var(--surface); border: 1px solid var(--ink-300); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-app .card-app-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.card-app .card-app-body { padding: 1.25rem; }

.stat-card {
  border-radius: var(--radius-lg); padding: 1.25rem; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.stat-card .icon-badge {
  width: 46px; height: 46px; border-radius: var(--radius-sm); background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .75rem;
}
.stat-card h3 { font-size: 1.7rem; font-weight: 800; margin: 0; }
.stat-card p { margin: 0; opacity: .9; font-size: .82rem; }
.stat-card.bg-brand { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); }
.stat-card.bg-ink { background: linear-gradient(135deg, #3f3a37, #1c1917); }
.stat-card.bg-success { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-card.bg-info { background: linear-gradient(135deg, #22d3ee, #0e7490); }

/* ---------- Botones ---------- */
.btn-brand { background: var(--brand-500); border-color: var(--brand-500); color: #fff; font-weight: 600; }
.btn-brand:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-outline-brand { border-color: var(--brand-500); color: var(--brand-600); font-weight: 600; }
.btn-outline-brand:hover { background: var(--brand-500); color: #fff; }

/* ---------- Badges de estado ---------- */
.badge-estado { font-weight: 600; padding: .4em .7em; border-radius: 30px; font-size: .72rem; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-en_preparacion { background: #dbeafe; color: #1e40af; }
.badge-listo { background: #dcfce7; color: #166534; }
.badge-entregado { background: #e5e7eb; color: #374151; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top left, #3f2d20 0%, var(--ink-900) 55%);
  padding: 1rem;
}
.login-card { max-width: 940px; width: 100%; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-card .login-visual {
  background: linear-gradient(160deg, var(--brand-500), var(--brand-700));
  color: #fff; padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem;
}
.login-card .login-form { background: #fff; padding: 3rem 2.5rem; }

/* ---------- Kanban de cocina ---------- */
.cocina-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.cocina-col { min-width: 300px; flex: 1; }
.cocina-col-header {
  padding: .7rem 1rem; border-radius: var(--radius-md) var(--radius-md) 0 0; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.ticket-card {
  background: #fff; border: 1px solid var(--ink-300); border-left: 5px solid var(--brand-500);
  border-radius: var(--radius-sm); padding: .85rem; margin-bottom: .7rem; box-shadow: var(--shadow-card);
  transition: transform .15s ease;
}
.ticket-card:hover { transform: translateY(-2px); }
.ticket-card.demorado { border-left-color: var(--danger); animation: pulse-warn 1.6s infinite; }
@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.25); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.ticket-card .ticket-mesa { font-weight: 800; font-size: 1.05rem; }
.ticket-card .ticket-time { font-size: .74rem; color: var(--ink-500); }

/* ---------- Menu QR publico ---------- */
.qr-menu-hero {
  background: linear-gradient(160deg, var(--ink-900), #2b2420);
  color: #fff; padding: 2.2rem 1.25rem 3rem; border-radius: 0 0 28px 28px;
}
.qr-plato-card {
  background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card);
  border: 1px solid var(--ink-300); height: 100%;
}
.qr-plato-img { height: 150px; background: var(--ink-100); display: flex; align-items: center; justify-content: center; color: var(--ink-300); font-size: 2rem; }
.qr-cat-pill {
  border: 1px solid var(--ink-300); border-radius: 30px; padding: .4rem .9rem; font-size: .82rem; font-weight: 600;
  white-space: nowrap; color: var(--ink-700); background: #fff;
}
.qr-cat-pill.active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

/* ---------- Toma de pedido mesero ---------- */
.carrito-panel { position: sticky; top: 80px; }
.plato-select-card {
  border: 1px solid var(--ink-300); border-radius: var(--radius-md); padding: .8rem; cursor: pointer;
  transition: border-color .15s ease, transform .1s ease; background: #fff;
}
.plato-select-card:hover { border-color: var(--brand-500); transform: translateY(-1px); }
.plato-select-card.agregado { border-color: var(--success); background: #f0fdf4; }

/* ---------- Ticket termico (impresion) ---------- */
@media print {
  body * { visibility: hidden; }
  #ticket-imprimir, #ticket-imprimir * { visibility: visible; }
  #ticket-imprimir { position: absolute; top: 0; left: 0; width: 80mm; }
}
.ticket-print { font-family: 'Courier New', monospace; width: 80mm; padding: 6px; font-size: 12px; }
.ticket-print h2 { text-align: center; font-size: 15px; margin: 4px 0; }
.ticket-print hr { border-top: 1px dashed #000; }

/* Utilidades */
.text-brand { color: var(--brand-600); }
.fw-800 { font-weight: 800; }
.rounded-xl { border-radius: var(--radius-lg) !important; }
.scroll-tabs { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem; }
.scroll-tabs::-webkit-scrollbar { height: 4px; }
