/* ==========================================================================
   ACELERA CORRETOR — ATrinca Real Estate
   Brand: Dark Navy #17323D • Peach #F4D9C1 • Serif accents (Playfair)
   ========================================================================== */

/* -------- Reset -------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: 0; background: transparent; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* -------- Design tokens -------- */
:root {
    /* Brand */
    --navy-900: #0E222A;
    --navy-800: #122B34;
    --navy-700: #17323D;     /* primary dark */
    --navy-600: #1E404C;
    --navy-500: #2A5462;
    --peach-100: #FDF1E5;
    --peach-200: #F9E3CF;
    --peach-300: #F4D9C1;    /* primary accent */
    --peach-400: #EBC7A6;
    --peach-500: #D9A679;

    --green: #3FB57A;
    --red: #E56B6B;
    --amber: #E6B450;
    --blue: #5AA9E6;

    /* Dark theme */
    --bg: var(--navy-900);
    --surface: var(--navy-800);
    --surface-2: var(--navy-700);
    --surface-3: var(--navy-600);
    --border: rgba(244, 217, 193, 0.10);
    --border-strong: rgba(244, 217, 193, 0.20);
    --text: #EEF2F5;
    --text-muted: #9AAAB3;
    --text-dim: #6D7F88;
    --accent: var(--peach-300);
    --accent-ink: var(--navy-900);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.45);

    --sidebar-w: 276px;
    --topbar-h: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
}

html[data-theme="light"] {
    --bg: #F6F1EC;
    --surface: #FFFFFF;
    --surface-2: #FBF6F0;
    --surface-3: #F2E8DC;
    --border: rgba(23, 50, 61, 0.10);
    --border-strong: rgba(23, 50, 61, 0.22);
    --text: #17323D;
    --text-muted: #52707A;
    --text-dim: #8FA3AB;
    --accent: var(--navy-700);
    --accent-ink: var(--peach-200);
    --shadow-sm: 0 1px 2px rgba(23,50,61,.08);
    --shadow-md: 0 8px 24px rgba(23,50,61,.08);
    --shadow-lg: 0 16px 48px rgba(23,50,61,.12);
}

/* -------- Scrollbars -------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============ SEAL (logo) ============ */
.seal {
    display: inline-flex;
    align-items: stretch;
    background: var(--navy-700);
    color: var(--peach-300);
    padding: 10px 14px;
    gap: 14px;
    position: relative;
    border-radius: 4px;
}
.seal-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    padding-right: 10px;
    border-right: 1px solid var(--peach-300);
    position: relative;
}
.seal-left::after {
    content: '';
    position: absolute;
    right: 0;
    top: -4px;
    bottom: -4px;
    width: 1px;
    background: var(--peach-300);
    transform: rotate(14deg);
    transform-origin: bottom;
}
.seal-official { font-size: 8px; letter-spacing: 1.5px; line-height: 1; font-family: 'Inter', sans-serif; font-style: normal; font-weight: 600; }
.seal-member { font-size: 14px; font-weight: 600; line-height: 1.1; margin-top: 3px; }
.seal-slash { display: none; }
.seal-right { display: flex; align-items: center; gap: 8px; padding-left: 4px; }
.seal-at { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 30px; line-height: 1; display: inline-flex; align-items: center; }
.seal-t { position: relative; display: inline-block; margin-left: -4px; }
.seal-dot { color: var(--peach-300); font-size: 28px; line-height: 1; margin-left: 2px; position: relative; top: -2px; }
.seal-real { font-size: 9px; font-weight: 700; letter-spacing: 2px; line-height: 1.1; font-family: 'Inter', sans-serif; }

.seal-sm { padding: 6px 9px; gap: 9px; }
.seal-sm .seal-official { font-size: 6.5px; letter-spacing: 1.2px; }
.seal-sm .seal-member { font-size: 10px; }
.seal-sm .seal-at { font-size: 22px; }
.seal-sm .seal-real { font-size: 7px; letter-spacing: 1.5px; }
.seal-sm .seal-dot { font-size: 20px; }

/* Light theme — seal inverts */
html[data-theme="light"] .seal {
    background: var(--peach-300);
    color: var(--navy-700);
}
html[data-theme="light"] .seal-left { border-right-color: var(--navy-700); }
html[data-theme="light"] .seal-left::after { background: var(--navy-700); }
html[data-theme="light"] .seal-dot { color: var(--navy-700); }

