:root {
    /* Light Theme (Default) */
    --bg-color: #f0f2f5;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #d7dde8 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.12);
    --text-color: #1a1a1a;
    --text-muted: #333333;
    --text-ghost: #777777;
    --primary-color: #0062cc; /* Darker blue for better contrast */
    --secondary-color: #495057;
    --success: #1e7e34;
    --warning: #856404;
    --danger: #bd2130;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --sidebar-text: #1a1a1a;
    --input-bg: rgba(255, 255, 255, 0.95);
    --input-text: #111111;

    /* Kanban Colors */
    --approval-color: #856404;
    --approved-color: #0056b3;
    --rejected-color: #bd2130;
    --purchasing-color: #d9480f;
    --purchased-color: #087f5b;
    --done-color: #1e7e34;
    
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #0062cc 0%, #4facfe 100%);
    --secondary-gradient: linear-gradient(135deg, #495057 0%, #adb5bd 100%);
    --danger-gradient: linear-gradient(135deg, #bd2130 0%, #ff4b2b 100%);
    --success-gradient: linear-gradient(135deg, #1e7e34 0%, #00ff87 100%);

    /* Aliases semânticos (cards, tabelas, dropdowns, gráficos) */
    --color-background-primary: var(--glass-bg);
    --color-background-secondary: color-mix(in srgb, var(--text-color) 5%, transparent);
    --color-text-primary: var(--text-color);
    --color-text-secondary: var(--text-muted);
    --color-text-tertiary: var(--text-ghost);
    --color-border-tertiary: var(--glass-border);
    --color-text-on-accent: #ffffff;
    /* Scrim de modal (independente do texto do tema) */
    --color-scrim: color-mix(in srgb, black 62%, transparent);
    --color-positive-value: #15803d;
    --color-negative-value: #b91c1c;
    --chart-tick-color: rgba(26, 26, 26, 0.68);
    --chart-grid-color: rgba(0, 0, 0, 0.09);
    --chart-legend-color: rgba(26, 26, 26, 0.9);
    --chart-muted-line: rgba(0, 0, 0, 0.22);
    --chart-primary-line: #2f6fbe;
    --chart-primary-fill: rgba(47, 111, 190, 0.2);
    --chart-saldo-line: #b45309;
    --chart-tickets-line: #6d28d9;
    --chart-tickets-fill: rgba(109, 40, 217, 0.16);
    --chart-point-ring: #ffffff;
    --chart-success-area: rgba(30, 126, 52, 0.28);
    --chart-plan-muted: #c9d3dd;
}

body.dark-theme {
    /* Dark Theme - Gray/Charcoal tones */
    --bg-color: #0f0f0f;
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #f8f9fa;
    --text-muted: #dee2e6;
    --text-ghost: #adb5bd;
    --primary-color: #4facfe;
    --secondary-color: #dee2e6;
    --success: #00f2fe;
    --warning: #f7b733;
    --danger: #ff4b2b;
    --sidebar-text: #f8f9fa;
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-text: #ffffff;

    /* Kanban Colors (Dark) - More Vibrant */
    --approval-color: #f9d423;
    --approved-color: #4facfe;
    --rejected-color: #ff416c;
    --purchasing-color: #ff9a9e;
    --purchased-color: #00f2fe;
    --done-color: #00ff87;

    --color-background-secondary: color-mix(in srgb, var(--text-color) 8%, transparent);
    --color-positive-value: #4ade80;
    --color-negative-value: #fca5a5;
    --chart-tick-color: rgba(255, 255, 255, 0.7);
    --chart-grid-color: rgba(255, 255, 255, 0.1);
    --chart-legend-color: rgba(255, 255, 255, 0.92);
    --chart-muted-line: rgba(255, 255, 255, 0.22);
    --chart-primary-line: #7eb8ea;
    --chart-primary-fill: rgba(126, 184, 234, 0.22);
    --chart-saldo-line: #fbbf24;
    --chart-tickets-line: #c4b5fd;
    --chart-tickets-fill: rgba(196, 181, 253, 0.14);
    --chart-point-ring: #121212;
    --chart-success-area: rgba(0, 242, 254, 0.18);
    --chart-plan-muted: #4b5563;

    /* Reaplica aliases no body para herança correta (html :root permanece no tema claro) */
    --color-background-primary: var(--glass-bg);
    --color-text-primary: var(--text-color);
    --color-text-secondary: var(--text-muted);
    --color-text-tertiary: var(--text-ghost);
    --color-border-tertiary: var(--glass-border);
    --color-scrim: color-mix(in srgb, black 72%, transparent);
    color-scheme: dark;
}

body.dark-theme select option {
    background-color: var(--color-background-primary);
    color: var(--color-text-primary);
}

/* Fix de legibilidade para selects no tema escuro (Windows/Chromium) */
body.dark-theme select.input-glass {
    background-color: #1f2329 !important;
    color: #f8f9fa !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

body.dark-theme select.input-glass option {
    background-color: #1f2329 !important;
    color: #f8f9fa !important;
}

body.dark-theme select.input-glass option:disabled {
    color: #aeb6bf;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    margin: 0;
    color: var(--text-color);
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body:not(.dark-theme) {
    color-scheme: light;
}

h1, h2, h3, h4, h5, h6 {
    color: inherit;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.device-card,
.unit-card {
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.btn-glass::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    pointer-events: none;
}

.btn-glass:hover::after {
    left: 100%;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.sidebar .btn-glass {
    justify-content: center;
    width: 100%;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.sidebar .btn-glass i {
    transition: transform 0.3s ease;
}

.sidebar .btn-glass:hover i {
    transform: scale(1.2);
    color: var(--primary-color);
}

.sidebar .btn-glass.active,
.tf-sidebar .btn-glass.active {
    background: var(--primary-gradient);
    color: var(--color-text-on-accent);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(0, 98, 204, 0.3);
}

.sidebar .btn-glass.active i,
.tf-sidebar .btn-glass.active i {
    color: var(--color-text-on-accent);
}

.sidebar .btn-glass.active::before,
.tf-sidebar .btn-glass.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background: var(--color-text-on-accent);
    border-radius: 0 4px 4px 0;
}

.input-glass {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--input-text);
    padding: 0.8rem;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.input-glass.input-filter-active {
    border-color: color-mix(in srgb, var(--primary-color) 60%, transparent);
}

/* focus: regras detalhadas em base.html (input-glass + select/textarea) */

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 2rem;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    flex-grow: 1;
    align-items: start;
    min-height: 100vh;
}

.sidebar {
    height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border-radius: 0 16px 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Firefox */
}

/* fadeIn usa transform no .animate — isso quebra position:sticky no mesmo elemento */
@keyframes tf-sidebar-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.sidebar.animate {
    animation: tf-sidebar-fade-in 0.55s ease forwards;
}

.sidebar.tf-sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    padding: 1.5rem 1rem 1rem;
    justify-content: flex-start;
}

.sidebar::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* —— Sidebar TechFlow: grupos, links modulares, rodapé —— */
.tf-sidebar {
    --tf-mod-geral: #4facfe;
    --tf-mod-finance: #f59f00;
    --tf-mod-ops: #00d4aa;
    --tf-mod-adm: #9b59b6;
    position: relative;
    container-type: size;
    container-name: tf-sidebar;
}

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

.tf-sidebar__footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 0.5rem;
}

.tf-sidebar__footer .tf-sidebar__theme-btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    min-height: 34px;
    padding: 0 12px !important;
    font-size: 12px !important;
    margin-top: 1rem !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

.tf-sidebar__close {
    display: none;
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 6;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    box-shadow: none;
}

.tf-sidebar__close:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: none;
    border-color: transparent;
}

.tf-sidebar__close::after {
    display: none;
}

.tf-sidebar__brand {
    flex-shrink: 0;
    padding: 1rem;
}

.tf-sidebar__logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0 0.5rem 0;
    white-space: nowrap;
    margin-bottom: 0;
}

.tf-sidebar__logo-svg {
    flex-shrink: 0;
}

.tf-sidebar__logo-text {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-family: 'Plus Jakarta Sans', var(--font-main);
    line-height: 1.15;
}

.tf-sidebar__user-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0 0 0.25rem 0;
    font-size: 12px;
    opacity: 0.5;
}

.tf-sidebar__username {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tf-sidebar__profile {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tf-sidebar__divider {
    flex-shrink: 0;
    height: 1px;
    margin: 0.65rem 0 0.5rem;
    background: var(--glass-border);
    border: none;
    opacity: 0.55;
}

.tf-sidebar__divider--subtle {
    height: 0;
    margin: 0.5rem 0.8rem;
    border: none;
    border-top: 1px solid var(--glass-border);
    background: none;
    opacity: 0.3;
}

.tf-sidebar__divider--logout {
    margin-top: 0.75rem;
    margin-bottom: 0.65rem;
}

.tf-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
}

.tf-sidebar__group {
    display: block;
    width: 100%;
    visibility: visible;
    opacity: 1;
}

.tf-sidebar__label {
    display: block;
    width: 100%;
    visibility: visible;
    padding: 0.5rem 1rem 0.2rem 1rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.4;
    color: var(--text-color);
    white-space: nowrap;
    margin-top: 0.5rem;
}

.tf-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    opacity: 0.82;
    transition: all 0.2s ease;
    text-decoration: none;
    margin: 1px 0;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.tf-sidebar-link > span:not(.tf-sidebar-link__icon-wrap) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 0;
    min-width: 0;
}

.tf-sidebar-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

body:not(.dark-theme) .tf-sidebar-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

.tf-sidebar-link.active {
    background: color-mix(in srgb, var(--primary-color) 16%, transparent);
    color: var(--primary-color);
    opacity: 1;
    font-weight: 600;
    box-shadow: inset 3px 0 0 0 var(--primary-color);
}

.tf-sidebar-link::before {
    content: none;
}

.tf-sidebar-link--geral.active {
    box-shadow: inset 3px 0 0 0 var(--tf-mod-geral);
}

.tf-sidebar-link--finance.active {
    box-shadow: inset 3px 0 0 0 var(--tf-mod-finance);
}

.tf-sidebar-link--ops.active {
    box-shadow: inset 3px 0 0 0 var(--tf-mod-ops);
}

.tf-sidebar-link--adm.active {
    box-shadow: inset 3px 0 0 0 var(--tf-mod-adm);
}

.tf-sidebar-link__icon-wrap {
    position: relative;
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 18px;
    width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tf-sidebar-link__icon-wrap i {
    min-width: 18px;
    width: 18px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1;
}

.tf-sidebar-link--geral.active .tf-sidebar-link__icon-wrap i {
    color: var(--tf-mod-geral);
}

.tf-sidebar-link--finance.active .tf-sidebar-link__icon-wrap i {
    color: var(--tf-mod-finance);
}

.tf-sidebar-link--ops.active .tf-sidebar-link__icon-wrap i {
    color: var(--tf-mod-ops);
}

.tf-sidebar-link--adm.active .tf-sidebar-link__icon-wrap i {
    color: var(--tf-mod-adm);
}

.tf-sidebar-ticket-ping {
    position: absolute;
    top: -2px;
    right: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #dc3545;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--glass-bg) 85%, transparent);
    pointer-events: none;
    animation: tf-sidebar-ticket-pulse 2s ease-in-out infinite;
}

@keyframes tf-sidebar-ticket-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.55;
        transform: scale(1.2);
    }
}

