/* =====================================================================
   AGA CRM — Design System
   Premium dark UI with glassmorphism, gradient glows and smooth motion.
   Built to complement TailwindCSS (loaded via play CDN as a static script).
   ===================================================================== */

:root {
    --bg-base       : #050816;
    --bg-elev-1     : #0b1020;
    --bg-elev-2     : #11172e;
    --bg-elev-3     : #1a2240;
    --surface       : rgba(15, 23, 42, 0.65);
    --surface-strong: rgba(15, 23, 42, 0.85);
    --border        : rgba(148, 163, 184, 0.12);
    --border-strong : rgba(148, 163, 184, 0.22);

    --text-base     : #e2e8f0;
    --text-muted    : #94a3b8;
    --text-soft     : #64748b;
    --text-strong   : #f8fafc;

    --primary       : #6366f1;
    --primary-soft  : rgba(99, 102, 241, 0.18);
    --primary-glow  : rgba(99, 102, 241, 0.45);
    --accent        : #22d3ee;
    --accent-soft   : rgba(34, 211, 238, 0.18);
    --success       : #10b981;
    --warning       : #f59e0b;
    --danger        : #f43f5e;

    --grad-1        : linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #22d3ee 100%);
    --grad-2        : linear-gradient(135deg, #f43f5e 0%, #f59e0b 100%);
    --grad-3        : linear-gradient(135deg, #10b981 0%, #22d3ee 100%);
    --grad-4        : linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --grad-aurora   : radial-gradient(60% 80% at 50% 0%, rgba(99,102,241,0.35), transparent 60%),
                      radial-gradient(50% 60% at 100% 30%, rgba(34,211,238,0.25), transparent 60%),
                      radial-gradient(60% 80% at 0% 80%, rgba(236,72,153,0.20), transparent 60%);

    --radius-sm     : 10px;
    --radius-md     : 14px;
    --radius-lg     : 18px;
    --radius-xl     : 24px;

    --shadow-soft   : 0 10px 30px -10px rgba(0,0,0,0.5), 0 4px 12px -2px rgba(0,0,0,0.3);
    --shadow-glow   : 0 0 40px rgba(99,102,241,0.35), 0 0 80px rgba(34,211,238,0.20);

    --transition    : 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme override */
[data-theme="light"] {
    --bg-base       : #f1f5f9;
    --bg-elev-1     : #ffffff;
    --bg-elev-2     : #f8fafc;
    --bg-elev-3     : #eef2f7;
    --surface       : rgba(255,255,255,0.85);
    --surface-strong: #ffffff;
    --border        : rgba(15,23,42,0.10);
    --border-strong : rgba(15,23,42,0.18);
    --text-base     : #1e293b;
    --text-muted    : #475569;
    --text-soft     : #64748b;
    --text-strong   : #0f172a;
    --shadow-soft   : 0 12px 30px -12px rgba(15,23,42,0.18);
}

/* ----- Reset / base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background : var(--bg-base);
    color      : var(--text-base);
    min-height : 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: 'Cairo', 'Tajawal', 'Inter', system-ui, sans-serif; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ----- Aurora background ------------------------------------------- */
.aurora {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background: var(--grad-aurora);
    filter: blur(30px) saturate(140%);
    opacity: 0.55;
}
.aurora::after {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at center, black 50%, transparent 100%);
    opacity: 0.5;
}
[data-theme="light"] .aurora { opacity: 0.20; }

/* ----- Layout shell ------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; position: relative; }
.app-main  { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-content { flex: 1; padding: 28px clamp(16px, 3vw, 36px); }

/* ----- Sidebar ----------------------------------------------------- */
.sidebar {
    width: 270px;
    background: linear-gradient(180deg, rgba(11,16,32,0.92), rgba(8,12,28,0.85));
    border-inline-end: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 22px 16px 24px;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; z-index: 30;
    transition: transform var(--transition);
}
[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    color: inherit; text-decoration: none;
    border-radius: 12px;
    transition: background var(--transition);
}
.sidebar-brand:hover { background: rgba(99,102,241,0.06); }
.brand-mark {
    width: 42px; height: 42px;
    border-radius: 14px;
    background: var(--grad-1);
    display: grid; place-items: center;
    font-weight: 800; color: white; font-size: 16px;
    box-shadow: var(--shadow-glow);
    letter-spacing: 0.5px;
}
.brand-meta strong { display: block; font-size: 14px; color: var(--text-strong); letter-spacing: 0.2px; }
.brand-meta span  { font-size: 11px; color: var(--text-muted); }

.nav-section { margin-top: 14px; }
.nav-section + .nav-section { margin-top: 18px; }
.nav-section-title {
    font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--text-soft); padding: 0 14px 8px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 14px; font-weight: 500;
    margin-bottom: 4px;
    transition: all var(--transition);
    position: relative;
}
.nav-link svg { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-link:hover { color: var(--text-strong); background: rgba(99,102,241,0.10); }
.nav-link.is-active {
    color: var(--text-strong);
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(34,211,238,0.12));
    box-shadow: 0 0 0 1px rgba(99,102,241,0.25), 0 8px 20px -8px rgba(99,102,241,0.45);
}
.nav-link.is-active::before {
    content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 4px; background: var(--grad-1);
}
.nav-badge {
    margin-inline-start: auto;
    background: var(--primary-soft);
    color: var(--accent);
    font-size: 11px; padding: 2px 8px; border-radius: 999px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(34,211,238,0.05));
    border: 1px solid var(--border);
}