/* ============ SPLASH ============ */
.splash {
    position: fixed; inset: 0;
    background: var(--navy-900);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 999;
    transition: opacity .5s;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-seal { display: flex; flex-direction: column; align-items: center; gap: 32px; }
.splash-title {
    color: var(--peach-300);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    letter-spacing: 6px;
    font-size: 14px;
    animation: fadeUp .8s .3s backwards;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============ APP LAYOUT ============ */
.app { display: flex; min-height: 100vh; }

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 50;
    transition: transform .3s ease;
}
.sidebar-brand {
    padding: 18px 18px 14px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand-title-lg {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    line-height: 1.1;
}
.brand-title-sm {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-top: 3px;
}
.sidebar-close {
    display: none;
    width: 32px; height: 32px; border-radius: 50%;
    align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 18px;
}
.sidebar-close:hover { background: var(--surface-2); color: var(--text); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px 20px;
}
.nav-section { margin-top: 12px; }
.nav-section:first-child { margin-top: 6px; }

/* Admin section: travado em display:none até o hydrate do Supabase confirmar
   is_admin=true e o JS adicionar a classe .admin-revealed. !important impede
   qualquer reveal acidental via state cacheado ou atribuição de hidden. */
#adminSection { display: none !important; }
#adminSection.admin-revealed { display: block !important; }
.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    padding: 6px 12px;
    font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    cursor: pointer;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
    background: var(--surface-2);
    color: var(--accent);
}
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 30%; bottom: 30%;
    width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item { position: relative; }

.sidebar-user {
    padding: 10px;
    border-top: 1px solid var(--border);
    position: relative;
}
.user-trigger {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.user-trigger:hover { background: var(--surface-2); }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    flex: none;
}
.user-info { display: flex; flex-direction: column; text-align: left; flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10.5px; color: var(--text-muted); letter-spacing: .3px; }
.user-chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform .2s; }
.user-trigger.open .user-chevron { transform: rotate(180deg); }

.user-menu {
    position: absolute;
    bottom: calc(100% - 4px);
    left: 10px; right: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 10;
    animation: slideUp .18s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.user-menu-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    text-align: left;
    transition: background .15s;
}
.user-menu-item svg { width: 17px; height: 17px; }
.user-menu-item:hover { background: var(--surface-3); }
.user-menu-item.danger:hover { background: rgba(229, 107, 107, .1); color: var(--red); }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 2px; }

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

/* ============ MAIN ============ */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex; flex-direction: column;
}

/* ============ TOPBAR ============ */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: sticky; top: 0; z-index: 30;
}
.menu-toggle {
    display: none;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
    color: var(--text);
}
.menu-toggle svg { width: 22px; height: 22px; }
.menu-toggle:hover { background: var(--surface-2); }

.topbar-search {
    flex: 1;
    max-width: 540px;
    position: relative;
    display: flex; align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 12px;
    height: 40px;
    transition: border-color .15s;
}
.topbar-search:focus-within { border-color: var(--accent); }
.topbar-search svg { width: 17px; height: 17px; color: var(--text-muted); flex: none; }
.topbar-search input {
    flex: 1;
    background: transparent; border: 0; outline: 0;
    padding: 0 10px;
    font-size: 13.5px;
    color: var(--text);
}
.topbar-search input::placeholder { color: var(--text-dim); }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    position: relative;
    transition: background .15s, color .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.badge-dot {
    position: absolute; top: 10px; right: 10px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--surface);
}
.mobile-theme-toggle { display: none; }

/* ============ NOTIF DRAWER ============ */
.notif-drawer {
    position: absolute;
    top: calc(var(--topbar-h) + 6px);
    right: 16px;
    width: 340px; max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 40;
    overflow: hidden;
    animation: slideUp .2s ease;
}
.notif-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.notif-header h4 { font-size: 14px; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
    padding: 12px 16px;
    display: flex; gap: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--surface-2); }
.notif-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-3);
    font-size: 16px;
    flex: none;
}
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-text { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ============ CONTENT ============ */
.content {
    flex: 1;
    padding: 28px 32px 60px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    animation: contentIn .3s ease;
}
@keyframes contentIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
    margin-bottom: 28px;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
    flex-wrap: wrap;
}
.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.5px;
    line-height: 1.1;
}
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

