/* Snack Bar Cazombo — Admin Professional */
:root {
    --sidebar-w: 260px;
    --primary: #ea580c;
    --primary-dark: #c2410c;
    --primary-light: #fff7ed;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --text-secondary: #475569;
    --muted: #94a3b8;
    --border: #e2e8f0;
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --shadow-sm: 0 1px 3px rgba(15,23,42,0.06);
    --shadow: 0 4px 20px rgba(15,23,42,0.08);
    --radius: 12px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-page { min-height: 100vh; }

.login-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.login-brand-side {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.login-brand-side::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(234,88,12,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
}

.login-brand-content { position: relative; max-width: 400px; }

.login-brand-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 30px rgba(234,88,12,0.35);
}

.login-brand-content h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; }
.login-brand-content > p { opacity: 0.7; line-height: 1.6; margin-bottom: 2rem; }

.login-features { list-style: none; }
.login-features li {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0; font-size: 0.95rem; opacity: 0.85;
}
.login-features i { color: var(--primary); }

.login-form-side {
    display: flex; align-items: center; justify-content: center;
    padding: 2rem; background: var(--bg);
}

.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.35rem; }
.login-sub { color: var(--text-secondary); margin-bottom: 2rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.5rem; color: var(--text); }

.input-icon { position: relative; }
.input-icon i {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 1rem;
}
.input-icon input {
    width: 100%; padding: 0.8rem 1rem 0.8rem 2.75rem;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 0.95rem; font-family: inherit;
    background: white; transition: border-color 0.2s, box-shadow 0.2s;
}
.input-icon input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234,88,12,0.12);
}

.btn-login {
    width: 100%; padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; border-radius: var(--radius);
    font-size: 1rem; font-weight: 700; font-family: inherit;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(234,88,12,0.3);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(234,88,12,0.4); }

.alert-error {
    background: var(--danger-bg); color: var(--danger);
    padding: 0.85rem 1rem; border-radius: var(--radius);
    margin-bottom: 1.25rem; font-size: 0.875rem;
    display: flex; align-items: center; gap: 0.5rem;
    border: 1px solid #fecaca;
}

.back-client {
    display: inline-flex; align-items: center; gap: 0.4rem;
    margin-top: 2rem; color: var(--text-secondary);
    text-decoration: none; font-size: 0.875rem; font-weight: 500;
}
.back-client:hover { color: var(--primary); }

/* ===== LAYOUT ===== */
.admin-body { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    color: white;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex; align-items: center; gap: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}

.brand-text strong { display: block; font-size: 1rem; }
.brand-text small { font-size: 0.75rem; opacity: 0.5; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }

.nav-label {
    display: block; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35); padding: 0.75rem 0.75rem 0.5rem;
}

.nav-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.85rem; margin-bottom: 0.15rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none; font-size: 0.875rem; font-weight: 500;
    border-radius: 8px; transition: all 0.15s;
}
.nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-link:hover { background: var(--sidebar-hover); color: white; }
.nav-link.active { background: rgba(234,88,12,0.15); color: #fb923c; }

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white; font-size: 0.7rem; font-weight: 700;
    padding: 0.15rem 0.5rem; border-radius: 50px;
    min-width: 20px; text-align: center;
}

.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.08); }

.user-card {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem;
}

.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { font-size: 0.7rem; opacity: 0.5; text-transform: capitalize; }

.btn-logout {
    color: rgba(255,255,255,0.4); font-size: 1.1rem;
    padding: 0.35rem; border-radius: 6px; transition: all 0.15s;
}
.btn-logout:hover { color: #f87171; background: rgba(248,113,113,0.1); }

/* Main */
.admin-main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; min-width: 0; }

.admin-topbar {
    background: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 50;
}

.sidebar-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.5rem; color: var(--text); cursor: pointer;
}

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 1.35rem; font-weight: 800; }
.topbar-title p { font-size: 0.8rem; color: var(--muted); margin-top: 0.1rem; }

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.topbar-alert {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--danger-bg); color: var(--danger);
    padding: 0.45rem 0.85rem; border-radius: 50px;
    font-size: 0.8rem; font-weight: 600; text-decoration: none;
    animation: pulse-alert 2s infinite;
}
@keyframes pulse-alert { 0%,100%{opacity:1} 50%{opacity:0.7} }

