/* =========================================================================
   Control ERP — Web Design System
   Padrão visual de alto nível inspirado no Family Control, protótipo de referência,
   Tiny ERP e SAP Fiori.
   ========================================================================= */

:root {
    /* Paleta Principal - Superfícies & Fundo */
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-alt: #F1F5F9;
    --surface-muted: #F1F5F9;
    --border: #E2E8F0;
    --border-subtle: #F1F5F9;
    --border-focus: rgba(37, 99, 235, 0.45);

    /* Tipografia & Textos */
    --text: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --muted: #94A3B8;

    /* Acentos Principais (Royal Blue) */
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-light: #EFF6FF;
    --accent-glow: rgba(37, 99, 235, 0.25);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --primary-subtle: var(--accent-light);

    /* Cores Semânticas Auxiliares */
    --violet: #8B5CF6;
    --violet-light: #F5F3FF;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --danger-light: #FEF2F2;
    --amber: #F59E0B;
    --amber-light: #FFFBEB;
    --green: #10B981;
    --green-light: #ECFDF5;
    --success: var(--green);
    --success-light: var(--green-light);

    /* Sidebar Dark Sleek */
    --sidebar-bg: #0D1424;
    --sidebar-bg-alt: #090D1A;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #94A3B8;
    --sidebar-text-hover: #FFFFFF;
    --sidebar-active-bg: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    --sidebar-active-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.45);

    /* Status Badges */
    --status-aberto-bg: var(--amber-light);
    --status-aberto-fg: #B45309;
    --status-pago-bg: var(--green-light);
    --status-pago-fg: #047857;
    --status-vencido-bg: var(--danger-light);
    --status-vencido-fg: #B91C1C;
    --status-info-bg: var(--accent-light);
    --status-info-fg: #1D4ED8;
    --status-purple-bg: var(--violet-light);
    --status-purple-fg: #6D28D9;
    --status-neutral-bg: #F1F5F9;
    --status-neutral-fg: #475569;

    /* Bordas e Hovers */
    --border-light: #F1F5F9;
    --border-hover: #CBD5E1;

    /* Topbar */
    --topbar-bg: rgba(255, 255, 255, 0.90);
    --topbar-border: var(--border);

    /* Formas & Raios */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius: 14px;
    --radius-lg: 16px;
    --radius-pill: 9999px;

    /* Elevações e Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 6px 16px -4px rgba(15, 23, 42, 0.06);
    --shadow-card-hover: 0 4px 8px -2px rgba(15, 23, 42, 0.06), 0 14px 28px -6px rgba(15, 23, 42, 0.12);
    --shadow-modal: 0 24px 64px -12px rgba(15, 23, 42, 0.35);
    --shadow-dropdown: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

    /* Tipografia */
    --font-main: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    /* Esquema de cores claro padrão */
    color-scheme: light;
}

/* =========================================================================
   Control ERP — Modo Escuro (Dark Theme)
   Paleta premium slate/navy com alto contraste e elegância visual
   ========================================================================= */

[data-theme="dark"] {
    /* Paleta Principal - Superfícies & Fundo */
    --bg: #0B1120;
    --surface: #111B30;
    --surface-alt: #17233D;
    --surface-muted: #0D1629;
    --border: #202E4E;
    --border-subtle: #18243E;
    --border-light: #1A2845;
    --border-hover: #33446D;
    --border-focus: rgba(59, 130, 246, 0.55);

    /* Tipografia & Textos de Alto Contraste */
    --text: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #94A3B8;
    --muted: #64748B;

    /* Acentos Principais (Vibrant Cobalt/Royal Blue) */
    --accent: #3B82F6;
    --accent-hover: #60A5FA;
    --accent-light: rgba(59, 130, 246, 0.16);
    --accent-glow: rgba(59, 130, 246, 0.35);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --primary-subtle: var(--accent-light);

    /* Cores Semânticas Auxiliares */
    --violet: #A78BFA;
    --violet-light: rgba(167, 139, 250, 0.16);
    --danger: #F87171;
    --danger-hover: #EF4444;
    --danger-light: rgba(248, 113, 113, 0.16);
    --amber: #FBBF24;
    --amber-light: rgba(251, 191, 36, 0.16);
    --green: #34D399;
    --green-light: rgba(52, 211, 153, 0.16);
    --success: var(--green);
    --success-light: var(--green-light);

    /* Sidebar Dark Sleek (mais profunda que o conteúdo para criar camadas) */
    --sidebar-bg: #070B14;
    --sidebar-bg-alt: #05080E;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #94A3B8;
    --sidebar-text-hover: #FFFFFF;
    --sidebar-active-bg: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    --sidebar-active-shadow: 0 4px 16px -2px rgba(37, 99, 235, 0.5);

    /* Status Badges no modo escuro (vibrantes com fundo translúcido) */
    --status-aberto-bg: rgba(251, 191, 36, 0.18);
    --status-aberto-fg: #FCD34D;
    --status-pago-bg: rgba(52, 211, 153, 0.18);
    --status-pago-fg: #6EE7B7;
    --status-vencido-bg: rgba(248, 113, 113, 0.18);
    --status-vencido-fg: #FCA5A5;
    --status-info-bg: rgba(59, 130, 246, 0.18);
    --status-info-fg: #93C5FD;
    --status-purple-bg: rgba(167, 139, 250, 0.18);
    --status-purple-fg: #C4B5FD;
    --status-neutral-bg: rgba(255, 255, 255, 0.08);
    --status-neutral-fg: #CBD5E1;

    /* Topbar Escura com Efeito Glassmorphism */
    --topbar-bg: rgba(17, 27, 48, 0.88);
    --topbar-border: var(--border);

    /* Elevações e Sombras para Fundo Escuro */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 8px 24px -4px rgba(0, 0, 0, 0.45);
    --shadow-card-hover: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 18px 36px -6px rgba(0, 0, 0, 0.65);
    --shadow-modal: 0 24px 64px -12px rgba(0, 0, 0, 0.85);
    --shadow-dropdown: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.55);

    /* Força controles nativos (calendários, scrollbars, etc.) a renderizarem escuros */
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-hover);
}

button {
    font-family: inherit;
}

h1:focus {
    outline: none;
}

/* =========================================================================
   Layout Shell & Sidebar
   ========================================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(185deg, var(--sidebar-bg) 0%, var(--sidebar-bg-alt) 100%);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.sidebar-brand {
    padding: 22px 20px 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

.brand-logo-badge {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 102, 255, 0.4);
    background: transparent;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.brand-logo-letter {
    color: #FFFFFF;
    font-weight: 800;
    font-size: 19px;
    line-height: 1;
    font-family: var(--font-main);
}

.sidebar-brand .logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    object-fit: cover;
    flex: none;
    background: #fff;
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, .35);
}

.brand-text-block {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.sidebar-brand .badge {
    display: inline-block;
    color: #60A5FA;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-top: 2px;
    text-transform: uppercase;
}

/* Busca */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 14px 14px 14px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--sidebar-text);
    font-size: 13px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    flex: none;
}

.sidebar-search:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

.sidebar-search-placeholder {
    flex: 1;
    font-weight: 500;
}

.sidebar-search-kbd {
    font-size: 10px;
    font-weight: 600;
    color: #64748B;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 2px 6px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.sidebar-section {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    margin: 10px 22px 6px 22px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: none;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text-hover);
    transform: translateX(2px);
}

.sidebar nav a.active {
    background: var(--sidebar-active-bg);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: var(--sidebar-active-shadow);
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all 0.15s ease;
}

.sidebar-group-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text-hover);
}