/* ============ COMPONENTS ============ */

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: border-color .2s, transform .2s;
}
.card.hover:hover { border-color: var(--border-strong); transform: translateY(-2px); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .2px;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost.small { padding: 4px 8px; font-size: 12px; }
.btn-outline { border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn.full { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.large { padding: 14px 26px; font-size: 15px; }

/* Pills */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid var(--border);
}
.pill.accent { background: rgba(244,217,193,.12); color: var(--accent); border-color: rgba(244,217,193,.25); }
.pill.green { background: rgba(63,181,122,.12); color: var(--green); border-color: rgba(63,181,122,.25); }
.pill.amber { background: rgba(230,180,80,.12); color: var(--amber); border-color: rgba(230,180,80,.25); }
.pill.red { background: rgba(229,107,107,.12); color: var(--red); border-color: rgba(229,107,107,.25); }

/* Inputs */
.input, .textarea, .select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13.5px;
    transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: 0; border-color: var(--accent);
}
.textarea { resize: vertical; min-height: 90px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field-error { display: block; color: var(--red); font-size: 12px; margin-top: 4px; }
.field-error:empty { display: none; }
.input.has-error, .input.has-error:focus { border-color: var(--red); }
.fields-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .fields-grid { grid-template-columns: 1fr; } }

/* Tabs */
.tabs {
    display: flex; gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 10px 16px;
    font-size: 13.5px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-weight: 500;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============ HERO / WELCOME ============ */
.hero {
    background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
    display: flex; align-items: center; justify-content: space-between; gap: 30px;
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
}
html[data-theme="light"] .hero { color: var(--peach-200); }
.hero::before {
    content: '';
    position: absolute; top: -40%; right: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(244,217,193,.18), transparent 70%);
    border-radius: 50%;
}
.hero-content { position: relative; z-index: 2; flex: 1; }
.hero-greeting {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 14px;
    color: var(--peach-300);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 500;
}
.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: 32px; font-weight: 600; line-height: 1.15;
    margin-bottom: 10px;
}
.hero-sub { color: rgba(255,255,255,.7); font-size: 14px; max-width: 540px; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero-side { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hero-stat { text-align: right; color: rgba(255,255,255,.9); }
.hero-stat-value { font-size: 28px; font-weight: 700; color: var(--peach-300); font-family: 'Playfair Display', serif; }
.hero-stat-label { font-size: 11px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: 1.5px; }

/* Section heading */
.section-heading {
    display: flex; align-items: center; justify-content: space-between;
    margin: 34px 0 16px;
}
.section-heading h2 {
    font-family: 'Playfair Display', serif;
    font-size: 22px; font-weight: 600;
    color: var(--text);
}
.section-heading .link { color: var(--accent); font-size: 13px; font-weight: 500; }
.section-heading .link:hover { text-decoration: underline; }

/* Grid */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Stats */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.stat-card-icon {
    width: 38px; height: 38px;
    background: var(--surface-2);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.stat-card-icon svg { width: 20px; height: 20px; }
.stat-card-value { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 600; color: var(--text); }
.stat-card-label { font-size: 12px; color: var(--text-muted); letter-spacing: .5px; text-transform: uppercase; margin-top: 2px; }
.stat-card-trend { font-size: 12px; color: var(--green); margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }

/* Course cards */
.course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: border-color .2s, transform .2s;
    display: flex; flex-direction: column;
}
.course-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.course-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
    position: relative;
    display: flex; align-items: center; justify-content: center;
    color: var(--peach-300);
    overflow: hidden;
}
.course-thumb::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 70% 30%, rgba(244,217,193,.15), transparent 60%);
}
.course-thumb .course-emoji { font-size: 42px; position: relative; z-index: 2; }
.course-thumb-badge {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,.55); color: #fff;
    padding: 3px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
    backdrop-filter: blur(6px);
}
.course-progress-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 3px; background: rgba(0,0,0,.35);
}
.course-progress-bar > span { display: block; height: 100%; background: var(--peach-300); transition: width .3s; }
.course-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.course-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.course-meta { display: flex; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.course-instructor { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.course-instructor-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--text); }

/* Tool card */
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    transition: border-color .2s, transform .2s;
    cursor: pointer;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--peach-400));
    color: var(--navy-900);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
}
.tool-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 600; color: var(--text); }
.tool-desc { color: var(--text-muted); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.tool-cta { margin-top: 14px; }

/* ============ COURSE PLAYER ============ */
.player-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}
@media (max-width: 1100px) { .player-layout { grid-template-columns: 1fr; } }