.topbar-date {
    font-size: 0.8rem; color: var(--muted);
    display: flex; align-items: center; gap: 0.35rem;
}

.admin-content { padding: 1.5rem; }

/* ===== WELCOME ===== */
.welcome-banner {
    background: linear-gradient(135deg, var(--sidebar) 0%, #1e293b 100%);
    color: white; border-radius: var(--radius-lg);
    padding: 1.5rem 2rem; margin-bottom: 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
}
.welcome-banner h2 { font-size: 1.35rem; font-weight: 700; }
.welcome-banner p { opacity: 0.65; font-size: 0.9rem; margin-top: 0.25rem; }

.live-clock {
    font-size: 2rem; font-weight: 800;
    font-variant-numeric: tabular-nums;
    opacity: 0.9;
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem; margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card.highlight { border-color: #bbf7d0; background: linear-gradient(135deg, #fff, var(--success-bg)); }
.stat-card.pulse-alert { border-color: #fecaca; }

.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: white; flex-shrink: 0;
}
.stat-icon.orange { background: linear-gradient(135deg, #ea580c, #c2410c); }
.stat-icon.green { background: linear-gradient(135deg, #16a34a, #15803d); }
.stat-icon.red { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.stat-icon.blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }

.stat-value { font-size: 1.5rem; font-weight: 800; display: block; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }

/* ===== PANELS ===== */
.panel {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: #fafbfc;
}
.panel-header h2 {
    font-size: 0.95rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
}
.panel-header h2 i { color: var(--primary); }
.panel-body { padding: 1.25rem; }
.panel-body.no-padding { padding: 0; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
}

.mt-4 { margin-top: 1.5rem; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.py-3 { padding: 1rem 0; }
.fw-bold { font-weight: 700; }
.mono { font-family: 'Courier New', monospace; font-size: 0.85rem; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
    text-align: left; padding: 0.75rem 1.25rem;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--muted);
    background: #f8fafc; border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:hover td { background: #fafbfc; }
.data-table tr:last-child td { border-bottom: none; }

.mesa-tag {
    background: var(--primary-light); color: var(--primary-dark);
    padding: 0.25rem 0.65rem; border-radius: 6px;
    font-weight: 700; font-size: 0.8rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.status-badge.lg { font-size: 0.8rem; padding: 0.35rem 0.85rem; }

.status-recebido { background: #ede9fe; color: #6d28d9; }
.status-preparacao { background: var(--warning-bg); color: var(--warning); }
.status-pronto { background: var(--info-bg); color: var(--info); }
.status-servido { background: var(--success-bg); color: var(--success); }
.status-cancelado { background: var(--danger-bg); color: var(--danger); }
.status-mesa-livre { background: var(--success-bg); color: var(--success); }
.status-mesa-ocupada { background: var(--warning-bg); color: var(--warning); }
.status-mesa-reservada { background: #ede9fe; color: #6d28d9; }

/* Ranking */
.ranking-list { list-style: none; }
.ranking-list li {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.ranking-list li:last-child { border-bottom: none; }

.rank {
    width: 28px; height: 28px;
    background: var(--bg); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.8rem; color: var(--muted);
}
.ranking-list li:first-child .rank { background: #fef3c7; color: #d97706; }

.rank-info { flex: 1; }
.rank-info strong { display: block; font-size: 0.875rem; }
.rank-info small { color: var(--muted); font-size: 0.75rem; }
.rank-value { font-weight: 700; font-size: 0.875rem; color: var(--success); }

/* Mesas admin grid */
.mesas-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
}

.mesa-admin-card {
    text-align: center; padding: 0.85rem 0.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: #fafbfc;
}
.mesa-admin-card.livre { border-color: #bbf7d0; background: var(--success-bg); }
.mesa-admin-card.ocupada { border-color: #fed7aa; background: var(--warning-bg); }
.mesa-admin-card.reservada { border-color: #c4b5fd; background: #f5f3ff; }

.ma-num { display: block; font-size: 1.25rem; font-weight: 800; }
.ma-status { display: block; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; margin: 0.2rem 0; }
.mesa-admin-card.livre .ma-status { color: var(--success); }
.mesa-admin-card.ocupada .ma-status { color: var(--warning); }
.mesa-admin-card.reservada .ma-status { color: #7c3aed; }
.mesa-admin-card small { font-size: 0.6rem; color: var(--muted); }

/* Empty state */
.empty-state {
    text-align: center; padding: 3rem 1.5rem; color: var(--muted);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state p { font-weight: 600; color: var(--text-secondary); }
.empty-state small { font-size: 0.8rem; }
.empty-state.sm { padding: 2rem; }
.empty-state.sm i { font-size: 2rem; }

/* Buttons */
.btn-primary-sm {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: var(--primary); color: white;
    border-radius: 8px; font-size: 0.8rem; font-weight: 600;
    text-decoration: none; transition: background 0.15s;
}
.btn-primary-sm:hover { background: var(--primary-dark); color: white; }

.btn-icon-sm {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px;
    background: white; color: var(--text-secondary);
    cursor: pointer; text-decoration: none; font-size: 1rem;
    transition: all 0.15s;
}
.btn-icon-sm:hover { border-color: var(--primary); color: var(--primary); }

.btn-outline-sm {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.75rem; font-weight: 600;
    text-decoration: none; color: var(--text-secondary);
    background: white;
}
.btn-outline-sm:hover { border-color: var(--primary); color: var(--primary); }

/* ===== PEDIDOS ===== */
.filter-tabs {
    display: flex; gap: 0.5rem; margin-bottom: 1.25rem;
    background: white; padding: 0.35rem;
    border-radius: var(--radius); border: 1px solid var(--border);
    width: fit-content;
}

.filter-tab {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    color: var(--text-secondary); text-decoration: none;
    transition: all 0.15s;
}
.filter-tab:hover { background: var(--bg); }
.filter-tab.active { background: var(--primary); color: white; }

.tab-count {
    background: rgba(0,0,0,0.1); padding: 0.1rem 0.45rem;
    border-radius: 50px; font-size: 0.7rem;
}
.filter-tab.active .tab-count { background: rgba(255,255,255,0.25); }

.pedidos-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1rem;
    min-height: calc(100vh - 200px);
}

.orders-panel { display: flex; flex-direction: column; }
.orders-scroll { flex: 1; overflow-y: auto; max-height: calc(100vh - 220px); padding: 0.5rem !important; }

.order-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.85rem 1rem; margin-bottom: 0.35rem;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: var(--text);
    transition: all 0.15s;
}
.order-item:hover { border-color: var(--primary); background: var(--primary-light); }
.order-item.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(234,88,12,0.1); }

.oi-mesa { font-weight: 800; color: var(--primary); font-size: 0.95rem; display: block; }
.oi-num { font-size: 0.75rem; color: var(--muted); font-family: monospace; }
.oi-right { text-align: right; }
.oi-time { display: block; font-size: 0.7rem; color: var(--muted); margin: 0.2rem 0; }
.oi-total { font-size: 0.9rem; color: var(--text); }

/* Detail panel */
.detail-panel { display: flex; flex-direction: column; }

.detail-header {
    padding: 1.5rem;
    display: flex; justify-content: space-between; align-items: flex-start;
    border-bottom: 1px solid var(--border);
}
.detail-header.status-recebido { background: linear-gradient(135deg, #faf5ff, #fff); }
.detail-header.status-preparacao { background: linear-gradient(135deg, #fffbeb, #fff); }
.detail-header.status-pronto { background: linear-gradient(135deg, #eff6ff, #fff); }
.detail-header.status-servido { background: linear-gradient(135deg, #f0fdf4, #fff); }

.detail-mesa { font-size: 0.8rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-header h2 { font-size: 1.25rem; font-weight: 800; margin: 0.25rem 0; }
.detail-header small { color: var(--muted); font-size: 0.8rem; }

/* Pipeline */
.pipeline {
    display: flex; justify-content: center; gap: 0;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.pipe-step {
    display: flex; flex-direction: column; align-items: center;
    flex: 1; position: relative; opacity: 0.35;
}
.pipe-step:not(:last-child)::after {
    content: '';
    position: absolute; top: 18px; left: 60%; right: -40%;
    height: 2px; background: var(--border);
}
.pipe-step.done { opacity: 1; }
.pipe-step.done:not(:last-child)::after { background: var(--success); }
.pipe-step.current .pipe-icon { background: var(--primary); color: white; box-shadow: 0 0 0 4px rgba(234,88,12,0.2); }

.pipe-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--border); color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; margin-bottom: 0.4rem;
    position: relative; z-index: 1;
}
.pipe-step.done .pipe-icon { background: var(--success); color: white; }
.pipe-step span { font-size: 0.65rem; font-weight: 600; text-align: center; }

.section-label {
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--muted); margin-bottom: 0.75rem;
}

.obs-box {
    display: flex; gap: 0.75rem;
    background: var(--warning-bg); border: 1px solid #fde68a;
    border-radius: var(--radius); padding: 1rem;
    margin-bottom: 1.25rem;
}
.obs-box i { color: var(--warning); font-size: 1.25rem; flex-shrink: 0; }
.obs-box strong { display: block; font-size: 0.8rem; margin-bottom: 0.25rem; }
.obs-box p { font-size: 0.9rem; color: var(--text-secondary); }

.items-detail { list-style: none; margin-bottom: 1rem; }
.items-detail li {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.item-qty {
    width: 28px; height: 28px;
    background: var(--primary); color: white;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.8rem; flex-shrink: 0;
}
.item-name { flex: 1; font-weight: 500; }
.item-price { font-weight: 700; }

.detail-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 0; margin-bottom: 1rem;
    border-top: 2px solid var(--border);
    font-size: 1.1rem;
}
.detail-total strong { font-size: 1.35rem; color: var(--primary); }

.action-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.action-btn {
    padding: 0.6rem 1rem;
    border: none; border-radius: 8px;
    font-size: 0.8rem; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.action-btn.current { box-shadow: 0 0 0 3px rgba(0,0,0,0.15); transform: scale(1.05); }
.btn-secondary { background: #f1f5f9; color: var(--text); }
.btn-warning { background: var(--warning-bg); color: var(--warning); }
.btn-info { background: var(--info-bg); color: var(--info); }
.btn-success { background: var(--success-bg); color: var(--success); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.action-btn:hover { filter: brightness(0.95); }

.detail-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Mesas page */
.mesas-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.mesa-manage-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.mesa-manage-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234,88,12,0.15);
}
.mesa-manage-card.livre { border-left: 4px solid var(--success); }
.mesa-manage-card.ocupada { border-left: 4px solid var(--warning); }
.mesa-manage-card.reservada { border-left: 4px solid #7c3aed; }

.mmc-clickable {
    display: block;
    padding: 1.25rem 1.25rem 0.75rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.mmc-clickable:hover {
    background: var(--primary-light);
}
.mmc-clickable:hover .mmc-edit-hint { opacity: 1; }

.mmc-edit-hint {
    display: flex; align-items: center; gap: 0.35rem;
    font-size: 0.75rem; color: var(--primary);
    font-weight: 600; margin-top: 0.5rem;
    opacity: 0.45; transition: opacity 0.15s;
}

.mmc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.mmc-num { font-weight: 800; font-size: 1.1rem; }
.mmc-local { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.mmc-pedidos { font-size: 0.8rem; color: var(--warning); font-weight: 600; margin-bottom: 0.25rem; }
.mmc-actions {
    display: flex; gap: 0.5rem;
    padding: 0 1.25rem 0.75rem;
}

.mmc-form {
    padding: 0 1.25rem;
}
.mmc-form select {
    width: 100%; padding: 0.55rem;
    border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 0.85rem;
    background: var(--bg); cursor: pointer;
}

/* Toast */
.toast-notification {
    position: fixed; top: 1rem; right: 1rem;
    background: var(--success); color: white;
    padding: 0.85rem 1.25rem; border-radius: var(--radius);
    font-weight: 600; font-size: 0.875rem;
    display: flex; align-items: center; gap: 0.5rem;
    box-shadow: var(--shadow); z-index: 999;
    transform: translateX(120%); transition: transform 0.3s;
}
.toast-notification.show { transform: translateX(0); }

.new-order-toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    background: var(--sidebar); color: white;
    padding: 1rem 1.5rem; border-radius: var(--radius);
    font-weight: 700; display: flex; align-items: center; gap: 0.75rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2); z-index: 999;
    transform: translateY(150%); transition: transform 0.4s;
    cursor: pointer;
}
.new-order-toast.show { transform: translateY(0); }
.new-order-toast i { color: #fb923c; font-size: 1.25rem; animation: ring 1s infinite; }
@keyframes ring { 0%,100%{transform:rotate(0)} 25%{transform:rotate(15deg)} 75%{transform:rotate(-15deg)} }

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .pedidos-layout { grid-template-columns: 1fr; }
    .orders-scroll { max-height: 300px; }
}

.mb-4 { margin-bottom: 1.5rem; }

/* CRUD */
.crud-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}

.search-form {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.search-form .input-icon input {
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.875rem; min-width: 200px;
}
.search-form select {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.875rem; background: white;
}

.toolbar-info { display: flex; gap: 0.5rem; }
.stat-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.85rem; background: white;
    border: 1px solid var(--border); border-radius: 50px;
    font-size: 0.8rem; font-weight: 600;
}
.stat-pill.green { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field.span-2 { grid-column: span 2; }

.form-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.form-field input, .form-field select, .form-field textarea {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.9rem; font-family: inherit;
    background: white; transition: border-color 0.15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234,88,12,0.1);
}

.field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

.checkbox-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
}
.check-group { flex-direction: row; gap: 1.5rem; align-items: center; padding-top: 1.5rem; }

.form-actions {
    display: flex; gap: 0.75rem; align-items: center;
    margin-top: 1.5rem; padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.table-responsive { overflow-x: auto; }

.prod-cell { display: flex; align-items: center; gap: 0.75rem; }
.prod-thumb {
    width: 44px; height: 44px; border-radius: 8px;
    object-fit: cover; background: var(--bg);
    border: 1px solid var(--border);
}

.mini-badge {
    display: inline-block; font-size: 0.6rem; font-weight: 700;
    padding: 0.1rem 0.4rem; border-radius: 4px;
    margin-left: 0.35rem; vertical-align: middle;
}
.mini-badge.destaque { background: #fef3c7; color: #d97706; }
.mini-badge.promo { background: #fef2f2; color: var(--danger); }

.row-inactive { opacity: 0.55; }

.action-group { display: flex; gap: 0.35rem; }
.btn-icon-sm.danger:hover { border-color: var(--danger); color: var(--danger); }

.toast-notification.toast-error { background: var(--danger); }
.toast-notification.toast-success { background: var(--success); }

.qr-preview {
    display: flex; gap: 0.75rem; align-items: center;
    background: var(--bg); padding: 1rem;
    border-radius: var(--radius); margin-top: 1rem;
    font-size: 0.875rem;
}
.qr-preview i { font-size: 2rem; color: var(--primary); }

.btn-text-danger {
    background: none; border: none;
    color: var(--danger); font-size: 0.8rem;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 0.3rem;
}
.btn-text-danger:hover { text-decoration: underline; }

/* Utilizadores */
.user-cell { display: flex; align-items: center; gap: 0.75rem; }
.user-cell-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem; flex-shrink: 0;
}

.perfil-info {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
    margin-top: 1rem;
}
.perfil-card {
    display: flex; gap: 0.75rem; align-items: flex-start;
    background: var(--bg); padding: 1rem;
    border-radius: var(--radius); font-size: 0.85rem;
}
.perfil-card i { font-size: 1.25rem; color: var(--primary); flex-shrink: 0; }
.perfil-card strong { display: block; margin-bottom: 0.15rem; }
.perfil-card p { color: var(--muted); font-size: 0.8rem; margin: 0; }

@media (max-width: 768px) {
    .perfil-info { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .login-split { grid-template-columns: 1fr; }
    .login-brand-side { display: none; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .admin-main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .welcome-banner { flex-direction: column; gap: 1rem; text-align: center; }
    .topbar-date { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field.span-2 { grid-column: span 1; }
    .crud-toolbar { flex-direction: column; align-items: stretch; }
    .search-form { width: 100%; }
    .search-form .input-icon input { min-width: 0; flex: 1; width: 100%; }
}

@media (max-width: 479px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-content { padding: 1rem 0.85rem; }
    .topbar { padding: 0.75rem 0.85rem; }
    .page-title { font-size: 1.15rem; }
    .data-table { font-size: 0.8rem; }
    .data-table th,
    .data-table td { padding: 0.55rem 0.45rem; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; min-height: 44px; }
    .new-order-toast {
        left: 0.85rem;
        right: 0.85rem;
        bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

@supports (padding: max(0px)) {
    .admin-body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}