/* ----- Topbar ------------------------------------------------------ */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    padding: 14px clamp(16px, 3vw, 28px);
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
}
.topbar-greeting {
    display: flex; flex-direction: column;
    padding: 4px 12px;
    line-height: 1.15;
    max-width: 320px; min-width: 0;
}
.topbar-greeting > div:last-child {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-cta { display: none; }
@media (min-width: 720px) { .topbar-cta { display: inline-flex; } }
@media (max-width: 540px) { .topbar-greeting { display: none; } }
.icon-btn {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    transition: all var(--transition);
    position: relative;
}
.icon-btn:hover { color: var(--text-strong); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn .dot {
    position: absolute; top: 8px; inset-inline-end: 8px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger); box-shadow: 0 0 8px var(--danger);
}

.avatar {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--grad-4);
    display: grid; place-items: center;
    color: white; font-weight: 700; font-size: 13px;
    box-shadow: 0 0 0 1px var(--border);
    letter-spacing: 1px;
}

/* ----- Card --------------------------------------------------------- */
.glass-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition);
    animation: aga-enter-fade 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 120ms;
}
[data-theme="light"] .glass-card { background: #ffffff; }
.glass-card:hover { border-color: var(--border-strong); }

.gradient-border {
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--bg-elev-1);
}
.gradient-border::before {
    content: ""; position: absolute; inset: 0; padding: 1px;
    border-radius: inherit;
    background: var(--grad-1);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
}

/* ----- KPI cards --------------------------------------------------- */
.kpi {
    padding: 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--border);
    position: relative; overflow: hidden;
    transition: all var(--transition);
    animation: aga-enter-up 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.kpi:nth-child(1) { animation-delay:  20ms; }
.kpi:nth-child(2) { animation-delay:  80ms; }
.kpi:nth-child(3) { animation-delay: 140ms; }
.kpi:nth-child(4) { animation-delay: 200ms; }
.kpi:nth-child(5) { animation-delay: 260ms; }
.kpi:nth-child(6) { animation-delay: 320ms; }
.kpi:nth-child(7) { animation-delay: 380ms; }
.kpi:nth-child(8) { animation-delay: 440ms; }