.player-breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--text-muted);
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.player-breadcrumb a:hover { color: var(--accent); }
.player-breadcrumb .sep { color: var(--text-dim); }

.player-video {
    background: #000;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.7);
}
.player-video::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #102028 0%, #1c3642 100%);
}
.player-play {
    position: relative; z-index: 2;
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(244,217,193,.9); color: var(--navy-900);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s;
}
.player-play:hover { transform: scale(1.08); }
.player-play svg { width: 28px; height: 28px; margin-left: 4px; }
.player-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 14px 18px; z-index: 3;
    background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
    display: flex; align-items: center; gap: 12px;
    color: #fff;
}
.player-bar { flex: 1; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; position: relative; cursor: pointer; }
.player-bar > span { position: absolute; top: 0; left: 0; bottom: 0; background: var(--peach-300); border-radius: 2px; }
.player-time { font-size: 12px; font-variant-numeric: tabular-nums; }

.player-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.player-toolbar-left h1 { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600; color: var(--text); }
.player-toolbar-left .meta { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.player-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.player-actions {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 0;
    flex-wrap: wrap;
}
.action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text);
    transition: all .15s;
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover { border-color: var(--border-strong); }
.action-btn.active { background: rgba(244,217,193,.12); border-color: var(--accent); color: var(--accent); }

.rating-stars { display: inline-flex; gap: 2px; }
.rating-stars .star { cursor: pointer; color: var(--text-dim); transition: color .15s; font-size: 18px; }
.rating-stars .star.filled, .rating-stars .star:hover, .rating-stars .star:hover ~ .star { color: var(--amber); }
.rating-stars.readonly .star { cursor: default; }
.rating-stars.readonly .star:hover ~ .star { color: var(--text-dim); }
.rating-stars.readonly .star.filled { color: var(--amber); }

.player-nav {
    display: flex; gap: 10px; margin-top: 14px;
    justify-content: space-between;
}
.player-nav .btn { flex: 1; max-width: 260px; }

/* Tabs on player */
.player-tabs-content { margin-top: 16px; }
.lesson-desc { color: var(--text); line-height: 1.7; font-size: 14px; }
.lesson-desc p { margin-bottom: 10px; }

/* Comments */
.comments-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.comment {
    display: flex; gap: 12px;
}
.comment-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface-3); color: var(--text);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; flex: none;
}
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-name { font-weight: 600; font-size: 13px; color: var(--text); }
.comment-time { font-size: 11.5px; color: var(--text-dim); }
.comment-text { font-size: 13.5px; color: var(--text); margin-top: 4px; line-height: 1.5; }
.comment-actions { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.comment-actions button:hover { color: var(--accent); }

.comment-compose {
    display: flex; gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    margin-top: 14px;
}
.comment-compose-body { flex: 1; }
.comment-compose-actions { display: flex; justify-content: space-between; margin-top: 8px; gap: 8px; flex-wrap: wrap; }
.compose-tools { display: flex; gap: 4px; }
.compose-tool {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border);
    transition: all .15s;
}
.compose-tool:hover { color: var(--accent); border-color: var(--accent); }
.compose-tool svg { width: 16px; height: 16px; }

/* Materials */
.material-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: var(--surface);
    transition: border-color .15s;
}
.material-item:hover { border-color: var(--accent); }
.material-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex: none;
}
.material-info { flex: 1; min-width: 0; }
.material-name { font-size: 13.5px; font-weight: 500; }
.material-size { font-size: 11.5px; color: var(--text-muted); }
.material-download {
    padding: 6px 10px; font-size: 12px;
    color: var(--accent); background: transparent; border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
}
.material-download:hover { background: var(--accent); color: var(--accent-ink); }

