:root {
    --sb-bg: #F7F8FA;
    --sb-sidebar: #111827;
    --sb-sidebar-muted: #9CA3AF;
    --sb-primary: #6366F1;
    --sb-primary-soft: rgba(99, 102, 241, .12);
    --sb-secondary: #64748B;
    --sb-success: #16A34A;
    --sb-warning: #D97706;
    --sb-danger: #DC2626;
    --sb-card: #FFFFFF;
    --sb-border: #E5E7EB;
    --sb-text: #111827;
    --sb-muted: #6B7280;
    --sb-radius: 16px;
    --sb-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
    --sb-font: "Segoe UI", Tahoma, Arial, sans-serif;
}

[data-theme="dark"] {
    --sb-bg: #0B1120;
    --sb-sidebar: #070B14;
    --sb-card: #111827;
    --sb-border: #1F2937;
    --sb-text: #E5E7EB;
    --sb-muted: #9CA3AF;
    --sb-primary-soft: rgba(99, 102, 241, .22);
    --sb-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--sb-bg);
    color: var(--sb-text);
    font-family: var(--sb-font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--sb-primary); text-decoration: none; }
a:hover { color: var(--sb-primary); }

.sb-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sb-sidebar {
    width: 268px;
    flex: 0 0 268px;
    background: var(--sb-sidebar);
    color: #E5E7EB;
    padding: 20px 14px 28px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sb-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }

.sb-brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--sb-primary), #8B5CF6);
    color: #fff; font-weight: 800; letter-spacing: .5px;
}

.sb-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sb-brand-text strong { font-size: 15px; color: #fff; }
.sb-brand-text small { color: var(--sb-sidebar-muted); font-size: 11px; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav-section {
    margin: 16px 10px 6px;
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6B7280;
}

.sb-nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 10px;
    color: #D1D5DB; font-size: 13.5px;
    transition: background .15s ease, color .15s ease;
}

.sb-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sb-nav-link.is-active { background: var(--sb-primary); color: #fff; }
.sb-nav-link .sb-icon { flex: 0 0 auto; opacity: .9; }

/* Main */
.sb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sb-topbar {
    height: 68px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    background: var(--sb-card);
    border-bottom: 1px solid var(--sb-border);
    position: sticky; top: 0; z-index: 20;
}

.sb-topbar-left, .sb-topbar-right { display: flex; align-items: center; gap: 12px; }
.sb-topbar-title { display: flex; flex-direction: column; line-height: 1.2; }
.sb-topbar-title strong { font-size: 15px; }
.sb-topbar-title small { color: var(--sb-muted); font-size: 12px; }

.sb-icon-btn {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--sb-border); background: transparent;
    color: var(--sb-text); display: inline-flex; align-items: center; justify-content: center;
}
.sb-icon-btn:hover { background: var(--sb-primary-soft); }

[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }

.sb-locale { width: 118px; background: var(--sb-card); color: var(--sb-text); border-color: var(--sb-border); }

.sb-user {
    display: flex; align-items: center; gap: 9px;
    border: 1px solid var(--sb-border); background: transparent;
    padding: 5px 10px 5px 6px; border-radius: 999px; color: var(--sb-text);
}
.sb-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--sb-primary-soft); color: var(--sb-primary);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.sb-user-name { font-size: 13px; }

.sb-content { padding: 26px 24px 32px; flex: 1; }
.sb-footer {
    padding: 14px 24px; border-top: 1px solid var(--sb-border);
    display: flex; justify-content: space-between; gap: 12px;
    font-size: 12px; color: var(--sb-muted);
}

/* Auth */
.sb-auth-body {
    min-height: 100vh; display: grid; place-items: center;
    background: radial-gradient(1200px 600px at 20% 0%, rgba(99, 102, 241, .16), transparent 60%), var(--sb-bg);
    padding: 24px;
}
.sb-auth-card {
    width: 100%; max-width: 420px; background: var(--sb-card);
    border: 1px solid var(--sb-border); border-radius: 20px;
    box-shadow: var(--sb-shadow); padding: 32px;
}
.sb-auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.sb-auth-brand strong { display: block; font-size: 15px; }
.sb-auth-brand small { color: var(--sb-muted); font-size: 12px; }
.sb-auth-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.sb-auth-subtitle { color: var(--sb-muted); font-size: 13.5px; margin-bottom: 20px; }
.sb-auth-note { margin: 18px 0 0; font-size: 11.5px; color: var(--sb-muted); text-align: center; }

[dir="rtl"] .sb-topbar-left, [dir="rtl"] .sb-topbar-right { flex-direction: row; }
[dir="rtl"] .sb-nav-link, [dir="rtl"] .sb-brand { flex-direction: row; }

.logout-btn, .dropdown-menu { text-align: start; }
