:root {
    --bg: #090d12;
    --bg-soft: #0d1119;
    --surface: #10141d;
    --surface-2: #171d28;
    --surface-3: #1d2632;
    --border: rgba(148, 163, 184, .14);
    --border-strong: rgba(148, 163, 184, .22);
    --text: #e8edf5;
    --text-soft: #b0bac9;
    --text-muted: #939faf;

    --primary: #32c7dc;
    --primary-2: #1298b0;
    --success: #35cfa5;
    --success-soft: rgba(34, 197, 94, .12);
    --danger: #f16d86;
    --danger-soft: rgba(239, 68, 68, .12);
    --warning: #edbf51;
    --warning-soft: rgba(245, 158, 11, .12);
    --info-soft: rgba(50, 199, 220, .12);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-sm: 0 4px 18px rgba(0, 0, 0, .16);
    --shadow-md: 0 14px 40px rgba(0, 0, 0, .24);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .38);

    --sidebar-width: 264px;
    --topbar-height: 68px;
    --transition: 180ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 80% -10%, rgba(50, 199, 220, .11), transparent 32%),
        radial-gradient(circle at 10% 100%, rgba(34, 197, 94, .055), transparent 28%),
        var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
select,
input[type="file"] {
    -webkit-tap-highlight-color: transparent;
}

button,
a {
    transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), opacity var(--transition);
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(12, 16, 23, .94);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 100;
    transition: width var(--transition), min-width var(--transition), transform var(--transition);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-sidebar {
    width: 100%;
    max-width: 165px;
    max-height: 48px;
    object-fit: contain;
    object-position: left center;
}

.sidebar-conteudo {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px 10px;
}

.sidebar-menu::-webkit-scrollbar,
.dashboard-scroll::-webkit-scrollbar,
.scroll-table::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.sidebar-menu::-webkit-scrollbar-thumb,
.dashboard-scroll::-webkit-scrollbar-thumb,
.scroll-table::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .18);
    border-radius: 99px;
}

.menu-label {
    padding: 15px 10px 7px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.sidebar-menu > a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin: 3px 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-weight: 600;
}

.sidebar-menu > a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .045);
    border-color: var(--border);
    transform: translateX(2px);
}

.sidebar-menu > a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(50, 199, 220, .19), rgba(18, 152, 176, .08));
    border-color: rgba(50, 199, 220, .24);
    box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-actions {
    display: grid;
    gap: 8px;
}

.sidebar-actions button {
    width: 100%;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    box-shadow: none;
}

.sidebar-actions button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.sidebar-filtros {
    display: grid;
    gap: 7px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .025);
}

.sidebar-filtros label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    margin-top: 3px;
}

.sidebar-filtros select {
    width: 100%;
}

.sidebar-footer {
    padding: 12px 14px 16px;
    border-top: 1px solid var(--border);
}

.logout-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: #fca5a5 !important;
    font-weight: 700;
}

.logout-link:hover {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, .22);
}

/* =========================
   MAIN / TOPBAR
========================= */
.main-content {
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.topbar {
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 21, .72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 30;
}

.btn-toggle-sidebar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 16px;
}

.btn-toggle-sidebar:hover {
    color: #fff;
    border-color: var(--border-strong);
    background: var(--surface-2);
    transform: translateY(-1px);
}

.topbar-titles h2 {
    font-size: 19px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.025em;
}

.topbar-titles p {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================
   DASHBOARD GRID
========================= */
.dashboard-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
}

.dashboard {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    padding-bottom: 24px;
}

.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* =========================
   KPI CARDS
========================= */
.kpi-card {
    position: relative;
    min-width: 0;
    min-height: 152px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.015)),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.kpi-card::after {
    content: "";
    position: absolute;
    width: 100px;
    height: 100px;
    right: -36px;
    top: -38px;
    border-radius: 50%;
    background: rgba(50, 199, 220, .07);
    pointer-events: none;
}

.kpi-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-card .icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin-bottom: 15px;
    border-radius: 12px;
    background: rgba(50, 199, 220, .10);
    font-size: 17px;
}

.kpi-card .label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.kpi-card .value {
    margin-top: 5px;
    color: var(--text);
    font-size: clamp(21px, 2vw, 28px);
    line-height: 1.15;
    font-weight: 850;
    letter-spacing: -.04em;
}

.kpi-card .sub {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 11px;
}