.tf-sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: var(--danger);
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.2);
    transition: all 0.2s ease;
    margin: 0.5rem;
    margin-top: 0;
    flex-shrink: 0;
    width: calc(100% - 1rem);
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tf-sidebar-logout > span:not(.tf-sidebar-logout__icon) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 0;
    min-width: 0;
}

.tf-sidebar-logout:hover {
    background: rgba(220, 53, 69, 0.15);
    transform: translateX(2px);
    color: var(--danger);
}

.tf-sidebar-logout__icon {
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 18px;
    width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tf-sidebar-logout__icon i {
    min-width: 18px;
    width: 18px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.95rem;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 20px;
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    transition: padding 0.3s ease;
    min-width: 0;
}

/* Mobile Menu Toggle */
.mobile-toggle {
    display: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 1100;
    transition: all 0.3s ease;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 260px;
        min-width: 260px;
        max-width: 260px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-radius: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        padding: 1rem;
        height: 100vh;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar.tf-sidebar.active .tf-sidebar__close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding: 1rem 20px;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        box-sizing: border-box;
    }

    .mobile-toggle {
        display: flex;
        position: fixed;
        top: 1rem;
        left: 1rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        width: 45px;
        height: 45px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border-radius: 12px;
        z-index: 1001;
    }

    .header-glass {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-glass div:last-child {
        text-align: left !important;
    }
}

/* Components */
.header-glass {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-grid.stat-grid--cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-grid.stat-grid--cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .stat-grid.stat-grid--cols-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .stat-grid.stat-grid--cols-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .stat-grid.stat-grid--cols-4 {
        grid-template-columns: 1fr;
    }

    .stat-grid.stat-grid--cols-5 {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
}

.stat-card.stat-card--stat-top {
    min-height: 110px;
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.stat-card.stat-card--stat-top .financial-label {
    text-align: left;
}

.stat-card.stat-card--stat-top .financial-value {
    text-align: left;
}

.stat-card--stat-top .stat-card-bg-icon {
    position: absolute;
    right: 1rem;
    bottom: 0.5rem;
    font-size: 2rem;
    opacity: 0.06;
    pointer-events: none;
    line-height: 1;
}

.task-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

@media (max-width: 1200px) {
    .task-board {
        grid-template-columns: 1fr;
    }
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-item {
    background: var(--glass-bg);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item.status-Done {
    border-left-color: var(--success);
    opacity: 0.6;
}

.task-item.status-Missed {
    border-left-color: var(--danger);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    animation: fadeIn 0.6s ease forwards;
}

/* Progress bar (dashboard) */
.progress-fill {
    height: 100%;
    background: var(--success);
    width: calc(var(--p, 0) * 1%);
}

/* Budget Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border-tertiary);
}

th {
    color: var(--secondary-color);
}

/* Utilities */
.text-gradient {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Budget Kanban */
.budget-kanban {
    display: grid;
    grid-template-columns: repeat(6, minmax(260px, 1fr));
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0.5rem 2rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

@media (max-width: 1600px) {
    .budget-kanban {
        grid-template-columns: repeat(6, 280px);
    }
}

.budget-col {
    display: flex;
    flex-direction: column;
    min-height: 500px;
    background: color-mix(in srgb, var(--color-text-primary) 3%, transparent);
    border: 1px solid var(--color-border-tertiary);
    border-radius: 16px;
    transition: background 0.3s ease;
}


.budget-col {
    padding: 1rem;
}

.budget-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.budget-col-body {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.budget-count {
    opacity: 0.6;
}

.budget-title-todo {
    color: var(--color-text-tertiary);
}

.budget-title-build {
    color: var(--primary-color);
}

.budget-title-approval {
    color: var(--warning);
}

.budget-title-done {
    color: var(--success);
}

.budget-kanban .budget-card {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--color-text-primary) 7%, transparent) 0%,
        color-mix(in srgb, var(--color-text-primary) 3%, transparent) 100%
    );
    border: 1px solid var(--color-border-tertiary);
    backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.budget-kanban .budget-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--color-text-primary) 10%, transparent) 0%,
        color-mix(in srgb, var(--color-text-primary) 4%, transparent) 100%
    );
    border-color: var(--primary-color);
}

.budget-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg) scale(0.95);
}