/* Gamification sidebar */
.gamif-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    position: sticky; top: calc(var(--topbar-h) + 20px);
}
.gamif-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 4px;
}
.gamif-title .trophy { font-size: 20px; }
.gamif-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 16px; }
.gamif-task {
    display: flex; gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.gamif-task:last-of-type { border-bottom: 0; }
.gamif-task-num {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: var(--text);
    flex: none;
}
.gamif-task.done .gamif-task-num { background: var(--green); color: #fff; }
.gamif-task-info { flex: 1; min-width: 0; }
.gamif-task-title { font-size: 13px; font-weight: 600; }
.gamif-task-progress {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 4px; font-size: 11.5px; color: var(--text-muted);
}
.gamif-task-bar {
    margin-top: 6px;
    height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden;
}
.gamif-task-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

.cert-block {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 14px;
    text-align: center;
}
.cert-locked { color: var(--text-muted); font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ============ FOCUS MODE ============ */
.focus-overlay {
    position: fixed; inset: 0;
    background: #000;
    z-index: 200;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 50px;
}
.focus-exit {
    position: absolute; top: 20px; right: 20px;
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    color: #fff;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.focus-exit svg { width: 16px; height: 16px; }
.focus-exit:hover { background: rgba(255,255,255,.2); }
.focus-player {
    width: 100%; max-width: 1200px;
    aspect-ratio: 16 / 9;
    background: #0a0a0a;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.7);
    position: relative;
}

/* ============ COMMUNITY ============ */
.community-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}
@media (max-width: 1000px) { .community-layout { grid-template-columns: 1fr; } }

.post-composer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}
.post-composer textarea {
    width: 100%;
    background: transparent; border: 0; outline: 0;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 60px;
}
.post-composer textarea::placeholder { color: var(--text-dim); }
.post-composer-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap; gap: 10px;
}

.post-feed { display: flex; flex-direction: column; gap: 18px; }
.post {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
}
.post-head { display: flex; gap: 12px; align-items: center; }
.post-author { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.post-author-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--surface-3); color: var(--text);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px;
    flex: none;
}
.post-author-info .name { font-weight: 600; font-size: 14px; }
.post-author-info .name-ext { color: var(--text-muted); font-size: 12px; }
.post-menu { color: var(--text-muted); padding: 6px; border-radius: 50%; }
.post-menu:hover { background: var(--surface-2); }

.post-body { font-size: 14px; line-height: 1.6; margin-top: 12px; color: var(--text); }
.post-attach {
    margin-top: 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
    display: flex; align-items: center; justify-content: center;
    color: var(--peach-300); font-size: 40px;
}
.post-actions {
    display: flex; align-items: center; gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.post-action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    transition: all .15s;
}
.post-action-btn svg { width: 17px; height: 17px; }
.post-action-btn:hover { background: var(--surface-2); color: var(--text); }
.post-action-btn.liked { color: var(--red); }
.post-action-btn.liked svg { fill: var(--red); }

.post-comments { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.community-side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
.community-side-card h4 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 12px;
}

/* ============ RANKING ============ */
.rank-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    transition: border-color .15s;
}
.rank-item:hover { border-color: var(--border-strong); }
.rank-item.me { border-color: var(--accent); background: rgba(244,217,193,.05); }
.rank-pos {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    background: var(--surface-2); color: var(--text);
    flex: none;
}
.rank-item.pos-1 .rank-pos { background: #E6B450; color: #1a1a1a; }
.rank-item.pos-2 .rank-pos { background: #C0C0C0; color: #1a1a1a; }
.rank-item.pos-3 .rank-pos { background: #CD7F32; color: #1a1a1a; }
.rank-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--surface-3); color: var(--text);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; flex: none;
    background-size: cover; background-position: center;
}
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: 14px; }
.rank-stats { display: flex; gap: 10px; font-size: 11.5px; color: var(--text-muted); margin-top: 3px; flex-wrap: wrap; }
.rank-stats span { display: inline-flex; align-items: center; gap: 3px; }
.rank-points { font-weight: 700; color: var(--accent); font-size: 16px; display: flex; align-items: center; gap: 4px; }

/* ============ BADGES ============ */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.badge-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: all .2s;
}
.badge-card.unlocked { border-color: var(--accent); }
.badge-card.locked { opacity: .5; }
.badge-icon {
    width: 60px; height: 60px; border-radius: 50%;
    margin: 0 auto 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent), var(--peach-400));
    color: var(--navy-900);
}
.badge-card.locked .badge-icon { background: var(--surface-2); color: var(--text-dim); }
.badge-name { font-size: 12.5px; font-weight: 600; }
.badge-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }

