:root {
    --sidebar: #111827;
    --sidebar-light: #1f2937;
    --accent: #2563eb;
    --soft: #eff6ff;
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 270px; background: var(--sidebar); color: #fff; padding: 20px 16px; position: fixed; top: 0; bottom: 0; left: 0; overflow-y:auto; }
.brand { display: flex; gap: 12px; align-items: center; padding-bottom: 20px; margin-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--accent); display:flex; align-items:center; justify-content:center; font-weight: 800; font-size: 23px; box-shadow: 0 10px 26px rgba(0,0,0,.18); }
.brand span { display:block; font-size: 12px; color: rgba(255,255,255,.72); }
.sidebar .nav-link { color: rgba(255,255,255,.78); border-radius: 12px; padding: 10px 12px; margin-bottom: 5px; display:flex; align-items:center; gap:9px; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-emoji { width: 24px; text-align:center; font-size: 18px; }
.app-main { margin-left: 270px; width: calc(100% - 270px); }
.topbar { background: var(--card); border-bottom: 1px solid rgba(148,163,184,.22); padding: 18px 28px; position: sticky; top: 0; z-index: 10; color: var(--text); }
.content-wrap { padding: 26px 28px; }
.card { background: var(--card); color: var(--text); border: 0; border-radius: 18px; box-shadow: 0 12px 30px rgba(15,23,42,.07); }
.card-header { border-bottom: 1px solid rgba(148,163,184,.18); }
.bg-white { background-color: var(--card) !important; }
.stat-card { padding: 20px; }
.stat-card .label { color: #64748b; font-size: 13px; }
.stat-card .value { font-size: 26px; font-weight: 800; }
.table-card { overflow:hidden; }
.table { color: var(--text); }
.table thead th { background: var(--soft); color:#475569; font-size: 12px; text-transform: uppercase; letter-spacing:.04em; }
.btn-primary { background-color: var(--accent); border-color: var(--accent); }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color:#fff; }
.btn-rounded { border-radius: 11px; }
.form-control, .form-select { border-radius: 11px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 20%, transparent); }
.login-page { min-height: 100vh; display:flex; align-items:center; justify-content:center; background: linear-gradient(135deg, var(--sidebar), var(--accent)); padding: 20px; }
.login-card { width: 100%; max-width: 420px; background:#fff; border-radius: 22px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.22); }
.text-money { font-variant-numeric: tabular-nums; }
.theme-escuro .text-muted { color: #94a3b8 !important; }
.theme-escuro .table thead th { color:#cbd5e1; }
.theme-escuro .table td, .theme-escuro .table th { border-color: rgba(148,163,184,.18); }
.theme-escuro .form-control, .theme-escuro .form-select { background:#0f172a; color:#e5e7eb; border-color:#334155; }
.theme-escuro .modal-content { background:#111827; color:#e5e7eb; }
.style-delicado .card, .style-delicado .login-card { border-radius: 26px; }
.style-delicado .sidebar .nav-link, .style-delicado .btn-rounded, .style-delicado .form-control, .style-delicado .form-select { border-radius: 18px; }
.style-executivo .card { border-radius: 8px; box-shadow: 0 8px 20px rgba(15,23,42,.05); }
.style-executivo .sidebar .nav-link, .style-executivo .btn-rounded, .style-executivo .form-control, .style-executivo .form-select { border-radius: 6px; }
.style-classico .card { border-radius: 12px; }
.menu-choice { border:1px solid rgba(148,163,184,.25); border-radius:16px; padding:12px; display:flex; gap:10px; align-items:center; height:100%; background: var(--card); }
.menu-choice input[type="checkbox"] { width:18px; height:18px; }
.emoji-input { max-width: 90px; text-align:center; font-size: 22px; }
.theme-swatch { width: 22px; height: 22px; display:inline-block; border-radius:999px; border: 2px solid rgba(0,0,0,.08); vertical-align:middle; margin-right:6px; }
@media print {
    .sidebar,.topbar,.no-print,.btn,.form-control,.form-select { display:none !important; }
    .app-main { margin-left:0; width:100%; }
    .content-wrap { padding:0; }
    .card { box-shadow:none; border:1px solid #ddd; }
}
/* ==============================
   Responsividade mobile
   ============================== */
.min-w-0 { min-width: 0; }
.mobile-menu-btn,
.sidebar-close { display: none; }
.sidebar-backdrop { display: none; }
.table-responsive { width: 100%; }
.table-card .table { min-width: 720px; }
.table-card .table.table-sm { min-width: 620px; }
.table td, .table th { vertical-align: middle; }
.table td form { display: inline-block; margin: 2px 0; }
.card-header .row { width: 100%; }
.btn { white-space: nowrap; }

@media (max-width: 1100px) {
    .sidebar { width: 238px; }
    .app-main { margin-left: 238px; width: calc(100% - 238px); }
    .content-wrap { padding: 22px; }
    .topbar { padding: 16px 22px; }
}

@media (max-width: 900px) {
    body.sidebar-open { overflow: hidden; }
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        width: min(86vw, 330px);
        max-width: 330px;
        min-height: 100vh;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1045;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 18px 0 45px rgba(15, 23, 42, .28);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .46);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .22s ease, visibility .22s ease;
        z-index: 1040;
    }
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 12px;
        top: 12px;
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, .12);
        color: #fff;
        font-size: 25px;
        line-height: 1;
    }
    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(148, 163, 184, .28);
        border-radius: 12px;
        background: var(--card);
        color: var(--text);
        flex: 0 0 auto;
    }
    .mobile-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
    }
    .app-main { margin-left: 0; width: 100%; }
    .topbar {
        padding: 12px 14px;
        min-height: 66px;
    }
    .topbar h1 { font-size: 18px; }
    .content-wrap { padding: 16px 14px 24px; }
    .stat-card { padding: 16px; }
    .stat-card .value { font-size: 22px; }
    .card { border-radius: 14px; }
    .card-header { padding: 12px 14px; }
    .card-body { padding: 14px; }
    .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 575.98px) {
    .topbar { align-items: flex-start !important; }
    .topbar-subtitle { display: none; }
    .topbar-user { font-size: 12px; line-height: 1.25; }
    .content-wrap { padding-left: 10px; padding-right: 10px; }
    .row.g-4 { --bs-gutter-y: 1rem; }
    .row.g-3 { --bs-gutter-y: .75rem; }
    .card-header.d-flex,
    .card-footer.d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }
    .card-header form,
    .card-footer form { width: 100%; }
    .card-header .btn,
    .card-footer .btn,
    .card-body > form > .btn,
    .card-body > form > a.btn { width: 100%; margin-top: 6px; }
    .card-header .row > .col,
    .card-header .row > .col-auto,
    .card-header .row > [class*="col-"] { flex: 0 0 100%; width: 100%; }
    .card-header .row .btn,
    form.row .btn { width: 100%; }
    .btn-group-mobile,
    .table td.text-nowrap { white-space: normal !important; }
    .table td .btn,
    .table td form .btn { margin: 2px 2px 2px 0; }

    /* Tabelas viram cartões no celular quando o JS adiciona data-label */
    .mobile-card-table {
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0 10px;
    }
    .mobile-card-table thead { display: none; }
    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td { display: block; width: 100%; }
    .mobile-card-table tr {
        background: var(--card);
        border: 1px solid rgba(148, 163, 184, .22);
        border-radius: 14px;
        padding: 8px 10px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    }
    .mobile-card-table td {
        border: 0 !important;
        padding: 7px 0 !important;
        white-space: normal !important;
    }
    .mobile-card-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        color: #64748b;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
    }
    .theme-escuro .mobile-card-table tr {
        border-color: rgba(148, 163, 184, .18);
        box-shadow: none;
    }
    .theme-escuro .mobile-card-table td[data-label]::before { color: #94a3b8; }
    .mobile-card-table td:last-child .btn,
    .mobile-card-table td:last-child form,
    .mobile-card-table td:last-child form .btn {
        width: 100%;
        margin-top: 4px;
    }
    .mobile-card-table .progress { max-width: 100%; }
}