.sidebar-group-toggle .group-chevron {
    margin-left: auto;
    display: flex;
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.sidebar-group-toggle .group-chevron.open {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar nav a.sub {
    padding-left: 38px;
    font-size: 13px;
}

.sidebar-footer {
    padding: 14px 18px;
    color: #64748B;
    font-size: 11.5px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: none;
}

.sidebar-meta {
    display: flex;
    flex-direction: column;
}

.sidebar-app-name {
    color: #94A3B8;
    font-weight: 600;
    font-size: 12px;
}

.sidebar-app-version {
    color: #475569;
    font-size: 10.5px;
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-theme-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: #94A3B8;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 9px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.sidebar-theme-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

[data-theme="dark"] .sidebar-theme-btn {
    color: #FBBF24;
}

[data-theme="dark"] .sidebar-theme-btn:hover {
    color: #FDE047;
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: #94A3B8;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #FFFFFF;
}

/* Sidebar Recolhida */
.app-shell.sidebar-collapsed .sidebar {
    width: 72px;
}

.app-shell.sidebar-collapsed .sidebar:hover {
    width: 250px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.app-shell.sidebar-collapsed .main-area {
    margin-left: 72px;
}

.sidebar-collapsed .sidebar:not(:hover) .nav-text {
    display: none;
}

.sidebar-collapsed .sidebar:not(:hover) .sidebar-brand {
    justify-content: center;
    padding: 18px 0;
}

.sidebar-collapsed .sidebar:not(:hover) .sidebar-search {
    justify-content: center;
    padding: 9px 0;
    margin: 0 10px 14px 10px;
}

.sidebar-collapsed .sidebar:not(:hover) nav a,
.sidebar-collapsed .sidebar:not(:hover) .sidebar-group-toggle {
    justify-content: center;
    padding: 10px 0;
}

.sidebar-collapsed .sidebar:not(:hover) nav a.sub {
    padding-left: 0;
}

.sidebar-collapsed .sidebar:not(:hover) .sidebar-footer-actions {
    flex-direction: column;
    width: 100%;
    gap: 6px;
}

.sidebar-collapsed .sidebar:not(:hover) .sidebar-theme-btn,
.sidebar-collapsed .sidebar:not(:hover) .sidebar-collapse-btn {
    justify-content: center;
    width: 100%;
    padding: 8px 0;
}

/* =========================================================================
   Área Principal & Topbar
   ========================================================================= */

.main-area {
    margin-left: 250px;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    flex: 1;
    overflow-y: auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 16px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

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

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

.breadcrumb-home {
    color: var(--muted);
}

.breadcrumb-home:hover {
    color: var(--text);
}

.breadcrumb-sep {
    color: var(--muted);
    display: flex;
    align-items: center;
    opacity: 0.6;
}

.breadcrumb-module {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.01em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-toggle-btn {
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.theme-toggle-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
    transform: rotate(15deg);
}

[data-theme="dark"] .theme-toggle-btn {
    color: #FBBF24;
}

[data-theme="dark"] .theme-toggle-btn:hover {
    color: #FDE047;
    background: rgba(251, 191, 36, 0.15);
    transform: rotate(20deg);
}

.notification-btn {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--surface);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 6px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-menu:hover {
    background: var(--surface-alt);
    border-color: var(--border-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.user-info {
    line-height: 1.15;
    text-align: left;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 11px;
    color: var(--muted);
}

.user-menu-chevron {
    color: var(--muted);
    transition: transform 0.2s ease;
}

.user-menu-chevron.open {
    transform: rotate(180deg);
}

.user-menu-wrapper {
    position: relative;
    display: inline-block;
}

.user-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: transparent;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1051;
    overflow: hidden;
    animation: user-dropdown-appear 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes user-dropdown-appear {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}

.user-avatar-lg {
    width: 38px;
    height: 38px;
    font-size: 14px;
}

.user-dropdown-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 2px;
}

.user-dropdown-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-dropdown-email {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-dropdown-badge {
    align-self: flex-start;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: var(--accent-subtle, rgba(37, 99, 235, 0.1));
    color: var(--accent, #2563EB);
    font-weight: 600;
    margin-top: 2px;
}

.user-dropdown-nav {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm, 8px);
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.user-dropdown-item:hover {
    background: var(--surface-alt);
    color: var(--accent);
}

.user-dropdown-item.danger {
    color: var(--danger, #EF4444);
}

.user-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger, #EF4444);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.user-dropdown-footer {
    padding: 6px;
}

.badge-readonly {
    background: var(--accent-light);
    color: var(--accent-hover);
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(37, 99, 235, 0.15);
    white-space: nowrap;
}

.content-footer {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 36px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
}

.content-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-refresh-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.footer-refresh-btn:hover {
    color: var(--accent);
}

.content-footer-env {
    display: flex;
    align-items: center;
    gap: 8px;
}

.env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
    display: inline-block;
}

/* =========================================================================
   Corpo de Conteúdo, Introdução & Toolbar
   ========================================================================= */

.content-body {
    padding: 28px 36px 48px 36px;
}

.page-intro {
    margin-bottom: 22px;
}

.page-intro h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.page-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.content-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================================================
   Cockpit - Seção Especial & Barra de Ferramentas
   ========================================================================= */

.cockpit-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cockpit-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-period-pill,
.filter-unit-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 40px;
    box-shadow: var(--shadow-sm);
    font-size: 13.5px;
    color: var(--text);
}

.filter-period-icon {
    color: var(--muted);
}

.filter-period-label,
.filter-unit-label {
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

.filter-period-select,
.filter-unit-select {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    padding: 0 4px;
    outline: none;
}

.filter-period-chevron {
    color: var(--muted);
    pointer-events: none;
}

.filter-date-range {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    height: 40px;
}

.filter-date-range input[type="date"] {
    border: none;
    height: 32px;
    padding: 0 4px;
    font-size: 13px;
    background: transparent;
    width: auto;
}

/* =========================================================================
   CARD GRIDS & INDICATOR CARDS (Compatibilidade Total com Todas as Páginas!)
   ========================================================================= */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* Indicador Card Clássico & Moderno */
.indicator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.indicator-card .icon-badge {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--accent-light);
    color: var(--accent);
    flex: none;
    transition: transform 0.18s ease;
}

.indicator-card:hover .icon-badge {
    transform: scale(1.05);
}

.indicator-card.accent-danger .icon-badge { background: var(--danger-light); color: var(--danger); }
.indicator-card.accent-amber .icon-badge { background: var(--amber-light); color: var(--amber); }
.indicator-card.accent-green .icon-badge { background: var(--green-light); color: var(--green); }
.indicator-card.accent-violet .icon-badge { background: var(--violet-light); color: var(--violet); }

.indicator-body {
    flex: 1;
    min-width: 0;
}

.indicator-card .label {
    display: block;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.indicator-card .value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.indicator-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.indicator-footer a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.indicator-footer a:hover {
    color: var(--accent-hover);
    gap: 6px;
}

.trend-badge-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.2;
}

.trend-pill.trend-up {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
}

.trend-pill.trend-down {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.trend-pill.trend-neutral {
    background: rgba(107, 114, 128, 0.12);
    color: #9CA3AF;
}

.trend-sub {
    font-size: 11px;
    color: var(--muted);
}

/* Componente StatCard Novo */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 148px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stat-card.clickable {
    cursor: pointer;
}

.stat-card-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-card-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: transform 0.2s ease;
}

.stat-card:hover .stat-card-icon-box {
    transform: scale(1.05);
}

.stat-card.variant-blue .stat-card-icon-box { background: var(--accent-light); color: var(--accent); }
.stat-card.variant-danger .stat-card-icon-box { background: var(--danger-light); color: var(--danger); }
.stat-card.variant-purple .stat-card-icon-box { background: var(--violet-light); color: var(--violet); }
.stat-card.variant-green .stat-card-icon-box { background: var(--green-light); color: var(--green); }
.stat-card.variant-amber .stat-card-icon-box { background: var(--amber-light); color: var(--amber); }

.stat-card-info {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.stat-card-value {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card-menu-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.stat-card-menu-btn:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.stat-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
}

.stat-card-sub {
    color: var(--muted);
    font-weight: 500;
}

.stat-card-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 12px;
    transition: gap 0.15s ease;
}

.stat-card.variant-blue .stat-card-action { color: var(--accent); }
.stat-card.variant-danger .stat-card-action { color: var(--danger); }
.stat-card.variant-purple .stat-card-action { color: var(--violet); }
.stat-card.variant-green .stat-card-action { color: var(--green); }
.stat-card.variant-amber .stat-card-action { color: var(--amber); }

.stat-card-action:hover {
    gap: 6px;
}

.stat-card-action-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

/* =========================================================================
   Cards Analíticos, Ilustrações e Resumos
   ========================================================================= */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1080px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

.summary-bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1180px) {
    .summary-bottom-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease;
}

.card + .card {
    margin-top: 20px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.card-title.card-title-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: color 0.15s ease;
}

.card-title.card-title-link:hover {
    color: var(--accent);
}

.card-info-badge {
    color: var(--muted);
    cursor: help;
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}

.card-info-badge:hover {
    color: var(--accent);
}

.card-action {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: gap 0.15s ease;
}

.card-action:hover {
    gap: 7px;
    color: var(--accent-hover);
}

button.card-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.card-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.compact-preview-wrap {
    margin-bottom: 16px;
    overflow-x: auto;
}

.compact-preview-wrap .data-table td {
    padding: 8px 10px;
    font-size: 13px;
}

.compact-preview-wrap .data-table th {
    padding: 8px 10px;
    font-size: 12px;
}

.card-footer-action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid var(--border-light);
    padding-top: 14px;
}

.view-mode-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.view-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.view-mode-btn:hover {
    color: var(--text);
}

.view-mode-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ellipsis-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-pill-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-pill-control select {
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 0 10px;
    outline: none;
    cursor: pointer;
}

.icon-btn-micro {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.icon-btn-micro:hover {
    background: var(--surface-alt);
    color: var(--text);
    border-color: #CBD5E1;
}

.card-illustration-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.card-illustration-content {
    flex: 1;
}

.card-illustration-badge {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: transform 0.2s ease;
}

.card:hover .card-illustration-badge {
    transform: scale(1.05);
}

.card-illustration-badge.variant-blue { background: var(--accent-light); color: var(--accent); }
.card-illustration-badge.variant-green { background: var(--green-light); color: var(--green); }
.card-illustration-badge.variant-purple { background: var(--violet-light); color: var(--violet); }

.card-mini-stats {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.callout-danger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.callout-danger-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 18px;
    min-height: 42px;
}

.callout-danger-banner svg {
    flex-shrink: 0;
}

.callout-danger-banner.clickable {
    cursor: pointer;
    transition: all 0.18s ease;
}

.callout-danger-banner.clickable:hover {
    filter: brightness(0.96);
    transform: translateY(-1px);
}

.stat-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13.5px;
    color: var(--text-secondary);
}

.stat-line:last-of-type {
    border-bottom: none;
}

.stat-line strong {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-line-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    border-bottom: none;
    font-size: 14px;
    font-weight: 600;
}

.stat-line-total strong {
    color: #EF4444;
    font-weight: 800;
    font-size: 15px;
}

.stat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.stat-row-val {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-row-highlight {
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-weight: 600;
}

.stat-row-highlight .stat-row-val {
    color: var(--accent);
    font-weight: 800;
}

.stat-row.is-link {
    cursor: pointer;
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
    padding: 6px 10px;
    margin: -2px -10px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-row.is-link:hover {
    background: var(--surface-muted, rgba(0, 0, 0, 0.04));
    transform: translateX(3px);
}

.stat-row.is-link:hover .stat-row-val {
    color: var(--accent);
}

.stat-row-highlight.is-link:hover {
    filter: brightness(0.96);
    transform: translateX(3px);
}

/* =========================================================================
   Donut Charts (Ambas as versões: Clássica e Nova com LeftContent)
   ========================================================================= */

.donut-wrap {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.donut-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.donut-container.with-left-stats {
    display: grid;
    grid-template-columns: 1fr 140px 1fr;
    align-items: center;
    gap: 20px;
}

@media (max-width: 640px) {
    .donut-container.with-left-stats {
        grid-template-columns: 1fr;
        justify-items: center;
    }
}

.donut-left-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-metric-block {
    display: flex;
    flex-direction: column;
}

.stat-metric-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.stat-metric-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-metric-block.is-link {
    cursor: pointer;
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
    padding: 6px 10px;
    margin: -4px -10px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-metric-block.is-link:hover {
    background: var(--surface-muted, rgba(0, 0, 0, 0.04));
    transform: translateX(3px);
}

.stat-metric-block.is-link:hover .stat-metric-value {
    color: var(--accent);
}

.donut-ring-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-ring {
    width: 136px;
    height: 136px;
    min-width: 136px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.donut-center {
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.donut-center.clickable {
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s ease;
}

.donut-center.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.donut-center.clickable:hover .value {
    color: var(--accent);
}

.donut-center .value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
    transition: color 0.15s ease;
}

.donut-center .label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    margin-top: 3px;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex: 1;
    min-width: 160px;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-secondary);
}

.donut-legend-item.is-link {
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--radius-sm, 4px);
    padding: 3px 6px;
    margin: -3px -6px;
    transition: all 0.15s ease;
}

.donut-legend-item.is-link:hover {
    background: var(--surface-muted, rgba(0, 0, 0, 0.04));
    transform: translateX(3px);
}

.donut-legend-item.is-link:hover .donut-legend-label {
    color: var(--accent);
}

.donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: none;
}

.donut-legend-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.donut-legend-pct {
    font-weight: 700;
    color: var(--text);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

/* =========================================================================
   Tabelas Principais & Compactas
   ========================================================================= */

.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

table.data-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    white-space: nowrap;
}

table.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text-secondary);
    font-size: 13.5px;
}

table.data-table tbody tr:last-child td {
    border-bottom: none;
}

table.data-table tbody tr {
    transition: background-color 0.12s ease;
}

table.data-table tbody tr:hover {
    background: var(--surface-alt);
}

table.data-table td.num, table.data-table th.num, table.data-table tfoot td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.data-table.table-dense th,
table.data-table.table-dense td {
    padding: 10px 14px;
}

table.data-table.table-dense tfoot td {
    padding: 10px 14px;
}

table.data-table tfoot td {
    padding: 13px 20px;
    border-top: 2px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    vertical-align: middle;
}

.table-footer {
    padding: 12px 20px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* Tabela Compacta */
table.data-table-compact th, table.data-table-compact td {
    padding: 9px 8px;
    font-size: 13px;
}

table.data-table-compact th {
    background: transparent;
    padding-left: 0;
}

table.data-table-compact td:first-child, table.data-table-compact th:first-child {
    padding-left: 0;
}

.compact-table-wrap {
    overflow-x: auto;
}

.compact-data-table {
    width: 100%;
    border-collapse: collapse;
}

.compact-data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
}

.compact-data-table td {
    padding: 10px 4px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text);
}

.table-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.table-status-dot.danger { background: #EF4444; }

.table-date-col {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.table-val-col {
    font-weight: 700;
}

.muted-more-records {
    margin: 10px 0 0 0;
    color: var(--muted);
    font-size: 12px;
}

.total-vencido-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text-secondary);
}

.total-vencido-amount {
    color: #EF4444;
    font-size: 16px;
    font-weight: 800;
}

.compact-data-table tr.clickable-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.compact-data-table tr.clickable-row:hover td {
    background: var(--surface-muted, rgba(0, 0, 0, 0.04));
}

.compact-data-table tr.clickable-row:hover .table-ref-title {
    color: var(--accent);
}

.total-vencido-footer.clickable {
    cursor: pointer;
    transition: all 0.18s ease;
    border-radius: var(--radius-sm, 6px);
    padding: 8px 10px;
    margin: 10px -10px 0 -10px;
}

.total-vencido-footer.clickable:hover {
    background: var(--danger-light, #fef2f2);
    transform: translateX(2px);
}

.muted-more-records.clickable {
    cursor: pointer;
    display: inline-block;
    transition: color 0.15s ease;
}

.muted-more-records.clickable:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* =========================================================================
   Paginador
   ========================================================================= */

.paginador {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
    background: var(--surface);
}

.paginador-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.paginador-nav label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.paginador-nav select {
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.paginador-btn {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.paginador-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.paginador-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.paginador-pos {
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text);
}

/* =========================================================================
   Filtros Padronizados (Clean Wrap, sem barra de rolagem horizontal feia)
   ========================================================================= */

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filters label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    margin-right: -6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.filters select, .filters input {
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 0 10px;
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    flex-shrink: 0;
    max-width: 240px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filters select:focus, .filters input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.content-toolbar .filters {
    margin-bottom: 0;
}

.filter-mode-info-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    margin-left: auto;
}

/* =========================================================================
   Badges e Tags de Status
   ========================================================================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge-dot {
    display: none; /* Fallback unificado com o ::before */
}

.status-info { background: var(--status-info-bg); color: var(--status-info-fg); }
.status-aberto { background: var(--status-aberto-bg); color: var(--status-aberto-fg); }
.status-pago { background: var(--status-pago-bg); color: var(--status-pago-fg); }
.status-vencido { background: var(--status-vencido-bg); color: var(--status-vencido-fg); }
.status-purple { background: var(--status-purple-bg); color: var(--status-purple-fg); }
.status-neutral { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }

/* =========================================================================
   Botões Globais & Ações
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    color: #FFFFFF;
    box-shadow: 0 3px 10px -2px rgba(37, 99, 235, 0.45);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1D4ED8 0%, #1E40AF 100%);
    box-shadow: 0 5px 14px -2px rgba(37, 99, 235, 0.55);
    color: #FFFFFF;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-alt);
    border-color: #CBD5E1;
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #FFFFFF;
    box-shadow: 0 3px 10px -2px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: #FFFFFF;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-alt);
    color: var(--text);
}

.btn-size-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
}

.btn-size-lg {
    height: 46px;
    padding: 0 24px;
    font-size: 15px;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
}

.btn-sm:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.btn-sm.danger {
    color: var(--danger);
}

.btn-sm.danger:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-link-row {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.btn-link-row:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

td.row-actions {
    justify-content: flex-end;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    flex: none;
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.btn-icon.danger {
    color: var(--text-muted);
}

.btn-icon.danger:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-icon.success {
    color: var(--green);
}

.btn-icon.success:hover {
    background: var(--green-light);
    border-color: var(--green);
    color: var(--green);
}

.btn-icon.primary {
    color: var(--accent);
}

.btn-icon.primary:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.btn-icon:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-mes-nav {
    height: 34px;
    width: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-mes-nav:hover {
    background: var(--surface-alt);
    border-color: var(--border-hover);
    color: var(--accent);
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    flex: none;
    transition: all 0.15s ease;
}

.icon-btn:hover {
    background: var(--surface-alt);
    color: var(--text);
}

/* =========================================================================
   Formulários Globais
   ========================================================================= */

input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="password"],
input:not([type]), select, textarea {
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 0 12px;
    font-size: 13.5px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    width: 100%;
    transition: all 0.15s ease;
}

textarea {
    height: auto;
    min-height: 84px;
    padding: 10px 12px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-field {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
}

.required-star {
    color: var(--danger);
    margin-left: 2px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-field {
    flex: 1;
    min-width: 0;
}

.form-hint {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

/* =========================================================================
   Modais & Diálogos
   ========================================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
    animation: modal-fade-in 0.18s ease-out;
}

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
    animation: modal-scale-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-box.modal-box-wide {
    max-width: 960px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex: none;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
    flex: none;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-scale-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-modal-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.confirm-modal-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.confirm-modal-icon-wrap.variant-danger { background: var(--danger-light); color: var(--danger); }
.confirm-modal-icon-wrap.variant-warning { background: var(--amber-light); color: var(--amber); }
.confirm-modal-icon-wrap.variant-primary { background: var(--accent-light); color: var(--accent); }

.confirm-modal-message {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px 0;
}

.confirm-modal-detail {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

/* =========================================================================
   Empty States
   ========================================================================= */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--surface-alt);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-state-message {
    font-size: 13.5px;
    color: var(--muted);
    max-width: 380px;
    margin: 0 auto;
}

/* =========================================================================
   Toasts (Posicionadas no topo da tela)
   ========================================================================= */

.toast-stack {
    position: fixed;
    top: 20px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99999;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px 18px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.16), 0 8px 10px -6px rgba(0, 0, 0, 0.10);
    font-size: 13.5px;
    font-weight: 500;
    min-width: 290px;
    max-width: 420px;
    pointer-events: auto;
    animation: toast-slide-down 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success { border-left: 4px solid var(--green); }
.toast-success .icon { color: var(--green); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast-warning { border-left: 4px solid var(--warning, #eab308); }
.toast-warning .icon { color: var(--warning, #eab308); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}
.toast-close:hover {
    background: var(--surface-alt);
    color: var(--text);
}

@keyframes toast-slide-down {
    from {
        transform: translateY(-24px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
    }
    .toast {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
}

/* =========================================================================
   Loaders & Spinners
   ========================================================================= */

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

.btn-secondary .btn-spinner {
    border-color: rgba(37, 99, 235, 0.2);
    border-top-color: var(--accent);
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.loader-overlay.loader-inline {
    position: absolute;
    z-index: 20;
    background: rgba(244, 245, 250, .60);
    border-radius: inherit;
}

.loader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
}

.loader-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: conic-gradient(from 90deg, var(--accent), #3B82F6 40%, rgba(37, 99, 235, 0) 75%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    animation: btn-spin 0.85s linear infinite;
}

.loading-state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.loader-dots {
    display: flex;
    gap: 5px;
}

.loader-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: .35;
    animation: loader-bounce 1s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: .15s; }
.loader-dots span:nth-child(3) { animation-delay: .30s; }

.loader-msg {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: .01em;
    max-width: 260px;
    text-align: center;
}

@keyframes loader-bounce {
    0%, 100% { opacity: .3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-4px); }
}

/* =========================================================================
   Global Loading Bar & Indicators (Top-level, Table & Action Loaders)
   ========================================================================= */

.global-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 99998;
    background: linear-gradient(90deg, #2563eb, #38bdf8, #6366f1, #2563eb);
    background-size: 250% 100%;
    animation: global-progress-anim 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.global-progress-glow {
    position: absolute;
    top: 0;
    right: 0;
    width: 140px;
    height: 100%;
    box-shadow: 0 0 12px 3px rgba(56, 189, 248, 0.8);
}

@keyframes global-progress-anim {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.global-loading-pill {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99997;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.90);
    color: #ffffff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    animation: pill-pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    letter-spacing: 0.2px;
}

[data-theme="dark"] .global-loading-pill {
    background: rgba(30, 41, 59, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

@keyframes pill-pop-in {
    from {
        transform: translate(-50%, -14px) scale(0.94);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
    }
}

/* Table Loading State */
.table-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    min-height: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 100%;
}

.table-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.table-loading-text {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Spinner Sizes */
.btn-spinner.sm {
    width: 12px;
    height: 12px;
    border-width: 2px;
}

.btn-spinner.md {
    width: 18px;
    height: 18px;
    border-width: 2.5px;
}

.btn-spinner.lg {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

/* Modal busy state */
.confirm-modal-busy-overlay {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(37, 99, 235, 0.07);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    animation: toast-slide-down 0.2s ease;
}

.variant-danger .confirm-modal-busy-overlay {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}


/* =========================================================================
   Painéis Em Linha e Utilitários Diversos
   ========================================================================= */

.inline-panel {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 4px 0;
}

.inline-panel-list {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.inline-panel-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.12s ease;
}

.inline-panel-item:last-child {
    border-bottom: none;
}

.inline-panel-item:hover {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-weight: 600;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.activities-timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activity-timeline-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
}

.activity-timeline-item.clickable {
    cursor: pointer;
    border-radius: var(--radius-sm, 6px);
    padding: 6px 10px;
    margin: -3px -10px;
    transition: all 0.18s ease;
}

.activity-timeline-item.clickable:hover {
    background: var(--surface-muted, rgba(0, 0, 0, 0.04));
    transform: translateX(3px);
}

.activity-timeline-item.clickable:hover .activity-text {
    color: var(--accent);
}

.activity-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
}

.activity-text {
    flex: 1;
    color: var(--text-secondary);
}

.activity-time {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Classes Utilitárias e Componentes Adicionais (Audit)
   ========================================================================= */

.stat-row-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.text-danger {
    color: var(--danger) !important;
}

.table-ref-title {
    font-weight: 600;
    color: var(--text);
}

.recent-activities-section {
    margin-top: 24px;
}

.card-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.paginador-info {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-badge-text {
    font-weight: 600;
    line-height: 1;
}

.error-boundary-card {
    border-left: 4px solid var(--danger);
    background: var(--danger-light);
    padding: 24px;
}

.confirm-modal-body {
    flex: 1;
    min-width: 0;
}

.topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scrollbars personalizadas e suaves para o tema escuro */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* =========================================================================
   Cockpit Grid (DnD, Reordering, 360° Resizing & Customization Mode)
   ========================================================================= */

.cockpit-edit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin-bottom: 20px;
    animation: fadeIn 0.2s ease-out;
}

.cockpit-edit-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
}

.cockpit-edit-bar-info strong {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.cockpit-edit-bar-info span {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.cockpit-edit-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cockpit-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 12px;
    grid-auto-flow: dense;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 24px;
    position: relative;
}

.cockpit-widget {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    border-radius: var(--radius);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-sizing: border-box;
}

.cockpit-widget > .stat-card,
.cockpit-widget > .card {
    height: 100%;
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.cockpit-widget > .card > .card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Edit Mode styling */
.cockpit-grid.is-edit-mode .cockpit-widget {
    border: 1px dashed var(--border);
    padding: 4px;
    background: rgba(37, 99, 235, 0.02);
}

.cockpit-grid.is-edit-mode .cockpit-widget:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.12);
}

.widget-drag-handle {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
    cursor: grab;
    user-select: none;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    transition: all 0.15s ease;
    gap: 8px;
}

.cockpit-grid.is-edit-mode .widget-drag-handle {
    display: flex;
}

.widget-drag-handle:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.widget-drag-handle:active {
    cursor: grabbing;
}

.widget-drag-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-drag-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.widget-preset-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 2px 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    line-height: 1.2;
}

.widget-preset-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* =========================================================================
   8-Direction Multidirectional Resize Handles (Bordas e Cantos)
   ========================================================================= */

.widget-resize-handle {
    display: none;
    position: absolute;
    z-index: 25;
    touch-action: none;
}

.cockpit-grid.is-edit-mode .widget-resize-handle {
    display: block;
}

/* 4 Bordas */
.widget-resize-handle.widget-resize-n {
    top: -6px;
    left: 14px;
    right: 14px;
    height: 12px;
    cursor: ns-resize;
}

.widget-resize-handle.widget-resize-s {
    bottom: -6px;
    left: 14px;
    right: 14px;
    height: 12px;
    cursor: ns-resize;
}

.widget-resize-handle.widget-resize-e {
    right: -6px;
    top: 14px;
    bottom: 14px;
    width: 12px;
    cursor: ew-resize;
}

.widget-resize-handle.widget-resize-w {
    left: -6px;
    top: 14px;
    bottom: 14px;
    width: 12px;
    cursor: ew-resize;
}

/* Indicadores de pílula visuais nas bordas ao passar o mouse */
.widget-resize-handle.widget-resize-n::after,
.widget-resize-handle.widget-resize-s::after {
    content: '';
    position: absolute;
    left: 30%;
    right: 30%;
    height: 3px;
    border-radius: 2px;
    background: transparent;
    transition: background 0.15s ease;
}

.widget-resize-handle.widget-resize-n::after { top: 4px; }
.widget-resize-handle.widget-resize-s::after { bottom: 4px; }

.widget-resize-handle.widget-resize-e::after,
.widget-resize-handle.widget-resize-w::after {
    content: '';
    position: absolute;
    top: 30%;
    bottom: 30%;
    width: 3px;
    border-radius: 2px;
    background: transparent;
    transition: background 0.15s ease;
}

.widget-resize-handle.widget-resize-e::after { right: 4px; }
.widget-resize-handle.widget-resize-w::after { left: 4px; }

.widget-resize-handle.widget-resize-n:hover::after,
.widget-resize-handle.widget-resize-s:hover::after,
.widget-resize-handle.widget-resize-e:hover::after,
.widget-resize-handle.widget-resize-w:hover::after,
.cockpit-widget.is-resizing .widget-resize-handle::after {
    background: var(--accent);
}

/* 4 Cantos */
.widget-resize-handle.widget-resize-ne {
    top: -7px;
    right: -7px;
    width: 16px;
    height: 16px;
    cursor: nesw-resize;
}

.widget-resize-handle.widget-resize-nw {
    top: -7px;
    left: -7px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.widget-resize-handle.widget-resize-sw {
    bottom: -7px;
    left: -7px;
    width: 16px;
    height: 16px;
    cursor: nesw-resize;
}

.widget-resize-handle.widget-resize-se {
    bottom: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Destaque sutil nos cantos */
.widget-resize-handle.widget-resize-ne::before,
.widget-resize-handle.widget-resize-nw::before,
.widget-resize-handle.widget-resize-sw::before,
.widget-resize-handle.widget-resize-se::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: 1px solid var(--surface);
    transition: all 0.15s ease;
}

.widget-resize-handle:hover::before,
.cockpit-widget.is-resizing .widget-resize-handle::before {
    background: var(--accent);
    transform: scale(1.3);
}

/* =========================================================================
   Adaptação de Conteúdo dos Cards aos Formatos (Fino, Quadrado, Comprido)
   ========================================================================= */

/* FORMATO FINO (altura <= 115px - Barra horizontal compacta) */
.cockpit-widget.is-slim > .stat-card {
    padding: 8px 14px !important;
    min-height: 0 !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.cockpit-widget.is-slim .stat-card-top {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 0 !important;
    flex: 1;
    min-width: 0;
}

.cockpit-widget.is-slim .stat-card-icon-box {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 7px !important;
}

.cockpit-widget.is-slim .stat-card-icon-box svg {
    width: 15px !important;
    height: 15px !important;
}

.cockpit-widget.is-slim .stat-card-label {
    font-size: 11px !important;
    margin-bottom: 1px !important;
}

.cockpit-widget.is-slim .stat-card-value {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
}

.cockpit-widget.is-slim .stat-card-sub {
    display: none !important;
}

.cockpit-widget.is-slim .stat-card-bottom {
    margin-top: 0 !important;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0;
}

.cockpit-widget.is-slim > .card {
    padding: 10px 14px !important;
    overflow: hidden;
}

.cockpit-widget.is-slim > .card .card-head {
    margin-bottom: 4px !important;
}

/* FORMATO QUADRADINHO PEQUENO (span 2 ou 3 x height <= 165px) */
.cockpit-widget.is-square-sm > .stat-card {
    padding: 12px 14px !important;
}

.cockpit-widget.is-square-sm .stat-card-value {
    font-size: 18px !important;
}

.cockpit-widget.is-square-sm .stat-card-sub {
    font-size: 11.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* FORMATO QUADRADO GRANDE (span >= 5 x height >= 280px) */
.cockpit-widget.is-square-lg > .stat-card {
    padding: 24px 28px !important;
    justify-content: space-around !important;
}

.cockpit-widget.is-square-lg .stat-card-icon-box {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    border-radius: 12px !important;
}

.cockpit-widget.is-square-lg .stat-card-icon-box svg {
    width: 24px !important;
    height: 24px !important;
}

.cockpit-widget.is-square-lg .stat-card-value {
    font-size: 28px !important;
    margin: 4px 0;
}

.cockpit-widget.is-square-lg .stat-card-label {
    font-size: 14px !important;
}

.cockpit-widget.is-square-lg .stat-card-sub {
    font-size: 13.5px !important;
}

/* Dragging & Resizing States */
.cockpit-widget.is-dragging {
    opacity: 0.38;
    transform: scale(0.98);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.cockpit-widget.is-resizing {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-lg);
    z-index: 100;
}

.widget-placeholder {
    background: var(--accent-light);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    min-height: 100px;
    box-sizing: border-box;
    animation: pulse 1.2s infinite ease-in-out;
}

body.cockpit-dnd-active,
body.cockpit-dnd-active * {
    cursor: grabbing !important;
    user-select: none !important;
}

body.cockpit-resize-active,
body.cockpit-resize-active * {
    user-select: none !important;
}

/* Floating Metric Badge */
.resize-metric-badge {
    position: fixed;
    z-index: 99999;
    background: var(--text);
    color: var(--surface);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.resize-metric-badge strong {
    color: #fff;
}

.resize-metric-badge .badge-tag {
    background: var(--accent);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Responsive collapse on smaller screens */
@media (max-width: 900px) {
    .cockpit-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .cockpit-grid {
        grid-template-columns: 1fr;
    }
    .cockpit-widget {
        grid-column: span 1 !important;
        min-height: auto !important;
    }
    .widget-resize-handle {
        display: none !important;
    }
}

/* =========================================================================
   Contas Pagas — Agrupamento por Orçamento & Relatório PDF
   ========================================================================= */

.view-mode-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.view-mode-tabs {
    display: inline-flex;
    align-items: center;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    padding: 3px;
    gap: 3px;
    max-width: 100%;
    overflow-x: auto;
}

.view-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

.view-tab-btn:hover:not(.active) {
    color: var(--text);
    background: rgba(125, 125, 125, 0.08);
}

.view-tab-btn.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: 600;
    border-color: var(--border-subtle);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.view-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-subtle);
    color: var(--primary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    min-width: 18px;
    line-height: 1.35;
}

.view-tab-btn.active .view-tab-badge {
    background: var(--primary);
    color: #ffffff;
}

/* Barra de Ações em Lote (Multi-seleção de Orçamentos) */
.batch-actions-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md, 8px);
    padding: 12px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.batch-selection-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.batch-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.batch-checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
}

.batch-stat-badge {
    background: var(--surface-muted, #f1f5f9);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.batch-stat-badge strong {
    color: var(--text);
    font-weight: 700;
}

.batch-stat-badge .amount-highlight {
    color: var(--success, #16a34a);
    font-weight: 700;
    margin-left: 4px;
}

.batch-actions-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Cards de Grupos de Orçamento */
.budget-groups-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.budget-group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 10px);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.budget-group-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.budget-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface);
    border-bottom: 1px solid transparent;
    cursor: pointer;
    gap: 14px;
    user-select: none;
    transition: background-color 0.12s ease;
}

.budget-group-card.expanded .budget-group-header {
    border-bottom-color: var(--border);
    background: var(--surface-subtle, rgba(248, 250, 252, 0.6));
}

.budget-group-header:hover {
    background: var(--surface-hover, rgba(0, 0, 0, 0.02));
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.group-checkbox {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
}

.group-chevron-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.group-chevron-btn.open {
    transform: rotate(180deg);
}

.budget-code-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-subtle, rgba(37, 99, 235, 0.1));
    color: var(--primary);
    font-weight: 700;
    font-size: 13.5px;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--primary-subtle, rgba(37, 99, 235, 0.2));
}

.budget-code-tag.unbudgeted {
    background: var(--surface-muted, #f1f5f9);
    color: var(--text-muted);
    border-color: var(--border);
}

.budget-meta-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.group-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.group-kpi-block {
    text-align: right;
    line-height: 1.25;
}

.group-kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.group-kpi-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.group-kpi-value.paid-highlight {
    color: var(--primary);
}

.budget-group-body {
    padding: 0;
}

/* Destaque para Banco / Conta que saiu */
.account-bank-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bank-name-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    color: var(--text);
    font-size: 13px;
}

/* Relatório Timbrado / PDF Modal */
.modal-box:has(.print-report-container) {
    max-width: 1040px;
    width: 95vw;
}

.print-report-container {
    padding: 24px 30px;
    background: #ffffff;
    color: #0f172a;
    border-radius: 8px;
    font-family: var(--font-main, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

/* Força container branco no preview para refletir o resultado do PDF impresso */
.print-report-container * {
    box-sizing: border-box;
}

.report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 18px;
    margin-bottom: 20px;
    gap: 20px;
}

.report-header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.report-logo-img {
    height: 48px;
    max-width: 160px;
    object-fit: contain;
    border-radius: 6px;
}

.report-badge-fallback {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 24px;
}

.report-brand-text {
    display: flex;
    flex-direction: column;
}

.report-brand-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.report-brand-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

.report-header-meta {
    text-align: right;
    line-height: 1.4;
}

.report-doc-title {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.report-meta-item {
    font-size: 12px;
    color: #475569;
}

.report-meta-item strong {
    color: #0f172a;
}

/* Resumo Executivo */
.report-summary-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 24px;
}

.report-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.report-summary-stat .stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.report-summary-stat .stat-val {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.report-summary-stat.highlight .stat-val {
    color: #1d4ed8;
}

/* Seção de cada orçamento */
.report-budget-section {
    margin-bottom: 26px;
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}

.report-budget-header {
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.report-budget-title-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-budget-code {
    font-size: 15px;
    font-weight: 800;
    color: #1e3a8a;
    background: #dbeafe;
    padding: 2px 8px;
    border-radius: 4px;
}

.report-budget-date,
.report-budget-unit,
.report-budget-supplier {
    font-size: 12.5px;
    color: #475569;
}

.report-budget-kpis {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}

.report-budget-orig {
    color: #64748b;
}

.report-budget-diff {
    color: #b45309;
}

.report-budget-diff strong {
    color: #b45309;
}

.report-budget-total-paid {
    color: #0f172a;
}

.report-budget-total-paid strong {
    font-size: 14.5px;
    color: #1d4ed8;
}

/* Tabela Detalhada do Relatório */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.report-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    border-bottom: 1px solid #cbd5e1;
    text-align: left;
}

.report-table th.num,
.report-table td.num {
    text-align: right;
}

.report-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
    vertical-align: middle;
}

.report-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.report-account-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-bank-name {
    color: #0f172a;
    font-weight: 700;
}

.report-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
}

.report-badge.badge-pj {
    background: #e0f2fe;
    color: #0369a1;
}

.report-badge.badge-pf {
    background: #fef3c7;
    color: #b45309;
}

.report-table tfoot td {
    background: #f1f5f9;
    font-weight: 700;
    border-top: 1px solid #cbd5e1;
    padding: 9px 12px;
    font-size: 12.5px;
}

.report-table tfoot .subtotal-label {
    text-align: right;
    color: #334155;
}

.report-table tfoot .subtotal-val {
    color: #1d4ed8;
    font-size: 13.5px;
}

/* Total Geral Consolidado */
.report-grand-total {
    background: #1e293b;
    color: #ffffff;
    border-radius: 6px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    margin-bottom: 24px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.grand-total-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.grand-total-value {
    font-size: 19px;
    font-weight: 800;
    color: #60a5fa;
}

/* Assinaturas no Rodapé */
.report-footer-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 40px;
    margin-bottom: 20px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.report-signature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.signature-line {
    width: 100%;
    border-bottom: 1px solid #94a3b8;
    margin-bottom: 6px;
}

.signature-caption {
    font-size: 11.5px;
    color: #64748b;
    font-weight: 600;
}

.report-system-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 16px;
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    page-break-inside: avoid;
    break-inside: avoid;
}

.report-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

/* =========================================================================
   REGRAS DE IMPRESSÃO (A4 Portrait / Salvar como PDF)
   ========================================================================= */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm 10mm 12mm;
    }

    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 10.5pt !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ocultar toda a interface de aplicação padrão */
    .app-shell > aside,
    .sidebar,
    .page-header,
    .page-intro,
    .filters,
    .view-mode-toolbar,
    .batch-actions-bar,
    .budget-groups-list,
    .table-card,
    .card,
    .back-link,
    .btn,
    .btn-sm,
    .icon-btn,
    .modal-header,
    .modal-footer,
    .modal-backdrop:not(:has(.print-report-container)) {
        display: none !important;
    }

    /* Liberar a modal de impressão como fluxo normal da página */
    .modal-backdrop:has(.print-report-container) {
        position: static !important;
        inset: auto !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: auto !important;
        animation: none !important;
    }

    .modal-backdrop:has(.print-report-container) .modal-box {
        position: static !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: none !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        animation: none !important;
    }

    .modal-backdrop:has(.print-report-container) .modal-body {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .print-report-container {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        color: #000000 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .report-budget-section {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 18px !important;
    }

    .report-table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .report-table thead {
        display: table-header-group !important;
    }

    .report-grand-total {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        background: #f1f5f9 !important;
        color: #0f172a !important;
        border: 2px solid #0f172a !important;
    }

    .report-grand-total .grand-total-value {
        color: #1d4ed8 !important;
    }

    .report-footer-signatures {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}

/* =========================================================================
   Configurações de Notificações (E-mail & WhatsApp)
   ========================================================================= */

.btn-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.btn-eye:hover {
    color: var(--text);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
}

.status-dot.online {
    background-color: var(--success, #16a34a);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.status-dot.offline {
    background-color: var(--text-muted);
}

.test-result-box {
    border-radius: var(--radius-md, 8px);
    padding: 14px 16px;
    border: 1px solid transparent;
    animation: modal-fade-in 0.2s ease-out;
}

.test-result-box.success {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.3);
    color: var(--success, #16a34a);
}

.test-result-box.error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger, #ef4444);
}

.test-result-box.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning, #f59e0b);
}

.test-result-box .result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 6px;
}

.test-result-box .result-message {
    font-size: 13px;
    margin: 0;
    color: var(--text);
    word-break: break-word;
}

.test-result-box .result-time {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.info-callout {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    padding: 12px 14px;
}

.kpi-mini {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-mini .label {
    font-size: 10.5px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.kpi-mini .val {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.kpi-mini.danger {
    border-left: 3px solid var(--danger, #ef4444);
}

.kpi-mini.danger .val {
    color: var(--danger, #ef4444);
}

.kpi-mini.warning {
    border-left: 3px solid var(--warning, #f59e0b);
}

.kpi-mini.warning .val {
    color: var(--warning, #f59e0b);
}

.kpi-mini.info {
    border-left: 3px solid var(--primary);
}

.kpi-mini.info .val {
    color: var(--primary);
}

.channel-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 700;
}

.channel-badge.email {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.channel-badge.whatsapp {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success, #16a34a);
}

/* =========================================================================
   Badges de Prazo de Vencimento e Recorrências
   ========================================================================= */
.prazo-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
}

.prazo-badge.prazo-vencido {
    background: #FEF2F2;
    color: #B91C1C;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.prazo-badge.prazo-hoje {
    background: #FFFBEB;
    color: #B45309;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.prazo-badge.prazo-aberto {
    background: #F8FAFC;
    color: #475569;
    border: 1px solid #E2E8F0;
}

/* Estilos da Projeção Financeira */
.projecao-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.projecao-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    position: relative;
}

.projecao-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.08);
    border-color: var(--accent);
}

.projecao-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), 0 4px 12px rgba(37, 99, 235, 0.12);
}

.projecao-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.projecao-mes-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.projecao-mes-total {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
}

.projecao-comp-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #E2E8F0;
    margin-bottom: 14px;
}

.comp-seg-contas {
    background: var(--accent);
}

.comp-seg-recorrencias {
    background: #8B5CF6;
}

.comp-seg-orcamentos {
    background: #F59E0B;
}

.projecao-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
}

.projecao-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.projecao-breakdown-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.projecao-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.projecao-dot.contas { background: var(--accent); }
.projecao-dot.recorrencias { background: #8B5CF6; }
.projecao-dot.orcamentos { background: #F59E0B; }

.origin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.origin-badge.conta {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
}

/* =========================================================================
   Autenticação, Modo Aberto e Usuários
   ========================================================================= */

.open-mode-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0.04) 100%);
    border-bottom: 1px solid rgba(37, 99, 235, 0.25);
    padding: 8px 24px;
    font-size: 13px;
    color: var(--text);
    flex-wrap: wrap;
}

.sidebar-user-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--sidebar-border);
    border-radius: 10px;
    margin-bottom: 12px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10.5px;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.sidebar-user-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-sidebar-user-action {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sidebar-user-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.origin-badge.recorrencia {
    background: rgba(139, 92, 246, 0.1);
    color: #7C3AED;
}

.origin-badge.orcamento {
    background: rgba(245, 158, 11, 0.12);
    color: #D97706;
}

/* ==========================================================================
   Splash de Verificação de Sessão (Transição suave no F5)
   ========================================================================== */
.session-splash-screen {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.session-splash-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.session-splash-badge {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-splash-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    animation: pulse 1.6s infinite ease-in-out;
}

.session-splash-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, var(--text));
    letter-spacing: -0.02em;
}

.session-splash-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary, #2563eb);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-top: 4px;
}

/* ==========================================================================
   Badges e Ações de Conferência de Depósitos (Orçamentos / Contas Pagas)
   ========================================================================== */
.badge-status-conferencia {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius-pill, 9999px);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    user-select: none;
    transition: all 0.15s ease;
}

.badge-status-conferencia.mini {
    padding: 2px 8px;
    font-size: 10.5px;
    gap: 4px;
}

.status-badge-dot-mini {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

.badge-status-conferencia.pendente {
    background: var(--status-aberto-bg, rgba(245, 158, 11, 0.14));
    color: var(--status-aberto-fg, #b45309);
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.badge-status-conferencia.aguardando {
    background: var(--status-info-bg, rgba(37, 99, 235, 0.12));
    color: var(--status-info-fg, #1d4ed8);
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.badge-status-conferencia.conferido {
    background: var(--status-pago-bg, rgba(16, 185, 129, 0.14));
    color: var(--status-pago-fg, #059669);
    border: 1px solid rgba(16, 185, 129, 0.22);
}

/* ==========================================================================
   Tabela de Contas Pagas (Layout Otimizado sem quebra / scroll horizontal)
   ========================================================================== */
table.data-table.table-contas-pagas {
    width: 100%;
    table-layout: auto;
}

table.data-table.table-contas-pagas th {
    padding: 10px 8px;
    font-size: 11px;
    white-space: nowrap;
}

table.data-table.table-contas-pagas td {
    padding: 8px 8px;
    font-size: 13px;
    vertical-align: middle;
}

table.data-table.table-contas-pagas .col-data {
    white-space: nowrap;
    width: 85px;
}

table.data-table.table-contas-pagas .col-banco {
    white-space: nowrap;
}

table.data-table.table-contas-pagas .col-banco .bank-name-badge {
    font-size: 12.5px;
}

table.data-table.table-contas-pagas .col-tipo {
    width: 55px;
    text-align: center;
}

table.data-table.table-contas-pagas .col-valor {
    white-space: nowrap;
    width: 95px;
}

table.data-table.table-contas-pagas .col-origem {
    max-width: 200px;
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}

table.data-table.table-contas-pagas .col-orcamento {
    white-space: nowrap;
    width: 90px;
}

table.data-table.table-contas-pagas .col-orcamento .budget-code-tag {
    font-size: 12px;
    padding: 2px 7px;
}

table.data-table.table-contas-pagas .col-conferencia {
    white-space: nowrap;
    width: 90px;
    text-align: center;
}

table.data-table.table-contas-pagas .col-nf {
    white-space: nowrap;
    width: 70px;
    text-align: center;
    font-size: 12.5px;
}

table.data-table.table-contas-pagas .col-obs {
    max-width: 150px;
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}

table.data-table.table-contas-pagas .col-acoes {
    width: 60px;
    white-space: nowrap;
    text-align: right;
}

.btn-conferencia {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-conferencia:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
}

.btn-conferencia-ok {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #059669;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-conferencia-ok:hover {
    background: #059669;
    color: #ffffff;
}

.btn-conferencia-reverter {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 7px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-conferencia-reverter:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: #ef4444;
}

.notif-modal-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.notif-modal-header-info {
    background: var(--surface-card, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.notif-preview-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 280px;
    overflow-y: auto;
    color: var(--text);
    margin-top: 8px;
}

/* =========================================================================
   Orçamentos: KPI Grid & Callout Warning
   ========================================================================= */

.callout-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--amber-light, rgba(245, 158, 11, 0.1));
    color: var(--amber, #b45309);
    border: 1px solid var(--amber, #f59e0b);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

.orcamentos-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.orcamentos-kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.orcamentos-kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.orcamentos-kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 4px;
}

.orcamentos-kpi-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.orcamentos-kpi-card.success .orcamentos-kpi-value {
    color: var(--color-success, #16a34a);
}

.orcamentos-kpi-card.warning .orcamentos-kpi-value {
    color: #d97706;
}

.orcamentos-kpi-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* =========================================================================
   Estilização Global de Input File & Dropzone Moderna (Padrão Control ERP)
   ========================================================================= */

input[type="file"] {
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

input[type="file"]::file-selector-button:hover {
    background: var(--surface-hover, rgba(0, 0, 0, 0.03));
    border-color: var(--accent);
    color: var(--accent);
}

/* Área de Dropzone / Upload Moderno */
.file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 24px;
    border: 2px dashed var(--border-strong, #cbd5e1);
    border-radius: var(--radius-md, 10px);
    background: var(--surface-alt, #f8fafc);
    cursor: pointer;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
}

[data-theme="dark"] .file-dropzone {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--border);
}

.file-dropzone:hover {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.03);
    transform: translateY(-1px);
}

.file-dropzone-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-dropzone-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.file-dropzone:hover .file-dropzone-icon {
    transform: scale(1.08);
    background: rgba(37, 99, 235, 0.15);
}

.file-dropzone-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.file-dropzone-subtitle {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.file-dropzone-btn {
    pointer-events: none;
    margin-top: 4px;
}

/* Card de Arquivo Selecionado */
.file-selected-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.file-selected-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.file-selected-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-selected-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.file-selected-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

/* Modal e barra de reconexão do Blazor Server */
#components-reconnect-modal {
    z-index: 100000 !important;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    position: fixed;
    top: 16px;
    right: 16px;
    background: var(--surface, #1e293b);
    color: var(--text, #f8fafc);
    border: 1px solid var(--border, #334155);
    border-radius: var(--radius-md, 10px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    padding: 14px 20px;
    display: flex !important;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    max-width: 420px;
    animation: modal-fade-in 0.2s ease-out;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none !important;
}

#blazor-error-ui {
    display: none !important;
}

/* ==========================================================================
   Quadro de Insights & Padrões Comerciais de Marketplace
   ========================================================================== */

.insights-section {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

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

.insights-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(139, 92, 246, 0.15));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.insights-title {
    font-size: 1.28rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insights-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

.insights-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.insights-alert-box {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 10px;
    padding: 20px;
}

.insight-kpi-card {
    border-radius: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.insight-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.diagnostic-narrative-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-left: 4px solid var(--primary);
}

.diagnostic-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.insights-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light, #F1F5F9);
    padding-bottom: 12px;
}

.insights-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.insights-card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

.top-days-list {
    display: flex;
    flex-direction: column;
}

.top-day-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light, #F1F5F9);
    align-items: flex-start;
}

.top-day-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.top-day-rank {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.top-day-rank.rank-1 {
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FCD34D;
}

.top-day-rank.rank-2 {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #CBD5E1;
}

.top-day-rank.rank-3 {
    background: #FFEDD5;
    color: #C2410C;
    border: 1px solid #FDBA74;
}

.top-day-info {
    flex: 1;
}

.factors-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.factor-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.25;
}

.factor-badge-compact {
    font-size: 0.7rem;
    padding: 1px 6px;
}

.factor-doubleday {
    background: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.factor-feriado {
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FDE68A;
}

.factor-iniciomes {
    background: #DCFCE7;
    color: #15803D;
    border: 1px solid #BBF7D0;
}

.factor-meiomes {
    background: #E0E7FF;
    color: #4338CA;
    border: 1px solid #C7D2FE;
}

.factor-fds {
    background: #F3E8FF;
    color: #7E22CE;
    border: 1px solid #E9D5FF;
}

.factor-default {
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.hourly-bars-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hourly-bar-row {
    display: flex;
    flex-direction: column;
}

.hourly-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.weekdays-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
    margin-top: 8px;
}

.weekday-item {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.weekday-item.weekday-champion {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.weekday-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 2px;
}

.weekday-pedidos {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.weekday-bar-container {
    height: 52px;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.weekday-bar-fill {
    width: 14px;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.weekday-fat {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
}

.weekday-val {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ==========================================================================
   Componente Seletor de Período (Mês Cheio e Calendário Customizado)
   ========================================================================== */

.seletor-periodo-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.seletor-periodo-control {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    box-shadow: var(--shadow-sm);
    height: 38px;
    padding: 2px;
}

.btn-periodo-nav {
    background: transparent;
    border: none;
    width: 28px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-periodo-nav:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.btn-periodo-trigger {
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    text-align: left;
    height: 32px;
}

.btn-periodo-trigger:hover,
.btn-periodo-trigger.active {
    background: var(--surface-alt);
}

.trigger-calendar-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.trigger-label-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.trigger-label-main {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.trigger-label-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.trigger-chevron-icon {
    color: var(--text-muted);
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.btn-periodo-trigger.active .trigger-chevron-icon {
    transform: rotate(180deg);
}

.seletor-periodo-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.seletor-periodo-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1001;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 330px;
    padding: 14px;
    animation: modal-fade-in 0.15s ease-out;
}

.seletor-tabs {
    display: flex;
    background: var(--surface-alt);
    padding: 3px;
    border-radius: 8px;
    margin-bottom: 12px;
    gap: 3px;
}

.seletor-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.seletor-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.seletor-ano-nav,
.cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.btn-ano-nav {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: all 0.15s ease;
}

.btn-ano-nav:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ano-display,
.cal-mes-display {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text);
    text-transform: capitalize;
}

.meses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.btn-mes-grid {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-family: inherit;
}

.btn-mes-grid:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.06);
}

.btn-mes-grid.selected {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.btn-mes-grid.current {
    border-color: var(--primary);
}

.badge-mes-atual {
    font-size: 9px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.12);
    padding: 1px 4px;
    border-radius: 4px;
}

.btn-mes-grid.selected .badge-mes-atual {
    display: none;
}

.seletor-shortcuts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-light, #F1F5F9);
}

.btn-shortcut {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    font-weight: 500;
}

.btn-shortcut:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface-alt);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.cal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 12px;
}

.cal-day-empty {
    height: 32px;
}

.cal-day {
    height: 32px;
    width: 100%;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    font-family: inherit;
}

.cal-day:hover {
    background: var(--surface-alt);
    font-weight: 700;
}

.cal-day.range-start {
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 6px 0 0 6px !important;
}

.cal-day.range-end {
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 0 6px 6px 0 !important;
}

.cal-day.range-start.range-end {
    border-radius: 6px !important;
}

.cal-day.in-range {
    background: rgba(37, 99, 235, 0.12) !important;
    color: var(--primary) !important;
    font-weight: 600;
    border-radius: 0 !important;
}

.cal-day.today {
    border: 1px solid var(--primary);
}

.custom-inputs-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--surface-alt);
    border-radius: 8px;
}

.custom-input-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.custom-input-box label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.custom-input-box input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 11.5px;
    background: var(--surface);
    color: var(--text);
}

.custom-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border-light, #F1F5F9);
    padding-top: 10px;
}