/* ============ EVENTS ============ */
.event-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    transition: border-color .15s;
}
.event-card:hover { border-color: var(--border-strong); }
.event-date {
    width: 90px; flex: none;
    background: var(--navy-700); color: var(--peach-300);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 16px 10px;
    text-align: center;
}
.event-date .day { font-family: 'Playfair Display', serif; font-size: 32px; font-weight: 600; line-height: 1; }
.event-date .month { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 6px; }
.event-body { flex: 1; padding: 16px 20px; display: flex; flex-direction: column; }
.event-title { font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; color: var(--text); }
.event-meta { display: flex; gap: 12px; font-size: 12.5px; color: var(--text-muted); margin-top: 6px; flex-wrap: wrap; }
.event-meta span { display: inline-flex; align-items: center; gap: 4px; }
.event-desc { font-size: 13px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; flex: 1; }
.event-footer { display: flex; gap: 10px; margin-top: 12px; }

@media (max-width: 560px) {
    .event-card { flex-direction: column; }
    .event-date { width: 100%; padding: 12px; flex-direction: row; gap: 10px; }
    .event-date .day { font-size: 22px; }
}

/* ============ PROFILE ============ */
.profile-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}
@media (max-width: 800px) { .profile-layout { grid-template-columns: 1fr; } }

.profile-nav {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
    position: sticky;
    top: calc(var(--topbar-h) + 20px);
    height: fit-content;
}
.profile-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    width: 100%; text-align: left;
}
.profile-nav-item svg { width: 17px; height: 17px; }
.profile-nav-item:hover { background: var(--surface-2); color: var(--text); }
.profile-nav-item.active { background: var(--surface-2); color: var(--accent); }

.profile-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}
.profile-panel h3 { font-family: 'Playfair Display', serif; font-size: 20px; margin-bottom: 4px; }
.profile-panel .panel-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

.avatar-upload { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.avatar-lg { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; background-size: cover; background-position: center; }

/* ============ ADMIN ============ */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } }

.admin-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px; height: fit-content; position: sticky; top: calc(var(--topbar-h) + 20px); }
.admin-nav-item {
    width: 100%; text-align: left;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 13.5px; color: var(--text-muted); font-weight: 500;
    transition: all .15s;
}
.admin-nav-item svg { width: 17px; height: 17px; }
.admin-nav-item:hover { background: var(--surface-2); color: var(--text); }
.admin-nav-item.active { background: var(--surface-2); color: var(--accent); }

.admin-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 22px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.admin-table th { font-weight: 600; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-row-actions { display: flex; gap: 6px; }
.admin-row-btn { padding: 4px 8px; font-size: 11.5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.admin-row-btn:hover { border-color: var(--accent); color: var(--accent); }
.admin-row-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* Switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { display: none; }
.switch-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--surface-3); border-radius: 20px; transition: background .2s;
}
.switch-slider::before {
    content: ''; position: absolute; left: 3px; top: 3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; transition: transform .2s;
}
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* ============ TOAST + MODAL ============ */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--navy-700); color: #fff;
    padding: 12px 20px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    animation: toastIn .25s ease;
    font-size: 13.5px;
    display: flex; align-items: center; gap: 10px;
    max-width: calc(100vw - 32px);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 250;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 100%; max-width: 560px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s;
}
.modal.large { max-width: 820px; }
.modal-header {
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: 'Playfair Display', serif; font-size: 18px; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; color: var(--text-muted); font-size: 16px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
    :root { --sidebar-w: 260px; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .sidebar-close { display: inline-flex; }
    .sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 49;
        opacity: 0; pointer-events: none;
        transition: opacity .25s;
    }
    .sidebar-overlay.active { opacity: 1; pointer-events: auto; }
    .mobile-theme-toggle { display: inline-flex; }
    .content { padding: 20px 18px 60px; }
    .hero { padding: 26px; flex-direction: column; align-items: flex-start; }
    .hero-title { font-size: 26px; }
    .page-title { font-size: 26px; }
    .topbar { padding: 0 14px; }
    .topbar-search { max-width: none; }
}
@media (max-width: 540px) {
    .topbar-search { display: none; }
    .player-toolbar { flex-direction: column; align-items: stretch; }
    .player-nav { flex-direction: column; }
    .player-nav .btn { max-width: none; }
}

/* ============ UTILS ============ */
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.text-sm { font-size: 12.5px; } .text-muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.empty-state h4 { font-size: 15px; color: var(--text); margin-bottom: 6px; }

.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }

.kbd { display: inline-block; padding: 2px 6px; font-size: 11px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2); font-family: monospace; }

