:root {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #f472b6;
    --accent: #34d399;
    --bg-dark: #09090b;
    --bg-card: rgba(24, 24, 27, 0.65);
    --bg-navbar: rgba(9, 9, 11, 0.75);
    --text-main: #fafafa;
    --text-muted: #b4b4be;
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.4);
    --glass-blur: blur(16px);
    --shadow-lg: 0 20px 40px -10px rgba(0,0,0,0.5), 0 10px 20px -5px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --body-bg: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.12), transparent 40%), 
               radial-gradient(circle at 85% 30%, rgba(244, 114, 182, 0.08), transparent 40%), 
               #09090b;
    --input-bg: rgba(24, 24, 27, 0.5);
    --modal-bg: rgba(24, 24, 27, 0.95);
    --danger: #ef4444;
    --warning: #f59e0b;
}

[data-theme="light"] {
    --bg-dark: #fafafa;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-navbar: rgba(250, 250, 250, 0.85);
    --text-main: #09090b;
    --text-muted: #63636b;
    --border: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.46);
    /* the pale indigo is fine on dark, but too faint for links and icons on white */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #047857;   /* the bright green is unreadable as text on white */
    --body-bg: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.1), transparent 40%), 
               radial-gradient(circle at 85% 30%, rgba(244, 114, 182, 0.08), transparent 40%), 
               #fafafa;
    --input-bg: rgba(255, 255, 255, 0.6);
    --modal-bg: rgba(255, 255, 255, 0.95);
    --shadow-lg: 0 20px 40px -10px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ── Layout ── */
#app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }

/* ── Sidebar ── */
.navbar {
    background: var(--bg-navbar);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem 3rem;
}

.nav-logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu { list-style: none; flex-grow: 1; }
.nav-item { margin-bottom: 0.5rem; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.nav-link i { font-size: 1.1rem; width: 22px; text-align: center; }

.nav-auth {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    cursor: pointer;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle i { font-size: 1rem; }

/* ── Main Content ── */
main { padding: 2.5rem; overflow-y: auto; }

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 2rem;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.view { display: none; animation: fadeIn 0.4s ease-out; }
.view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99,102,241,0.4);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99,102,241,0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-main);
}
.btn-outline:hover { background: rgba(255,255,255,0.05); border-color: var(--text-muted); }

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(239,68,68,0.3);
}
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; border-radius: 0.5rem; }
.btn-text { background: none; border: none; color: var(--primary); cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.btn-text:hover { text-decoration: underline; }
.w-full { width: 100%; }
.hidden { display: none; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Loading ── */
.loader {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 3000;
    display: none;
}
.spinner-overlay.active { display: flex; }

.spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline button spinner */
.btn.loading { opacity: 0.7; pointer-events: none; }

/* ── Dashboard ── */
.section-header { margin-bottom: 2rem; }
.section-header h1 { margin-bottom: 0.25rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 1.75rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.06;
}
.stat-card:hover { border-color: var(--primary); transform: translateY(-4px); }
.stat-card h3 { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin-bottom: 0.25rem; }
.stat-card p { color: var(--text-muted); font-weight: 500; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.06em; }

.recent-notes-container { }
.container-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.container-header h2 { font-size: 1.25rem; font-weight: 700; }

/* ── Notes Section ── */
.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.notes-header h1 { margin-bottom: 0; }

.notes-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.tag-filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.tag-filter-btn:hover,
.tag-filter-btn.active {
    background: rgba(99,102,241,0.15);
    border-color: var(--primary);
    color: var(--primary);
}
.tag-filter-btn.active { font-weight: 700; }

.export-bar { display: flex; gap: 0.5rem; }

/* ── Note Cards ── */
#notes-list, #recent-notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.note-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 1.5rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.note-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}
.note-card:hover { background: rgba(30,41,59,0.9); border-color: rgba(99,102,241,0.3); transform: scale(1.01); }
.note-card:hover::before { opacity: 1; }

[data-theme="light"] .note-card:hover { background: rgba(255,255,255,0.95); }

.note-card h3 { font-size: 1.1rem; margin-bottom: 0.6rem; color: var(--text-main); }
.note-card > p {
    color: var(--text-muted);
    font-size: 0.88rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.note-meta {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.note-tags { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    padding: 0.2rem 0.65rem;
    border-radius: 2rem;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.tag:hover { background: rgba(99,102,241,0.25); }

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    opacity: 0;
    transition: var(--transition);
}
.note-card:hover .note-actions { opacity: 1; }

/* Source badge */
.source-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 0.4rem;
    background: rgba(16,185,129,0.1);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-main); }
.empty-state p { font-size: 0.9rem; }

/* ── Search View ── */
.search-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
}
#search-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border);
    padding: 0.9rem 1.25rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    font-size: 1rem;
}
#search-input:focus { outline: none; border-color: var(--primary); }
#search-input::placeholder { color: var(--text-muted); }

