
        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        :root {
            --verde: #38bdf8;
            --verde-light: #e0f4ff;
            --verde-mid: #7dd3fc;
            --bg: #f0f6ff;
            --sidebar: #0a1628;
            --sidebar-text: #7a9cc0;
            --card: #ffffff;
            --border: #dbeafe;
            --text: #0f2744;
            --muted: #4a7fa5;
            --red: #ef4444;
            --red-light: #fee2e2;
            --amber: #f59e0b;
            --amber-light: #fef3c7;
            --blue: #2d7dd2;
            --blue-light: #dbeafe;
        }

        body {
            font-family: 'DM Sans', sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
        }

        #login-screen {
            position: fixed;
            inset: 0;
            z-index: 1000;
            background: var(--sidebar);
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.4s ease;
        }

        .login-box {
            background: #0d1f35;
            border: 1px solid #1a3a5c;
            border-radius: 16px;
            padding: 48px 40px;
            width: 100%;
            max-width: 400px;
            animation: slideUp 0.5s ease;
        }

        .login-logo {
            font-size: 1.6rem;
            font-weight: 700;
            color: #38bdf8;
            letter-spacing: 1px;
            margin-bottom: 8px;
        }

        .login-sub {
            font-size: 0.85rem;
            color: #4a7fa5;
            margin-bottom: 36px;
        }

        .login-label {
            font-size: 0.78rem;
            font-weight: 600;
            color: #7a9cc0;
            letter-spacing: 0.5px;
            text-transform: uppercase;
            margin-bottom: 8px;
            display: block;
        }

        .login-input {
            width: 100%;
            background: #0a1628;
            border: 1px solid #1a3a5c;
            color: #f0f4ff;
            font-family: 'DM Sans', sans-serif;
            font-size: 0.95rem;
            padding: 12px 16px;
            border-radius: 8px;
            outline: none;
            margin-bottom: 20px;
            transition: border-color 0.2s;
        }

        .login-input:focus {
            border-color: #38bdf8;
        }

        .login-hint {
            font-size: 0.78rem;
            color: #2d4a6a;
            margin-bottom: 28px;
        }

        .login-hint span {
            color: #38bdf8;
            font-family: 'DM Mono', monospace;
        }

        .login-btn {
            width: 100%;
            background: #2d7dd2;
            color: #fff;
            font-family: 'DM Sans', sans-serif;
            font-weight: 700;
            font-size: 1rem;
            padding: 14px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s, transform 0.1s;
        }

        .login-btn:hover {
            background: #1a5fa8;
        }

        .login-btn:active {
            transform: scale(0.98);
        }

        .demo-badge {
            text-align: center;
            margin-top: 20px;
            font-size: 0.78rem;
            color: #1a3a5c;
            background: #0d1f35;
            border: 1px solid #1a3a5c;
            border-radius: 6px;
            padding: 8px;
        }

        #app {
            display: none;
            height: 100vh;
            flex-direction: row;
        }

        #app.active {
            display: flex;
        }

        .sidebar {
            width: 240px;
            flex-shrink: 0;
            background: var(--sidebar);
            display: flex;
            flex-direction: column;
            padding: 24px 0;
            position: relative;
            z-index: 10;
        }

        .sidebar-logo {
            padding: 0 24px 24px;
            font-size: 1.4rem;
            font-weight: 700;
            color: #38bdf8;
            letter-spacing: 1px;
            border-bottom: 1px solid #112240;
            margin-bottom: 12px;
        }

        .sidebar-section {
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            color: #1a3a5c;
            padding: 12px 24px 6px;
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 24px;
            color: var(--sidebar-text);
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            border-left: 3px solid transparent;
            transition: all 0.2s;
            margin: 2px 0;
        }

        .nav-item:hover {
            color: #f0f4ff;
            background: rgba(255, 255, 255, 0.04);
        }

        .nav-item.active {
            color: #38bdf8;
            border-left-color: #38bdf8;
            background: rgba(56, 189, 248, 0.06);
        }

        .nav-icon {
            font-size: 1.1rem;
            width: 20px;
            text-align: center;
        }

        .sidebar-footer {
            margin-top: auto;
            padding: 20px 24px;
            border-top: 1px solid #112240;
            font-size: 0.82rem;
            color: #1a3a5c;
        }

        .sidebar-user {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .sidebar-avatar {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: linear-gradient(135deg, #2d7dd2, #0a1628);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            color: #fff;
            font-size: 0.85rem;
        }

        .sidebar-name {
            color: #7a9cc0;
            font-size: 0.85rem;
            font-weight: 600;
        }

        .sidebar-role {
            color: #1a3a5c;
            font-size: 0.75rem;
        }

        .main {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .topbar {
            background: #fff;
            border-bottom: 1px solid var(--border);
            padding: 0 32px;
            height: 64px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            position: sticky;
            top: 0;
            z-index: 5;
        }

        .topbar-title {
            font-size: 1.1rem;
            font-weight: 700;
        }

        .topbar-right {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .topbar-badge {
            background: var(--verde-light);
            color: var(--verde);
            font-size: 0.75rem;
            font-weight: 700;
            padding: 4px 10px;
            border-radius: 20px;
        }

        .notif {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--bg);
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            cursor: pointer;
            position: relative;
        }

        .notif-dot {
            position: absolute;
            top: 4px;
            right: 4px;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--red);
            border: 2px solid #fff;
        }

        .content {
            padding: 28px 32px;
            flex: 1;
        }

        .page {
            display: none;
            animation: fadeIn 0.3s ease;
        }

        .page.active {
            display: block;
        }

        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
            margin-bottom: 28px;
        }

        .kpi-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 20px 24px;
            transition: box-shadow 0.2s;
        }

        .kpi-card:hover {
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
        }

        .kpi-label {
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 8px;
        }

        .kpi-val {
            font-size: 1.8rem;
            font-weight: 700;
            line-height: 1;
            margin-bottom: 6px;
        }

        .kpi-sub {
            font-size: 0.78rem;
            color: var(--muted);
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .kpi-up {
            color: var(--verde);
        }

        .kpi-down {
            color: var(--red);
        }

        .section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;
        }

        .section-title-sm {
            font-size: 1rem;
            font-weight: 700;
        }

        .btn-sm {
            background: #2d7dd2;
            color: #fff;
            font-family: 'DM Sans', sans-serif;
            font-size: 0.82rem;
            font-weight: 700;
            padding: 8px 16px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .btn-sm:hover {
            background: #1a5fa8;
        }

        .btn-sm.outline {
            background: transparent;
            color: #2d7dd2;
            border: 1px solid #2d7dd2;
        }

        .btn-sm.outline:hover {
            background: var(--verde-light);
        }

        .table-wrap {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
        }

        .table-scroll {
            overflow-x: auto;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .table-scroll::-webkit-scrollbar {
            height: 6px;
            width: 6px;
        }

        .table-scroll::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 99px;
        }

        .table-scroll::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 99px;
        }

        .table-scroll::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            min-width: 600px;
        }

        thead {
            background: var(--bg);
        }

        th {
            padding: 12px 16px;
            text-align: left;
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 1px solid var(--border);
            white-space: nowrap;
        }

        td {
            padding: 14px 16px;
            font-size: 0.88rem;
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
            white-space: nowrap;
        }

        tr:last-child td {
            border-bottom: none;
        }

        tr:hover td {
            background: rgba(0, 0, 0, 0.015);
        }

        .badge {
            display: inline-flex;
            align-items: center;
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 700;
        }

        .badge-green {
            background: var(--verde-light);
            color: #2d7dd2;
        }

        .badge-red {
            background: var(--red-light);
            color: var(--red);
        }

        .badge-amber {
            background: var(--amber-light);
            color: var(--amber);
        }

        .badge-blue {
            background: var(--blue-light);
            color: var(--blue);
        }

        .prog-bar {
            background: #e2e8f0;
            border-radius: 99px;
            height: 6px;
            overflow: hidden;
        }

        .prog-fill {
            height: 100%;
            border-radius: 99px;
            background: var(--verde);
            transition: width 0.6s ease;
        }

        .prog-fill.low {
            background: var(--red);
        }

        .prog-fill.mid {
            background: var(--amber);
        }

        .dash-bottom {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-top: 16px;
        }

        .mini-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 20px;
        }

        .mini-title {
            font-size: 0.85rem;
            font-weight: 700;
            margin-bottom: 16px;
            color: var(--text);
        }

        .activity-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 0;
            border-bottom: 1px solid var(--border);
        }

        .activity-item:last-child {
            border-bottom: none;
        }

        .act-icon {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            flex-shrink: 0;
        }

        .act-green {
            background: var(--verde-light);
        }

        .act-red {
            background: var(--red-light);
        }

        .act-amber {
            background: var(--amber-light);
        }

        .act-info {
            flex: 1;
        }

        .act-label {
            font-size: 0.85rem;
            font-weight: 600;
        }

        .act-time {
            font-size: 0.75rem;
            color: var(--muted);
        }

        .act-val {
            font-size: 0.88rem;
            font-weight: 700;
        }

        .act-val.pos {
            color: var(--verde);
        }

        .act-val.neg {
            color: var(--red);
        }

        .fiado-summary {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
            margin-bottom: 24px;
        }

        .caixa-header {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 20px;
            display: grid;
            grid-template-columns: 1fr 1fr 1fr auto;
            gap: 20px;
            align-items: center;
        }

        .caixa-meta {
            display: flex;
            flex-direction: column;
        }

        .caixa-meta-label {
            font-size: 0.75rem;
            color: var(--muted);
            font-weight: 600;
            text-transform: uppercase;
            margin-bottom: 4px;
        }

        .caixa-meta-val {
            font-size: 1.1rem;
            font-weight: 700;
        }

        .modal-overlay {
            position: fixed;
            inset: 0;
            z-index: 500;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(4px);
            display: none;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.open {
            display: flex;
            animation: fadeIn 0.2s ease;
        }

        .modal {
            background: #fff;
            border-radius: 16px;
            padding: 32px;
            width: 100%;
            max-width: 440px;
            animation: slideUp 0.3s ease;
        }

        .modal-title {
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 24px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-label {
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            display: block;
            margin-bottom: 6px;
        }

        .form-input {
            width: 100%;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-family: 'DM Sans', sans-serif;
            font-size: 0.95rem;
            padding: 10px 14px;
            outline: none;
            transition: border-color 0.2s;
            background: var(--bg);
        }

        .form-input:focus {
            border-color: var(--verde);
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
            margin-top: 24px;
            justify-content: flex-end;
        }

        .btn-cancel {
            background: var(--bg);
            color: var(--muted);
            border: 1px solid var(--border);
            font-family: 'DM Sans', sans-serif;
            font-size: 0.9rem;
            font-weight: 600;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
        }

        .btn-save {
            background: #2d7dd2;
            color: #fff;
            border: none;
            font-family: 'DM Sans', sans-serif;
            font-size: 0.9rem;
            font-weight: 700;
            padding: 10px 24px;
            border-radius: 8px;
            cursor: pointer;
        }

        .toast {
            position: fixed;
            bottom: 28px;
            right: 28px;
            z-index: 9999;
            background: #0a1628;
            color: #f0f4ff;
            font-size: 0.88rem;
            font-weight: 600;
            padding: 14px 20px;
            border-radius: 10px;
            border-left: 4px solid #38bdf8;
            display: none;
            align-items: center;
            gap: 10px;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
            animation: slideUp 0.3s ease;
        }

        .toast.show {
            display: flex;
        }

        .alert-bar {
            background: var(--amber-light);
            border: 1px solid #fcd34d;
            border-radius: 8px;
            padding: 12px 16px;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.85rem;
            color: #92400e;
            font-weight: 500;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .scroll-hint {
            display: none;
            font-size: 0.72rem;
            color: var(--muted);
            padding: 6px 12px;
            text-align: right;
            border-bottom: 1px solid var(--border);
            background: var(--bg);
        }

        @media(max-width:900px) {
            .kpi-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .dash-bottom {
                grid-template-columns: 1fr;
            }

            .fiado-summary {
                grid-template-columns: repeat(2, 1fr);
            }

            .caixa-header {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media(max-width:640px) {
            .sidebar {
                width: 56px;
                overflow: hidden;
            }

            .sidebar-logo {
                padding: 0 0 20px;
                text-align: center;
                font-size: 1rem;
            }

            .nav-item {
                padding: 12px 0;
                justify-content: center;
            }

            .nav-item span:not(.nav-icon) {
                display: none;
            }

            .nav-item.active {
                border-left: 3px solid var(--verde);
            }

            .sidebar-name,
            .sidebar-role,
            .sidebar-section {
                display: none;
            }

            .sidebar-footer {
                padding: 12px 0;
                display: flex;
                justify-content: center;
            }

            .sidebar-user {
                gap: 0;
            }

            .topbar {
                padding: 0 12px;
            }

            .topbar-badge {
                display: none;
            }

            .content {
                padding: 16px 12px;
            }

            .kpi-grid {
                grid-template-columns: 1fr 1fr;
            }

            .kpi-val {
                font-size: 1.4rem;
            }

            .scroll-hint {
                display: block;
            }

            .table-scroll {
                max-height: 55vh;
            }

            .fiado-summary {
                grid-template-columns: 1fr 1fr;
            }

            .caixa-header {
                grid-template-columns: 1fr 1fr;
                gap: 12px;
                padding: 16px;
            }

            .dash-bottom {
                grid-template-columns: 1fr;
            }

            .modal {
                padding: 24px 16px;
                margin: 12px;
            }

            .form-row {
                grid-template-columns: 1fr;
            }

            .login-box {
                padding: 32px 20px;
                margin: 16px;
            }
        }
    
