
        :root {
            --bg-primary: #07111f;
            --bg-secondary: #0b1628;
            --bg-card: rgba(15, 23, 42, 0.78);
            --bg-card-hover: rgba(30, 41, 59, 0.94);
            --bg-input: #0f172a;
            --border: #1e3a5f;
            --border-light: #31537a;
            --accent: #60a5fa;
            --accent-glow: rgba(96, 165, 250, 0.14);
            --text-primary: #e5eefb;
            --text-secondary: #cbdcf2;
            --text-muted: #8aa4c7;
            --red: #ef4444;
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            letter-spacing: -0.011em;
        }

        h1, h2, h3, .font-display { font-family: 'Outfit', sans-serif; }
        .font-mono { font-family: 'JetBrains Mono', monospace; }

        .sidebar {
            background: var(--bg-secondary);
            border-right: 1px solid var(--border);
            width: 260px;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .nav-item {
            transition: all 0.2s ease;
            position: relative;
        }

        .nav-item::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 0;
            background-color: var(--accent);
            transition: height 0.2s ease;
            border-radius: 0 4px 4px 0;
        }

        .nav-item.active {
            background: var(--accent-glow);
            color: var(--accent);
        }

        .nav-item.active::before { height: 20px; }

        .card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            backdrop-filter: blur(8px);
            transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
        }

        .card:hover {
            border-color: var(--border-light);
            transform: translateY(-2px);
            box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
        }

        .btn {
            @apply inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg font-semibold transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed;
        }

        .btn-primary { background-color: var(--accent); color: #08111f; }
        .btn-primary:hover { filter: brightness(1.1); box-shadow: 0 0 15px var(--accent-glow); }
        .btn-ghost { @apply bg-transparent hover:bg-surface-variant text-muted hover:text-on-surface; }
        .btn-danger-ghost { @apply bg-transparent hover:bg-error/10 text-error/70 hover:text-error; }

        .badge { @apply px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider whitespace-nowrap inline-flex items-center gap-1.5; }

        .modal-backdrop { background-color: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); }

        @keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        .animate-up { animation: slideUp 0.4s ease forwards; }

        .func-selector { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
        .func-btn { padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; }
        .func-btn:hover { border-color: var(--accent); color: var(--text-primary); }
        .func-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); font-weight: 600; }

        /* ===== Formulários integrados ao layout escuro ===== */
        .modal-input,
        .hour-input,
        .func-search-input {
            width: 100%;
            min-height: 44px;
            padding: 0.68rem 0.95rem;
            border-radius: 0.85rem;
            border: 1px solid rgba(96, 165, 250, 0.30) !important;
            background:
                linear-gradient(180deg, rgba(23, 32, 51, 0.98) 0%, rgba(11, 22, 40, 0.98) 100%) !important;
            color: var(--text-primary) !important;
            box-shadow:
                inset 0 1px 0 rgba(255, 255, 255, 0.045),
                0 0 0 1px rgba(0, 0, 0, 0.10);
            outline: none;
            transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
            font-size: 0.875rem;
            line-height: 1.25rem;
            caret-color: var(--accent);
        }

        .modal-input:hover,
        .hour-input:hover,
        .func-search-input:hover {
            border-color: rgba(96, 165, 250, 0.58) !important;
            background:
                linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%) !important;
        }

        .modal-input:focus,
        .hour-input:focus,
        .func-search-input:focus {
            border-color: var(--accent) !important;
            box-shadow:
                0 0 0 3px rgba(96, 165, 250, 0.16),
                0 0 22px rgba(96, 165, 250, 0.10),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
        }

        .modal-input::placeholder,
        .func-search-input::placeholder {
            color: rgba(203, 220, 242, 0.56) !important;
            letter-spacing: 0.01em;
        }

        .modal-input[readonly],
        .modal-input:read-only.auto-date-input,
        .auto-date-input {
            background:
                linear-gradient(180deg, rgba(15, 47, 111, 0.52) 0%, rgba(15, 23, 42, 0.98) 100%) !important;
            border-color: rgba(96, 165, 250, 0.58) !important;
            color: #bfdbfe !important;
            font-weight: 800;
        }

        .modal-input:disabled,
        .hour-input:disabled {
            opacity: 0.65;
            cursor: not-allowed;
        }

        select.modal-input {
            appearance: none;
            -webkit-appearance: none;
            padding-right: 2.75rem;
            background-image:
                linear-gradient(45deg, transparent 50%, #60a5fa 50%),
                linear-gradient(135deg, #60a5fa 50%, transparent 50%),
                linear-gradient(180deg, rgba(23, 32, 51, 0.98) 0%, rgba(11, 22, 40, 0.98) 100%) !important;
            background-position:
                calc(100% - 18px) calc(50% - 2px),
                calc(100% - 13px) calc(50% - 2px),
                0 0 !important;
            background-size: 5px 5px, 5px 5px, 100% 100% !important;
            background-repeat: no-repeat !important;
            cursor: pointer;
        }

        .modal-input option {
            color: var(--text-primary) !important;
            background: #0f172a !important;
        }

        input[type="date"].modal-input {
            color-scheme: dark;
            font-family: 'JetBrains Mono', monospace;
            letter-spacing: 0.01em;
        }

        input[type="date"].modal-input::-webkit-calendar-picker-indicator {
            filter: invert(66%) sepia(63%) saturate(1702%) hue-rotate(187deg) brightness(100%) contrast(98%);
            opacity: 0.95;
            cursor: pointer;
            padding: 4px;
            border-radius: 0.45rem;
            background-color: rgba(96, 165, 250, 0.12);
        }

        textarea.modal-input {
            min-height: 88px;
            line-height: 1.45;
            resize: vertical;
        }

        .hour-input {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 800;
            text-align: center;
        }

        .table-scroll .modal-input,
        table .modal-input {
            min-height: 38px;
            padding: 0.55rem 0.75rem;
            border-radius: 0.70rem;
            font-size: 0.78rem;
        }

        table input[type="date"].modal-input,
        table input[type="number"].modal-input {
            background:
                linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%) !important;
        }

        .card .modal-input,
        .card .func-search-input {
            backdrop-filter: blur(8px);
        }

        label + .modal-input,
        label + div .modal-input {
            margin-top: 0.2rem;
        }

        @keyframes pulse-warning {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.6; transform: scale(1.1); color: #ffb4ab; }
        }
        .alert-pulse { animation: pulse-warning 1.5s infinite ease-in-out; }

        .page { min-width: 0; }
        .content-shell { max-width: 1280px; margin: 0 auto; }
        .table-scroll { overflow-x: auto; }
        .empty-state { border: 1px dashed var(--border-light); background: rgba(255,255,255,0.025); }

        @media (max-width: 1023px) {
            .sidebar { box-shadow: 24px 0 60px rgba(0,0,0,0.45); }
            main { width: 100%; }
        }

        @media (max-width: 640px) {
            header { padding-left: 1rem; padding-right: 1rem; }
            #topbar-title { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            #topbar-action-btn { padding-left: 0.75rem; padding-right: 0.75rem; }
            .card { transform: none !important; }
            .card:hover { transform: none; }
            .responsive-row { align-items: flex-start; gap: 0.75rem; }
            .responsive-row > div:last-child { width: 100%; justify-content: space-between; }
        }

        /* ===== Function Sidebar (Matriz de Treinamentos) ===== */
        .func-sidebar {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 1rem;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            height: calc(100vh - 200px);
            max-height: 720px;
        }
        .func-sidebar-header {
            padding: 12px 16px;
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex-shrink: 0;
        }
        .func-search-input {
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: 0.5rem;
            color: var(--text-primary);
            font-size: 11px;
            padding: 6px 10px;
            width: 100%;
            outline: none;
            transition: border-color 0.15s;
        }
        .func-search-input::placeholder { color: var(--text-muted); }
        .func-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
        .func-sidebar-list {
            flex: 1;
            overflow-y: auto;
            padding: 6px;
        }
        .func-sidebar-list::-webkit-scrollbar { width: 4px; }
        .func-sidebar-list::-webkit-scrollbar-track { background: transparent; }
        .func-sidebar-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
        .func-sidebar-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 9px 12px;
            border-radius: 0.5rem;
            font-size: 12px;
            font-weight: 500;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.15s;
            border-left: 3px solid transparent;
            margin-bottom: 2px;
            text-transform: uppercase;
            letter-spacing: 0.02em;
        }
        .func-sidebar-item:hover {
            background: var(--accent-glow);
            color: var(--text-primary);
        }
        .func-sidebar-item.active {
            background: var(--accent-glow);
            color: var(--accent);
            border-left-color: var(--accent);
            font-weight: 700;
        }
        .func-sidebar-count {
            margin-left: auto;
            font-size: 10px;
            font-weight: 700;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            color: var(--text-muted);
            border-radius: 9999px;
            padding: 1px 7px;
            min-width: 28px;
            text-align: center;
            flex-shrink: 0;
        }
        .func-sidebar-item.active .func-sidebar-count {
            background: var(--accent);
            color: var(--surface);
            border-color: var(--accent);
        }
        .btn-new-func {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 7px 14px;
            border-radius: 0.5rem;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
            color: #ffffff;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
            flex-shrink: 0;
            white-space: nowrap;
        }
        .btn-new-func:hover {
            filter: brightness(1.15);
            box-shadow: 0 4px 16px rgba(37, 99, 235, 0.6);
            transform: translateY(-1px);
        }
        .btn-new-func:active { transform: scale(0.97); }
        .btn-new-func .material-symbols-outlined {
            font-size: 15px;
            animation: pulse-glow 2s infinite ease-in-out;
        }
        @keyframes pulse-glow {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }

        @media (max-width: 1023px) {
            .func-sidebar { height: auto; max-height: 280px; }
        }
    

/* Rolagem interna do módulo Crachá: impede dados ocultos em zoom alto/baixo */
#page-cracha .table-scroll {
    max-height: calc(100vh - 340px);
    min-height: 320px;
    overflow-x: auto !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
}
#page-cracha .table-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
#page-cracha .table-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, .72);
    border-radius: 999px;
}
#page-cracha .table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(96,165,250,.55), rgba(96,165,250,.9));
    border: 2px solid rgba(15, 23, 42, .72);
    border-radius: 999px;
}
#page-cracha .table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(96,165,250,1);
}
#page-cracha .table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 12;
    background: #172033;
    box-shadow: 0 1px 0 rgba(138, 164, 199, .22);
}
@media (max-height: 760px) {
    #page-cracha .table-scroll {
        max-height: calc(100vh - 300px);
        min-height: 260px;
    }
}
@media (max-width: 768px) {
    #page-cracha .table-scroll {
        max-height: calc(100vh - 320px);
        min-height: 260px;
    }
}