#search-results { display: flex; flex-direction: column; gap: 1rem; }

.search-result-card {
    background: var(--bg-card);
    padding: 1.25rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}
.search-result-card:hover { border-color: rgba(99,102,241,0.3); }
.search-result-card .match-score {
    color: var(--accent);
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ── Upload / Collection Hub ── */
.upload-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.upload-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
}
.upload-card h3 { margin-bottom: 1.5rem; font-size: 1.1rem; display: flex; align-items: center; gap: 0.75rem; }
.upload-card h3 i { color: var(--primary); }

.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}
.file-drop-zone:hover { border-color: var(--primary); color: var(--text-main); }
.file-drop-zone i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }

/* ── Profile Section ── */
.profile-content {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    max-width: 700px;
}
.profile-header-row { display: flex; align-items: center; gap: 2rem; margin-bottom: 2rem; }
.avatar-stack { position: relative; width: 120px; height: 120px; }
.avatar-stack img { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--primary); object-fit: cover; }
.btn-icon {
    position: absolute; bottom: 0; right: 0;
    background: var(--primary); border: none; color: white;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
}
.info-stack h2 { font-size: 1.3rem; font-weight: 700; }
.info-stack p { color: var(--text-muted); font-size: 0.9rem; }

.network-container {
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    transition: background 0.3s ease;
}
[data-theme="light"] .network-container {
    background: radial-gradient(circle, #f1f5f9 0%, #e2e8f0 100%);
}

.toggle-switch { display: flex; align-items: center; gap: 1rem; cursor: pointer; margin: 1.5rem 0; }
.slider {
    position: relative; width: 44px; height: 24px;
    background: var(--bg-dark); border-radius: 12px;
    border: 1px solid var(--border); flex-shrink: 0;
    transition: var(--transition);
}
.slider::after {
    content: '';
    position: absolute; left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: var(--text-muted); border-radius: 50%;
    transition: var(--transition);
}
input[type="checkbox"]:checked + .slider { background: var(--primary); border-color: var(--primary); }
input[type="checkbox"]:checked + .slider::after { transform: translateX(20px); background: white; }
input[type="checkbox"] { display: none; }

.debug-output-box {
    font-family: monospace;
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.04);
    color: #4f46e5;
    border-radius: 0.5rem;
    padding: 1rem;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
    border: 1px solid var(--border);
    transition: background 0.3s, color 0.3s;
}
[data-theme="dark"] .debug-output-box {
    background: rgba(0, 0, 0, 0.25);
    color: #a3e635;
}

/* ── Analytics Section ── */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}
.analytics-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 1.5rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.analytics-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.analytics-card .label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.5rem; }
.analytics-card .value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.analytics-card .sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

.analytics-section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-main); }