.kpi-faturamento { border-top: 2px solid rgba(34, 197, 94, .6); }
.kpi-custo { border-top: 2px solid rgba(245, 158, 11, .6); }
.kpi-despesa { border-top: 2px solid rgba(239, 68, 68, .6); }
#cardSaldo { border-top: 2px solid rgba(50, 199, 220, .7); }

/* =========================
   PANELS / CHARTS
========================= */
.chart-box {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(16, 20, 29, .88);
    box-shadow: var(--shadow-sm);
}

.chart-box:hover {
    border-color: rgba(148, 163, 184, .19);
}

.chart-box h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.chart-title {
    min-width: 0;
}

.chart-icon-blue {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.seletor-grafico {
    display: flex;
    align-items: center;
    gap: 8px;
}

.seletor-grafico label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.chart-container {
    position: relative;
    width: 100%;
}

.chart-container.tall {
    min-height: 330px;
    height: 330px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.input-filter {
    width: 100%;
    margin: 13px 0 10px;
}

/* =========================
   FORMS
========================= */
input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
    background: rgba(8, 13, 21, .72);
    color: var(--text);
    padding: 10px 12px;
}

select {
    cursor: pointer;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #8e9aab;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(50, 199, 220, .7);
    box-shadow: 0 0 0 3px rgba(50, 199, 220, .10);
}

label {
    display: block;
    margin: 13px 0 6px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 750;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.input-nova-cat {
    display: none;
    margin-top: 7px;
}

.fw-600 {
    font-weight: 700 !important;
}

.icon-blue { color: var(--primary) !important; }
.icon-green { color: var(--success) !important; }
.icon-yellow { color: var(--warning) !important; }
.icon-red { color: var(--danger) !important; }
.text-green { color: var(--success) !important; }

/* =========================
   BUTTONS
========================= */
.btn,
.btn-primary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-download,
.btn-warning-dark {
    border: 1px solid transparent;
    border-radius: 10px;
    color: #fff;
    font-weight: 750;
}

.btn {
    padding: 10px 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: rgba(50, 199, 220, .35);
}

.btn-success {
    background: linear-gradient(135deg, #35cfa5, #16a34a);
}

.btn-warning {
    background: linear-gradient(135deg, #edbf51, #d97706);
}

.btn-warning-dark {
    background: linear-gradient(135deg, #b7791f, #8a5a14);
}

.btn-danger {
    background: linear-gradient(135deg, #f16d86, #dc2626);
}

.btn-download {
    background: linear-gradient(135deg, #198754, #146c43);
}

.btn-primary:hover,
.btn-success:hover,
.btn-warning:hover,
.btn-warning-dark:hover,
.btn-danger:hover,
.btn-download:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 7px 20px rgba(0, 0, 0, .18);
}

.btn-modal,
.btn-modal-user {
    width: 100%;
    margin-top: 18px;
    padding: 12px 15px;
}

/* =========================
   TABLES
========================= */
.scroll-table {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 460px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.tabela-recebimentos,
.tabela-nao-pagos {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
    font-size: 12px;
}

.tabela-recebimentos th,
.tabela-nao-pagos th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    background: #141a24;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .045em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.tabela-recebimentos th {
    cursor: pointer;
}

.tabela-recebimentos th:hover {
    color: var(--text);
    background: #1a2330;
}

.tabela-recebimentos td,
.tabela-nao-pagos td {
    padding: 11px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, .075);
    vertical-align: middle;
    white-space: nowrap;
}

.tabela-recebimentos tbody tr,
.tabela-nao-pagos tbody tr {
    background: transparent;
}

.tabela-recebimentos tbody tr:hover,
.tabela-nao-pagos tbody tr:hover {
    background: rgba(50, 199, 220, .045);
}

.tabela-recebimentos tbody tr:last-child td,
.tabela-nao-pagos tbody tr:last-child td {
    border-bottom: 0;
}

.tabela-recebimentos .descricao-cell {
    display: block;
    min-width: 150px;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: normal;
}

.tabela-recebimentos button,
.tabela-nao-pagos button {
    border-radius: 8px;
}

.tabela-recebimentos .status-ok,
.tabela-recebimentos .status-pago {
    color: #86efac;
    background: var(--success-soft);
}

.tabela-recebimentos .status-nao,
.tabela-recebimentos .status-pendente {
    color: #fca5a5;
    background: var(--danger-soft);
}

/* =========================
   FOOTER / UPLOAD
========================= */
.footer {
    grid-column: span 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 2px 0;
    color: var(--text-muted);
    font-size: 11px;
}

.footer-text {
    display: flex;
    align-items: center;
    gap: 7px;
}

.upload-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.upload-box {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
}

.input-file {
    width: min(240px, 100%);
    padding: 5px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}

.input-file:focus {
    box-shadow: none;
}

.btn-upload {
    padding: 8px 12px;
}

.upload-status {
    color: var(--text-muted);
}

/* =========================
   MODALS
========================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal[style*="display: block"],
.modal[style*="display:block"] {
    display: flex !important;
}

.modal-content {
    position: relative;
    width: min(620px, 100%);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    padding: 25px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    background: linear-gradient(145deg, #171e2a, #10151f);
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    padding-right: 30px;
    color: var(--text);
    font-size: 19px;
    letter-spacing: -.02em;
}

.close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--text-muted);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
}

.modal-msg {
    min-height: 18px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
}

.modal-content::-webkit-scrollbar {
    width: 7px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .18);
    border-radius: 99px;
}

/* =========================
   SIDEBAR COLLAPSED DESKTOP
========================= */
.layout.menu-oculto .sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: 0;
}

.layout.menu-oculto .sidebar > * {
    opacity: 0;
    pointer-events: none;
}

/* =========================
   MOBILE
========================= */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, .62);
    backdrop-filter: blur(2px);
}

@media (max-width: 1200px) {
    .col-3 {
        grid-column: span 6;
    }

    .col-8,
    .col-4 {
        grid-column: span 12;
    }

    .dashboard-scroll {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-102%);
        box-shadow: var(--shadow-lg);
    }

    .layout.menu-aberto .sidebar {
        transform: translateX(0);
    }

    .layout.menu-aberto .overlay {
        display: block;
    }

    .main-content {
        width: 100%;
    }

    .topbar {
        padding: 10px 14px;
    }

    .topbar-titles h2 {
        font-size: 17px;
    }

    .dashboard-scroll {
        padding: 14px;
    }

    .dashboard {
        gap: 12px;
    }

    .col-3,
    .col-4,
    .col-6,
    .col-8,
    .col-12 {
        grid-column: span 12;
    }

    .kpi-card {
        min-height: 132px;
        padding: 17px;
    }

    .chart-box {
        padding: 15px;
        border-radius: 16px;
    }

    .chart-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .seletor-grafico {
        width: 100%;
    }

    .seletor-grafico select {
        flex: 1;
    }

    .chart-container.tall {
        min-height: 290px;
        height: 290px;
    }

    .input-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .footer {
        align-items: stretch;
        flex-direction: column;
    }

    .upload-area {
        justify-content: flex-start;
    }

    .upload-box {
        align-items: stretch;
        flex-direction: column;
    }

    .input-file {
        width: 100%;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        padding: 20px;
        border-radius: 18px;
    }
}

@media (max-width: 480px) {
    .topbar-titles p {
        display: none;
    }

    .dashboard-scroll {
        padding: 10px;
    }

    .kpi-card .value {
        font-size: 23px;
    }

    .chart-container.tall {
        min-height: 260px;
        height: 260px;
    }

    .tabela-recebimentos,
    .tabela-nao-pagos {
        font-size: 11px;
    }
}

/* Acessibilidade e feedback */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}