.budget-edit {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.budget-edit .btn-glass {
    padding: 0.4rem 0.8rem;
}

.budget-edit-input {
    margin-bottom: 0;
    flex: 1;
    min-width: 140px;
}

/* Financial Cards */
.financial-card {
    padding: 1.5rem;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.financial-card:hover {
    transform: translateY(-5px);
}

.financial-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0.5rem 0;
    line-height: 1;
}

.financial-label {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.financial-progress-container {
    background: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.financial-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

.financial-progress-bar.usage {
    background: linear-gradient(90deg, var(--primary-color), var(--success));
}

.financial-progress-bar.over {
    background: linear-gradient(90deg, var(--warning), var(--danger));
}

.financial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.6;
}

@media (max-width: 992px) {
    .sidebar .btn-glass:not(.tf-sidebar__theme-btn):not(.tf-sidebar__close) {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        margin-bottom: 0.4rem !important;
    }

    .sidebar h1 {
        font-size: 1.1rem !important;
    }

    .sidebar p {
        font-size: 0.8rem;
        margin-bottom: 0.5rem !important;
    }
}

.btn-logout {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
    margin-top: 1rem;
    font-weight: 700;
    border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

.btn-logout:hover {
    background: color-mix(in srgb, var(--danger) 22%, transparent);
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
    color: var(--color-text-on-accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px color-mix(in srgb, var(--danger) 35%, transparent);
}

/* ═══════════════════════════════
   Glass Modal — Dark-Theme Safe
   Used in: tickets.html, budgets_management.html
═══════════════════════════════ */
.modal-content.glass-modal {
    background: var(--color-background-primary);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--color-border-tertiary);
    color: var(--color-text-primary);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.modal-content.glass-modal .modal-header,
.modal-content.glass-modal .modal-footer {
    border-color: var(--color-border-tertiary);
    background: transparent;
}

.modal-content.glass-modal .modal-title {
    color: var(--color-text-primary);
}

.modal-content.glass-modal .btn-close {
    filter: invert(1) opacity(0.65);
}

.modal-content.glass-modal label {
    color: var(--color-text-primary);
}

.modal-content.glass-modal h4,
.modal-content.glass-modal h5,
.modal-content.glass-modal p,
.modal-content.glass-modal span,
.modal-content.glass-modal small,
.modal-content.glass-modal div {
    color: inherit;
}

body:not(.dark-theme) .modal-content.glass-modal .btn-close {
    filter: none;
}

/* Formulários Bootstrap + tema */
body input.form-control,
body select.form-select,
body textarea.form-control,
body select.form-control,
body input.input-glass,
body select.input-glass,
body textarea.input-glass {
    background-color: var(--input-bg);
    border-color: var(--color-border-tertiary);
    color: var(--input-text);
}

body input.form-control:focus,
body select.form-select:focus,
body textarea.form-control:focus,
body select.form-control:focus,
body input.input-glass:focus,
body select.input-glass:focus,
body textarea.input-glass:focus {
    background-color: var(--input-bg);
    border-color: color-mix(in srgb, var(--primary-color) 50%, var(--color-border-tertiary));
    color: var(--input-text);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary-color) 16%, transparent);
}

body .btn-outline-secondary,
body .btn-outline-primary {
    color: var(--color-text-primary);
    border-color: var(--color-border-tertiary);
    background-color: transparent;
}

body .btn-outline-secondary:hover,
body .btn-outline-primary:hover {
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 45%, var(--color-border-tertiary));
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

/* Valores financeiros em tabela (verde/vermelho legíveis) */
.fin-tone-success {
    color: var(--color-positive-value);
}

.fin-tone-danger {
    color: var(--color-negative-value);
}

/* Dashboard — Limpar filtros e Nova Demanda (templates/dashboard.html) */
button#tf-filter-clear.tf-filter-clear-btn {
    background: var(--color-background-secondary);
    color: var(--color-text-secondary);
    border-color: var(--color-border-tertiary);
}

button#tf-filter-clear.tf-filter-clear-btn:hover {
    background: color-mix(in srgb, var(--color-text-primary) 10%, var(--color-background-secondary));
    color: var(--color-text-primary);
    border-color: var(--color-border-tertiary);
}

