:root {
    /* Flutter Palette Light Mode Configured via CSS Variables */
    --brand: #0D8B8F;
    --brand-light: #10A8AD;
    --brand-dark: #0A6E72;
    --secondary: #0F5F66;
    --secondary-light: #147A82;
    --accent: #E1B15A;
    --accent-light: #EAC57E;
    --accent-dark: #C99A3E;
    --surface: #ECF8F8;
    --surface-alt: #D6F0F0;
    --bg: #F8FAFA;
    --panel: #FFFFFF;
    --text: #16343A;
    --muted: #4A7A82;
    --text-light: #8AABAF;
    --border: #B8DDDE;
    --notif-success: #10b981;
    --notif-error: #ef4444;
}

[data-theme='dark'] {
    /* Dark Layout Preserves Theme Token Contracts */
    --brand: #10A8AD;
    --surface: #16343A;
    --bg: #0D1F22;
    --panel: #11282C;
    --text: #ECF8F8;
    --muted: #8AABAF;
    --border: #1F4A52;
}

body {
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: sans-serif;
}

.sidebar {
    background-color: var(--panel);
    border-inline-end: 1px solid var(--border);
}

.active-link {
    background-color: var(--surface);
    color: var(--brand);
    border-inline-start: 4px solid var(--brand);
}

html[dir="rtl"] .active-link {
    border-inline-start: 0;
    border-inline-end: 4px solid var(--brand);
}

.btn-portal {
    background-color: var(--brand);
    color: white;
}

.bg-panel { background-color: var(--panel); }
.bg-brand { background-color: var(--brand); }
.bg-surface { background-color: var(--surface); }
.text-accent { color: var(--accent); }
.border-ui { border-color: var(--border); }

/* Custom Scrollbar Viewports */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 10px; opacity: 0.3; }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes letter-wave {
    0%, 100% { transform: scale(1); color: var(--muted); }
    50% { transform: scale(1.5); color: var(--brand); font-weight: bold; }
}
@keyframes bounce-in {
    0% { transform: translateY(-20px); opacity: 0; }
    60% { transform: translateY(5px); }
    100% { transform: translateY(0); opacity: 1; }
}

.loading-text { font-size: 1.1rem; display: flex; gap: 2px; }
.loading-letter { display: inline-block; animation: letter-wave 1.2s infinite ease-in-out; }
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-relative { position: relative !important; pointer-events: none; user-select: none; }
.animate-bounce-in { animation: bounce-in 0.5s ease-out; }

#main_content {
    background: radial-gradient(circle at top left, var(--bg), var(--surface));
    transition: all 0.3s ease;
}