/* =========================
   DASHBOARD PRO — V4
========================= */
.topbar {
    justify-content: space-between;
}

.topbar-left,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-actions {
    justify-content: flex-end;
}

.topbar-period {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,.025);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.quick-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.quick-btn-income {
    background: rgba(34,197,94,.12);
    border-color: rgba(34,197,94,.25);
    color: #86efac;
}

.quick-btn-expense {
    background: rgba(239,68,68,.10);
    border-color: rgba(239,68,68,.22);
    color: #fca5a5;
}

.dashboard-intro {
    min-height: 116px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(50,199,220,.20);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 88% 10%, rgba(50,199,220,.16), transparent 30%),
        linear-gradient(135deg, rgba(50,199,220,.08), rgba(16,20,29,.94) 45%, rgba(16,20,29,.90));
    box-shadow: var(--shadow-sm);
}

.dashboard-intro::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -90px;
    bottom: -150px;
    border-radius: 50%;
    border: 1px solid rgba(50,199,220,.13);
}

.eyebrow,
.panel-eyebrow {
    color: #6adbea;
    font-size: 9px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(34,197,94,.10), 0 0 16px rgba(34,197,94,.45);
}

.dashboard-intro h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(23px, 2.4vw, 32px);
    line-height: 1.1;
    letter-spacing: -.04em;
}