@keyframes aga-enter-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes aga-enter-fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.kpi::before {
    content: ""; position: absolute; inset-block-start: -60%; inset-inline-end: -20%;
    width: 220px; height: 220px;
    background: var(--grad-1); filter: blur(60px);
    opacity: 0.25; transition: all var(--transition);
}
.kpi:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.kpi:hover::before { opacity: 0.45; }
.kpi-label { color: var(--text-muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.kpi-value { color: var(--text-strong); font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 10px;
    padding: 3px 8px; border-radius: 999px;
    background: rgba(16,185,129,0.12); color: #34d399;
}
.kpi-trend.down { background: rgba(244,63,94,0.12); color: #fb7185; }
.kpi-icon {
    position: absolute; top: 18px; inset-inline-end: 18px;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--primary-soft); color: #a5b4fc;
    display: grid; place-items: center;
}

/* ----- Buttons ----------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px; font-weight: 600;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-strong);
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary {
    background: var(--grad-1); border: 0; color: white;
    box-shadow: 0 12px 30px -10px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 18px 38px -10px var(--primary-glow); }
.btn-success { background: var(--grad-3); border: 0; color: white; }
.btn-danger  { background: var(--grad-2); border: 0; color: white; }
.btn-ghost   { background: transparent; }
.btn-sm      { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

/* ----- Form controls ---------------------------------------------- */
.form-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-control,
.form-select,
.form-textarea {
    width: 100%;
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--border);
    color: var(--text-base);
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 14px;
    transition: all var(--transition);
    font-family: inherit;
}
[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea { background: #ffffff; }
.form-control:focus, .form-select:focus, .form-textarea:focus {
    outline: 0; border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
    background: rgba(15,23,42,0.7);
}
[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus { background: #ffffff; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-error { color: #fda4af; font-size: 12px; margin-top: 4px; }

/* ----- Tables ----------------------------------------------------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: start; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-base); font-size: 14px;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(99,102,241,0.05); }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* ----- Kanban ----------------------------------------------------- */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-column {
    flex: 0 0 300px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex; flex-direction: column;
    max-height: calc(100vh - 220px);
}
.kanban-column header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.kanban-column header h3 { margin: 0; font-size: 13px; color: var(--text-strong); display: flex; align-items: center; gap: 8px; }
.kanban-column header h3::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.kanban-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-inline-end: 4px; }
.kanban-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    cursor: grab; user-select: none;
    transition: all var(--transition);
}
.kanban-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.kanban-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-strong); }
.kanban-card .meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.kanban-column.drag-over { border-color: var(--primary); background: rgba(99,102,241,0.05); }

/* ----- Toasts ----------------------------------------------------- */
.toast-host { position: fixed; top: 18px; inset-inline-end: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
    padding: 12px 16px; border-radius: 12px;
    background: var(--surface-strong); border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    display: flex; align-items: center; gap: 10px;
    animation: slide-in 280ms cubic-bezier(0.4,0,0.2,1);
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(244,63,94,0.4); }
.toast.warning { border-color: rgba(245,158,11,0.4); }
.toast.info    { border-color: rgba(34,211,238,0.4); }
@keyframes slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
html[dir="rtl"] .toast { animation-name: slide-in-rtl; }
@keyframes slide-in-rtl {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ----- Modal ------------------------------------------------------ */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(2,6,23,0.65);
    backdrop-filter: blur(8px); z-index: 90;
    /* Force hidden by default so no other framework rule can show it
       accidentally. `visibility` + `opacity` + `pointer-events` are all
       belt-and-braces so the page can never be darkened by an idle modal. */
    display: none !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    align-items: center; justify-content: center;
    padding: 24px;
}
.modal-backdrop.is-open {
    display: flex !important;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.modal {
    width: min(560px, 100%);
    background: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: 0 24px 60px -16px rgba(0,0,0,0.8);
    animation: modal-pop 240ms cubic-bezier(0.4,0,0.2,1);
}
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ----- Pagination ------------------------------------------------- */
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-muted); font-size: 13px;
}
.pagination a:hover { border-color: var(--primary); color: var(--text-strong); }
.pagination .is-active { background: var(--primary-soft); color: var(--text-strong); border-color: var(--primary); }

/* ----- Skeletons -------------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ----- Notification dropdown ------------------------------------- */
.dropdown { position: relative; }
.dropdown-panel {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
    width: 360px;
    background: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px -12px rgba(0,0,0,0.6);
    padding: 8px;
    z-index: 40;
    display: none !important;
}
.dropdown-panel.is-open { display: block !important; animation: modal-pop 200ms ease; }
.dropdown-item {
    display: flex; gap: 10px; padding: 10px;
    border-radius: 10px; transition: background var(--transition);
    cursor: pointer;
}
.dropdown-item:hover { background: rgba(99,102,241,0.08); }

/* ----- Misc ------------------------------------------------------- */
.page-title { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.4px; }
.page-subtitle { color: var(--text-muted); font-size: 13px; }
.muted { color: var(--text-muted); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    font-size: 11px; color: var(--text-muted);
}