/* Relatórios — cards de setor (histórico mensal) + modal de detalhe */
.tf-sector-invest-card {
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tf-sector-invest-card:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 4px 0 0 0 color-mix(in srgb, var(--sector-accent, var(--primary-color)) 88%, white 12%),
        0 8px 24px rgba(0, 0, 0, 0.18);
    filter: brightness(1.02);
}

.tf-sector-invest-card:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary-color) 55%, transparent);
    outline-offset: 2px;
}

body.dark-theme .tf-sector-invest-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.tf-sector-budget-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.tf-sector-budget-modal.is-open {
    display: flex;
}

.tf-sector-budget-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.tf-sector-budget-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-radius: 12px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.tf-sector-budget-modal__dialog--in {
    opacity: 1;
    transform: scale(1);
}

.tf-sector-budget-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-left: 14px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.tf-sector-budget-modal__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
    font-family: 'Plus Jakarta Sans', var(--font-main);
}

.tf-sector-budget-modal__sub {
    margin: 0.35rem 0 0 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
}

.tf-sector-budget-modal__x {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: color-mix(in srgb, var(--text-color) 6%, transparent);
    color: var(--text-color);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tf-sector-budget-modal__x:hover {
    background: color-mix(in srgb, var(--text-color) 12%, transparent);
}

.tf-sector-budget-modal__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    font-size: 13px;
}