.dashboard-intro p {
    max-width: 760px;
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 12px;
}

.intro-meta {
    min-width: 150px;
    display: grid;
    justify-items: end;
    position: relative;
    z-index: 1;
}

.intro-meta .meta-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.intro-meta strong {
    margin: 1px 0;
    color: #fff;
    font-size: 28px;
    letter-spacing: -.04em;
}

.intro-meta .meta-caption {
    color: var(--text-muted);
    font-size: 10px;
}

.kpi-card {
    min-height: 166px;
    padding: 19px;
}

.kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.kpi-card .kpi-top .icon {
    margin-bottom: 0;
}

.trend-badge {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    font-weight: 850;
    white-space: nowrap;
}

.trend-badge.positive {
    color: #86efac;
    background: rgba(34,197,94,.10);
    border-color: rgba(34,197,94,.18);
}

.trend-badge.negative {
    color: #fca5a5;
    background: rgba(239,68,68,.10);
    border-color: rgba(239,68,68,.18);
}

.trend-badge.neutral {
    color: var(--text-muted);
    background: rgba(148,163,184,.07);
    border-color: rgba(148,163,184,.10);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(16,20,29,.78);
    box-shadow: var(--shadow-sm);
}

.mini-metric {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-right: 1px solid var(--border);
}

.mini-metric:last-child {
    border-right: 0;
}

.mini-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--warning);
    background: var(--warning-soft);
}

.mini-icon-green { color: var(--success); background: var(--success-soft); }
.mini-icon-red { color: var(--danger); background: var(--danger-soft); }
.mini-icon-blue { color: var(--primary); background: var(--info-soft); }

.mini-metric span {
    display: block;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-metric strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    letter-spacing: -.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-box-featured {
    background:
        radial-gradient(circle at 75% 0%, rgba(50,199,220,.07), transparent 28%),
        rgba(16,20,29,.90);
}

.panel-eyebrow {
    margin-bottom: 7px;
}

.chart-header.compact {
    margin-bottom: 4px;
}

.chart-container.medium {
    height: 285px;
    min-height: 285px;
}

.comparison-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(145deg, rgba(255,255,255,.03), rgba(255,255,255,.01)),
        rgba(16,20,29,.91);
    box-shadow: var(--shadow-sm);
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 17px;
}

.comparison-header h3 {
    font-size: 15px;
    font-weight: 850;
}

.comparison-header p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}

.comparison-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: var(--info-soft);
}

.comparison-list {
    display: grid;
    gap: 8px;
}

.comparison-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(148,163,184,.09);
    border-radius: 12px;
    background: rgba(255,255,255,.018);
}

.comparison-row > div span {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.comparison-row > div strong {
    display: block;
    margin-top: 2px;
    font-size: 14px;
}

.comparison-note {
    display: flex;
    gap: 7px;
    align-items: flex-start;
    margin-top: 14px;
    padding: 10px 11px;
    border-radius: 10px;
    color: var(--text-muted);
    background: rgba(50,199,220,.055);
    font-size: 9px;
    line-height: 1.45;
}

.comparison-note i {
    margin-top: 2px;
    color: var(--primary);
}

.ranking-chart {
    position: relative;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    color: var(--text-muted);
    font-size: 11px;
}

.pending-panel {
    padding-bottom: 16px;
}

.pending-header,
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 13px;
}

.pending-search {
    width: min(320px,100%);
    position: relative;
}

.pending-search > i {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 11px;
}

.pending-search .input-filter {
    margin: 0;
    padding-left: 32px;
}

.pending-table {
    max-height: 260px;
}

.history-count {
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(255,255,255,.02);
    font-size: 9px;
    font-weight: 800;
}

.history-panel .scroll-table {
    max-height: 520px;
}

/* Estado do saldo mais evidente */
#cardSaldo.kpi-saldo-pos {
    border-top-color: rgba(34,197,94,.72);
}

#cardSaldo.kpi-saldo-neg {
    border-top-color: rgba(239,68,68,.72);
}

