:root {
    --cor-primaria: #e63946;
    --sidebar-bg: #1d2330;
    --sidebar-bg2: #161b26;
    --cinza-fundo: #f4f6fa;
}

* { box-sizing: border-box; }

body {
    background: var(--cinza-fundo);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
}

.btn-primary {
    --bs-btn-bg: var(--cor-primaria);
    --bs-btn-border-color: var(--cor-primaria);
    --bs-btn-hover-bg: #c92c39;
    --bs-btn-hover-border-color: #c92c39;
    --bs-btn-active-bg: #b02631;
    --bs-btn-disabled-bg: var(--cor-primaria);
    --bs-btn-disabled-border-color: var(--cor-primaria);
}
a { color: var(--cor-primaria); }

/* ===================== LOGIN ===================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d2330, #2c3446);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 36px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-logo { max-height: 80px; margin-bottom: 10px; }
.login-emoji { font-size: 54px; }
.login-titulo { font-size: 22px; font-weight: 700; margin: 8px 0 2px; }
.login-sub { color: #8a90a0; font-size: 14px; margin: 0; }

/* ===================== LAYOUT ===================== */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg2));
    color: #cfd3dc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { max-height: 38px; max-width: 38px; border-radius: 8px; }
.sidebar-logo-emoji { font-size: 30px; }
.sidebar-title { font-weight: 700; color: #fff; font-size: 16px; line-height: 1.1; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: #cfd3dc; text-decoration: none;
    font-size: 15px; margin-bottom: 3px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--cor-primaria); color: #fff; }
