:root {
    --md-ink: #1b1935;
    --md-muted: #615b75;
    --md-accent: #6240bf;
    --md-accent-dark: #4b2d9b;
    --md-line: #e5dff0;
    --md-bg: #f5f2fa;
    --md-surface: #fff;
    --md-radius: 16px;
    --md-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { font-family: var(--md-font); }
.md-portal.bg-light, .md-public { background: var(--md-bg) !important; color: var(--md-ink); }
.md-portal { --bs-body-color: var(--md-ink); --bs-border-color: var(--md-line); }
.md-portal .md-navbar {
    background: var(--md-surface);
    border-bottom: 1px solid var(--md-line);
    min-height: 68px;
}
.md-navbar .navbar-brand img { width: auto; max-width: 155px; object-fit: contain; }
.md-profile-name { max-width: min(26vw, 12rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-sidebar { flex: 0 0 230px; width: 230px; border-right: 1px solid var(--md-line); background: var(--md-surface); }
.md-sidebar-nav h6 { color: var(--md-muted); font-size: .72rem; letter-spacing: .11em; }
.md-sidebar-nav .nav { gap: .25rem; }
.md-sidebar-nav .nav-link { color: var(--md-ink); border-radius: 10px; font-size: .92rem; padding: .65rem .75rem; }
.md-sidebar-nav .nav-link:hover, .md-sidebar-nav .nav-link.active { color: var(--md-accent-dark); background: #eee7ff; }
.md-sidebar-nav .nav-link.active { font-weight: 700; }
.md-main { min-width: 0; }
.md-portal h1, .md-portal h2, .md-portal h3 { letter-spacing: -.025em; }
.md-portal .card, .md-portal .modal-content, .md-portal .dropdown-menu {
    border-radius: var(--md-radius);
    border-color: var(--md-line);
}
.md-portal .card.shadow-sm { box-shadow: 0 8px 26px #33224d0e !important; }
.md-portal .card-header:first-child { border-radius: var(--md-radius) var(--md-radius) 0 0; }
.md-portal .table th { font-size: .83rem; }
.md-portal .table-responsive { border-radius: inherit; }
.md-portal .btn, .md-portal .form-control, .md-portal .form-select { border-radius: 9px; }
.md-portal .btn-primary, .md-portal .bg-primary { --bs-primary-rgb: 98, 64, 191; }
.md-portal .btn-primary {
    --bs-btn-bg: #6240bf; --bs-btn-border-color: #6240bf;
    --bs-btn-hover-bg: #4b2d9b; --bs-btn-hover-border-color: #4b2d9b;
    --bs-btn-active-bg: #44268f; --bs-btn-active-border-color: #44268f;
}
.md-portal .btn-outline-primary {
    --bs-btn-color: #6240bf; --bs-btn-border-color: #6240bf;
    --bs-btn-hover-bg: #6240bf; --bs-btn-hover-border-color: #6240bf;
    --bs-btn-active-bg: #4b2d9b; --bs-btn-active-border-color: #4b2d9b;
}
.md-portal .text-primary { --bs-primary-rgb: 98, 64, 191; }
.md-portal .form-control:focus, .md-portal .form-select:focus {
    border-color: var(--md-accent);
    box-shadow: 0 0 0 .2rem #6240bf29;
}
.md-portal footer { background: var(--md-surface) !important; }
.md-public #home {
    background: radial-gradient(ellipse at 88% 14%, #794bdd 0%, transparent 56%), linear-gradient(128deg, #21163c, #472783);
}
.md-public #features article, .md-public #pricing .shadow-lg { border-radius: 22px; }
.md-public nav { border-bottom-color: var(--md-line); }

.auth-page {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    background: radial-gradient(ellipse at 15% 0%, #e5dbff, transparent 55%), var(--md-bg);
    color: var(--md-ink);
}
.auth-shell {
    width: min(100%, 910px);
    display: grid;
    grid-template-columns: .95fr 1.05fr;
    border-radius: 26px;
    overflow: hidden;
    background: var(--md-surface);
    box-shadow: 0 18px 65px #30214a25;
}
.auth-brand, .auth-panel { padding: clamp(26px, 5vw, 54px); }
.auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 38px;
    background: radial-gradient(ellipse at 90% 0%, #6542ac, transparent 64%), #251841;
    color: #f7f2ff;
}
.auth-brand img { display: block; width: min(100%, 155px); padding: 8px 12px; background: white; border-radius: 12px; }
.auth-brand h2 { margin: .4rem 0; font-size: clamp(1.65rem, 3.5vw, 2.45rem); line-height: 1.08; letter-spacing: -.04em; }
.auth-brand p { color: #e5d9ff; line-height: 1.5; }
.auth-brand-caption { font-size: .72rem; letter-spacing: .16em; }
.auth-home { color: #f7f2ff; }
.auth-panel h1 { margin: 0 0 .6rem; font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.05em; }
.auth-panel > p { line-height: 1.55; color: var(--md-muted); }
.auth-panel a { color: var(--md-accent-dark); font-weight: 650; }
.auth-panel form { display: grid; gap: .5rem; margin: 1.5rem 0 1rem; }
.auth-panel label { font-size: .9rem; font-weight: 650; }
.auth-panel input {
    font: inherit;
    min-width: 0;
    padding: .75rem;
    box-sizing: border-box;
    border: 1px solid #bfb4d2;
    border-radius: 9px;
    margin-bottom: .5rem;
    color: var(--md-ink);
}
.auth-panel button {
    background: var(--md-accent);
    border: 0;
    border-radius: 9px;
    padding: .8rem 1rem;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.auth-panel button:hover { background: var(--md-accent-dark); }
.auth-page :focus-visible { outline: 3px solid #9973ed; outline-offset: 2px; }
.auth-panel .auth-error, .auth-panel .auth-notice { padding: .7rem .8rem; border-radius: 9px; font-size: .9rem; }
.auth-panel .auth-error { color: #8a1c35; background: #fbe9ee; }
.auth-panel .auth-notice { color: #145d43; background: #e2f5ed; }
@media (max-width: 650px) {
    .auth-page { padding: 14px; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-brand { flex-direction: row; gap: .75rem; align-items: center; }
    .auth-brand > div { display: none; }
    .auth-brand img { width: 92px; }
    .auth-home { font-size: .85rem; }
}

.md-dashboard-heading {
    background: var(--md-surface);
    border: 1px solid var(--md-line);
    border-radius: var(--md-radius);
    padding: clamp(1rem, 3vw, 1.8rem);
}
.md-stat { border-bottom: 3px solid #c7b2ef !important; }
.md-stat h5 { color: var(--md-muted); font-size: .95rem; }
.md-stat h2 { color: var(--md-ink) !important; margin: .4rem 0 0; }
.md-wallet { background: linear-gradient(135deg, #34205d, #6944ba); }

.auth-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    padding: .35rem;
    margin-top: 1.3rem;
    background: var(--md-bg);
    border-radius: 12px;
}
.auth-methods a { padding: .65rem .35rem; text-align: center; border-radius: 8px; text-decoration: none; }
.auth-methods a[aria-current="page"] { background: white; box-shadow: 0 1px 6px #30214a22; }
.md-avatar { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
.md-avatar-lg { width: 78px; height: 78px; font-size: 1.75rem; }
.md-avatar-placeholder { display: inline-grid; place-items: center; background: #eee7ff; color: var(--md-accent-dark); font-weight: 700; }