/* ----- Auth page -------------------------------------------------- */
.auth-body { position: relative; overflow-x: hidden; }

.auth-bg {
    position: fixed; inset: 0; z-index: -1;
    overflow: hidden; pointer-events: none;
}
.auth-bg-grid {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0.7;
}

.aga-window {
    fill: #1e293b;
    animation: aga-window-blink 4s ease-in-out infinite;
}
@keyframes aga-window-blink {
    0%, 30%   { fill: #1e293b; }
    35%, 65%  { fill: rgba(252, 211, 77, 0.92); filter: drop-shadow(0 0 4px rgba(252, 211, 77, 0.7)); }
    70%, 100% { fill: #1e293b; filter: none; }
}

.aga-beacon {
    transform-box: fill-box; transform-origin: center;
    animation: aga-beacon-pulse 1.8s ease-in-out infinite;
}
@keyframes aga-beacon-pulse {
    0%, 100% { opacity: 0.3; r: 2; filter: drop-shadow(0 0 4px rgba(34,211,238,0.5)); }
    50%      { opacity: 1;   r: 4; filter: drop-shadow(0 0 10px rgba(34,211,238,0.9)); }
}

.aga-radar-sweep {
    transform-box: fill-box; transform-origin: 0 0;
    animation: aga-radar-spin 6s linear infinite;
}
@keyframes aga-radar-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.aga-pin {
    transform-box: fill-box; transform-origin: center;
    animation: aga-pin-float 3.5s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(99,102,241,0.6));
}
@keyframes aga-pin-float {
    0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
    50%      { transform: translateY(-10px) scale(1.05); opacity: 0.85; }
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.45;
    animation: aga-orb-drift 18s ease-in-out infinite;
}
.auth-orb--1 {
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(99,102,241,0.7), transparent 60%);
    top: -120px; inset-inline-start: -80px;
}
.auth-orb--2 {
    width: 460px; height: 460px;
    background: radial-gradient(circle, rgba(34,211,238,0.55), transparent 60%);
    bottom: -180px; inset-inline-end: -120px;
    animation-delay: -6s;
}
.auth-orb--3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(236,72,153,0.45), transparent 60%);
    top: 35%; inset-inline-start: 45%;
    animation-delay: -12s;
}
@keyframes aga-orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(40px, -30px) scale(1.08); }
    66%      { transform: translate(-30px, 40px) scale(0.94); }
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}
@media (min-width: 1024px) {
    .auth-shell { grid-template-columns: 1.1fr 1fr; max-width: 100%; }
    .auth-art { display: grid; place-items: center; padding: 36px; }
}
.auth-card {
    width: 100%; max-width: 460px;
    padding: 36px;
    border-radius: var(--radius-xl);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    backdrop-filter: blur(24px);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
    animation: aga-enter-up 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 80ms;
}
.auth-art > * { animation: aga-enter-fade 600ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.auth-art > *:nth-child(1) { animation-delay:  40ms; }
.auth-art > *:nth-child(2) { animation-delay: 120ms; }
.auth-art > *:nth-child(3) { animation-delay: 200ms; }
.auth-art > *:nth-child(4) { animation-delay: 280ms; }
.auth-logo {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: var(--grad-1);
    display: grid; place-items: center;
    color: white; font-weight: 800; font-size: 22px;
    box-shadow: var(--shadow-glow);
}

/* ----- Responsive ------------------------------------------------- */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0; bottom: 0;
        inset-inline-start: 0;       /* anchored to the inline-start edge in both LTR and RTL */
        transform: translateX(-100%); /* LTR default: slide out to the left  */
    }
    html[dir="rtl"] .sidebar {
        transform: translateX(100%); /* RTL: slide out to the right (away from the inline-start = right edge) */
    }
    .sidebar.is-open { transform: translateX(0) !important; }
    .sidebar-toggle  { display: grid; }
    .sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(2,6,23,0.5);
        backdrop-filter: blur(4px);
        z-index: 29;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .sidebar-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Reduce motion preference — also keeps elements visible since we
   removed `opacity: 0` initial state from the keyframes' impact. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.18); border-radius: 8px;
    border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.30); background-clip: padding-box; }
