/**
 * AIMOutlet — Main Stylesheet (Dark Theme)
 */

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary:     #0d1117;
    --bg-secondary:   #161b22;
    --bg-tertiary:    #21262d;
    --bg-card:        #1c2128;
    --border-color:   #30363d;
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    --accent:         #58a6ff;
    --accent-hover:   #79c0ff;
    --success:        #22782d;
    --warning:        #d29922;
    --danger:         #f85149;
    --font-family:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono:      'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    --radius:         6px;
    --shadow:         0 1px 3px rgba(0,0,0,0.3);
    --transition:     0.2s ease;
}

/* Fluid typography and adaptable horizontal breathing room. clamp() keeps
   text readable on narrow screens without oversized ultra-wide headings. */
body { font-size: clamp(0.9375rem, 0.88rem + 0.18vw, 1rem); }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem); }
h2 { font-size: clamp(1.35rem, 1.05rem + 1.2vw, 2.1rem); }
h3 { font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.35rem); }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    /* Main scrollbar — themed like the sidebar (visible) */
    scrollbar-width: thin;
    scrollbar-color: rgba(88, 166, 255, 0.55) var(--bg-secondary);
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.45);
    border: 2px solid var(--bg-secondary);
    border-radius: 999px;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 166, 255, 0.75);
}
body {
    scrollbar-width: thin;
    scrollbar-color: rgba(88, 166, 255, 0.55) var(--bg-secondary);
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Headings ──────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 56px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    margin-right: auto;
}
.nav-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
}
.nav-logo-text {
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-username {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color var(--transition);
}
.nav-username:hover {
    color: var(--accent);
}
.nav-role {
    cursor: pointer;
    transition: opacity var(--transition);
}
.nav-role:hover {
    opacity: 0.8;
}

/* Hamburger button (left side of navbar) — mobile only, toggles sidebar */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
}
.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}
/* Animate to X when sidebar is open */
body.sidebar-open .nav-hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
body.sidebar-open .nav-hamburger span:nth-child(2) {
    opacity: 0;
}
body.sidebar-open .nav-hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Legacy toggle (kept for backwards compat, unused now) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
}

/* ── Persistent Left Sidebar (below the header) ────────────────── */
.app-sidebar {
    position: fixed;
    top: 56px;            /* below the sticky navbar */
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 900;
    overflow-y: auto;     /* scroll only if content overflows */
    overflow-x: hidden;
    transition: transform 0.25s ease;
    /* Firefox scrollbar colors */
    scrollbar-width: thin;
    scrollbar-color: rgba(88, 166, 255, 0.55) var(--bg-secondary);
}
.app-sidebar::-webkit-scrollbar { width: 8px; }
.app-sidebar::-webkit-scrollbar-track { background: var(--bg-secondary); }
.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.45);
    border: 2px solid var(--bg-secondary);
    border-radius: 999px;
}
.app-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(88, 166, 255, 0.75); }
.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}
.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}
.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.sidebar-username {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-role {
    align-self: flex-start;
    font-size: 0.7rem;
}

.sidebar-nav {
    padding: 0.75rem 0.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}
.sidebar-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.sidebar-link.active {
    background: rgba(88,166,255,0.12);
    color: var(--accent);
}
.sidebar-link-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}
.sidebar-link.active .sidebar-badge {
    background: rgba(88,166,255,0.2);
    color: var(--accent);
}

.sidebar-sublink {
    font-size: 0.85rem;
    padding-left: 1.25rem;
}

.sidebar-section-divider {
    margin: 0.75rem 0.5rem 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.sidebar-mod-toggle-wrap {
    margin: 0.25rem 0.5rem 0.5rem;
    padding: 0.6rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}
.sidebar-mod-toggle-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Backdrop for mobile when sidebar is open */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 850;
}
body.sidebar-open .sidebar-backdrop {
    display: block;
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    box-sizing: border-box;
}
/* Moderator panels do not use a page heading above their content, so keep
   their side/bottom gutter but remove unused space below the navbar. */
