/* =========================================================
   Sistema Multi-Empresas de Delivery — Estilo Global
   Paleta: Branco / Vermelho / Laranja
   ========================================================= */

:root {
    --cor-primaria: #E4181C;
    --cor-primaria-escura: #B7100F;
    --cor-secundaria: #FF7A00;
    --gradiente: linear-gradient(135deg, #E4181C 0%, #FF7A00 100%);
    --cor-fundo: #F7F7F8;
    --cor-texto: #1F2024;
    --cor-texto-suave: #6B7280;
    --cor-borda: #ECECEE;
    --branco: #FFFFFF;
    --sombra: 0 2px 10px rgba(0,0,0,0.06);
    --sombra-forte: 0 8px 30px rgba(0,0,0,0.12);
    --raio: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--cor-fundo);
    color: var(--cor-texto);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gradiente); color: #fff; box-shadow: 0 4px 14px rgba(228,24,28,0.35); }
.btn-primary:hover { opacity: 0.92; }
.btn-outline { background: #fff; color: var(--cor-primaria); border: 2px solid var(--cor-primaria); }
.btn-secundario { background: var(--cor-fundo); color: var(--cor-texto); border: 1px solid var(--cor-borda); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: #DC2626; color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Formulários ---------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--cor-texto); }
input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--cor-borda);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--cor-texto);
    transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cor-primaria);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 24px;
}

/* ---------- Auth pages (login/cadastro) ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--gradiente);
}
.auth-box {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--sombra-forte);
}
.auth-box.wide { max-width: 720px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .icone {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--gradiente);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px; color: #fff; font-size: 26px; font-weight: 800;
}
.auth-box h1 { font-size: 22px; text-align: center; margin: 0 0 6px; }
.auth-box p.subtitle { text-align: center; color: var(--cor-texto-suave); margin: 0 0 28px; font-size: 14px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--cor-texto-suave); }
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; }
.alert-erro { background: #FEE2E2; color: #B91C1C; }
.alert-sucesso { background: #DCFCE7; color: #15803D; }

/* ---------- Admin layout ---------- */
.admin-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: #17181C;
    color: #fff;
    padding: 24px 16px;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform .2s ease;
}
.sidebar .marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.sidebar .marca .icone {
    width: 38px; height: 38px; border-radius: 10px; background: var(--gradiente);
    display:flex; align-items:center; justify-content:center; font-weight:800;
}
.sidebar .marca strong { font-size: 15px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px; border-radius: 10px; margin-bottom: 4px;
    color: #C7C8CC; font-size: 14px; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.ativo { background: var(--gradiente); color: #fff; }
.sidebar nav .grupo-titulo { font-size: 11px; text-transform: uppercase; color: #6B6C72; margin: 18px 8px 8px; letter-spacing: .04em; }
.sidebar .sair { margin-top: 20px; }

.main-content { margin-left: 250px; flex: 1; padding: 28px 32px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 22px; margin: 0; }
.menu-toggle { display: none; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; }
.stat-card .valor { font-size: 28px; font-weight: 800; margin: 6px 0 2px; }
.stat-card .rotulo { color: var(--cor-texto-suave); font-size: 13px; font-weight: 600; }

table.tabela { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--raio); overflow: hidden; }
table.tabela th, table.tabela td { padding: 13px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--cor-borda); }
table.tabela th { background: #FAFAFB; font-weight: 700; color: var(--cor-texto-suave); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.tabela tr:last-child td { border-bottom: none; }
table.tabela tr:hover td { background: #FAFAFB; }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; color: #fff; }

.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap: wrap; gap: 10px; }

.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.ativo { display: flex; }
.modal-box { background: #fff; border-radius: var(--raio); padding: 28px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-box h2 { margin-top: 0; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.aberta { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px 16px; }
    .menu-toggle { display: flex; }
}