.tf-sector-budget-modal__loading,
.tf-sector-budget-modal__error,
.tf-sector-budget-modal__empty {
    text-align: center;
    padding: 2.5rem 1rem;
    opacity: 0.85;
}

.tf-sector-budget-modal__error {
    color: var(--danger);
}

.tf-sector-budget-modal__table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.tf-sector-budget-modal__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tf-sector-budget-modal__table th {
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.75;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

.tf-sector-budget-modal__table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--glass-border) 70%, transparent);
    vertical-align: middle;
}

.tf-sector-budget-modal__table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.tf-sector-budget-modal__table tbody tr {
    transition: background 0.15s ease;
}

.tf-sector-budget-modal__table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tf-sector-budget-modal__th {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    padding: 0;
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tf-sector-budget-modal__valor {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.tf-sector-budget-modal__user {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tf-sector-budget-modal__avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-gradient);
    color: var(--color-text-on-accent);
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tf-sector-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}

.tf-sector-badge--ok {
    background: rgba(40, 167, 69, 0.18);
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.35);
}

.tf-sector-badge--pend {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.35);
}

.tf-sector-badge--no {
    background: rgba(220, 53, 69, 0.18);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.35);
}

.tf-sector-budget-modal__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.tf-sector-budget-modal__count {
    font-size: 13px;
    opacity: 0.8;
}

.tf-sector-budget-modal__foot-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-left: auto;
}