/* ============ AUTH SCREENS ============ */
.auth {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--navy-900);
    z-index: 500;
    padding: 20px;
    overflow-y: auto;
}
.auth-bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(244,217,193,.08), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(244,217,193,.06), transparent 50%);
    pointer-events: none;
}
.auth-card {
    position: relative;
    background: var(--navy-800);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 38px 34px;
    width: 100%; max-width: 440px;
    box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .seal { margin: 0 auto 18px; }
.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 26px; font-weight: 600;
    color: var(--peach-300);
    margin-bottom: 2px;
}
.auth-subtitle {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.auth-form h2 {
    font-family: 'Playfair Display', serif;
    font-size: 22px; color: #fff;
    margin-bottom: 4px;
}
.auth-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.auth-link { color: var(--peach-300); font-size: 12.5px; }
.auth-link:hover { text-decoration: underline; }
.auth-foot {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}
.auth-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 18px 0;
    color: var(--text-dim);
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ============ ONBOARDING ============ */
.onboarding {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
    z-index: 450;
    display: flex; flex-direction: column;
    padding: 40px 20px;
    overflow-y: auto;
}
.onb-progress {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px; background: rgba(244,217,193,.1);
}
.onb-progress > span {
    display: block; height: 100%;
    background: var(--peach-300);
    width: 0%;
    transition: width .4s;
}
.onb-skip {
    position: absolute; top: 18px; right: 20px;
    color: rgba(255,255,255,.5);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}
.onb-skip:hover { color: #fff; background: rgba(255,255,255,.08); }
.onb-content {
    max-width: 620px;
    margin: auto;
    color: #fff;
    text-align: center;
}
.onb-badge {
    display: inline-block;
    color: var(--peach-300);
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.onb-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 42px; font-weight: 600;
    line-height: 1.1;
    margin-bottom: 16px;
}
.onb-content p {
    color: rgba(255,255,255,.75);
    font-size: 15px; line-height: 1.6;
    max-width: 520px; margin: 0 auto 30px;
}
.onb-interests {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 540px;
    margin: 30px auto;
}
@media (max-width: 560px) { .onb-interests { grid-template-columns: repeat(2, 1fr); } }
.onb-interest {
    padding: 14px;
    border: 1px solid rgba(244,217,193,.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all .15s;
    color: #fff;
    font-size: 13px;
}
.onb-interest:hover { border-color: var(--peach-300); }
.onb-interest.active {
    background: var(--peach-300);
    color: var(--navy-900);
    border-color: var(--peach-300);
    font-weight: 600;
}
.onb-actions {
    display: flex; gap: 12px; justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}
.onb-avatar-upload {
    width: 120px; height: 120px; border-radius: 50%;
    background: rgba(244,217,193,.1);
    border: 2px dashed rgba(244,217,193,.3);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    cursor: pointer;
    font-size: 40px;
    transition: all .2s;
}
.onb-avatar-upload:hover { border-color: var(--peach-300); background: rgba(244,217,193,.15); }

/* ============ ID CARD ============ */
.id-card {
    max-width: 560px;
    aspect-ratio: 1.586;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-800) 50%, var(--navy-900) 100%);
    border-radius: 18px;
    padding: 30px;
    color: var(--peach-300);
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 0 1px rgba(244,217,193,.1);
}
.id-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -30%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(244,217,193,.12), transparent 65%);
    border-radius: 50%;
}
.id-card::after {
    content: '';
    position: absolute;
    bottom: -20%; left: -10%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(244,217,193,.06), transparent 70%);
    border-radius: 50%;
}
.id-card-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    position: relative; z-index: 2;
}
.id-card-brand .seal { transform: scale(.85); transform-origin: left top; }
.id-card-since { text-align: right; }
.id-card-since .label { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; opacity: .6; }
.id-card-since .year {
    font-family: 'Playfair Display', serif;
    font-size: 28px; font-weight: 600;
    margin-top: 2px;
}
.id-card-body {
    position: relative; z-index: 2;
    display: flex; align-items: center; gap: 20px;
    margin-top: 30px;
}
.id-card-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--peach-300); color: var(--navy-900);
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 700;
    border: 3px solid var(--peach-300);
    flex: none;
}
.id-card-info .name {
    font-family: 'Playfair Display', serif;
    font-size: 22px; font-weight: 600;
    color: #fff;
    line-height: 1.1;
}
.id-card-info .role {
    font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    opacity: .7; margin-top: 4px;
}
.id-card-bottom {
    position: relative; z-index: 2;
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-top: 30px;
}
.id-card-id .label { font-size: 9px; letter-spacing: 2px; opacity: .6; }
.id-card-id .value { font-family: monospace; font-size: 14px; margin-top: 2px; color: #fff; }

/* ============ TRILHAS ============ */
.trilha-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, transform .2s;
    cursor: pointer;
}
.trilha-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.trilha-card::before {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(244,217,193,.1), transparent 70%);
    border-radius: 50%;
}
.trilha-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--peach-400));
    color: var(--navy-900);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin-bottom: 14px;
    position: relative; z-index: 2;
}
.trilha-title { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.trilha-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; line-height: 1.5; }
.trilha-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); margin-bottom: 14px; flex-wrap: wrap; }
.trilha-path {
    display: flex; gap: 0; align-items: center;
    margin-top: 10px;
}
.trilha-step {
    flex: 1; height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    margin-right: 4px;
    position: relative;
    transition: background .3s;
}
.trilha-step:last-child { margin-right: 0; }
.trilha-step.done { background: var(--accent); }
.trilha-step.current { background: var(--accent); opacity: .6; }