.val-info { color: #6adbea !important; }
.val-despesa { color: #fca5a5 !important; }
.val-receita { color: #86efac !important; }

@media (max-width: 1200px) {
    .metric-strip {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .mini-metric:nth-child(2) {
        border-right: 0;
    }

    .mini-metric:nth-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 900px) {
    .topbar-actions .topbar-period {
        display: none;
    }
}

@media (max-width: 768px) {
    .topbar-actions .quick-btn {
        width: 38px;
        padding: 0;
        justify-content: center;
        font-size: 0;
    }

    .topbar-actions .quick-btn i {
        font-size: 12px;
    }

    .dashboard-intro {
        align-items: flex-start;
        flex-direction: column;
        padding: 19px;
    }

    .intro-meta {
        width: 100%;
        justify-items: start;
    }

    .metric-strip {
        grid-template-columns: 1fr;
    }

    .mini-metric,
    .mini-metric:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .mini-metric:last-child {
        border-bottom: 0;
    }

    .chart-container.medium {
        min-height: 260px;
        height: 260px;
    }

    .pending-header,
    .history-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .pending-search {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar-actions {
        gap: 6px;
    }

    .quick-btn {
        min-height: 36px;
    }

    .dashboard-intro h1 {
        font-size: 24px;
    }

    .comparison-card {
        padding: 16px;
    }
}

/* =========================
   CADASTROS MESTRES NOS LANÇAMENTOS
========================= */
.master-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: center;
}

.btn-master-add {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(50, 199, 220, .35);
    border-radius: 10px;
    background: rgba(50, 199, 220, .12);
    color: var(--primary);
}

.btn-master-add:hover {
    transform: translateY(-1px);
    background: rgba(50, 199, 220, .20);
    color: #fff;
}

.field-help {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 10px;
}

.modal-intro {
    margin: -7px 0 14px;
    color: var(--text-muted);
    font-size: 12px;
}

.modal-master-content {
    width: min(560px, 100%);
}

.sidebar-logo img,
.brand img,
.logo img {
    width: 190px;
    max-width: 100%;
    height: 72px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Identidade visual FixLAN */
.sidebar-header {
    height: 120px !important;
    padding: 6px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar-header .logo-sidebar {
    width: 280px !important;
    height: 100px !important;
    max-width: 95% !important;
    max-height: 100px !important;
    object-fit: contain !important;
    transform: none !important;
    margin: 0 auto !important;
}
/* ========================================
   LOGO CENTRAL NA BARRA SUPERIOR
   ======================================== */

.topbar {
    position: relative !important;
}

/* Logo centralizada independentemente dos itens laterais */
.topbar-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
}

.topbar-logo img {
    width: 138px;
    height: 76px;
    object-fit: contain;
    display: block;
}

/* Remove a antiga área da logo da lateral */
.sidebar-header {
    display: none !important;
}

/* Páginas auxiliares ainda exibem a marca no menu lateral. */
body.brand-sidebar .sidebar-header {
    display: flex !important;
    height: 86px !important;
    padding: 10px !important;
    justify-content: center !important;
}

body.brand-sidebar .sidebar-header .logo-sidebar {
    width: 64px !important;
    height: 64px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
}

/* Tablets */
@media (max-width: 1200px) {
    .topbar-logo img {
        width: 112px;
        height: 62px;
    }
}

/* Celular */
@media (max-width: 850px) {
    .topbar-logo {
        display: none;
    }
}

/* FixLAN — acabamento do painel */
.dashboard { gap: 12px; }
.dashboard-scroll { min-height: 0; padding: 20px; }
.topbar { flex-shrink: 0; }
.kpi-card, .chart-box, .comparison-card {
    background: linear-gradient(140deg, rgba(255,255,255,.015), transparent 65%), #10141d;
    box-shadow: 0 3px 14px rgba(0,0,0,.12);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.kpi-card { min-height: 144px; padding: 17px; }
.kpi-card::after { display: none; }
.kpi-card:hover { transform: none; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.kpi-card .icon { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }
.kpi-card .label { color: var(--text-soft); font-weight: 650; letter-spacing: .025em; }
.kpi-card .value { font-variant-numeric: tabular-nums; font-weight: 750; letter-spacing: -.025em; }
.chart-box, .comparison-card { padding: 18px; }
.chart-box h3, .comparison-header h3 { font-weight: 650; }
.dashboard-intro {
    min-height: 100px;
    padding: 20px;
    border-color: var(--border);
    background: radial-gradient(ellipse at top left, rgba(50,199,220,.065), transparent 65%), #10141d;
}
.dashboard-intro::after { display: none; }
.dashboard-intro h1 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 700; }
.metric-strip { background: #10141d; }
.comparison-row { background: rgba(255,255,255,.012); border-radius: 9px; }
.sidebar-menu > a.active { color: #85e6f2; }
.btn-primary { color: #071b22; }
.trend-badge { border-radius: 7px; }
:where(button, a, input, select, textarea):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
@supports (height: 100dvh) {
    .layout, .main-content, .sidebar { height: 100dvh; }
    .modal-content { max-height: calc(100dvh - 44px); }
}
@media (max-width: 768px) {
    .dashboard-scroll { padding: 12px; }
    .chart-box, .comparison-card, .kpi-card { padding: 15px; }
    .dashboard-intro { padding: 17px; }
    /* O estado recolhido do desktop não impede a abertura no celular. */
    .layout.menu-oculto .sidebar {
        width: min(var(--sidebar-width), 86vw);
        min-width: min(var(--sidebar-width), 86vw);
        border-right: 1px solid var(--border);
    }
    .layout.menu-oculto.menu-aberto .sidebar > * { opacity: 1; pointer-events: auto; }
    .sidebar { width: min(var(--sidebar-width), 86vw); min-width: min(var(--sidebar-width), 86vw); }
}

/* Barra superior: a marca ocupa seu próprio espaço, sem sobreposição. */
.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 12px;
    padding: 10px 20px;
}
.topbar-left, .topbar-actions { min-width: 0; }
.topbar-titles h2 { font-size: 17px; }
.topbar-titles p { font-size: 11px; }
.topbar-logo {
    position: static;
    transform: none;
    display: flex;
    min-width: 0;
}
.topbar-logo img { width: 180px; height: 48px; max-width: 100%; }
.topbar-period { white-space: nowrap; }
.btn-toggle-sidebar, .quick-btn { flex-shrink: 0; }
.seletor-grafico { min-width: 0; }
.seletor-grafico label { margin: 0; }
.seletor-grafico select { width: auto; max-width: 100%; min-width: 0; }
.chart-header { flex-wrap: wrap; }
.sidebar-actions .btn-warning {
    color: #9aefd6; background: rgba(53,207,165,.10); border-color: rgba(53,207,165,.22);
}
.sidebar-actions .btn-danger {
    color: #ffacbb; background: rgba(241,109,134,.10); border-color: rgba(241,109,134,.22);
}
.sidebar-actions .btn-download {
    color: var(--text-soft); background: rgba(255,255,255,.03); border-color: var(--border);
}
.sidebar-actions .btn-primary {
    color: #85e6f2; background: rgba(50,199,220,.10); border-color: rgba(50,199,220,.22);
}
@media (min-width: 1101px) and (max-width: 1450px) {
    .topbar-period { display: none; }
}
@media (max-width: 1100px) {
    .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
    .topbar-logo { grid-column: 1 / -1; grid-row: 1; }
    .topbar-logo img { width: 180px; height: 42px; }
    .topbar-left { grid-column: 1; grid-row: 2; }
    .topbar-actions { grid-column: 2; grid-row: 2; }
    .topbar-actions .topbar-period { display: none; }
}
@media (max-width: 768px) {
    .topbar { padding: 8px 12px; }
    .topbar-titles h2 { font-size: 15px; }
    .topbar-left { gap: 8px; }
    .btn-toggle-sidebar, .topbar-actions .quick-btn { width: 44px; min-height: 44px; }
    .topbar-actions .quick-btn i { font-size: 15px; }
    .seletor-grafico select { flex: 1; width: 100%; }
    .mini-metric > div:last-child { min-width: 0; }
}

/* Lançamento simplificado */
.lancamento-detalhes { margin-top: 18px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.02); }
.lancamento-detalhes summary { cursor: pointer; color: var(--text-soft); font-weight: 600; }
.lancamento-detalhes summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.lancamento-ajuda { margin-top: 8px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.input-row.input-row-unica { grid-template-columns: minmax(0,1fr); }
.modal-content button.close { border: 0; background: transparent; }
.modal-msg { overflow-wrap: anywhere; }
.modal-content button:disabled { cursor: default; opacity: .65; transform: none; }
.modal-content form[aria-busy="true"] { opacity: .8; }