body.page-moderator .main-content { padding-top: 0; }

/* ── Moderator Mode Toggle (global — used in sidebar on all pages) ── */
.toggle-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-radius: 99px;
    padding: .125em;
    background-image: linear-gradient(to bottom, #777676, #212121);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}
.toggle-checkbox {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    z-index: 1;
    border-radius: inherit;
    width: 100%;
    height: 100%;
    font: inherit;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}
.toggle-container {
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 99px;
    width: 3em;
    height: 1.5em;
    background-color: #212121;
    box-shadow: inset 0 0 .0625em .125em rgba(5, 5, 5, 0.2), inset 0 .0625em .125em rgba(0, 0, 0, 0.4);
    transition: background-color .4s linear;
}
.toggle-checkbox:checked + .toggle-container {
    background-color: #8b6914;
    background-image: radial-gradient(ellipse at center, rgba(255, 223, 130, 0.85) 0%, rgba(139, 105, 20, 0.9) 55%, #6b520f 100%);
    box-shadow: inset 0 .15em .3em rgba(0, 0, 0, 0.7), inset 0 -.1em .15em rgba(0, 0, 0, 0.5), 0 0 .5em rgba(139, 105, 20, 0.45);
}
.toggle-button {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: .0625em;
    border-radius: 99px;
    width: 1.375em;
    height: 1.375em;
    background-color: #212121;
    box-shadow: inset 0 -.0625em .0625em .125em rgba(5, 5, 5, 0.2), inset 0 -.125em .0625em rgba(5, 5, 5, 0.2), inset 0 .1875em .0625em rgba(219, 219, 219, 0.3), 0 .125em .125em rgb(0 0 0 / .5);
    transition: left .4s;
}
.toggle-checkbox:checked + .toggle-container > .toggle-button {
    left: 1.5625em;
}
.toggle-button-circles-container {
    display: grid;
    grid-template-columns: repeat(3, min-content);
    gap: .125em;
    position: absolute;
    margin: 0 auto;
}
.toggle-button-circle {
    border-radius: 50%;
    width: .125em;
    height: .125em;
    background-image: radial-gradient(circle at 50% 0, #5e5d5d, #807d7d);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    gap: 0.5rem;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--border-color);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--accent);
    background: rgba(88,166,255,0.1);
}

.btn-success {
    background: #22782d;
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
    background: #2ea043;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-user       { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-moderator  { background: #1f6feb33; color: var(--accent); }
.badge-admin      { background: #f8514933; color: var(--danger); }
.badge-lifetime   { background: #3fb95033; color: var(--success); }
.badge-active     { background: #3fb95033; color: var(--success); }
.badge-trial      { background: #d2992233; color: var(--warning); }
.badge-inactive   { background: #6e768133; color: var(--text-muted); }
.badge-tint-green  { background: rgba(63, 185, 80, 0.20);  color: #22782d; border: 1px solid rgba(63, 185, 80, 0.40); }
.badge-tint-blue   { background: rgba(31, 111, 235, 0.20); color: #58a6ff; border: 1px solid rgba(31, 111, 235, 0.40); }
.badge-tint-yellow { background: rgba(210, 153, 34, 0.20); color: #d29922; border: 1px solid rgba(210, 153, 34, 0.45); }
.badge-tint-red    { background: rgba(248, 81, 73, 0.20);  color: #f85149; border: 1px solid rgba(248, 81, 73, 0.40); }
.badge-free       { background: #0e6b1ab1; color: #dbf3df; }
.badge-price      { background: #d2992233; color: var(--warning); }
.badge-subscribed { background: #3fb95033; color: var(--success); }
.badge-success    { background: #3fb95033; color: var(--success); }
.badge-warning    { background: #d2992233; color: var(--warning); }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea,
.form-group select,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-status {
    display: inline-block;
    margin-left: 1rem;
    font-size: 0.875rem;
}

/* ── Alerts ────────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-error {
    background: #f8514922;
    border: 1px solid #f8514944;
    color: var(--danger);
}
.alert-success {
    background: #3fb95022;
    border: 1px solid #3fb95044;
    color: var(--success);
}

/* ── Accent Text ───────────────────────────────────────────────── */
.accent {
    color: var(--accent);
}
.text-muted {
    color: var(--text-muted);
}

/* ── Login Page ────────────────────────────────────────────────── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
}
.login-logo h1 {
    font-size: 1.75rem;
}
.login-logo .tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.login-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.login-disclaimer {
    margin-top: 1rem;
}

/* ── Disclaimers ───────────────────────────────────────────────── */
.disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.disclaimer-footer {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 3rem 0;
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}
.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ── Features ──────────────────────────────────────────────────── */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 3rem;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}
.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.feature-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}
.feature-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ── Landing Section ───────────────────────────────────────────── */
.landing-section {
    margin-top: 2rem;
}
.landing-section h2 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}
.section-action {
    text-align: center;
    margin-top: 1.5rem;
}

/* ── Loading ───────────────────────────────────────────────────── */
.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

/* ── Error Pages ───────────────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 4rem 0;
}
.error-page h1 {
    font-size: 5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.error-page p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ── Checkout Result ───────────────────────────────────────────── */
.checkout-result {
    text-align: center;
    padding: 4rem 0;
}
.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}
.checkout-result.success .result-icon { color: var(--success); }
.checkout-result.cancel .result-icon  { color: var(--danger); }
.checkout-result h2 { margin-bottom: 0.5rem; }
.checkout-result p  { color: var(--text-secondary); margin-bottom: 0.5rem; }
.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* ── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.modal-header h3 { font-size: 1.125rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.modal-body ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-top: auto;
    box-sizing: border-box;
}
.footer-container {
    width: 100%;
    margin: 0 auto;
    text-align: center;
}
.footer-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.footer-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.footer-disclaimer {
    margin-bottom: 0.5rem;
}
.footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Progress Bar ──────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
}

/* ── Responsive ────────────────────────────────────────────────── */

/* Desktop: navbar spans edge-to-edge (sidebar sits below it). Only the
   main content and footer are indented right of the sidebar via padding-left
   (NOT margin-left — margin + width:100% causes a 240px overflow that clips
   the right side). Inner containers center themselves via margin:auto. */
@media (min-width: 769px) {
    body.has-sidebar .main-content {
        padding-left: calc(240px + 1.5rem);
    }
    body.has-sidebar .site-footer {
        padding-left: calc(240px + 1.5rem);
    }
    /* Hide hamburger on desktop — sidebar is always visible */
    body.has-sidebar .nav-hamburger { display: none; }
    /* Show full text logo + nav links on desktop */
    body.has-sidebar .nav-logo-text { display: inline; }
    body.has-sidebar .nav-links { display: flex; }
}

/* Mobile: sidebar slides in from the left, hamburger toggles it */
@media (max-width: 768px) {
    /* Sidebar starts off-canvas, below the navbar */
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 30px rgba(0,0,0,0.5);
    }
    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    /* Show hamburger on mobile */
    body.has-sidebar .nav-hamburger { display: flex; }
    /* Hide the text logo on mobile — keep only the webp icon */
    body.has-sidebar .nav-logo-text { display: none; }
    /* Hide the username/role/logout on mobile (they're in the sidebar) */
    body.has-sidebar .nav-user { display: none; }

    .nav-links { display: none; }
    .nav-toggle { display: flex; }
    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 56px;
        left: 0; right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        gap: 0.5rem;
    }
    .hero h1 { font-size: 2rem; }
    .form-row { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; align-items: center; }
}

/* ── Light / Dark Theme Toggle ──────────────────────────────────── */
.theme-toggle-btn {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 0.75rem -0.25rem var(--accent), inset 0 0 0.75rem -0.5rem var(--accent);
    color: var(--accent);
    z-index: 9999;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
/* Header variant — inline next to logout button, not floating */
.theme-toggle-btn.nav-theme-toggle {
    position: static;
    width: 32px;
    height: 32px;
    box-shadow: none;
    border-radius: 50%;
}
.theme-toggle-btn.nav-theme-toggle:hover {
    box-shadow: none;
    transform: scale(1.05);
    background: var(--bg-tertiary);
}
.theme-toggle-btn:hover {
    box-shadow: 0 0 1rem -0.25rem var(--accent), inset 0 0 1rem -0.25rem var(--accent);
    transform: scale(1.05);
}
.theme-icon {
    grid-column: 1 / 1;
    grid-row: 1 / 1;
    transition: transform 400ms ease, opacity 400ms ease;
}
/* Dark mode (default): show sun icon (click to go light) */
.theme-icon--sun {
    opacity: 1;
    transform: scale(1);
}
.theme-icon--moon {
    opacity: 0;
    transform: scale(0);
}
/* Light mode: show moon icon (click to go dark) */
body.theme-light .theme-icon--sun {
    opacity: 0;
    transform: scale(0);
}
body.theme-light .theme-icon--moon {
    opacity: 1;
    transform: scale(1);
}

/* ── Light Theme Variables ─────────────────────────────────────── */
/* Applied to body.theme-light for the real page, and to .page-clone
   inside the clip for the transition. */
body.theme-light,
.page-clone.theme-light {
    --bg-primary:     #f6f8fa;
    --bg-secondary:   #ffffff;
    --bg-tertiary:    #e1e4e8;
    --bg-card:        #ffffff;
    --border-color:   #d0d7de;
    --text-primary:   #1f2328;
    --text-secondary: #656d76;
    --text-muted:     #8c959f;
    --accent:         #0969da;
    --accent-hover:   #0550ae;
    --success:        #1a7f37;
    --warning:        #9a6700;
    --danger:         #cf222e;
    --shadow:         0 1px 3px rgba(0,0,0,0.1);
}

/* Dark theme variables for the clone (same as :root defaults) */
.page-clone.theme-dark {
    --bg-primary:     #0d1117;
    --bg-secondary:   #161b22;
    --bg-tertiary:    #21262d;
    --bg-card:        #1c2128;
    --border-color:   #30363d;
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    --accent:         #58a6ff;
    --accent-hover:   #79c0ff;
    --success:        #3fb950;
    --warning:        #d29922;
    --danger:         #f85149;
    --shadow:         0 1px 3px rgba(0,0,0,0.3);
}

/* ── Theme Transition Clip ─────────────────────────────────────── */
/* Circular clip-path wipe. The JS clones the entire page (html element)
   into this div with the NEW theme applied, then expands the circle. */
.theme-clip {
    z-index: 9998;
    position: fixed;
    /* JS sets these to the center of the actual toggle button. */
    top: var(--theme-origin-y, calc(100vh - 52px));
    left: var(--theme-origin-x, 52px);
    width: 0;
    height: 0;
    border-radius: 100%;
    pointer-events: none;
    overflow: hidden;
}
.theme-clip.anim {
    animation: theme-wipe-open 0.7s ease-in forwards;
}
@keyframes theme-wipe-open {
    0% {
        top: var(--theme-origin-y, calc(100vh - 52px));
        left: var(--theme-origin-x, 52px);
        width: 0;
        height: 0;
        clip-path: circle(0% at center);
    }
    100% {
        top: calc(var(--theme-origin-y, calc(100vh - 52px)) - 250vmax);
        left: calc(var(--theme-origin-x, 52px) - 250vmax);
        width: 500vmax;
        height: 500vmax;
        clip-path: circle(100% at center);
    }
}
/* The cloned page inside the clip fills the viewport. The JS adds
   .theme-light or .theme-dark to this element so the CSS variables
   resolve to the new theme inside the expanding circle. */
.theme-clip .page-clone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
}
