* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ff6b35;
    --primary-dark: #e55a2b;
    --secondary: #2d3436;
    --bg: #f5f6fa;
    --white: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
    --info: #0984e3;
    --sidebar-width: 250px;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --radius: 12px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 28px;
    color: var(--primary);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.nav-links {
    list-style: none;
    padding: 12px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.nav-link.active {
    color: white;
    background: rgba(255,107,53,0.15);
    border-left-color: var(--primary);
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.top-bar {
    background: var(--white);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 600;
    flex: 1;
}

.top-bar-right {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
}

.page-container {
    padding: 24px 30px;
}

/* ===== PAGES ===== */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #00a381;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
}

.btn-filter {
    background: var(--border);
    color: var(--text);
}

.btn-filter.active {
    background: var(--primary);
    color: white;
}

/* ===== DASHBOARD CARDS ===== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.card-blue .card-icon { background: var(--info); }
.card-green .card-icon { background: var(--success); }
.card-orange .card-icon { background: var(--primary); }
.card-red .card-icon { background: var(--danger); }

.card-info {
    display: flex;
    flex-direction: column;
}

.card-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.panel h3 i {
    color: var(--primary);
}

.panel-content {
    font-size: 14px;
}

.top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.top-item:last-child { border-bottom: none; }

.top-item-name { font-weight: 500; }
.top-item-value { font-weight: 700; color: var(--success); }

.empty-msg {
    color: var(--text-light);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* ===== TABLES ===== */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-top: 1px solid var(--border);
}

.data-table tr:hover td {
    background: #f8f9fa;
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-aberto { background: #cce5ff; color: #004085; }
.badge-preparando { background: #fff3cd; color: #856404; }
.badge-pronto { background: #d4edda; color: #155724; }
.badge-entregue { background: #d1ecf1; color: #0c5460; }
.badge-cancelado { background: #f8d7da; color: #721c24; }

/* ===== PEDIDOS GRID ===== */
.pedidos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.pedido-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.pedido-card-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.pedido-card-header h4 {
    font-size: 16px;
}

.pedido-card-body {
    padding: 16px 20px;
    font-size: 14px;
}

.pedido-card-body p {
    margin-bottom: 6px;
    color: var(--text-light);
}

.pedido-card-body p strong {
    color: var(--text);
}

.pedido-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pedido-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    margin-top: 8px;
}

/* ===== NOVO PEDIDO ===== */
.novo-pedido-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.pedido-config {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.pedido-config h3 {
    margin: 20px 0 12px;
    font-size: 16px;
    color: var(--text);
}

.pedido-resumo {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 90px;
}

.pedido-resumo h3 {
    font-size: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.itens-pedido {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.item-pedido {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.item-pedido-info {
    flex: 1;
}

.item-pedido-name {
    font-weight: 500;
}

.item-pedido-price {
    font-size: 12px;
    color: var(--text-light);
}

.item-pedido-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-qty button {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-qty span {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.item-pedido-subtotal {
    font-weight: 700;
    min-width: 80px;
    text-align: right;
}

.pedido-total {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: 700;
    padding: 16px 0;
    border-top: 2px solid var(--text);
    margin-bottom: 16px;
}

.produtos-disponiveis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.produto-card-mini {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.produto-card-mini:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.produto-card-mini h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.produto-card-mini .preco {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
}

.produto-card-mini .categoria-tag {
    font-size: 11px;
    color: var(--text-light);
}

/* ===== MESAS ===== */
.mesas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.mesa-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--success);
    cursor: pointer;
    transition: all 0.2s;
}

.mesa-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.mesa-card.ocupada { border-top-color: var(--danger); }
.mesa-card.reservada { border-top-color: var(--warning); }

.mesa-card .mesa-numero {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
}

.mesa-card .mesa-info {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

.mesa-card .mesa-status {
    margin-top: 12px;
}

/* ===== CAIXA ===== */
.caixa-container {
    max-width: 500px;
}

.caixa-status {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.caixa-status h3 {
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.caixa-info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}

.caixa-info-row:last-of-type { border-bottom: none; }

.caixa-saldo {
    font-size: 28px;
    font-weight: 700;
    color: var(--success);
    text-align: center;
    margin: 20px 0;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-group {
    display: flex;
    gap: 8px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--white);
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .novo-pedido-layout {
        grid-template-columns: 1fr;
    }

    .pedido-resumo {
        position: static;
    }

    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
}
