:root {
            --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

            /* Cores da Marca — Institucional Navy (azul do brasão CMDC) */
            --brand-50: #eef4fb;
            --brand-100: #e8f0fa;
            --brand-200: #c7dbf0;
            --brand-300: #9db8d8;
            --brand-500: #1c5f9e;
            --brand-600: #0a3d73;
            --brand-700: #082f57;

            /* Cores Semânticas */
            --success: #2f855a; --success-bg: #e9f5ee;
            --warning: #b25e09; --warning-bg: #fdf0e4;
            --danger: #b42323;  --danger-bg: #fbe9e9;
            --info: #0a3d73;    --info-bg: #e8f0fa;
            --purple: #7c3aad;  --purple-bg: #f5eefa;
            --gold: #c2a14d;    --gold-bg: #faf5e8;

            /* Sidebar — navy fixo em ambos os temas */
            --sidebar-navy: #0b2e55;
            --sidebar-text: #a8c2df;
            --sidebar-text-active: #ffffff;
            --sidebar-sub: #7fa3cd;
            --sidebar-hover-bg: rgba(255,255,255,0.08);
            --sidebar-active-bg: rgba(255,255,255,0.14);
            --sidebar-border: rgba(255,255,255,0.09);

            /* Cores Claras */
            --bg-light: #f2f5f9;
            --sidebar-bg-light: var(--sidebar-navy);
            --card-bg-light: #ffffff;
            --header-bg-light: #ffffff;
            --text-primary-light: #132a44;
            --text-secondary-light: #5a6b82;
            --text-muted-light: #8194ab;
            --border-light: #e3e9f1;
            --shadow-color-light: rgba(16, 42, 74, 0.06);

            /* Cores Escuras */
            --bg-dark: #0f1826;
            --sidebar-bg-dark: var(--sidebar-navy);
            --card-bg-dark: #16233a;
            --header-bg-dark: #16233a;
            --text-primary-dark: #eef2f8;
            --text-secondary-dark: #a7b6cc;
            --text-muted-dark: #7c8ba3;
            --border-dark: rgba(255,255,255,0.08);
            --shadow-color-dark: rgba(0, 0, 0, 0.35);

            /* Transições e Bordas */
            --radius: 12px;
            --radius-sm: 9px;
            --transition-speed: 0.15s;
        }

        /* Aplicação das variáveis de tema */
        body {
            --bg: var(--bg-light);
            --bg-color-only: var(--bg-light);
            --sidebar-bg: var(--sidebar-bg-light);
            --card-bg: var(--card-bg-light);
            --header-bg: var(--header-bg-light);
            --text-primary: var(--text-primary-light);
            --text-secondary: var(--text-secondary-light);
            --text-muted: var(--text-muted-light);
            --border-color: var(--border-light);
            --shadow: none;
            --shadow-float: 0 20px 50px rgba(16, 42, 74, 0.18);
            --brand-bg-active: var(--brand-50);
            --brand-text-active: var(--brand-700);
        }

        body[data-theme="dark"] {
            --bg: var(--bg-dark);
            --bg-color-only: var(--bg-dark);
            --sidebar-bg: var(--sidebar-bg-dark);
            --card-bg: var(--card-bg-dark);
            --header-bg: var(--header-bg-dark);
            --text-primary: var(--text-primary-dark);
            --text-secondary: var(--text-secondary-dark);
            --text-muted: var(--text-muted-dark);
            --border-color: var(--border-dark);
            --shadow: none;
            --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.5);
            --brand-bg-active: rgba(10, 61, 115, 0.25);
            --brand-text-active: #bcd3ee;
        }

        /* Reset Básico e Estilos Globais */
        *, *::before, *::after {
            box-sizing: border-box;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
                scroll-behavior: auto !important;
            }
            .btn:hover, .kpi:hover, .notification-item:hover {
                transform: none;
            }
        }

        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }

        body {
            background: var(--bg);
            color: var(--text-secondary);
            font-family: var(--font-sans);
            font-size: 14px;
            line-height: 1.6;
            transition: background-color var(--transition-speed), color var(--transition-speed);
        }
        
        h1, h2, h3, h4, h5, h6 {
            margin: 0;
            color: var(--text-primary);
            font-weight: 700;
        }
        h1 { font-size: 1.875rem; }
        h2 { font-size: 1.1875rem; margin-bottom: 1.25rem; }
        h3 { font-size: 0.9375rem; margin-bottom: 1rem; }

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border-width: 0;
        }

        .app-layout {
            display: flex;
            flex-direction: row;
            position: fixed;
            inset: 0;
        }

        /* ===== Sidebar ===== */
        .sidebar {
            width: 230px;
            min-width: 230px;
            background: var(--sidebar-navy);
            border-right: none;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            z-index: 200;
            transition: width 0.25s ease, min-width 0.25s ease;
            overflow: hidden;
        }
        .sidebar.collapsed { width: 72px; min-width: 72px; }

        .sidebar-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 0.75rem;
            height: 65px;
            flex-shrink: 0;
            border-bottom: 1px solid var(--sidebar-border);
            gap: 0.5rem;
        }
        .sidebar-logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            min-width: 0;
            overflow: hidden;
        }
        .sidebar-logo-icon {
            width: 40px; height: 40px;
            background: #fff;
            border: none;
            border-radius: 9px;
            padding: 5px;
            box-sizing: border-box;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }
        .sidebar-logo-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
        .sidebar-logo-text-wrap {
            display: flex; flex-direction: column; min-width: 0; overflow: hidden;
            transition: opacity 0.2s ease;
        }
        .sidebar-logo-text {
            font-size: 1rem; font-weight: 700; color: #fff;
            white-space: nowrap; opacity: 1;
            letter-spacing: -0.2px;
            line-height: 1.3;
        }
        .sidebar-logo-sub {
            font-size: 0.656rem; font-weight: 600; color: var(--sidebar-sub);
            white-space: nowrap; letter-spacing: 0.8px; line-height: 1.3;
        }
        /* Colapsado: mantém o brasão visível, esconde só o texto */
        .sidebar.collapsed .sidebar-logo { justify-content: center; }
        .sidebar.collapsed .sidebar-logo-text-wrap { display: none; }
        .sidebar.collapsed .sidebar-header {
            flex-direction: column; justify-content: center;
            height: auto; padding: 0.75rem 0; gap: 0.4rem;
        }
        .sidebar-header .icon-btn { color: var(--sidebar-text); }
        .sidebar-header .icon-btn:hover { background-color: var(--sidebar-hover-bg); color: #fff; }
        .sidebar-collapse-btn svg { transition: transform 0.25s ease; }
        .sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

        .sidebar-nav { flex-grow: 1; padding: 0.875rem 0.75rem; overflow-y: auto; overflow-x: hidden; }
        .sidebar-nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.125rem; }
        .sidebar-nav a {
            display: flex; align-items: center; gap: 0.6875rem;
            padding: 0.625rem 0.75rem; margin: 0;
            border-radius: 8px; text-decoration: none;
            color: var(--sidebar-text); font-weight: 500; font-size: 0.875rem;
            white-space: nowrap; overflow: hidden; position: relative;
            transition: color var(--transition-speed), background-color var(--transition-speed);
        }
        .sidebar-nav a:hover { color: #fff; background-color: var(--sidebar-hover-bg); }
        .sidebar-nav a.active { color: var(--sidebar-text-active); background-color: var(--sidebar-active-bg); font-weight: 600; }
        .sidebar-nav a svg { flex-shrink: 0; width: 17px; height: 17px; stroke-width: 2; }
        .sidebar-nav .nav-label { transition: opacity 0.15s ease, width 0.15s ease; }
        .sidebar.collapsed .sidebar-nav a { justify-content: center; gap: 0; padding: 0.625rem; }
        .sidebar.collapsed .sidebar-nav .nav-label { opacity: 0; width: 0; overflow: hidden; }

        /* ===== App Body (right of sidebar) ===== */
        .app-body {
            flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
        }

        .main-content {
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            flex-grow: 1;
        }

        .page-title {
            font-size: 1.1875rem; font-weight: 700; color: var(--text-primary);
            margin: 0; letter-spacing: -0.2px;
        }

        /* ===== Sidebar Overlay (mobile) ===== */
        .sidebar-overlay {
            position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.45);
            z-index: 190; opacity: 0; visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s ease;
        }
        .sidebar-overlay.active { opacity: 1; visibility: visible; }

        .app-header {
            backdrop-filter: saturate(180%) blur(12px);
            -webkit-backdrop-filter: saturate(180%) blur(12px);
            background: color-mix(in srgb, var(--header-bg) 90%, transparent);
            border-bottom: 1px solid var(--border-color);
            padding: 0 1.75rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            height: 65px;
            flex-shrink: 0;
            z-index: 100;
            transition: background-color var(--transition-speed), border-color var(--transition-speed), height 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
        }
        .app-header.header-compact {
            height: 56px;
            padding: 0 1.5rem;
            box-shadow: 0 6px 20px var(--shadow-color-light);
        }
        body[data-theme="dark"] .app-header.header-compact {
            box-shadow: 0 6px 20px var(--shadow-color-dark);
        }

        .header-left { display: flex; align-items: center; gap: 1rem; }
        .header-right { display: flex; align-items: center; gap: 1rem; }
        
        .header-logo h1 { font-size: 1.25rem; color: var(--brand-600); cursor: default; }
        
        #welcomeMsg { font-weight: 600; color: var(--text-primary); }
        .icon-btn {
            background: none; border: none; cursor: pointer; padding: 0.25rem; border-radius: 50%;
            display: inline-flex; align-items: center; justify-content: center;
            transition: background-color var(--transition-speed); color: var(--text-muted);
        }
        .icon-btn:hover { background-color: var(--brand-bg-active); color: var(--brand-600); }
        .icon-btn svg { width: 20px; height: 20px; }
        
        .icon-btn:focus-visible, .top-nav a:focus-visible, .theme-menu-btn:focus-visible, .theme-toggle-btn:focus-visible {
            outline: 2px solid var(--brand-500);
            outline-offset: 2px;
            border-radius: 4px;
        }

        .theme-toggle-btn {
            background: none; border: 1px solid var(--border-color); cursor: pointer;
            padding: 0.35rem 0.7rem 0.35rem 0.55rem; border-radius: 999px;
            display: inline-flex; align-items: center; gap: 0.4rem;
            transition: background-color var(--transition-speed), border-color var(--transition-speed);
            color: var(--text-secondary);
        }
        .theme-toggle-btn:hover { background-color: var(--brand-bg-active); color: var(--brand-600); border-color: var(--brand-300); }
        .theme-toggle-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
        .theme-toggle-btn .chevron { width: 13px; height: 13px; color: var(--text-muted); }
        .theme-toggle-label { font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
        @media (max-width: 640px) {
            .theme-toggle-label, .theme-toggle-btn .chevron { display: none; }
            .theme-toggle-btn { padding: 0.35rem; border-radius: 50%; border: none; }
        }

        .top-nav { display: flex; align-items: center; height: 100%; }
        .top-nav ul { list-style: none; padding: 0; margin: 0; display: flex; height: 100%; }
        .top-nav a {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0 1rem;
            height: 100%;
            text-decoration: none;
            color: var(--text-secondary);
            font-weight: 600;
            transition: color var(--transition-speed), background-color var(--transition-speed);
            position: relative; 
        }
        .top-nav a::after {
            content: "";
            position: absolute;
            left: 1rem;
            right: 1rem;
            bottom: -8px;
            height: 3px;
            background: var(--brand-600);
            transform: scaleX(0);
            transform-origin: left;
            transition: transform .25s ease;
        }
        .top-nav a:hover {
            color: var(--brand-600);
            background-color: var(--brand-bg-active);
        }
        .top-nav a:hover::after,
        .top-nav a.active::after {
            transform: scaleX(1);
        }
        .top-nav a.active {
            color: var(--brand-600);
        }
        .top-nav a.active svg { color: var(--brand-600); }
        .top-nav a svg { width: 20px; height: 20px; }

        #mobile-menu-toggle { display: none; }

        main {
            padding: 2rem;
            flex-grow: 1;
            min-width: 0;
            width: 100%;
            box-sizing: border-box;
        }

        .card {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 1.5rem;
            transition: background-color var(--transition-speed), border-color var(--transition-speed);
        }
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.5625rem 1.125rem;
            border-radius: 9px;
            font-weight: 600;
            cursor: pointer;
            border: 1px solid transparent;
            text-decoration: none;
            transition: transform var(--transition-speed), box-shadow var(--transition-speed), background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
        }
        .btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(16, 42, 74, 0.12);
        }
        .btn.primary { background-color: var(--brand-600); color: #fff; border-color: var(--brand-600); }
        .btn.primary:hover { background-color: var(--brand-700); }
        .btn.secondary { background-color: var(--card-bg); color: var(--text-secondary); border-color: var(--border-color); }
        .btn.secondary:hover { border-color: var(--brand-600); color: var(--brand-600); background-color: var(--brand-50); }
        body[data-theme="dark"] .btn.secondary:hover { background-color: rgba(255,255,255,0.06); border-color: var(--brand-200); color: var(--brand-200); }
        .btn.danger { background-color: var(--danger-bg); color: var(--danger); border-color: transparent; }
        .btn.danger:hover { background-color: var(--danger); color: #fff; }
        .input, .select, textarea {
            width: 100%; background-color: var(--card-bg); color: var(--text-primary); border: 1.5px solid var(--border-color);
            border-radius: 9px; padding: 0.625rem 0.75rem; outline: none;
            transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
        }
        .input:focus, .select:focus, textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(10, 61, 115, 0.16); }
        body[data-theme="dark"] .input, body[data-theme="dark"] .select, body[data-theme="dark"] textarea { background-color: #101b2c; }

        .theme-switch-wrapper {
            position: relative;
        }
        .theme-menu {
            position: absolute;
            top: calc(100% + 1rem);
            right: 0;
            width: 220px;
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            box-shadow: var(--shadow-float);
            z-index: 1000;
            padding: 0.5rem;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
        }
        .theme-menu.active {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }
        .theme-menu-btn {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            width: 100%;
            padding: 0.5rem 0.75rem;
            border-radius: 8px;
            border: none;
            background-color: transparent;
            color: var(--text-secondary);
            font-family: var(--font-sans);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            text-align: left;
        }
        .theme-menu-btn:hover {
            background-color: var(--brand-bg-active);
            color: var(--brand-600);
        }
        .theme-menu-btn.active {
            background-color: var(--brand-bg-active);
            color: var(--brand-700);
        }
        .theme-menu-btn svg {
            width: 20px;
            height: 20px;
        }
        .theme-menu-divider {
            height: 1px;
            background-color: var(--border-color);
            margin: 0.5rem 0;
        }

        .login-overlay {
            position: fixed; inset: 0;
            background: #fff;
            display: flex; z-index: 2001;
        }
        .login-card {
            width: 100%; height: 100%;
            background: #fff;
            display: flex;
        }
        .login-hero {
            flex: 1 1 55%;
            background: linear-gradient(160deg, #092c52 0%, #0a3d73 55%, #0e4a89 100%);
            color: #fff;
            display: flex; flex-direction: column; justify-content: center;
            padding: 3rem 5vw;
        }
        .login-hero-shield { width: 110px; filter: brightness(0) invert(1); opacity: 0.95; margin-bottom: 1.75rem; }
        .login-hero-eyebrow {
            font-size: 0.8125rem; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase;
            color: #9fc0e8; margin: 0 0 0.625rem;
        }
        .login-hero-title { font-size: 3rem; font-weight: 700; letter-spacing: -1px; line-height: 1.15; color: #fff; margin: 0; }
        .login-panel {
            flex: 0 0 420px; max-width: 420px;
            background: #fff;
            display: flex; flex-direction: column; justify-content: center;
            padding: 3rem 4vw;
            overflow-y: auto;
            text-align: left;
        }
        .login-panel h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary-light); margin: 0 0 0.35rem; letter-spacing: -0.3px; }
        .login-panel-subtitle { color: var(--text-secondary-light); font-size: 0.875rem; margin: 0 0 1.75rem; }
        .login-card .grupo { margin-bottom: 1.1rem; text-align: left;}
        .login-card label { display: block; font-weight: 600; color: var(--text-secondary-light); margin-bottom: 0.4375rem; font-size: 0.8125rem; }
        .login-erro { color: var(--danger); font-weight: 600; margin-top: 1rem; min-height: 1.2em; text-align: left; }
        .login-acoes { margin-top: 1.5rem; }
        .login-acoes .btn { width: 100%; padding: 0.75rem 1rem; font-size: 0.9375rem; box-shadow: 0 4px 14px rgba(10, 61, 115, 0.35); }
        .login-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }
        .lembrar-me { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary-light); font-size: 0.84rem; justify-content: flex-start; }
        .login-forgot { font-size: 0.84rem; color: var(--brand-600); font-weight: 600; }
        /* A tela de login mantém sempre o visual claro, independente do tema do app */
        .login-panel .input {
            background: #fafbfd; color: #132a44; border: 1.5px solid #d5dce6;
        }
        .login-panel .input::placeholder { color: #94a3b8; }
        .login-panel .input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(10, 61, 115, 0.15); }
        .login-mobile-brand { display: none; }
        @media (max-width: 800px) {
            .login-hero { display: none; }
            .login-panel { flex: 1 1 auto; max-width: none; align-items: center; justify-content: flex-start; padding-top: 3.5rem; }
            .login-panel > * { width: 100%; max-width: 380px; }
            .login-mobile-brand {
                display: flex; flex-direction: column; align-items: center;
                text-align: center; margin-bottom: 2rem;
            }
            .login-mobile-brand img { width: 88px; margin-bottom: 1rem; }
            .login-mobile-eyebrow {
                font-size: 0.6875rem; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase;
                color: var(--brand-500); margin-bottom: 0.25rem;
            }
            .login-mobile-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.5px; color: var(--brand-600); }
            .login-panel h2 { text-align: center; }
            .login-panel-subtitle { text-align: center; }
        }

        .dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 1.5rem; }
        .dash-kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1.5rem; }
        .kpi {
            background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius);
            padding: 1.125rem 1.25rem; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow var(--transition-speed), border-color var(--transition-speed);
            display: flex; flex-direction: column; gap: 0.5625rem;
        }
        .kpi:hover { box-shadow: 0 2px 8px var(--shadow-color-light); border-color: var(--brand-200); }
        body[data-theme="dark"] .kpi:hover { box-shadow: 0 2px 8px var(--shadow-color-dark); }
        .kpi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0; }
        .kpi h4 { margin: 0; color: var(--text-secondary); font-weight: 600; font-size: 0.8125rem; }
        .kpi-icon {
            opacity: 1; flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px;
            display: flex; align-items: center; justify-content: center;
            background: color-mix(in srgb, currentColor 14%, transparent);
        }
        .kpi-icon svg { width: 15px; height: 15px; }
        .kpi .v { font-size: 1.875rem; font-weight: 700; color: var(--text-primary); line-height: 1; letter-spacing: -1px; }
        
        .dash-left-col { grid-column: 1; display: grid; gap: 1.5rem; min-width: 0; overflow: hidden; }
        .dash-right-col { grid-column: 2; display: grid; gap: 1.5rem; align-content: start; width: 310px; min-width: 310px; }
        
        .prazos-list, .alert-list { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; }
        .prazos-list li, .alert-list li { display: flex; align-items: flex-start; gap: 1rem; padding: 0.75rem 0.25rem; border-bottom: 1px solid var(--border-color); }
        .prazos-list li:last-child, .alert-list li:last-child { border-bottom: none; }
        .prazo-date { display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; background-color: var(--info-bg); color: var(--info); border-radius: 10px; width: 44px; height: 44px; flex-shrink: 0;}
        .prazo-date.prazo-date-danger { background-color: var(--danger-bg); color: var(--danger); }
        .prazo-date.prazo-date-warning { background-color: var(--warning-bg); color: var(--warning); }
        .prazo-date.prazo-date-info { background-color: var(--info-bg); color: var(--info); }
        .prazo-date .month { font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }
        .prazo-date .day { font-size: 0.9375rem; font-weight: 800; line-height: 1.3; }
        .prazo-info .type, .alert-info .type { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
        .prazo-info .desc, .alert-info .desc { font-weight: 600; color: var(--text-primary); }

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

        .toolbar { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
        .toolbar .input { max-width: 350px; flex-grow: 1;}
        .toolbar .select { max-width: 200px;}
        .toolbar .actions-group { margin-left: auto; display: flex; gap: 1rem; flex-wrap: wrap; }

        #btnToggleFiltros { position: relative; }
        #btnToggleFiltros.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
        #btnSelecionar.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

        .bulk-bar {
            display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
            background: var(--card-bg); border: 1px solid var(--border-color);
            border-radius: 12px; padding: 0.75rem 1.1rem; margin-bottom: 1.25rem;
        }
        .bulk-selall { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
        .bulk-selall input { width: 16px; height: 16px; cursor: pointer; }
        .bulk-count { font-weight: 700; color: var(--text-primary); }
        .bulk-bar-actions { margin-left: auto; display: flex; gap: 0.6rem; flex-wrap: wrap; }
        .sel-chk { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-600); flex-shrink: 0; }
        tr.row-selected td { background: color-mix(in srgb, var(--brand-600) 10%, transparent); }
        .proc-card.row-selected { border-color: var(--brand-600); box-shadow: 0 0 0 1px var(--brand-600); }
        .filtros-count {
            display: inline-flex; align-items: center; justify-content: center;
            min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
            background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 800;
        }
        .filtros-panel {
            background: var(--card-bg); border: 1px solid var(--border-color);
            border-radius: 12px; padding: 1.1rem 1.25rem; margin-bottom: 1.5rem;
        }
        .filtros-grid {
            display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 1rem;
        }
        .filtros-grid .form-group label {
            font-size: 0.76rem; font-weight: 700; color: var(--text-muted);
            margin-bottom: 0.3rem; display: block;
        }
        .filtros-grid .select, .filtros-grid .input { width: 100%; }
        .filtros-footer {
            display: flex; justify-content: flex-end; margin-top: 1rem;
            padding-top: 0.9rem; border-top: 1px solid var(--border-color);
        }
        @media (max-width: 640px) {
            .filtros-grid { grid-template-columns: 1fr 1fr; }
        } 
        
        .table-wrap { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
        table { width: 100%; border-collapse: collapse; }
        thead th { position: sticky; top: 0; background-color: #f8fafc; color: var(--text-muted); text-align: left; font-weight: 700; font-size: 0.719rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); text-transform: uppercase; letter-spacing: 0.5px; }
        body[data-theme="dark"] thead th { background-color: rgba(255,255,255,0.04); }
        tbody td { padding: 1rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; color: var(--text-secondary); }
        tbody tr:last-child td { border-bottom: none; }
        tbody tr:nth-child(even) { background-color: var(--brand-50); }
        tbody tr:hover { background-color: var(--brand-100); }
        body[data-theme="dark"] tbody tr:nth-child(even) { background-color: rgba(255,255,255,0.03); }
        body[data-theme="dark"] tbody tr:hover { background-color: rgba(255,255,255,0.07); }
        .status { display: inline-block; padding: 0.1875rem 0.625rem; border-radius: 999px; font-weight: 700; font-size: 0.6875rem; }
        .status.em-analise{background:var(--warning-bg);color:var(--warning);} .status.pendente{background:var(--danger-bg);color:var(--danger);} .status.finalizado{background:var(--success-bg);color:var(--success);}
        .status.aguardando-documentacao{background:var(--info-bg);color:var(--info);} .status.em-diligencia{background:var(--purple-bg);color:var(--purple);} .status.arquivado{background:#eef1f5;color:#5a6b82;}
        .status.rascunho{background:var(--warning-bg);color:var(--warning);} .status.emitido{background:var(--success-bg);color:var(--success);}
        body[data-theme="dark"] .status.arquivado{background:rgba(255,255,255,0.08);color:var(--text-secondary-dark);}

        /* ===== Indicador de urgência de prazo (lista e cards) ===== */
        tbody tr.row-vencido { box-shadow: inset 4px 0 0 var(--danger); }
        tbody tr.row-alerta  { box-shadow: inset 4px 0 0 var(--warning); }
        .prazo-cell { display: inline-flex; align-items: center; gap: 4px; }
        .prazo-cell.row-vencido { color: var(--danger); font-weight: 700; }
        .prazo-cell.row-alerta  { color: var(--warning); font-weight: 700; }
        .urgencia-icon { flex-shrink: 0; }
        .proc-card.row-vencido { border-left: 4px solid var(--danger); }
        .proc-card.row-alerta  { border-left: 4px solid var(--warning); }

        .lei-numero { font-weight: 700; color: var(--brand-600); font-size: 0.84rem; white-space: nowrap; }
        .lei-ementa { font-size: 0.8125rem; line-height: 1.4; }
        .lei-tipo-pill { background: var(--info-bg); color: var(--info); white-space: nowrap; }
        .lei-row-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

        .danger-zone h3 { color: var(--danger); }

        .pagination-container { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
        .page-link { border: 1px solid var(--border-color); background-color: var(--card-bg); color: var(--text-secondary); font-weight: 600; border-radius: 8px; padding: 0.5rem 0.8rem; cursor: pointer; transition: all var(--transition-speed); }
        .page-link:hover { border-color: var(--brand-500); color: var(--brand-600); background-color: var(--brand-50); }
        .page-link.active { background-color: var(--brand-600); border-color: var(--brand-600); color: #fff; }
        .page-link.disabled { opacity: 0.5; cursor: not-allowed; }
        .page-link.ellipsis { border: none; background: none; cursor: default; padding: 0.5rem 0.3rem; color: var(--text-muted); }
        .page-link.ellipsis:hover { border: none; background: none; color: var(--text-muted); }

        .pagination-bar {
            display: flex; align-items: center; justify-content: space-between;
            flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem;
        }
        .pagination-bar .pagination-container { margin-top: 0; justify-content: flex-start; flex: 1; }
        .items-per-page { display: flex; align-items: center; gap: 0.5rem; }
        .items-per-page label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
        .items-per-page .select { width: auto; min-width: 72px; padding: 0.4rem 1.8rem 0.4rem 0.6rem; }

        #mobile-menu-toggle { display: none; }
        .mobile-cards-container { display: none; gap: 1rem; flex-direction: column; }
        .proc-card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
        .proc-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
        .proc-card-header .num { font-weight: 700; color: var(--text-primary); }
        .proc-card-body .item { font-size: 0.9rem; }
        .proc-card-body .item strong { color: var(--text-muted); }
        .proc-card-footer { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-color); }

        /* ===== Kanban Board ===== */
        .view-toggle-group {
            display: flex; border: none; background: #eef1f6; border-radius: 9px; padding: 3px; gap: 2px; overflow: hidden; flex-shrink: 0;
        }
        body[data-theme="dark"] .view-toggle-group { background: rgba(255,255,255,0.06); }
        .view-toggle-group .btn {
            border-radius: 7px; border: none; padding: 0.375rem 1rem;
            display: flex; align-items: center; gap: 0.4rem;
            font-size: 0.82rem; font-weight: 600;
            background: transparent; color: var(--text-secondary);
        }
        .view-toggle-group .btn + .btn { border-left: none; }
        .view-toggle-group .btn:hover { transform: none; box-shadow: none; }
        .view-toggle-group .btn.active { background: var(--card-bg); color: var(--brand-600); box-shadow: 0 1px 3px rgba(16,42,74,0.12); }

        .kanban-board {
            display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem;
            align-items: flex-start; min-height: 300px; width: 100%;
        }
        .kanban-board::-webkit-scrollbar { height: 6px; }
        .kanban-board::-webkit-scrollbar-track { background: var(--border-color); border-radius: 3px; }
        .kanban-board::-webkit-scrollbar-thumb { background: var(--brand-300); border-radius: 3px; }

        .kanban-column {
            flex: 0 0 240px; min-width: 240px;
            background: var(--bg-color-only);
            border: 1px solid var(--border-color);
            border-radius: 11px; display: flex; flex-direction: column;
            max-height: calc(100vh - 260px);
        }
        .kanban-col-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 0.7rem 0.875rem;
            border-radius: 11px 11px 0 0;
            background: var(--card-bg);
            border-bottom: 1px solid var(--border-color);
        }
        .kanban-col-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
        .kanban-col-count {
            font-size: 0.72rem; font-weight: 700;
            background: var(--border-color); color: var(--text-muted);
            padding: 2px 8px; border-radius: 999px;
        }
        .kanban-col-body {
            flex: 1; overflow-y: auto; padding: 0.625rem;
            display: flex; flex-direction: column; gap: 0.5rem;
        }
        .kanban-col-body::-webkit-scrollbar { width: 4px; }
        .kanban-col-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

        .kanban-card {
            background: var(--card-bg); border: 1px solid var(--border-color);
            border-radius: 11px; padding: 0.7rem; cursor: grab;
            transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
            touch-action: none; user-select: none; -webkit-user-select: none;
        }
        .kanban-card:hover { box-shadow: 0 4px 14px rgba(16,42,74,0.12); transform: translateY(-2px); }
        body[data-theme="dark"] .kanban-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
        .kanban-card:active { cursor: grabbing; }
        .kanban-card.dragging { opacity: 0.35; }
        .kanban-col-body[data-col-key="finalizado"] .kanban-card,
        .kanban-col-body[data-col-key="arquivado"] .kanban-card { opacity: 0.75; }
        .kanban-card-ghost {
            position: fixed; z-index: 3000; margin: 0; pointer-events: none;
            box-shadow: 0 12px 32px rgba(0,0,0,0.28);
            transform: rotate(2deg); opacity: 0.96;
        }
        .kanban-col-body.drag-over {
            background: var(--brand-100);
            outline: 2px dashed var(--brand-600); outline-offset: -5px;
            border-radius: 8px;
        }
        body[data-theme="dark"] .kanban-col-body.drag-over {
            background: rgba(28,95,158,0.18); outline-color: var(--brand-300);
        }
        body.kanban-dragging, body.kanban-dragging * { cursor: grabbing !important; }
        .kanban-card-num { font-size: 0.72rem; font-weight: 800; color: var(--brand-600); margin-bottom: 0.2rem; }
        body[data-theme="dark"] .kanban-card-num { color: var(--brand-300); }
        .kanban-card-int { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.2rem; line-height: 1.3; }
        .kanban-card-obj {
            font-size: 0.76rem; color: var(--text-muted); margin-bottom: 0.4rem; line-height: 1.4;
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        }
        .kanban-card-footer {
            display: flex; align-items: center; justify-content: space-between;
            padding-top: 0.45rem; border-top: 1px solid var(--border-color); margin-top: 0.4rem; gap: 0.4rem;
        }
        .kanban-prazo { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
        .kanban-prazo.vencido { color: var(--danger); }
        .kanban-prazo.alerta  { color: var(--warning); }
        .kanban-empty { text-align: center; color: var(--text-muted); font-size: 0.78rem; padding: 1rem 0; margin: 0; }

        /* ===== Badge de anotações no card ===== */
        .anotacoes-badge {
            display: inline-flex; align-items: center; gap: 4px;
            background: var(--brand-100); color: var(--brand-700);
            font-size: 0.72rem; font-weight: 700;
            padding: 2px 7px; border-radius: 999px;
            border: 1px solid var(--brand-200);
        }
        body[data-theme="dark"] .anotacoes-badge {
            background: rgba(28,95,158,0.22); color: var(--brand-300);
            border-color: rgba(28,95,158,0.4);
        }
        .anotacoes-badge { cursor: help; }

        /* ===== Tooltip de anotações (hover no balãozinho) ===== */
        .anot-tooltip {
            position: fixed; z-index: 4000; max-width: 320px;
            background: var(--card-bg); color: var(--text-primary);
            border: 1px solid var(--border-color); border-radius: 9px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.18);
            padding: 0.65rem 0.75rem; font-size: 0.78rem; line-height: 1.45;
            pointer-events: none;
        }
        .anot-tip-title {
            font-weight: 800; font-size: 0.66rem; text-transform: uppercase;
            letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.45rem;
        }
        .anot-tip-row { padding: 0.4rem 0; }
        .anot-tip-row + .anot-tip-row { border-top: 1px solid var(--border-color); }
        .anot-tip-meta { display: flex; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.15rem; }
        .anot-tip-user { font-weight: 700; color: var(--brand-600); }
        body[data-theme="dark"] .anot-tip-user { color: var(--brand-300); }
        .anot-tip-date { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
        .anot-tip-text { color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }
        .anot-tip-more { margin-top: 0.45rem; font-size: 0.7rem; color: var(--text-muted); font-style: italic; }

        /* ===== Seção de anotações no modal Ver ===== */
        .anotacoes-section h4 { margin-bottom: 1rem; }
        .anotacoes-timeline { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
        .anotacoes-empty { font-size: 0.875rem; color: var(--text-muted); text-align: center; padding: 1rem 0; margin: 0; }

        .anotacao-entry {
            display: flex; gap: 0.75rem; align-items: flex-start;
            background: var(--bg-color-only);
            border: 1px solid var(--border-color);
            border-radius: 9px; padding: 0.75rem;
        }
        .anotacao-avatar {
            width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
            background: var(--brand-100); color: var(--brand-700);
            display: flex; align-items: center; justify-content: center;
            font-size: 0.75rem; font-weight: 800; border: 1.5px solid var(--brand-200);
        }
        body[data-theme="dark"] .anotacao-avatar {
            background: rgba(28,95,158,0.22); color: var(--brand-300);
            border-color: rgba(28,95,158,0.4);
        }
        .anotacao-body { flex: 1; min-width: 0; }
        .anotacao-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
        .anotacao-user { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
        .anotacao-date { font-size: 0.78rem; color: var(--text-muted); }
        .anotacao-texto { margin: 0; font-size: 0.875rem; color: var(--text-secondary); white-space: pre-wrap; line-height: 1.5; }

        .anotacao-nova { display: flex; gap: 0.75rem; align-items: flex-end; }
        .anotacao-textarea {
            flex: 1; min-height: 72px; resize: vertical;
            border: 1.5px solid var(--border-color); border-radius: 9px;
            padding: 0.6rem 0.875rem; font-size: 0.875rem;
            color: var(--text-primary); background: var(--card-bg);
            font-family: inherit; transition: border-color 0.2s;
            outline: none;
        }
        .anotacao-textarea:focus { border-color: var(--brand-400); }

        .anotacao-meta-right { display: flex; align-items: center; gap: 0.4rem; }
        .anotacao-acoes { display: flex; gap: 0.15rem; }
        .anotacao-acao-btn {
            display: inline-flex; align-items: center; justify-content: center;
            width: 26px; height: 26px; padding: 0; border-radius: 7px;
            border: 1px solid transparent; background: transparent;
            color: var(--text-muted); cursor: pointer; transition: all 0.15s;
        }
        .anotacao-acao-btn:hover { background: var(--brand-100); color: var(--brand-700); border-color: var(--border-color); }
        .anotacao-acao-btn.danger:hover { background: #fbe9e9; color: #b42323; border-color: #f3cccc; }
        body[data-theme="dark"] .anotacao-acao-btn:hover { background: rgba(28,95,158,0.22); color: var(--brand-300); }
        body[data-theme="dark"] .anotacao-acao-btn.danger:hover { background: rgba(180,35,35,0.2); color: #e88b8b; border-color: rgba(180,35,35,0.35); }
        .anotacao-edit-input { min-height: 60px; width: 100%; }
        .anotacao-edit-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }
        .anotacao-edit-actions .btn { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

        @media (max-width: 992px) {
            #proc-table-wrap { display: none; }
            .mobile-cards-container { display: flex; }
            .table-wrap { overflow-x: auto; }
            .table-wrap table { min-width: 640px; }
            .table-wrap .empty-state { position: sticky; left: 0; max-width: calc(100vw - 3rem); }
            #mobile-menu-toggle { display: inline-flex; }
            .app-header { padding: 0 1rem; gap: 0.5rem; }
            .header-right { gap: 0.5rem; }
            #welcomeMsg { display: none; }
            .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
            .header-left { min-width: 0; flex: 1; }
            main { padding: 1.5rem; }
            .dash-grid { grid-template-columns: 1fr; }
            .dash-right-col { grid-column: 1; width: 100%; min-width: 0; }
            .two-col-grid { grid-template-columns: 1fr !important; }

            .sidebar {
                position: fixed;
                left: 0; top: 0; bottom: 0;
                z-index: 200;
                transform: translateX(-100%);
                width: 240px !important;
                transition: transform 0.3s ease;
                box-shadow: 4px 0 24px rgba(0,0,0,0.15);
            }
            .sidebar.mobile-open { transform: translateX(0); }
            .sidebar.collapsed { width: 240px !important; min-width: 240px !important; }
            .sidebar.collapsed .sidebar-header {
                flex-direction: row; justify-content: space-between;
                height: 65px; padding: 0 0.75rem; gap: 0.5rem;
            }
            .sidebar.collapsed .sidebar-logo { justify-content: flex-start; }
            .sidebar.collapsed .sidebar-logo-text-wrap { display: flex; opacity: 1; width: auto; }
            .sidebar.collapsed .sidebar-nav a { justify-content: flex-start; gap: 0.6875rem; padding: 0.625rem 0.75rem; }
            .sidebar.collapsed .sidebar-nav .nav-label { opacity: 1; width: auto; overflow: visible; }
            .sidebar-collapse-btn { display: none; }
        }

        .cal-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
        .cal-title { margin: 0 auto; font-weight: 700; font-size: 1.25rem; color: var(--text-primary); }
        .cal-zone { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; min-height: 70vh; }
        @media (max-width: 992px) {
            .cal-zone { grid-template-columns: 1fr; min-height: 0; }
            .cal-title { font-size: 1.0625rem; }
            #new_evt { width: 100%; }
            .cell { height: 96px; padding: 0.35rem; }
        }
        .cal-left { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border-color); display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
        .cal-body { overflow: auto; padding: 0.5rem; }
        .grid-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background-color: var(--border-color); border: 1px solid var(--border-color); }
        .weekdays { display: grid; grid-template-columns: repeat(7, 1fr); }
        .wd { background-color: var(--bg-color-only); color: var(--text-secondary); font-weight: 600; text-align: center; padding: 0.5rem; }
        .cell { background-color: var(--card-bg); padding: 0.5rem; display: flex; flex-direction: column; height: 140px; }
        .cell:has(.dnum .today) { background-color: var(--brand-50); }
        body[data-theme="dark"] .cell:has(.dnum .today) { background-color: rgba(10, 61, 115, 0.2); }
        .dnum { font-weight: 600; text-align: right; color: var(--text-primary); flex-shrink: 0; }
        .dnum .today { background: var(--brand-600); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; }
        
        .events-wrapper { flex-grow: 1; overflow: hidden; position: relative; }
        .event-dots-container { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
        .event-dot {
            width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
            color: #fff; font-size: 0.7rem; font-weight: 700; cursor: pointer; flex-shrink: 0; text-transform: uppercase;
            transition: transform 0.15s ease;
        }
        .event-dot:hover { transform: scale(1.1); }
        .event-dot.g{background:var(--brand-500)} .event-dot.a{background:var(--success)} .event-dot.r{background:var(--info)}
        .event-dot.p{background:var(--warning)} .event-dot.u{background:var(--danger)} .event-dot.e{background:#5a6b82} .event-dot.o{background:var(--gold)}

        /* ===== Calendário: visões Semana / Dia ===== */
        .time-view { display: flex; flex-direction: column; min-width: 640px; }
        .time-head, .time-allday-row, .time-grid { display: grid; }
        .time-head { position: sticky; top: 0; background: var(--card-bg); z-index: 2; border-bottom: 1px solid var(--border-color); }
        .time-head-corner { border-right: 1px solid var(--border-color); }
        .time-head-day { text-align: center; padding: 0.5rem 0.25rem; border-left: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
        .thd-wd { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
        .thd-num { font-size: 1rem; font-weight: 700; color: var(--text-primary); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
        .thd-num.today { background: var(--brand-600); color: #fff; }

        .time-allday-row { border-bottom: 2px solid var(--border-color); background: var(--bg-color-only); }
        .time-allday-label { font-size: 0.66rem; color: var(--text-muted); font-weight: 700; padding: 0.35rem 0.4rem; border-right: 1px solid var(--border-color); display: flex; align-items: center; }
        .time-allday-cell { border-left: 1px solid var(--border-color); padding: 0.25rem; display: flex; flex-direction: column; gap: 3px; min-height: 34px; }

        .time-grid { grid-auto-rows: 44px; }
        .time-hour-label { font-size: 0.66rem; color: var(--text-muted); text-align: right; padding: 0 0.5rem; border-right: 1px solid var(--border-color); transform: translateY(-0.6em); }
        .time-hour-cell { border-left: 1px solid var(--border-color); border-top: 1px solid var(--border-color); padding: 2px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; cursor: pointer; }
        .time-hour-cell:hover { background: var(--brand-bg-active); }

        .time-chip {
            font-size: 0.66rem; font-weight: 600; color: #fff; padding: 2px 6px; border-radius: 6px;
            cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        .time-chip:hover { filter: brightness(1.08); }
        .time-chip.g{background:var(--brand-500)} .time-chip.a{background:var(--success)} .time-chip.r{background:var(--info)}
        .time-chip.p{background:var(--warning)} .time-chip.u{background:var(--danger)} .time-chip.e{background:#5a6b82} .time-chip.o{background:var(--gold)}

        .side { display: flex; flex-direction: column; gap: 1.5rem; }
        .side .row { display:flex; align-items:center; gap:8px; margin:6px 0 }
        .tag-pill { display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border-radius:999px; color:#fff; font-weight:700 }
        .tag-pill.g{background:var(--brand-500)} .tag-pill.a{background:var(--success)} .tag-pill.r{background:var(--info)} .tag-pill.p{background:var(--warning)} .tag-pill.u{background:var(--danger)} .tag-pill.e{background:#5a6b82} .tag-pill.o{background:var(--gold)}

        .modal { 
            position: fixed; inset: 0; background: rgba(16, 24, 40, .6); display: none; 
            align-items: flex-start; justify-content: center; z-index: 1001; overflow-y: auto; padding: 4rem 1rem; 
        }
        .dialog { width: 100%; max-width: 640px; background-color: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow-float); margin: auto; display: flex; flex-direction: column; }
        .dialog-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); }
        .dialog-body { padding: 1.5rem; flex-grow: 1; }
        .dialog-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 0.75rem; background-color: var(--bg-color-only); border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; flex-wrap: wrap; }

        .parecer-dialog .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
        .parecer-timbre-topo, .parecer-timbre-rodape {
            text-align: center; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 9px;
            background-color: var(--bg-color-only); color: var(--text-primary); margin-bottom: 1rem;
        }
        .parecer-timbre-topo strong { display: block; font-size: 0.85rem; letter-spacing: 0.02em; }
        .parecer-timbre-rodape { margin-top: 1rem; margin-bottom: 0; font-size: 0.75rem; color: var(--text-muted); }
        .parecer-body .ql-toolbar { border-color: var(--border-color); background-color: var(--bg-color-only); border-top-left-radius: 10px; border-top-right-radius: 10px; }
        .parecer-body .ql-container { border-color: var(--border-color); background-color: var(--card-bg); color: var(--text-primary); min-height: 320px; font-size: 1rem; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
        .parecer-body .ql-editor.ql-blank::before { color: var(--text-muted); }
        body[data-theme="dark"] .parecer-body .ql-picker-label { color: var(--text-primary); }
        body[data-theme="dark"] .parecer-body .ql-stroke { stroke: var(--text-primary); }
        body[data-theme="dark"] .parecer-body .ql-fill { fill: var(--text-primary); }
        body[data-theme="dark"] .parecer-body .ql-picker-options { background-color: var(--card-bg); color: var(--text-primary); }

        .confirm-dialog-header { display: flex; align-items: center; gap: 0.75rem; }
        .confirm-icon {
            display: flex; align-items: center; justify-content: center;
            width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
            background: var(--danger-bg); color: var(--danger);
        }
        #confirm-message { margin: 0; color: var(--text-primary); line-height: 1.5; }
        #confirm-message strong { color: var(--text-primary); }

        .form-grid { display: grid; gap: 1rem; }
        .form-grid.two-cols { grid-template-columns: 1fr 1fr; }
        .form-grid.three-cols { grid-template-columns: repeat(3, 1fr); }
        .full-width { grid-column: 1 / -1; }
        .form-group label { font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; display: block; }
        .view-section { border: 1px solid var(--border-color); border-radius: 9px; padding: 1rem; margin-bottom: 1rem; }
        .view-section h4 { color: var(--brand-600); margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
        .view-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
        .view-item strong { display: block; font-size: 0.8rem; color: var(--text-muted); }
        .view-item p { margin: 0; word-break: break-word; }
        
        .notification-bell { position: relative; cursor: pointer; color: var(--text-secondary); }
        .notification-bell:hover { color: var(--text-primary); }
        .notification-bell svg { width: 24px; height: 24px; fill: currentColor; }
        .notification-count { position: absolute; top: -5px; right: -8px; background-color: var(--danger); color: white; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; font-weight: bold; display: flex; align-items: center; justify-content: center; }
        .notification-panel { position: absolute; top: calc(100% + 1rem); right: 0; width: 380px; background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-float); z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity 0.2s ease, transform 0.2s ease; }
        .notification-panel.active { opacity: 1; visibility: visible; transform: translateY(0); }
        @media (max-width: 640px) {
            .notification-panel { position: fixed; top: 72px; left: 0.75rem; right: 0.75rem; width: auto; max-width: none; }
        }
        .notification-header { padding: 1rem; border-bottom: 1px solid var(--border-color); }
        .notification-filters { display: flex; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); }
        .notification-filter-btn { border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
        .notification-filter-btn.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
        .notification-panel ul { list-style: none; padding: 0; margin: 0; max-height: 350px; overflow-y: auto; }
        .notification-item { position: relative; display: flex; align-items: center; gap: 1rem; padding: 1rem; transition: transform 0.2s, box-shadow 0.2s; border-bottom: 1px solid var(--border-color); }
        .notification-item:last-child { border-bottom: none; }
        .notification-item:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
        .notification-item .icon-wrapper { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
        .notification-item .icon-wrapper svg { width: 20px; height: 20px; fill: currentColor; }
        .notification-item .notification-content { flex-grow: 1; cursor: pointer; }
        .notification-item .title { font-weight: 700; color: var(--text-primary); }
        .notification-item .subtitle { font-size: 0.85rem; color: var(--text-secondary); }
        .notification-close-btn { position: absolute; top: 8px; right: 8px; border: none; background: transparent; cursor: pointer; opacity: 0.6; }
        .notification-close-btn:hover { opacity: 1; }
        .notification-close-btn svg { width: 16px; height: 16px; fill: var(--text-muted); }
        .notification-item.type-prazo { background-color: var(--danger-bg); }
        .notification-item.type-prazo .icon-wrapper { color: var(--danger); }
        .notification-item.type-evento { background-color: var(--info-bg); }
        .notification-item.type-evento .icon-wrapper { color: var(--info); }
        .notification-item.type-alerta { background-color: var(--warning-bg); }
        .notification-item.type-alerta .icon-wrapper { color: var(--warning); }

        .list .user-item, .list .version-item, .list .emissor-item { display:flex; justify-content:space-between; align-items:center; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
        .list .user-item:last-child, .list .version-item:last-child, .list .emissor-item:last-child { border-bottom: none; }
        .doc-list .doc-item {border:1px solid var(--border-color);border-radius:9px;padding:8px;display:flex;justify-content:space-between;align-items:center;background:var(--card-bg); gap: 8px;}

        #toast-container { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.75rem; width: 100%; max-width: 350px; }
        .toast { background-color: var(--card-bg); color: var(--text-primary); border-radius: 9px; box-shadow: var(--shadow-float); padding: 1rem; display: flex; align-items: center; gap: 0.75rem; border-left: 4px solid; opacity: 0; transform: translateX(2rem); animation: toast-slide-in 0.4s ease-out forwards, toast-fade-out 0.4s ease-in 3.5s forwards; }
        .toast .icon { flex-shrink: 0; width: 20px; height: 20px; }
        .toast.success { border-color: var(--success); } .toast.success .icon { color: var(--success); }
        .toast.danger { border-color: var(--danger); } .toast.danger .icon { color: var(--danger); }
        .toast.info { border-color: var(--info); } .toast.info .icon { color: var(--info); }
        @keyframes toast-slide-in { to { opacity: 1; transform: translateX(0); } }
        @keyframes toast-fade-out { from { opacity: 1; } to { opacity: 0; transform: translateY(1rem); height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; } }

        /* ===== Empty States ===== */
        .empty-state {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            padding: 3.5rem 2rem; text-align: center; color: var(--text-muted); gap: 0.75rem;
        }
        .empty-state svg { width: 56px; height: 56px; opacity: 0.3; color: var(--text-muted); }
        .empty-state h3 { color: var(--text-secondary); margin: 0; font-size: 1rem; font-weight: 600; }
        .empty-state p { margin: 0; font-size: 0.875rem; max-width: 300px; }

        /* ===== Histórico de Alterações ===== */
        .historico-timeline { display: flex; flex-direction: column; }
        .historico-entry {
            display: flex; gap: 1rem; position: relative; padding-bottom: 1.5rem;
        }
        .historico-entry::before {
            content: ''; position: absolute; left: 19px; top: 42px; bottom: 0;
            width: 2px; background: var(--border-color); z-index: 0;
        }
        .historico-entry:last-child::before { display: none; }
        .historico-icon {
            width: 40px; height: 40px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; z-index: 1; border: 2px solid transparent;
        }
        .historico-icon svg { width: 18px; height: 18px; }
        .historico-icon.criado { background: var(--success-bg); color: var(--success); border-color: var(--success); }
        .historico-icon.editado { background: var(--info-bg); color: var(--info); border-color: var(--info); }
        .historico-icon.excluido { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
        .historico-icon.parecer-criado, .historico-icon.parecer-editado { background: var(--info-bg); color: var(--info); border-color: var(--info); }
        .historico-icon.parecer-emitido { background: var(--success-bg); color: var(--success); border-color: var(--success); }
        .historico-icon.parecer-reaberto { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
        .historico-content { flex: 1; background: var(--bg); border: 1px solid var(--border-color); border-radius: 9px; padding: 0.875rem 1rem; }
        .historico-header { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
        .historico-action { font-weight: 700; color: var(--text-primary); font-size: 0.9rem; }
        .historico-meta { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
        .historico-changes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
        .historico-changes li { font-size: 0.82rem; display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
        .historico-changes .campo { font-weight: 700; color: var(--text-secondary); min-width: fit-content; }
        .historico-changes .de { color: var(--danger); text-decoration: line-through; opacity: 0.8; }
        .historico-changes .para { color: var(--success); font-weight: 600; }
        .historico-loading { padding: 2rem; text-align: center; color: var(--text-muted); }

        /* ===== Animação de Seção ===== */
        @keyframes section-fade-in {
            from { opacity: 0; transform: translateY(10px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        .section-enter { animation: section-fade-in 0.22s ease-out; }

        /* ===== Animação de Modal ===== */
        @keyframes dialog-slide-in {
            from { opacity: 0; transform: translateY(-18px) scale(0.97); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }
        .modal .dialog { animation: dialog-slide-in 0.22s ease-out; }

        /* ===== Widget de Atividades ===== */
        .atividades-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
        .atividade-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--border-color); }
        .atividade-item:last-child { border-bottom: none; }
        .atividade-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
        .atividade-icon svg { width: 13px; height: 13px; }
        .atividade-icon.criado { background: var(--success-bg); color: var(--success); }
        .atividade-icon.editado { background: var(--info-bg); color: var(--info); }
        .atividade-icon.excluido { background: var(--danger-bg); color: var(--danger); }
        .atividade-content { flex: 1; min-width: 0; }
        .atividade-desc { font-size: 0.82rem; color: var(--text-primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .atividade-meta { font-size: 0.74rem; color: var(--text-muted); }