.source-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.source-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.source-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.source-item .source-name { font-size: 0.85rem; font-weight: 600; color: var(--text-main); }
.source-item .source-count { font-size: 0.75rem; color: var(--text-muted); }

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
}
.tag-cloud-item {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    color: var(--primary);
    padding: 0.3rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ── Modals ── */
.modal {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-y: auto;
}
.modal-content {
    background: var(--modal-bg);
    width: 90%;
    max-width: 600px;
    margin: 8vh auto;
    padding: 2.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    position: relative;
    box-shadow: var(--shadow-lg);
}
.close {
    position: absolute; top: 1.25rem; right: 1.5rem;
    font-size: 1.5rem; color: var(--text-muted); cursor: pointer;
    transition: var(--transition);
}
.close:hover { color: var(--text-main); }
.modal-content h2 { margin-bottom: 1.5rem; font-size: 1.5rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.45rem; font-weight: 500; color: var(--text-muted); font-size: 0.88rem; }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    transition: var(--transition);
    font-size: 0.95rem;
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--input-bg);
}
.form-group select option { background: var(--modal-bg); color: var(--text-main); }

/* ── Glass utility ── */
.glass {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
}

/* ── Toast ── */
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 5000; display: flex; flex-direction: column; gap: 0.75rem; }
.toast {
    padding: 0.9rem 1.5rem;
    border-radius: 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideIn 0.3s ease;
    max-width: min(420px, calc(100vw - 2rem));
    color: white;
}
.toast.success { background: rgba(16,185,129,0.92); }
.toast.error   { background: rgba(239,68,68,0.92); }
.toast.info    { background: rgba(99,102,241,0.92); }
@keyframes slideIn { from { opacity:0; transform: translateX(2rem); } to { opacity:1; transform: translateX(0); } }
@keyframes slideOut { to { opacity:0; transform: translateX(2rem); } }

/* ── Collector (standalone page) ── */
.collector-container { max-width: 500px; margin: 0 auto; padding: 2rem 1.5rem; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.action-card {
    background: var(--bg-card);
    padding: 2rem 1rem;
    border-radius: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}
.action-card:active, .action-card:hover { transform: scale(0.97); background: var(--primary); }
.action-card i { font-size: 2rem; color: var(--primary); margin-bottom: 0.5rem; display: block; }
.action-card:hover i, .action-card:active i { color: white; }
.action-card span { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.action-card:hover span, .action-card:active span { color: white; }

.recent-item { background: rgba(255,255,255,0.03); padding: 1rem; border-radius: 1rem; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 1rem; }
.recent-item i { color: var(--primary); }
.recent-item div { flex: 1; }
.recent-item h4 { font-size: 0.9rem; margin-bottom: 0.2rem; }
.recent-item p { font-size: 0.7rem; color: var(--text-muted); }

/* ── Responsive / Mobile ── */
@media (max-width: 1024px) {
    #app { grid-template-columns: 1fr; }

    .navbar {
        height: auto;
        position: fixed;
        bottom: 0; left: 0;
        width: 100%; z-index: 1000;
        flex-direction: row;
        padding: 0.5rem;
        border-right: none;
        border-top: 1px solid var(--border);
    }
    .nav-logo { display: none; }
    .nav-menu { display: flex; justify-content: space-around; flex: 1; }
    .nav-link { flex-direction: column; gap: 0.2rem; font-size: 0.65rem; padding: 0.5rem; }
    .nav-link span { display: none; }
    .nav-link i { font-size: 1.3rem; }
    .nav-auth { display: flex; gap: 0.5rem; }
    .nav-auth .theme-toggle { display: none; }
    .nav-auth .btn { padding: 0.35rem 0.55rem; font-size: 0.72rem; }
    main { padding: 1.25rem; padding-bottom: 5.5rem; }
    h1 { font-size: 1.75rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .upload-options { grid-template-columns: 1fr; }
    .notes-header { flex-wrap: wrap; gap: 0.75rem; }
    .toast-container { bottom: 5.5rem; right: 1rem; }
}

@media (max-width: 600px) {
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    #notes-list, #recent-notes-list { grid-template-columns: 1fr; }
    .modal-content { padding: 1.5rem; margin: 4vh auto; }
}

/* ── URL Preview Card ─────────────────────────────────────────── */
.url-preview-card {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease;
}
.url-preview-platform {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    margin: 0.75rem 0.75rem 0;
    width: fit-content;
}
.url-preview-img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 0;
}
.url-preview-body {
    padding: 0.5rem 0.75rem 0.75rem;
}
.url-preview-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}
.url-preview-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.platform-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ── Knowledge Maps ───────────────────────────────────────────── */
#maps-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}
.map-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
    backdrop-filter: var(--glass-blur);
}
.map-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.map-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.map-card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.map-card-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.map-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    gap: 0.5rem;
    flex-wrap: wrap;
}
.map-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}
.map-badge.public  { background: rgba(16,185,129,0.15); color: #10b981; }
.map-badge.private { background: rgba(148,163,184,0.15); color: var(--text-muted); }

/* Map Detail Panel */
.map-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.map-detail-header h2 { font-size: 1.3rem; font-weight: 700; }
.map-search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}
.map-search-bar input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.6rem 0.9rem;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}
.map-search-bar input:focus { border-color: var(--primary); }
.map-search-result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
}
#map-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.map-note-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    transition: var(--transition);
}
.map-note-card:hover { border-color: var(--primary); }
.map-note-title   { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.2rem; }
.map-note-preview { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }
.map-note-thumb   { width: 100%; max-height: 150px; object-fit: cover; border-radius: 0.5rem; margin-bottom: 0.5rem; display: block; }
.map-note-video   { margin-bottom: 0.5rem; }