.nav-icone { font-size: 18px; width: 24px; text-align: center; }
.nav-grupo-titulo {
    font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
    color: #6b7280; padding: 12px 14px 4px; font-weight: 700;
}
.nav-sair-contexto { color: #fca5a5; }
.nav-sair-contexto:hover { background: rgba(239,68,68,.15); color: #fecaca; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--cor-primaria); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; text-transform: uppercase;
}
.user-nome { color: #fff; font-size: 14px; font-weight: 600; }
.user-nivel { font-size: 12px; color: #8a90a0; }

.content-area {
    flex: 1;
    margin-left: 250px;
    display: flex; flex-direction: column;
    min-width: 0;
}
.topbar {
    background: #fff;
    height: 62px;
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-size: 19px; font-weight: 700; margin: 0; }
.btn-menu { display: none; font-size: 20px; line-height: 1; padding: 4px 12px; }
.main-content { padding: 22px; flex: 1; }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1035;
}

/* ===================== CARDS / STATS ===================== */
.card { border: none; box-shadow: 0 2px 10px rgba(0,0,0,.05); border-radius: 14px; }
.card-header { background: #fff; border-bottom: 1px solid #eef0f4; font-weight: 600; border-radius: 14px 14px 0 0 !important; }

.stat-card {
    background: #fff; border-radius: 14px; padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    text-align: center; height: 100%;
    border-top: 4px solid #ccc;
}
.stat-icone { font-size: 26px; }
.stat-numero { font-size: 30px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.stat-label { color: #8a90a0; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.stat-novo { border-top-color: #3b82f6; }
.stat-prep { border-top-color: #f59e0b; }
.stat-pronto { border-top-color: #06b6d4; }
.stat-hoje { border-top-color: #8b5cf6; }
.stat-atendido { border-top-color: #22c55e; }
.stat-vendido { border-top-color: #e63946; }
.stat-acesso { border-top-color: #64748b; }

/* ===================== TABELAS ===================== */
.prod-thumb {
    width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
}
.prod-thumb-vazio {
    display: flex; align-items: center; justify-content: center;
    background: #eef0f4; font-size: 22px;
}
.prod-thumb-lg { max-width: 120px; border-radius: 8px; }

.config-logo { max-height: 140px; max-width: 100%; border-radius: 10px; }
.config-logo-vazio { font-size: 64px; }

/* ===================== QR CODES ===================== */
.qr-card {
    background: #fff; border-radius: 14px; padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    text-align: center; height: 100%;
}
.qr-inativa { opacity: .55; }
.qr-card-titulo { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.qr-holder { display: flex; justify-content: center; padding: 6px; }
.qr-holder img, .qr-holder canvas { width: 100% !important; height: auto !important; max-width: 160px; }
.qr-codigo { font-family: monospace; font-size: 12px; color: #888; margin: 8px 0; letter-spacing: 1px; }
.qr-acoes { display: flex; gap: 6px; justify-content: center; }

/* ===================== PAINEL DE PEDIDOS ===================== */
.painel-topo {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.painel-controles { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.painel-status { color: #22a355; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.live-dot {
    width: 9px; height: 9px; border-radius: 50%; background: #22c55e;
    display: inline-block; animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(34,197,94,.5)} 70%{box-shadow:0 0 0 8px rgba(34,197,94,0)} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0)} }

.coluna-pedidos {
    background: #eef0f4; border-radius: 14px; overflow: hidden;
    display: flex; flex-direction: column; min-height: 200px;
}
.coluna-header {
    padding: 12px 14px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 8px;
}
.col-novo { background: #3b82f6; }
.col-prep { background: #f59e0b; }
.col-pronto { background: #06b6d4; }
.coluna-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 60px; }

.pedido-card {
    background: #fff; border-radius: 12px; padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    border-left: 5px solid #cbd5e1;
}
.pedido-card.novo-destaque {
    border-left-color: #3b82f6;
    animation: entrar .4s ease, flash 1.6s ease;
}
@keyframes entrar { from{opacity:0; transform: translateY(-8px);} to{opacity:1; transform:none;} }
@keyframes flash { 0%,100%{background:#fff} 30%{background:#dbeafe} }

.pedido-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pedido-mesa { font-weight: 800; font-size: 18px; }
.pedido-num { color: #64748b; font-size: 13px; }
.pedido-hora { margin-left: auto; color: #64748b; font-size: 13px; }
.pedido-itens { list-style: none; padding: 0; margin: 0 0 8px; }
.pedido-itens li { padding: 3px 0; font-size: 15px; border-bottom: 1px dashed #eef0f4; }
.pedido-itens li:last-child { border-bottom: none; }
.item-qtd { font-weight: 700; color: var(--cor-primaria); }
.item-obs { display: block; font-size: 12px; color: #64748b; padding-left: 12px; }
.pedido-obs {
    background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px;
    padding: 6px 10px; font-size: 13px; margin-bottom: 8px; color: #9a3412;
}
.pedido-mesa.is-delivery { color: #7c3aed; }
.pedido-entrega {
    background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 8px;
    padding: 8px 10px; font-size: 13px; margin-bottom: 8px; color: #4c1d95;
}
.pedido-entrega .ent-linha { padding: 1px 0; }
.pedido-entrega a { color: #6d28d9; text-decoration: none; }
.pedido-entrega .ent-comp { font-style: italic; color: #6b7280; }
.pedido-total { text-align: right; font-weight: 800; margin-bottom: 8px; }
.pedido-total .pt-sub { font-weight: 500; font-size: 12px; color: #64748b; }
.pedido-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.pedido-acoes .btn { flex: 1; min-width: 90px; }

/* ===================== FECHAR MESA ===================== */
.lanch-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

.barra-mini { height: 6px; background: #eef0f4; border-radius: 4px; margin-top: 4px; overflow: hidden; }
.barra-mini span { display: block; height: 100%; background: var(--cor-primaria); border-radius: 4px; }

.fechar-card .fechar-total {
    font-size: 18px; text-align: right; padding-top: 8px; border-top: 2px solid #eef0f4;
}

/* ===================== RESPONSIVO ===================== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.aberto { transform: translateX(0); }
    .content-area { margin-left: 0; }
    .btn-menu { display: inline-block; }
    .sidebar-backdrop.aberto { display: block; }
}