/* ============ PLANS ============ */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 26px;
    display: flex; flex-direction: column;
    transition: all .2s;
    position: relative;
}
.plan-card.featured {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(244,217,193,.04), var(--surface));
}
.plan-card.featured::before {
    content: 'MAIS POPULAR';
    position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: var(--accent-ink);
    padding: 3px 12px; border-radius: 999px;
    font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
}
.plan-name { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.plan-tagline { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }
.plan-price { margin-bottom: 20px; }
.plan-price .value { font-family: 'Playfair Display', serif; font-size: 38px; font-weight: 600; color: var(--text); }
.plan-price .period { color: var(--text-muted); font-size: 13px; }
.plan-features { list-style: none; flex: 1; margin-bottom: 20px; }
.plan-features li {
    padding: 8px 0;
    font-size: 13px;
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--border);
}
.plan-features li::before {
    content: '✓';
    color: var(--green);
    font-weight: 700;
    flex: none;
}
.plan-features li.off { color: var(--text-dim); }
.plan-features li.off::before { content: '✕'; color: var(--text-dim); }

/* ============ SPLASH sub ============ */
.splash-sub {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 3px;
    margin-top: 6px;
    text-transform: uppercase;
}

@media (max-width: 500px) {
    .auth-card { padding: 28px 22px; }
    .onb-content h1 { font-size: 30px; }
    .id-card { padding: 20px; border-radius: 14px; }
    .id-card-info .name { font-size: 17px; }
    .id-card-avatar { width: 56px; height: 56px; font-size: 22px; }
}

/* Password criteria (signup form) */
.pass-checks { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 12px; }
.pass-check { display: flex; align-items: center; gap: 6px; color: #dc2626; transition: color .15s; }
.pass-check::before { content: '✗'; font-weight: 700; width: 12px; display: inline-block; text-align: center; }
.pass-check.met { color: #16a34a; }
.pass-check.met::before { content: '✓'; }

/* Onboarding carteirinha (step 3) */
.onb-card-preview {
    max-width: 420px;
    margin: 24px auto 0;
    background: linear-gradient(135deg, #0a0a14, #1a1a2e);
    border: 1px solid rgba(201,169,110,.3);
    border-radius: 14px;
    padding: 26px 24px 18px;
    position: relative;
    overflow: hidden;
    color: #fff;
}
.onb-card-preview::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #c9a96e, #f4d9c1, #c9a96e);
}
.onb-card-header {
    font-family: 'Playfair Display', serif;
    font-size: 13px; letter-spacing: 3px;
    color: #c9a96e; text-align: center;
    margin-bottom: 18px;
}
.onb-card-body { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.onb-card-avatar {
    width: 84px; height: 84px; border-radius: 50%;
    background: #1f1f33;
    border: 2px solid #c9a96e;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    font-family: 'Playfair Display', serif;
    font-size: 34px; font-weight: 600; color: #fff;
}
.onb-card-name { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600; }
.onb-card-sub { font-size: 12px; color: rgba(255,255,255,.6); }
.onb-card-footer { text-align: center; margin-top: 14px; font-size: 10px; letter-spacing: 2px; color: #c9a96e; }