/* ── Notification Bell ─────────────────────────────────────────── */
.notif-bell-wrap { align-items: center; }
.notif-bell-btn {
    position: relative; width: 38px; height: 38px; border: 1px solid var(--border);
    border-radius: 0.6rem; background: var(--bg-card); color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
    transition: var(--transition);
}
.notif-bell-btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-badge {
    position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
    background: var(--danger); color: #fff; border-radius: 999px; font-size: 0.65rem;
    font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 3px;
    border: 2px solid var(--bg-navbar);
}
.notif-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-width: 95vw;
    max-height: 70vh; overflow-y: auto;
    background: var(--bg-card); backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border); border-radius: 1rem;
    box-shadow: var(--shadow-lg); z-index: 1001;
    animation: fadeInDown 0.18s ease;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.notif-dropdown-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.9rem;
}
.notif-item {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.85rem 1rem; cursor: pointer; transition: var(--transition);
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-card); }
.notif-item.unread { background: rgba(99,102,241,0.05); }
.notif-icon { font-size: 1.2rem; flex-shrink: 0; padding-top: 2px; }
.notif-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.15rem; }
.notif-msg   { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.notif-time  { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.notif-dot   { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.88rem; }

/* ── Note thumbnail in card ────────────────────────────────────── */
.note-thumb-img {
    width: 100%; max-height: 140px; object-fit: cover;
    border-radius: 0.6rem; margin-bottom: 0.6rem; display: block;
}
.note-yt-thumb { position: relative; display: block; margin-bottom: 0.6rem; }
.yt-play-btn {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    background: rgba(0,0,0,0.7); color: #fff; font-size: 1.5rem;
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

/* ── Collaboration banner ──────────────────────────────────────── */
.map-collab-banner {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
    border-radius: 0.75rem; padding: 0.65rem 1rem; margin-bottom: 1rem; font-size: 0.85rem; color: #10b981;
}

/* ── Advertisement Footer ──────────────────────────────────────── */
.ad-footer {
    position: fixed; bottom: 0; left: 280px; right: 0;
    background: var(--bg-navbar); border-top: 1px solid var(--border);
    padding: 0.5rem 1.5rem; display: flex; align-items: center; gap: 1rem;
    z-index: 100; backdrop-filter: var(--glass-blur);
}
.ad-slot { flex: 1; }
main { padding-bottom: 3.5rem; } /* reserve space for ad footer */

/* ── Android-style notification dot on bell for mobile ─────────── */
@media (max-width: 900px) {
    .ad-footer { left: 0; }
}

/* ── Btn-icon ──────────────────────────────────────────────────── */
.btn-icon {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 1rem; padding: 0.3rem; border-radius: 0.4rem; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--text-main); background: var(--bg-card); }

/* ── Master Panel ──────────────────────────────────────────────── */
.stat-card .stat-icon { font-size: 1.4rem; margin-bottom: 0.6rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); margin-bottom: 0.2rem; }
.stat-card .stat-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 1.25rem;
    backdrop-filter: var(--glass-blur);
}

/* Master user list */
.master-user-row {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.master-user-row:last-child { border-bottom: none; }
.master-user-avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800; color: #fff; flex-shrink: 0;
}
.master-user-info { flex: 1; min-width: 0; }
.master-user-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.master-user-email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.master-user-badge {
    font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.45rem;
    border-radius: 999px; flex-shrink: 0;
}
.badge-verified { background: rgba(16,185,129,.15); color: #10b981; }
.badge-unverified { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-master { background: rgba(239,68,68,.15); color: #ef4444; }

/* Cookie / Privacy Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    max-width: 420px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUp {
    from { transform: translateY(100px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Logged out state helper styles */
body.logged-out #app {
    grid-template-columns: 1fr !important;
}
body.logged-out .navbar {
    display: none !important;
}
body.logged-out .ad-footer {
    left: 0 !important;
}

/* Pinterest-style Masonry Infographics Feed */
.infographics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 1.5rem;
    grid-auto-flow: dense;
    align-items: start;
}

.infographic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

.infographic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -8px rgba(0,0,0,0.25);
    border-color: rgba(99,102,241,0.4);
}

.infographic-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: rgba(0,0,0,0.03);
}

.infographic-media img, .infographic-media video {
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.infographic-card:hover .infographic-media img {
    transform: scale(1.03);
}

.infographic-overlay {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 10;
}

.category-badge {
    padding: 0.25rem 0.65rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.category-badge.academic { background: rgba(59,130,246,0.15); color: #3b82f6; border: 1px solid rgba(59,130,246,0.25); }
.category-badge.technology { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
.category-badge.design { background: rgba(139,92,246,0.15); color: #8b5cf6; border: 1px solid rgba(139,92,246,0.25); }
.category-badge.business { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }
.category-badge.social { background: rgba(236,72,153,0.15); color: #ec4899; border: 1px solid rgba(236,72,153,0.25); }
.category-badge.personal { background: rgba(107,114,128,0.15); color: #6b7280; border: 1px solid rgba(107,114,128,0.25); }
.category-badge.other { background: rgba(156,163,175,0.15); color: #9ca3af; border: 1px solid rgba(156,163,175,0.25); }

.infographic-info {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.infographic-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.35;
}

.infographic-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.infographic-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
    margin-top: 0.35rem;
    font-size: 0.75rem;
}

/* Sign in <-> Create account switch links */
.auth-switch {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-switch a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════
   UI refresh — sign-in / sign-up, sidebar, dashboard, accessibility
   ═══════════════════════════════════════════════════════════════ */

* { scrollbar-width: thin; scrollbar-color: rgba(129, 140, 248, .35) transparent; }

/* Keyboard focus that is visible on every theme */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Primary buttons: darker gradient so white text meets contrast guidelines */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .7);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    box-shadow: 0 14px 26px -10px rgba(99, 102, 241, .75);
}

/* ── Modals ── */
.modal { overscroll-behavior: contain; }
.modal-content { animation: modalIn .3s cubic-bezier(.16, 1, .3, 1); }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to   { opacity: 1; transform: none; }
}
.close {
    top: 1rem; right: 1rem;
    width: 2.1rem; height: 2.1rem;
    display: grid; place-items: center;
    border-radius: 50%;
    line-height: 1;
}
.close:hover { background: rgba(129, 140, 248, .12); }

/* ── Sign in / Create account ── */
.auth-modal { max-width: 440px; }
.auth-head { text-align: center; margin-bottom: 1.6rem; }
.auth-badge {
    display: inline-grid; place-items: center;
    width: 3.3rem; height: 3.3rem; margin-bottom: .9rem;
    border-radius: 1.05rem;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff; font-size: 1.3rem;
    box-shadow: 0 12px 26px -10px rgba(99, 102, 241, .85);
}
.modal-content .auth-head h2 { margin: 0 0 .35rem; font-size: 1.65rem; letter-spacing: -.02em; }
.auth-head p { color: var(--text-muted); font-size: .95rem; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.label-row label { margin-bottom: .45rem; }
.auth-link { font-size: .82rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.input-wrap { position: relative; }
.form-group .input-wrap input { padding-right: 3rem; }
.pw-toggle {
    position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
    width: 2.2rem; height: 2.2rem;
    display: grid; place-items: center;
    background: none; border: 0; border-radius: .55rem;
    color: var(--text-muted); cursor: pointer;
    transition: color .2s, background .2s;
}
.pw-toggle:hover { color: var(--text-main); background: rgba(129, 140, 248, .12); }
.field-hint { display: block; margin-top: .45rem; font-size: .78rem; color: var(--text-muted); line-height: 1.4; }
.auth-modal .form-group input:focus { box-shadow: 0 0 0 3px rgba(129, 140, 248, .25); }
.safety-box {
    margin: .25rem 0 1.25rem; padding: .9rem 1rem;
    border-radius: .85rem;
    background: rgba(129, 140, 248, .07);
    border: 1px solid rgba(129, 140, 248, .18);
    font-size: .8rem; line-height: 1.5; color: var(--text-muted);
}
.safety-title { display: flex; align-items: center; gap: .45rem; margin-bottom: .5rem; font-weight: 600; font-size: .82rem; color: var(--text-main); }
.safety-title i { color: var(--primary); }
.safety-box ul { margin: 0 0 .6rem 1.1rem; padding: 0; }
.safety-box li { margin-bottom: .25rem; }
.safety-box a { color: var(--primary); font-weight: 600; }

/* ── Sidebar ── */
.nav-label {
    list-style: none;
    padding: 1.1rem 1rem .4rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-muted); opacity: .7;
}
.nav-label:first-child { padding-top: 0; }
.nav-link { position: relative; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, .2), rgba(99, 102, 241, .05));
    color: var(--primary);
}
.nav-link.active::before {
    content: ""; position: absolute; left: 0; top: 22%; bottom: 22%;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-user {
    display: flex; align-items: center; gap: .75rem;
    width: 100%; padding: .6rem .75rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: .9rem;
    color: inherit; font: inherit; text-align: left; cursor: pointer;
    transition: var(--transition);
}
.nav-user:hover { border-color: var(--primary); }
.nav-user img { width: 2.3rem; height: 2.3rem; flex: none; border-radius: 50%; object-fit: cover; background: #27272a; }
.nav-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.nav-user-text strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-text span { font-size: .72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Dashboard shortcuts ── */
.dash-shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.dash-shortcut {
    display: flex; align-items: center; gap: .9rem;
    padding: 1rem 1.1rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 1rem;
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    color: var(--text-main); font: inherit; text-align: left; cursor: pointer;
    transition: var(--transition);
}
.dash-shortcut:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.dash-shortcut > i {
    width: 2.5rem; height: 2.5rem; flex: none;
    display: grid; place-items: center;
    border-radius: .8rem;
    background: rgba(var(--tone), .16); color: rgb(var(--tone)); font-size: 1rem;
}
.dash-shortcut strong { display: block; font-size: .95rem; }
.dash-shortcut small { display: block; margin-top: .1rem; font-size: .78rem; color: var(--text-muted); }

/* ── Small screens: sidebar becomes a bottom tab bar ──
   (The original rules left `top: 0` from the desktop sidebar in place, which stretched the
   fixed bar over the whole screen. `top: auto` is what makes it a bar again.) */
@media (max-width: 1024px) {
    .nav-label, .nav-user { display: none !important; }

    .navbar {
        top: auto; bottom: 0; height: auto;
        overflow: visible;
        align-items: center; gap: .25rem;
        padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom, 0px));
        background: var(--modal-bg);
        box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, .45);
    }
    .nav-menu { align-items: center; justify-content: space-between; gap: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
    .nav-menu::-webkit-scrollbar { display: none; }
    .nav-item { margin-bottom: 0; flex: none; }
    .nav-link { padding: .55rem .45rem; border-radius: .7rem; }
    .nav-link.active::before { display: none; }
    .nav-auth { padding-top: 0; border-top: 0; flex-direction: row; align-items: center; flex: none; }
    /* Sign-out keeps its icon only, so all eight tabs fit on a phone */
    #logout-btn { font-size: 0; padding: .55rem .7rem; }
    #logout-btn i { font-size: 1rem; }
    /* the ad strip would sit underneath the tab bar anyway */
    .ad-footer { display: none; }
    main { padding-bottom: 6rem; }
}

/* ── Brand mark (logo tile) ── */
.brand-mark {
    display: inline-grid; place-items: center; flex: none;
    width: 2.3rem; height: 2.3rem;
    border-radius: .75rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .9);
}
.brand-glyph { width: 62%; height: 62%; display: block; }
.nav-logo { align-items: center; }
.auth-badge .brand-glyph { width: 58%; height: 58%; }

/* ── Sign-up: terms tick box, verification notices, "check your email" step ── */
[hidden] { display: none !important; }

.tick-row {
    display: flex; align-items: flex-start; gap: .75rem;
    margin: 0 0 1.25rem; cursor: pointer;
    font-size: .9rem; line-height: 1.5; color: var(--text-main);
}
.tick-row input[type="checkbox"] {
    display: inline-block; flex: none;
    width: 1.2rem; height: 1.2rem; margin-top: .15rem;
    accent-color: #6366f1; cursor: pointer;
}
.tick-row a { color: var(--primary); font-weight: 600; }

.auth-notice {
    display: flex; align-items: flex-start; gap: .75rem;
    margin: 0 0 1.25rem; padding: .9rem 1rem;
    border: 1px solid; border-radius: .85rem;
    font-size: .92rem; line-height: 1.5; color: var(--text-main);
}
.auth-notice > i { margin-top: .2rem; flex: none; }
.auth-notice.is-info    { background: rgba(129, 140, 248, .13); border-color: rgba(129, 140, 248, .55); }
.auth-notice.is-info > i { color: var(--primary); }
.auth-notice.is-success { background: rgba(52, 211, 153, .13); border-color: rgba(52, 211, 153, .6); }
.auth-notice.is-success > i { color: #34d399; }
.auth-notice.is-warn    { background: rgba(245, 158, 11, .13); border-color: rgba(245, 158, 11, .65); }
.auth-notice.is-warn > i { color: #f59e0b; }

.link-btn {
    display: inline; padding: 0; margin-left: .25rem;
    background: none; border: 0; cursor: pointer;
    color: var(--primary); font: inherit; font-weight: 700; text-decoration: underline;
}
.link-btn:disabled { opacity: .6; cursor: not-allowed; text-decoration: none; }

.auth-done { text-align: center; }
.modal-content .auth-done h2 { margin: 0 0 .6rem; font-size: 1.65rem; letter-spacing: -.02em; outline: none; }
.auth-done p { color: var(--text-muted); font-size: .98rem; line-height: 1.6; margin: 0 0 .5rem; }
.auth-done strong { color: var(--text-main); overflow-wrap: anywhere; }
.auth-done .field-hint { margin-top: .75rem; }
.auth-done-actions { display: grid; gap: .75rem; margin-top: 1.5rem; }
.auth-badge-ok { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 12px 26px -10px rgba(16, 185, 129, .8); }

/* Placeholder text must be readable too (the browser default is too faint on dark fields) */
::placeholder { color: var(--text-muted); opacity: 1; }

/* Live username availability line under the sign-up field */
.field-status.is-checking { color: var(--text-muted); }
.field-status.is-ok  { color: #34d399; font-weight: 600; }
.field-status.is-bad { color: #f87171; }
.field-status .link-btn { margin-left: .5rem; }
[data-theme="light"] .field-status.is-ok  { color: #047857; }
[data-theme="light"] .field-status.is-bad { color: #b91c1c; }
