/* Reveal body once this stylesheet loads (prevents FOUC) */
body { opacity: 1; transition: opacity 0.15s ease; }

/* Animagic Work OS — Web UI Styles v4.0 (Sidebar + Dark-First) */

/* ══════════════════════════════════════════════════════════
   VARIABLES — Dark-first (default = dark, [data-theme="light"] = light)
   ══════════════════════════════════════════════════════════ */

:root {
    --bg: #0f0f0f;
    --bg-card: #161616;
    --bg-input: #1a1a1a;
    --bg-sidebar: #000000;
    --border: #252525;
    --border-light: #333;
    --accent: #e5e7eb;
    --accent-hover: #ffffff;
    --on-accent: #0d0d0d;
    --green: #3cff4f;
    --red: #fda4af;
    --orange: #fdba74;
    --text: #e5e7eb;
    --text-muted: #888;
    --text-dim: #666;
    --pink: #5eead4;
    --danger: #fda4af;
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.4);
    --font: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --radius: 12px;
    --sidebar-width: 320px;
    --sidebar-collapsed-width: 64px;
    --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --cyan: #48e1d6;
}

:root[data-theme="light"] {
    --bg: #eef0f4;
    --bg-card: #f5f6f9;
    --bg-input: #e8eaef;
    --bg-sidebar: #e6e8ed;
    --border: #d5d7dd;
    --border-light: #c5c8cf;
    --accent: #111827;
    --accent-hover: #000000;
    --on-accent: #ffffff;
    --green: #177245;
    --red: #b42318;
    --orange: #b45309;
    --text: #111827;
    --text-muted: #4b5563;
    --text-dim: #6b7280;
    --pink: #0f766e;
    --danger: #b42318;
    --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.06);
    --cyan: #0d9488;
}

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

html { background: #000000; }
:root[data-theme="light"] html { background: var(--bg); }

body {
    background: #000000;
    color: #aaaaaa;
    font-family: 'Archivo', var(--font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    min-height: 100vh;
}
:root[data-theme="light"] body { color: var(--text); background: var(--bg); }

/* Smooth theme transitions */
html.theme-ready body,
html.theme-ready body *,
html.theme-ready body *::before,
html.theme-ready body *::after {
    transition:
        background-color 300ms ease,
        color 300ms ease,
        border-color 300ms ease,
        box-shadow 300ms ease;
}

/* ── PAGE BUSY OVERLAY ── */
.page-busy-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 3000;
    display: flex; align-items: center; justify-content: center;
}
.page-busy-overlay[hidden] { display: none !important; }
.page-busy-card {
    min-width: 220px; padding: 1rem 1.2rem;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text);
    display: flex; align-items: center; gap: 0.65rem;
    box-shadow: var(--shadow-soft);
}
.page-busy-card p { margin: 0; font-size: 0.9rem; }
.page-busy-spinner {
    width: 16px; height: 16px; border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: var(--cyan);
    animation: page-busy-spin 0.75s linear infinite;
}
:root[data-theme="light"] .page-busy-spinner { border-color: rgba(0,0,0,0.1); border-top-color: var(--accent); }
@keyframes page-busy-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   APP LAYOUT — Sidebar + Main Content Grid
   ══════════════════════════════════════════════════════════ */

.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns var(--sidebar-transition);
}

/* Collapsed state */
.app-layout.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

/* ── SIDEBAR ── */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    width: var(--sidebar-width);
    transition: width var(--sidebar-transition);
    z-index: 50;
}
:root[data-theme="light"] .sidebar { border-right-color: #d5d7dd; }
.app-layout.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-top {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px;
    scrollbar-width: none;
}
.sidebar-top::-webkit-scrollbar { display: none; }

/* ── Sidebar header (logo + collapse) ── */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 20px 0 16px;
    min-height: 56px;
}

.sidebar-logo {
    display: flex; align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    margin-left: 12px;
}
.sidebar-logo-icon { width: 18px; height: 16px; }

/* Logo theme variants */
.sidebar-logo-light { display: none; }
.content-logo-light { display: none; }
:root[data-theme="light"] .sidebar-logo-light { display: block; }
:root[data-theme="light"] .sidebar-logo-dark { display: none; }
:root[data-theme="light"] .content-logo-light { display: inline; }
:root[data-theme="light"] .content-logo-dark { display: none; }

.sidebar-collapse-btn {
    margin-left: auto;
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; padding: 6px; border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.sidebar-collapse-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
:root[data-theme="light"] .sidebar-collapse-btn:hover { background: rgba(0,0,0,0.04); }

/* Collapsed: hide text labels + logo */
.app-layout.sidebar-collapsed .nav-label,
.app-layout.sidebar-collapsed .spaces-label,
.app-layout.sidebar-collapsed .spaces-chevron,
.app-layout.sidebar-collapsed .sidebar-settings-email,
.app-layout.sidebar-collapsed .sidebar-user-info,
.app-layout.sidebar-collapsed .sidebar-user-toggle,
.app-layout.sidebar-collapsed .sidebar-settings-divider,
.app-layout.sidebar-collapsed .nav-arrow,
.app-layout.sidebar-collapsed .sidebar-logo {
    display: none;
}
.app-layout.sidebar-collapsed .sidebar-header { justify-content: center; gap: 0; }
.app-layout.sidebar-collapsed .sidebar-collapse-btn { margin-left: 0; }
.app-layout.sidebar-collapsed .sidebar-top { padding: 0 8px; }
.app-layout.sidebar-collapsed .sidebar-bottom { padding: 0 8px 12px; }
.app-layout.sidebar-collapsed .sidebar-nav-item { justify-content: center; padding: 8px; }
.app-layout.sidebar-collapsed .spaces-trigger { justify-content: center; padding: 8px; }
.app-layout.sidebar-collapsed .sidebar-user-card { justify-content: center; padding: 8px; gap: 0; }

/* ── Spaces dropdown ── */
.spaces-dropdown { margin-bottom: 8px; position: relative; }
.spaces-trigger {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 8px 12px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.875rem;
    font-weight: 500; font-family: var(--font);
    cursor: pointer; transition: all 0.15s;
}
:root[data-theme="light"] .spaces-trigger { background: rgba(0,0,0,0.03); }
.spaces-trigger:hover { border-color: var(--border-light); }
.spaces-icon { flex-shrink: 0; color: #85a9fb; }
.spaces-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spaces-label-prefix { color: #fff; }
:root[data-theme="light"] .spaces-label-prefix { color: #111827; }
.spaces-label-name { color: #85a9fb; }
.spaces-chevron { flex-shrink: 0; color: var(--text-dim); transition: transform 0.2s ease; }
.spaces-dropdown.open .spaces-chevron { transform: rotate(180deg); }

.spaces-menu {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 4px; z-index: 200; box-shadow: var(--shadow-soft);
    animation: dropdown-in 0.15s ease;
}
.spaces-menu[hidden] { display: none; }
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.spaces-option {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-radius: 6px;
    color: var(--text); text-decoration: none; font-size: 0.85rem;
    transition: background 0.1s;
}
.spaces-option:hover { background: rgba(255,255,255,0.04); }
:root[data-theme="light"] .spaces-option:hover { background: rgba(0,0,0,0.04); }
.spaces-option.active svg { color: var(--cyan); }

/* ── Sidebar nav ── */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: 8px;
    color: var(--text-dim); text-decoration: none;
    font-size: 0.8rem; font-weight: 500;
    cursor: pointer; background: none; border: none;
    font-family: var(--font); width: 100%; text-align: left;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap; overflow: hidden;
}
.sidebar-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
:root[data-theme="light"] .sidebar-nav-item:hover { background: rgba(0,0,0,0.04); }
.sidebar-nav-item.active { color: var(--text); background: rgba(255,255,255,0.06); }
:root[data-theme="light"] .sidebar-nav-item.active { background: rgba(0,0,0,0.06); }

.sidebar-nav-item svg { flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-arrow { margin-left: auto; color: var(--text-dim); flex-shrink: 0; }

/* ── Sidebar bottom ── */
.sidebar-bottom {
    border-top: 1px solid var(--border);
    padding: 12px 20px 16px;
    flex-shrink: 0;
}

/* Settings section (toggleable) */
.sidebar-settings-section {
    display: flex; flex-direction: column; gap: 2px;
    max-height: 400px; opacity: 1;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
    margin-bottom: 12px;
    background: #111111;
    border-radius: 8px;
    padding: 8px 0;
}
:root[data-theme="light"] .sidebar-settings-section { background: #dfe1e7; }
.sidebar-settings-section.collapsed {
    max-height: 0; opacity: 0; margin-bottom: 0;
    pointer-events: none;
}

.sidebar-settings-email {
    font-size: 0.68rem; color: var(--text-dim); font-weight: 500;
    padding: 0 12px; margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-settings-divider {
    height: 1px; background: var(--border); margin: 6px 12px;
}

/* Theme toggle icon visibility */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
:root[data-theme="light"] .theme-icon-sun { display: block; }
:root[data-theme="light"] .theme-icon-moon { display: none; }

/* ── User card ── */
.sidebar-user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    transition: background 0.15s;
}
:root[data-theme="light"] .sidebar-user-card { background: rgba(0,0,0,0.02); }
.sidebar-user-card:hover { background: rgba(255,255,255,0.05); }
:root[data-theme="light"] .sidebar-user-card:hover { background: rgba(0,0,0,0.04); }

.sidebar-user-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--border-light); color: var(--text);
    font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
    overflow: hidden;
}
.sidebar-user-avatar-img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}

.sidebar-user-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
}
.sidebar-user-name {
    font-size: 0.85rem; font-weight: 500; color: #85a9fb;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-meta {
    font-size: 0.68rem; color: var(--text-dim);
}

.sidebar-user-toggle {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; padding: 4px; border-radius: 4px;
    transition: color 0.15s, transform 0.25s ease;
    flex-shrink: 0;
}
.sidebar-user-toggle:hover { color: var(--text); }
.sidebar-settings-section.collapsed ~ .sidebar-user-card .sidebar-user-toggle {
    transform: rotate(180deg);
}

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════ */

.main-content-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #111111;
}
:root[data-theme="light"] .main-content-wrapper { background: var(--bg); }
.main-content {
    padding: 2.25rem 2rem 4rem;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: fade-in 0.25s ease;
    box-sizing: border-box;
}
/* Scrollable content area only inside the app layout (not auth pages) */
.app-layout .main-content {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Content header — logo bar at top of main content area */
.content-header {
    padding: 20px 2rem 0;
    min-height: 56px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
.content-logo {
    height: 16px;
    width: auto;
    opacity: 0.9;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Auth pages: centered, no sidebar */
.main-content--auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}
/* Override content wrapper bg on auth pages so body #0f0f0f shows through */
.main-content-wrapper:has(.main-content--auth) {
    background: #0f0f0f;
}
:root[data-theme="light"] .main-content-wrapper:has(.main-content--auth) { background: var(--bg); }

/* ── LINKS ── */
a { color: var(--cyan); }
a:hover { color: var(--accent-hover); }
:root[data-theme="light"] a { color: #0f172a; }
:root[data-theme="light"] a:hover { color: #000000; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 2rem; }

/* H2 — Page titles (shared across all pages) */
.page-title,
.page-header h1 {
    font-size: 32px; font-weight: 500; color: #aaaaaa;
    font-family: 'Archivo', var(--font);
    margin: 0 0 0.25rem; letter-spacing: 0;
}
:root[data-theme="light"] .page-title,
:root[data-theme="light"] .page-header h1 { color: #111827; }

.subtitle, .page-subtitle {
    font-size: 16px; font-weight: 400; color: #aaaaaa;
    font-family: 'Archivo', var(--font);
    margin: 0; margin-top: 0.25rem;
}
:root[data-theme="light"] .subtitle,
:root[data-theme="light"] .page-subtitle { color: #4b5563; }

/* ══════════════════════════════════════════════════════════
   FORM SECTIONS
   ══════════════════════════════════════════════════════════ */

.form-section {
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    padding: 1.75rem;
    margin-bottom: 1.25rem;
}
:root[data-theme="light"] .form-section { background: var(--bg-card); }
/* H3 — Section titles inside cards (shared style) */
.section-title,
.form-section h2 {
    font-size: 16px; font-weight: 500;
    color: #85a9fb; font-family: 'Archivo', var(--font);
    margin-bottom: 1.25rem;
}
:root[data-theme="light"] .section-title,
:root[data-theme="light"] .form-section h2 { color: #4a7cf5; }
.hint {
    color: var(--text-dim); font-size: 0.9rem;
    font-family: var(--font); margin-bottom: 1rem;
}

/* Monday.com import section */
.monday-import {
    margin-bottom: 1.25rem; padding: 1rem 1.25rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-input);
}
.monday-import .toggle-item { margin-bottom: 0; }
.monday-import-row {
    display: flex; gap: 1rem; align-items: flex-start; margin-top: 0.75rem;
}
.monday-import-row .field { margin-bottom: 0; }
.monday-import-row input[type="url"] {
    height: 44px; padding: 0 1rem; font-size: 0.9rem;
    background: #000; border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-family: var(--font);
}
:root[data-theme="light"] .monday-import-row input[type="url"] {
    background: var(--bg-input);
}
.monday-import-row .btn-submit {
    flex-shrink: 0; height: 44px; min-height: 44px;
    border-radius: 8px; font-size: 0.88rem; padding: 0 1.5rem;
    min-width: 160px;
}
.monday-import-status { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; display: block; }

/* ── FIELDS ── */
.field-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1rem; margin-bottom: 1rem;
}
.field-row:last-child { margin-bottom: 0; }
.field-row.single-col { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label {
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-dim); letter-spacing: 0.01em;
}
.req { color: var(--red); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.62rem 0.78rem;
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
select {
    -webkit-appearance: none; appearance: none;
    padding-right: 2.6rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 12px 8px;
    background-position: right 0.95rem center;
}
:root[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
input:focus, select:focus {
    border-color: #85a9fb;
    box-shadow: 0 0 0 2px rgba(133, 169, 251, 0.15);
}
:root[data-theme="light"] input:focus,
:root[data-theme="light"] select:focus {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(88%) sepia(30%) saturate(585%) hue-rotate(102deg) brightness(96%) contrast(96%);
    opacity: 0.9; cursor: pointer;
}
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: grayscale(100%);
}
input::placeholder { color: var(--text-dim); }
select option { background: var(--bg-card); color: var(--text); }

/* ── CUSTOM SELECT ── */
.custom-select { position: relative; display: inline-block; }
.custom-select.input-pipeline { width: 130px; }
.custom-select.spec-mode-select { min-width: 155px; }
.custom-select-trigger {
    width: 100%; text-align: left;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    padding: 0.48rem 2rem 0.48rem 0.72rem;
    font-size: 0.9rem; font-family: var(--font);
    cursor: pointer; position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.custom-select-trigger:hover { border-color: var(--border-light); }
.custom-select.open .custom-select-trigger {
    border-color: #85a9fb;
    box-shadow: 0 0 0 2px rgba(133, 169, 251, 0.15);
}
.custom-select-trigger::after {
    content: ''; position: absolute; right: 0.72rem; top: 50%;
    width: 11px; height: 7px; transform: translateY(-50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-size: contain;
}
.custom-select.open .custom-select-trigger::after { transform: translateY(-50%) rotate(180deg); }
.custom-select-menu {
    list-style: none; margin: 0; padding: 0.25rem;
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow-soft);
    z-index: 220; max-height: 220px; overflow-y: auto;
}
.custom-select-menu[hidden] { display: none; }
.custom-select-option {
    width: 100%; border: none; background: transparent;
    color: var(--text); text-align: left;
    font-size: 0.9rem; font-family: var(--font);
    padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer;
}
.custom-select-option:hover { background: rgba(255,255,255,0.05); }
:root[data-theme="light"] .custom-select-option:hover { background: #e2e5ea; }
.custom-select-option.selected { background: rgba(72, 225, 214, 0.12); color: var(--cyan); }
:root[data-theme="light"] .custom-select-option.selected { background: #cdd8f0; color: #1e3a8a; }
.custom-select-option:disabled, .custom-select-option.disabled {
    color: var(--text-dim); cursor: not-allowed; opacity: 0.6;
}
.native-select-hidden {
    position: absolute !important; opacity: 0 !important;
    pointer-events: none !important; width: 1px !important; height: 1px !important;
}

/* ── DYNAMIC ROWS ── */
.dynamic-row {
    display: grid; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem;
}
.dynamic-row:last-child { margin-bottom: 0; }
.asset-row { grid-template-columns: auto 1fr auto auto; }
.input-pipeline { width: 130px; font-size: 0.82rem; }

/* 3D sub-step checkboxes */
.substeps-panel {
    padding: 0.75rem 0.8rem; margin: 0.5rem 0 0.95rem;
    background: var(--bg-input);
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
}
.substeps-label { font-size: 0.76rem; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.substeps-checkboxes { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.substep-checkbox {
    display: flex; align-items: center; gap: 0.42rem;
    font-size: 0.76rem; font-weight: 500; color: var(--text-muted);
    cursor: pointer; user-select: none; line-height: 1.1;
}
.substep-checkbox input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 18px; height: 18px; margin: 0;
    border-radius: 50%; border: 1px solid var(--border-light);
    background: var(--bg-input);
    display: inline-grid; place-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.substep-checkbox input[type="checkbox"]:checked {
    border-color: #2563eb; background-color: #2563eb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.5L4.5 8.5L10.5 1.5' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 10px 8px;
}

.milestone-row { grid-template-columns: auto 1fr 170px auto auto auto; }
.input-ms-name { width: 100%; }

/* Milestone asset assignment */
.btn-assign-assets {
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-dim);
    cursor: pointer; font-size: 0.75rem; padding: 0.25rem 0.5rem;
    white-space: nowrap; transition: all 0.15s;
}
.btn-assign-assets:hover { border-color: #60a5fa; color: #60a5fa; }
.btn-assign-assets.has-assignments { border-color: #60a5fa; color: #60a5fa; }
.ms-asset-panel {
    grid-column: 1 / -1; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.5rem; margin-top: 0.3rem;
    font-size: 0.82rem;
}
.ms-asset-panel label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; padding: 0.1rem 0; }
.ms-asset-panel .ms-group-header { font-weight: 600; margin-top: 0.3rem; display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.ms-asset-panel .ms-group-header:first-child { margin-top: 0; }
.ms-asset-panel .ms-group-assets { padding-left: 1.2rem; }

.ms-prefix {
    font-size: 0.85rem; font-weight: 700; color: var(--accent);
    background: rgba(144,166,249,0.15); padding: 0.45rem 0.6rem;
    border-radius: var(--radius); white-space: nowrap; user-select: none;
    text-align: center; min-width: 36px;
}

.input-ms-date.date-error { border-color: var(--red); }
.ms-date-error { display: block; color: var(--red); font-size: 0.82rem; min-height: 1.2em; margin-top: 0.25rem; }

.btn-remove {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-dim);
    cursor: pointer; padding: 0.4rem 0.6rem; font-size: 0.75rem;
    transition: all 0.15s; flex-shrink: 0;
}
.btn-remove:hover { border-color: var(--red); color: var(--red); }

.btn-duplicate {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-muted);
    cursor: pointer; padding: 0.4rem 0.6rem; font-size: 0.72rem;
    font-family: var(--font); transition: all 0.15s;
    flex-shrink: 0; white-space: nowrap;
}
.btn-duplicate:hover { background: rgba(255,255,255,0.04); color: var(--text); border-color: var(--border-light); }
:root[data-theme="light"] .btn-duplicate:hover { background: #eef0f4; }

.asset-row-actions { display: flex; gap: 0.35rem; align-items: center; }

.btn-add {
    background: var(--bg-card); border: 1px dashed var(--border);
    border-radius: var(--radius); color: var(--text-muted);
    cursor: pointer; padding: 0.5rem 1rem; font-size: 0.78rem;
    font-weight: 600; font-family: var(--font);
    margin-top: 0.75rem; transition: all 0.15s;
}
.btn-add:hover { border-color: var(--border-light); color: var(--text); }

/* ── ASSET GROUPS ── */
.asset-group {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem;
}
.asset-group:last-child { margin-bottom: 0; }
.group-header {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 0.75rem; flex-wrap: wrap;
}
.group-name-input { flex: 1; font-weight: 600; color: var(--pink); }
.group-name-input::placeholder { color: var(--text-dim); }
.btn-remove-group {
    background: none; border: 1px solid var(--pink);
    border-radius: var(--radius); color: var(--pink);
    cursor: pointer; padding: 0.4rem 0.75rem; font-size: 0.78rem;
    white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
}
.btn-remove-group:hover { opacity: 0.75; }
.group-buttons { margin-top: 0.75rem; }

/* Drag handle */
.drag-handle {
    cursor: grab; color: var(--text-dim); font-size: 1.1rem;
    line-height: 1; padding: 0.2rem 0.15rem; user-select: none;
    flex-shrink: 0; transition: color 0.15s; letter-spacing: -1px;
}
.drag-handle:hover { color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.asset-group.dragging { opacity: 0.4; border-style: dashed; }
.asset-group.drag-over-top { border-top: 2px solid var(--accent); }
.asset-group.drag-over-bottom { border-bottom: 2px solid var(--accent); }

/* ── TEAM ── */
.team-subsection { margin-bottom: 1.25rem; }
.team-subsection:last-child { margin-bottom: 0; }
.team-subsection-title {
    font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
    margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.team-role-icon { font-size: 1rem; }

.team-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem;
}
.team-member-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: border-color 0.15s; user-select: none;
}
.team-member-item:hover { border-color: var(--accent); }
.team-member-item input[type="checkbox"],
.toggle-item input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 18px; height: 18px; margin: 0;
    border-radius: 50%; border: 1px solid var(--border-light);
    background: var(--bg-input);
    display: inline-grid; place-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.team-member-item input[type="checkbox"]:checked,
.toggle-item input[type="checkbox"]:checked {
    border-color: #2563eb; background-color: #2563eb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.5L4.5 8.5L10.5 1.5' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 10px 8px;
}
.member-name { flex: 1; font-size: 0.875rem; }
.member-initials {
    font-size: 0.75rem; color: var(--text-dim);
    background: var(--bg-card); padding: 0.1rem 0.35rem;
    border-radius: 4px; font-family: monospace;
}

/* ── INTEGRATION TOGGLES ── */
.integration-toggles { display: flex; flex-direction: column; gap: 0.6rem; }
.toggle-item {
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer; font-size: 0.9rem; color: var(--text-muted);
}

/* ── SUBMIT ── */
.submit-row {
    margin-top: 1.5rem; display: flex;
    align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.btn-submit {
    background: #85a9fb; border: 1px solid transparent; border-radius: 6px;
    color: #000000; cursor: pointer; font-size: 0.86rem;
    font-weight: 600; padding: 0 1.5rem; box-sizing: border-box;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none; display: inline-flex;
    align-items: center; justify-content: center;
    line-height: 1; height: 32px; min-height: 32px; min-width: 160px;
    text-align: center; white-space: nowrap;
}
.btn-submit:hover { background: #000000; color: #85a9fb; border: 1px solid #85a9fb; }
.btn-submit:active { background: #85a9fb; color: #000000; border: 1px solid transparent; }
.btn-submit:disabled { background: var(--text-dim); cursor: not-allowed; }
.btn-secondary {
    background: #4b5c77; border: 1px solid transparent; border-radius: 6px;
    color: #e8edf5; cursor: pointer; font-size: 0.86rem;
    font-weight: 600; padding: 0 1.5rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none; display: inline-flex;
    align-items: center; justify-content: center;
    line-height: 1; height: 32px; min-height: 32px; white-space: nowrap;
    box-sizing: border-box;
}
.btn-secondary:hover { background: #000; color: #85a9fb; border-color: #85a9fb; }
.btn-secondary:active { background: #4b5c77; color: #e8edf5; border-color: transparent; }
:root[data-theme="light"] .btn-secondary { background: #4b5563; color: #fff; }
:root[data-theme="light"] .btn-secondary:hover { background: #374151; }

/* ── RESULT PAGE ── */
.result-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem;
}
.result-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

.links-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem;
}
.link-card {
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    padding: 1.25rem; border-radius: var(--radius); text-decoration: none;
    border: 1px solid var(--border); transition: all 0.15s; text-align: center;
}
.link-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.link-icon { font-size: 2rem; }
.link-label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.link-sub { font-size: 0.78rem; color: var(--text-muted); }
.link-card.dropbox { background: rgba(0, 97, 255, 0.06); }
.link-card.discord { background: rgba(88, 101, 242, 0.06); }
.link-card.slides { background: rgba(234, 67, 53, 0.06); }

/* Steps list */
.steps-list { display: flex; flex-direction: column; gap: 0.6rem; }
.step-item {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.75rem 1rem; border-radius: var(--radius);
    border: 1px solid var(--border);
}
.step-ok { border-left: 3px solid var(--green); }
.step-fail { border-left: 3px solid var(--red); }
.step-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.step-body { flex: 1; }
.step-name { display: block; font-size: 0.9rem; }
.step-detail { color: var(--text-muted); font-size: 0.82rem; margin-left: 0.5rem; }
.step-link { color: var(--cyan); font-size: 0.82rem; margin-left: 0.5rem; text-decoration: none; }
.step-link:hover { text-decoration: underline; }
.step-error {
    color: var(--red); font-size: 0.82rem; margin-top: 0.25rem;
    background: rgba(239,68,68,0.08); padding: 0.3rem 0.5rem; border-radius: 4px;
}

/* ── STATUS PAGE ── */
.status-card { transition: border-color 0.2s; }
.status-ok { border-left: 3px solid var(--green); }
.status-needs-setup { border-left: 3px solid var(--orange); }
.status-header { margin-bottom: 1rem; }
.status-badge { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 600; }
.badge-label { font-size: 0.75rem; font-weight: 500; padding: 0.15rem 0.5rem; border-radius: 999px; }
.badge-ok .badge-label { background: rgba(176, 249, 155, 0.15); color: var(--green); }
.badge-warn .badge-label { background: rgba(245, 158, 11, 0.15); color: var(--orange); }

.status-items { display: flex; flex-direction: column; gap: 0.5rem; }
.status-item {
    display: flex; align-items: flex-start; gap: 0.6rem;
    padding: 0.5rem 0.75rem; background: var(--bg-input);
    border-radius: var(--radius); border: 1px solid var(--border);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 0.45rem; }
.dot-ok { background: var(--green); }
.dot-missing { background: var(--orange); }
.status-item-content { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.status-item-content strong { font-size: 0.85rem; font-weight: 600; }
.status-value { font-size: 0.8rem; color: var(--text-muted); font-family: monospace; word-break: break-all; }
.status-help { font-size: 0.78rem; color: var(--orange); font-style: italic; }

.setup-steps { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.75rem; }
.setup-steps summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); margin-bottom: 0.5rem; user-select: none; }
.setup-steps summary:hover { color: var(--accent-hover); }
.setup-steps ol { padding-left: 1.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.setup-steps li { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

/* ── DELIVERY SPECS ── */
.pill-tabs {
    display: inline-flex; gap: 4px;
    background: var(--bg-input); border-radius: 999px; padding: 3px;
}
.pill-tab {
    padding: 0.35rem 0.9rem; font-size: 0.78rem;
    border: 1px solid transparent; background: transparent;
    color: var(--text-muted); cursor: pointer; border-radius: 999px;
    transition: all 0.15s; font-family: var(--font); font-weight: 600;
}
.pill-tab.active { border-color: var(--accent); color: var(--on-accent); background: var(--accent); }
.pill-tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.06); }
:root[data-theme="light"] .pill-tab:hover:not(.active) { background: #dcdee4; }

.spec-block { padding: 0.25rem 0; margin-top: 0.35rem; margin-bottom: 0.25rem; }
.spec-fields-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem; align-items: start; margin-top: 0.6rem;
}
.spec-extra-row { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.spec-extra-row .spec-field-group { min-width: 160px; max-width: 260px; }
.spec-field-group { display: flex; flex-direction: column; gap: 0.3rem; }
.spec-field-group label {
    font-size: 0.75rem; color: var(--text-dim); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    display: flex; align-items: center; gap: 0.4rem;
}

.aspect-ratio-display {
    font-size: 0.72rem; color: var(--pink);
    background: rgba(94, 234, 212, 0.12); padding: 0.1rem 0.45rem;
    border-radius: 4px; white-space: nowrap; font-weight: 600;
    display: inline-block; text-transform: none; letter-spacing: 0;
}
.aspect-ratio-display:empty { display: none; }

.spec-mode-select {
    width: auto; min-width: 155px; font-size: 0.82rem;
    padding: 0.4rem 1.75rem 0.4rem 0.6rem; flex-shrink: 0;
    color: var(--cyan); border-color: var(--border);
}
.spec-mode-select:focus { border-color: #85a9fb; }
.spec-mode-select option { color: var(--text); }

.group-header .spec-mode-select,
.group-header .tpl-group-preset { min-height: 46px; height: 46px; border-radius: var(--radius); font-size: 0.84rem; }
.group-header .spec-mode-select { min-width: 150px; }
.group-header .tpl-group-preset { width: 150px; }
.group-header .btn-remove-group { min-height: 46px; height: 46px; font-size: 0.84rem; }

/* ── COLLAPSIBLE SECTION HEADERS ── */
.section-divider {
    display: flex; align-items: center; gap: 0.5rem;
    margin: 0.6rem 0 0.35rem; cursor: pointer; user-select: none;
}
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-label {
    font-size: 0.68rem; font-weight: 700; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap;
    display: flex; align-items: center; gap: 0.35rem;
}
.section-chevron { font-size: 1.2rem; transition: transform 0.2s ease; display: inline-block; color: var(--cyan); }
.section-divider.collapsed .section-chevron { transform: rotate(-90deg); }
.section-content { overflow: visible !important; height: auto !important; max-height: none !important; opacity: 1; }
.section-content.collapsed { display: none; }
.group-section-hr { border: none; border-top: 1px solid var(--border); margin: 0.6rem 0; }

.edit-ungrouped-section {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem;
}
.edit-ungrouped-title {
    font-size: 0.82rem; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 0.5rem 0;
}

.asset-spec-section {
    margin-left: 0.5rem; border-left: 2px solid var(--border);
    padding-left: 0.75rem; margin-top: 0.25rem; margin-bottom: 0.75rem;
}

/* ── SETTINGS PAGE ── */
.project-type-card { position: relative; overflow: visible !important; height: auto !important; max-height: none !important; }
.project-type-header {
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer; user-select: none; padding: 0.25rem 0;
}
.type-code-badge {
    font-size: 0.78rem; font-weight: 700; color: var(--pink);
    background: rgba(94, 234, 212, 0.12); padding: 0.25rem 0.55rem;
    border-radius: 4px; font-family: monospace; letter-spacing: 0.05em;
    white-space: nowrap; min-width: 36px; text-align: center;
}
.project-type-title {
    flex: 1; font-weight: 600; font-size: 0.95rem; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-chevron { font-size: 1.62rem; color: var(--cyan); transition: transform 0.2s ease; display: inline-block; flex-shrink: 0; }
.project-type-header.collapsed .card-chevron { transform: rotate(-90deg); }
.project-type-body { overflow: visible !important; height: auto !important; max-height: none !important; opacity: 1; padding-top: 0.75rem; }
.project-type-body.collapsed { display: none; }
.btn-remove-card {
    background: none; border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-dim);
    cursor: pointer; padding: 0.3rem 0.55rem; font-size: 0.72rem; transition: all 0.15s; flex-shrink: 0;
}
.btn-remove-card:hover { border-color: var(--red); color: var(--red); }
.template-assets-section { margin-top: 0.25rem; }
.project-type-card .section-chevron { font-size: 1.62rem; }

.settings-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; margin-bottom: 2rem; }
#btn-add-type { margin-top: 0.5rem; margin-bottom: 0; }
.save-success { color: var(--green); font-size: 0.85rem; font-weight: 600; }
.save-error { color: var(--red); font-size: 0.85rem; font-weight: 600; }

.settings-tabs { display: inline-flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.5rem; }

/* ── TEAM MEMBER CARDS ── */
.team-member-card { position: relative; overflow: visible !important; height: auto !important; max-height: none !important; }
.team-member-header {
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer; user-select: none; padding: 0.25rem 0;
}
.member-initials-badge {
    font-size: 0.78rem; font-weight: 700; color: var(--accent);
    background: rgba(144, 166, 243, 0.12); padding: 0.25rem 0.55rem;
    border-radius: 4px; font-family: monospace; letter-spacing: 0.05em;
    white-space: nowrap; min-width: 36px; text-align: center;
}
.team-member-name {
    flex: 1; font-weight: 600; font-size: 0.95rem; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.team-member-header.collapsed .card-chevron { transform: rotate(-90deg); }
.team-member-body { overflow: visible !important; height: auto !important; max-height: none !important; opacity: 1; padding-top: 0.75rem; }
.team-member-body.collapsed { display: none; }

.member-role-badge {
    font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.45rem;
    border-radius: 4px; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em;
}
.member-role-badge.role-pm { color: var(--pink); background: rgba(94, 234, 212, 0.12); }
.member-role-badge.role-creative_director { color: var(--orange); background: rgba(255, 159, 67, 0.12); }
.member-role-badge.role-production { color: var(--green); background: rgba(81, 207, 102, 0.12); }
.member-role-badge.role-non_production { color: var(--text-dim); background: rgba(255, 255, 255, 0.06); }

/* ── PROJECT WIZARD ── */
.project-stepper { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 1.75rem; align-items: center; }
.step-group { display: inline-flex; align-items: center; gap: 0.35rem; }
.step-number { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.step-pill {
    display: inline-flex; align-items: center; justify-content: center;
    width: 96px; height: 28px;
    border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.5); border-radius: 8px;
    font-size: 11px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; font-family: var(--font);
    padding: 0;
}
.step-pill:hover { background: rgba(255,255,255,0.12); }
.step-pill.active { background: transparent; border-color: #85a9fb; color: #85a9fb; }
.step-pill.done { color: rgba(255,255,255,0.5); }
:root[data-theme="light"] .step-pill {
    background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: rgba(0,0,0,0.5);
}
:root[data-theme="light"] .step-pill:hover { background: rgba(0,0,0,0.06); }
:root[data-theme="light"] .step-pill.active { background: transparent; border-color: #4a7cf5; color: #4a7cf5; }

.wizard-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem; margin-top: 1.5rem;
}
.wizard-actions-right { display: flex; align-items: center; gap: 0.6rem; }
.wizard-actions .btn-secondary,
.wizard-actions .btn-submit {
    font-size: 0.88rem; font-weight: 600; padding: 0.6rem 2rem;
    min-height: 40px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
}

/* ── AUTH PAGES ── */
.auth-container {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    min-height: 100vh; padding: 2rem 1rem 10vh;
}
.auth-brand {
    margin-bottom: 2rem; text-align: center;
}
.auth-brand img { height: 24px; opacity: 0.7; }
.auth-card {
    background: #000; border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px; padding: 32px;
    width: 400px; max-width: calc(100vw - 2rem); box-sizing: border-box;
}
.auth-logo {
    display: flex; justify-content: center; margin-bottom: 1.5rem;
}
.auth-logo img { height: 24px; opacity: 0.8; }
.auth-title { font-size: 1.3rem; font-weight: 500; color: #aaaaaa; margin-bottom: 0.25rem; }
.auth-subtitle { color: #666; font-size: 0.85rem; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-field label { font-size: 0.73rem; font-weight: 500; color: #2d2d2d; }
.auth-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field select {
    background: #0f0f0f; border: 0.75px solid transparent; border-radius: 8px;
    color: var(--text); height: 32px; padding: 0 0.8rem;
    font-size: 0.88rem; font-family: var(--font);
    width: 100%; box-sizing: border-box;
    outline: none; transition: border-color 0.15s;
}
.auth-field input[type="text"]:focus,
.auth-field input[type="email"]:focus,
.auth-field input[type="password"]:focus,
.auth-field select:focus {
    border-color: #85a9fb;
    outline: none;
}
.auth-field select {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
}
.auth-field-label-row {
    display: flex; justify-content: space-between; align-items: baseline;
}
.auth-hint { font-size: 0.68rem; color: #555; }
.auth-hint a { color: #85a9fb; text-decoration: none; }
.auth-pw-wrapper { position: relative; }
.auth-pw-toggle {
    position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #555; font-size: 0.72rem;
    cursor: pointer; font-family: var(--font); padding: 0;
}
.auth-pw-toggle:hover { color: #888; }
.auth-btn {
    margin-top: 0.75rem; width: 100%; text-align: center;
    background: #000 !important; color: #85a9fb !important;
    border: 1px solid #85a9fb !important;
}
.auth-btn:hover {
    background: #85a9fb !important; color: #000 !important;
    border-color: #85a9fb !important;
}
.auth-error {
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red); padding: 0.6rem 0.85rem; border-radius: 8px;
    font-size: 0.85rem; margin-bottom: 1rem;
}
.auth-success {
    background: rgba(176, 249, 155, 0.1); border: 1px solid rgba(176, 249, 155, 0.3);
    color: var(--green); padding: 0.6rem 0.85rem; border-radius: 8px;
    font-size: 0.85rem; margin-bottom: 1rem;
}
.auth-link { text-align: center; margin-top: 1.25rem; font-size: 0.85rem; color: #555; }
.auth-link a { color: #85a9fb; text-decoration: none; }

/* ── STATUS PAGE — Simple view ── */
.status-simple-grid { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 2rem; }
.status-simple-card {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem 1.25rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.status-simple-icon { font-size: 1.5rem; }
.status-simple-name { flex: 1; font-weight: 600; font-size: 0.95rem; }
.status-simple-badge { font-size: 0.78rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: 999px; }
.badge-connected { background: rgba(176, 249, 155, 0.15); color: var(--green); }
.badge-disconnected { background: rgba(239, 68, 68, 0.1); color: var(--red); }

/* ── ADMIN TAB ── */
.admin-user-list { display: flex; flex-direction: column; gap: 0.5rem; }
.admin-user-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem; padding: 0.6rem 0.85rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.admin-user-info { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; }
.admin-user-info strong { font-size: 0.88rem; white-space: nowrap; }
.admin-user-email { font-size: 0.78rem; color: var(--text-muted); margin-left: 0.25rem; }
.admin-user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--pink); color: #fff; font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.admin-user-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.admin-role-label { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }
.admin-badge-inline {
    font-size: 0.68rem; font-weight: 600; padding: 0.12rem 0.45rem;
    border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.badge-owner { background: rgba(255, 183, 77, 0.18); color: #ffb74d; }
.badge-admin { background: rgba(94, 234, 212, 0.15); color: var(--pink); }
.badge-member { background: rgba(144, 166, 249, 0.12); color: var(--accent); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--orange); }

.btn-reset-pw {
    background: none; border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-muted);
    cursor: pointer; padding: 0.3rem 0.65rem; font-size: 0.78rem;
    font-family: var(--font); transition: all 0.15s;
}
.btn-reset-pw:hover { border-color: var(--text); color: var(--text); }

.admin-config-group { margin-bottom: 1.25rem; }
.admin-config-group:last-child { margin-bottom: 0; }
.admin-config-group-title {
    font-size: 0.82rem; font-weight: 600; color: var(--pink);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.6rem;
}

/* ══════════════════════════════════════════════════════════
   MOBILE TOP BAR & BACKDROP — hidden by default (desktop)
   ══════════════════════════════════════════════════════════ */

.mobile-topbar { display: none; }
.mobile-sidebar-backdrop { display: none; }
.sidebar-mobile-close { display: none; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* ── Layout ── */
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    .app-layout.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    /* ── Mobile top bar ── */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        height: 56px;
        background: var(--bg);
        position: sticky;
        top: 0;
        z-index: 100;
        flex-shrink: 0;
    }
    .mobile-hamburger {
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 8px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-hamburger:hover { background: rgba(255, 255, 255, 0.05); }
    :root[data-theme="light"] .mobile-hamburger:hover { background: rgba(0, 0, 0, 0.05); }
    .mobile-topbar-title {
        font-family: var(--font);
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text);
        letter-spacing: -0.01em;
        display: flex;
        align-items: center;
    }
    .mobile-topbar-logo {
        height: 14px;
        width: auto;
    }
    .mobile-topbar-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--bg-card);
        border: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: 600;
        color: var(--text-muted);
        overflow: hidden;
        flex-shrink: 0;
    }
    .mobile-topbar-avatar-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* ── Sidebar overlay (full-screen on mobile) ── */
    .sidebar {
        position: fixed; left: 0; right: 0; top: 0; bottom: 0;
        width: 100%; z-index: 200;
        transform: translateX(-100%);
        transition: transform var(--sidebar-transition);
        overflow: hidden;
        overflow-y: hidden;
        border-right: none;
        touch-action: none;
        -webkit-overflow-scrolling: auto;
    }
    .sidebar-top {
        overflow: hidden;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: auto;
        padding-top: env(safe-area-inset-top, 0px);
    }
    .sidebar-top::-webkit-scrollbar { display: none; }
    .sidebar-bottom {
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .app-layout.sidebar-open .sidebar,
    .app-layout.sidebar-open.sidebar-collapsed .sidebar {
        transform: translateX(0);
        width: 100%;
    }
    .app-layout.sidebar-collapsed .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }

    /* ── Hide desktop sidebar header, show mobile close btn ── */
    .sidebar-header { display: none; }
    .sidebar-mobile-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 8px;
        margin: 8px 12px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    .sidebar-mobile-close:hover { background: rgba(255, 255, 255, 0.05); }
    :root[data-theme="light"] .sidebar-mobile-close:hover { background: rgba(0, 0, 0, 0.05); }

    /* ── Agent Mode nav item visible on mobile ── */

    /* ── Backdrop (hidden since sidebar is full-width) ── */
    .mobile-sidebar-backdrop {
        display: none;
    }

    /* ── Mobile sidebar sizing: ~25-30% larger for touch ── */
    .sidebar-top { padding: 0 24px; }
    .sidebar-bottom { padding: 16px 24px 20px; }
    .sidebar-nav { gap: 4px; }
    .spaces-dropdown { margin-bottom: 12px; }
    .spaces-trigger {
        padding: 12px 16px;
        font-size: 1.1rem;
        gap: 10px;
        border-radius: 10px;
        min-height: 48px;
    }
    .spaces-icon { width: 20px; height: 20px; }
    .spaces-chevron { width: 14px; height: 14px; }
    .sidebar-nav-item {
        padding: 12px 16px;
        font-size: 1rem;
        gap: 12px;
        border-radius: 10px;
    }
    .sidebar-nav-item svg { width: 20px; height: 20px; }
    .sidebar-settings-section {
        padding: 10px 0;
        border-radius: 10px;
        gap: 4px;
    }
    .sidebar-settings-email {
        font-size: 0.85rem;
        padding: 0 16px;
        margin-bottom: 8px;
    }
    .sidebar-settings-divider { margin: 8px 16px; }
    .sidebar-user-card {
        padding: 14px 16px;
        gap: 12px;
        border-radius: 10px;
    }
    .sidebar-user-avatar { width: 40px; height: 40px; font-size: 0.85rem; }
    .sidebar-user-name { font-size: 1.05rem; }
    .sidebar-user-meta { font-size: 0.85rem; }
    .sidebar-user-toggle { padding: 6px; }

    /* ── Hide desktop content header ── */
    .content-header { display: none; }

    /* ── Main content wrapper fills remaining grid row (app pages only) ── */
    .app-layout .main-content-wrapper {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: hidden;
    }

    /* ── Main content (app pages only) ── */
    .app-layout .main-content {
        padding: 0.75rem 16px 1rem;
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Auth pages: better centering + larger touch targets on mobile ── */
    .main-content-wrapper:has(.main-content--auth) {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        overflow: hidden;
        background: #000;
    }
    :root[data-theme="light"] .main-content-wrapper:has(.main-content--auth) {
        background: var(--bg);
    }
    .main-content--auth {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .auth-container {
        min-height: 100%;
        padding: calc(20rem + env(safe-area-inset-top, 0px)) 1rem calc(10rem + env(safe-area-inset-bottom, 0px));
    }
    .auth-container--login {
        padding-top: calc(12rem + env(safe-area-inset-top, 0px));
    }
    .auth-brand {
        margin-bottom: 1.25rem;
    }
    .auth-field-row { grid-template-columns: 1fr; }
    .auth-brand img { height: 28px; }
    .auth-card { padding: 28px 24px; border-radius: 14px; max-width: 100%; }
    .auth-logo img { height: 30px; }
    .auth-title { font-size: 1.6rem; margin-bottom: 0.35rem; }
    .auth-subtitle { font-size: 1.05rem; margin-bottom: 1.75rem; }
    .auth-form { gap: 1.25rem; }
    .auth-field { gap: 0.5rem; }
    .auth-field label { font-size: 0.9rem; }
    .auth-field input[type="text"],
    .auth-field input[type="email"],
    .auth-field input[type="password"],
    .auth-field select {
        height: 44px;
        font-size: 16px;
        padding: 0 1rem;
        border-radius: 10px;
    }
    .auth-pw-toggle { font-size: 0.88rem; right: 0.8rem; }
    .auth-btn,
    .auth-form .btn-submit {
        height: 44px;
        min-height: 44px;
        font-size: 1.05rem;
        border-radius: 10px;
        margin-top: 1rem;
    }
    .auth-error, .auth-success { font-size: 1rem; padding: 0.75rem 1rem; border-radius: 10px; }
    .auth-link { font-size: 1rem; margin-top: 1.5rem; }
    .auth-hint { font-size: 0.82rem; }
    .auth-card {
        padding: 24px;
    }

    /* ── Form & wizard adjustments (existing) ── */
    .field-row { grid-template-columns: 1fr; }
    .team-grid { grid-template-columns: 1fr 1fr; }
    .wizard-actions { flex-direction: column; align-items: stretch; }
    .wizard-actions-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; }

    /* ── Global form elements: ~25-30% larger for mobile touch ── */
    .page-title { font-size: 1.75rem; }
    .page-subtitle { font-size: 1.1rem; }
    .field label { font-size: 0.95rem; }
    .field input[type="text"],
    .field input[type="email"],
    .field input[type="password"],
    .field input[type="date"],
    .field select,
    .field textarea {
        font-size: 16px;
        padding: 0.75rem 1rem;
        border-radius: 10px;
    }
    .btn-submit {
        height: 44px;
        min-height: 44px;
        font-size: 1.05rem;
        border-radius: 10px;
    }

    /* ── Project Templates page (pt-* classes) ── */
    .pt-input, .pt-search-input {
        font-size: 16px !important;
        padding: 12px 16px !important;
        border-radius: 10px !important;
        min-height: 44px;
    }
    .pt-field label {
        font-size: 0.9rem !important;
    }
    .pt-btn {
        font-size: 1rem !important;
        padding: 12px 24px !important;
        border-radius: 10px !important;
        min-height: 44px;
    }

    /* ── Production Assets page (pa-* classes) ── */
    .pa-input, .pa-search-input {
        font-size: 16px !important;
        padding: 12px 16px !important;
        border-radius: 10px !important;
        min-height: 44px;
    }
    .pa-field label {
        font-size: 0.9rem !important;
    }
    .pa-btn {
        font-size: 1rem !important;
        padding: 12px 24px !important;
        border-radius: 10px !important;
        min-height: 44px;
    }
}


/* ══════════════════════════════════════════════════════════
   SETTINGS POPUP OVERLAY
   ══════════════════════════════════════════════════════════ */

.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(35, 35, 35, 0.80);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: settingsFadeIn 0.15s ease;
}

@keyframes settingsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.settings-popup {
    display: flex;
    width: 800px;
    max-width: 94vw;
    height: 82vh;
    max-height: 820px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    border: 1px solid #0f0f0f;
}

/* ── Settings Sidebar ─────────────────────────────────────── */

.settings-sidebar {
    width: 240px;
    min-width: 240px;
    background: #0f0f0f;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 0 1.5rem;
    border-right: 1px solid #1e1e24;
}

:root[data-theme="light"] .settings-sidebar {
    background: #e6e8ed;
    border-right-color: #d5d7dd;
}

.settings-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.9rem 1.2rem;
}

.settings-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.settings-close-btn:hover {
    color: var(--text);
}

.settings-user-email {
    font-size: 0.72rem;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
}

.settings-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: none;
    border: none;
    color: #4c4c4c;
    font-size: 0.85rem;
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
    border-radius: 0;
    transition: color 0.15s;
}

.settings-nav-btn svg {
    flex-shrink: 0;
}

.settings-nav-btn:hover {
    color: #888;
}

.settings-nav-btn.active {
    color: #fff;
    font-weight: 600;
}

/* ── Settings Content ─────────────────────────────────────── */

.settings-content {
    flex: 1;
    background: #000000;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.settings-content::-webkit-scrollbar {
    width: 2px;
}
.settings-content::-webkit-scrollbar-track {
    background: transparent;
}
.settings-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
.settings-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

:root[data-theme="light"] .settings-content {
    background: #eef0f4;
}

.settings-content-loading {
    padding: 2rem;
    color: var(--text-muted);
    text-align: center;
}

.settings-tab-content {
    padding: 1.5rem 2rem;
}

/* Explicit input styling inside settings popup */
.settings-tab-content input[type="text"],
.settings-tab-content input[type="email"],
.settings-tab-content input[type="password"],
.settings-tab-content select:not(.settings-inline-select) {
    background: #0f0f0f;
    border: none;
    border-radius: 8px;
    color: var(--text);
    height: 38px;
    padding: 0 0.8rem;
    font-size: 0.88rem;
    font-family: var(--font);
    width: 100%;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.settings-tab-content select:not(.settings-inline-select) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
}

:root[data-theme="light"] .settings-tab-content input[type="text"],
:root[data-theme="light"] .settings-tab-content input[type="email"],
:root[data-theme="light"] .settings-tab-content input[type="password"],
:root[data-theme="light"] .settings-tab-content select:not(.settings-inline-select) {
    background: #e4e6eb;
    border-color: #d5d7dd;
}

.settings-tab-content input:focus,
.settings-tab-content select:focus {
    border-color: #85a9fb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(133, 169, 251, 0.12);
}

/* Field labels inside settings */
.settings-tab-content .field-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.settings-tab-content .btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 1.5rem;
    height: 32px;
    min-height: 32px;
    font-size: 0.86rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.settings-tab-content .btn-secondary:hover {
    border-color: #85a9fb;
    color: #85a9fb;
}
.settings-tab-content .btn-secondary:active {
    background: rgba(133, 169, 251, 0.08);
}

.settings-section-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.settings-section-header h2 {
    margin: 0;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 500;
    color: #aaaaaa;
    line-height: 1;
}

.settings-tab-content h2 {
    font-size: 1.5rem;
    font-weight: 500;
    color: #aaaaaa;
    margin: 0 0 1rem;
}

/* Thin separator line below the section header */
.settings-header-line {
    border: none;
    border-top: 1px solid #222;
    margin: 0.6rem 0 1.25rem;
}

.settings-count-inline {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-weight: 400;
}

.settings-account-badge {
    background: transparent;
    color: #85a9fb;
    border: 1px solid rgba(133, 169, 251, 0.5);
    padding: 2px 14px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    position: relative;
    top: -0.12em;
}

.settings-badge-green {
    color: var(--green);
    border-color: var(--green);
}

/* ── Profile Avatar ── */

.settings-profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.settings-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #85a9fb;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #000;
}

.avatar-initials {
    font-size: 1.1rem;
    font-weight: 600;
    color: #aaaaaa;
    letter-spacing: 0.05em;
    user-select: none;
}

.avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    color: #85a9fb;
}

.settings-profile-avatar:hover .avatar-hover-overlay {
    opacity: 1;
}

.settings-greeting {
    font-size: 1.15rem;
    color: #aaaaaa;
    font-weight: 500;
}

/* ── Image Upload Modal (shared by profile picture & project BG) ── */

.image-upload-modal {
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 520px;
    width: 90%;
    position: relative;
    color: #fff;
}

.image-upload-close-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.image-upload-close-btn:hover {
    color: #fff;
}

.image-upload-title {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #aaaaaa;
}

.image-upload-preview {
    width: 100%;
    height: 240px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.2);
}

.image-upload-placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.image-upload-preview img {
    max-width: calc(100% - 64px);
    max-height: calc(100% - 64px);
    object-fit: contain;
}

.image-upload-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.6);
    color: #aaaaaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
    z-index: 2;
}

.image-upload-remove-btn:hover {
    color: #fff;
    border-color: #fff;
}

.image-upload-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.image-upload-actions .btn-submit {
    flex: 1;
}

.settings-form-section {
    margin-bottom: 1rem;
}

.settings-divider {
    border: none;
    border-top: 1px solid #222;
    margin: 1.75rem 0;
}

.settings-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 32px;
}

/* Field row spacing inside settings */
.settings-tab-content .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.settings-tab-content .field-row.single-col {
    grid-template-columns: 1fr;
}

.settings-tab-content .field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-save-status {
    font-size: 0.82rem;
    color: var(--green);
}

.settings-info-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ── Bug Report ──────────────────────────────────────────── */

.settings-tab-content textarea {
    background: #0f0f0f;
    border: none;
    border-radius: 8px;
    color: var(--text);
    padding: 0.7rem 0.8rem;
    font-size: 0.88rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}
:root[data-theme="light"] .settings-tab-content textarea {
    background: #e4e6eb;
    border-color: #d5d7dd;
}
.settings-tab-content textarea:focus {
    border-color: #85a9fb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(133, 169, 251, 0.12);
}

.bug-upload-zone {
    border: 2px dashed #333;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.2s, background 0.2s;
}
.bug-upload-zone:hover,
.bug-upload-zone.drag-over {
    border-color: #85a9fb;
    background: rgba(133, 169, 251, 0.04);
}
:root[data-theme="light"] .bug-upload-zone {
    border-color: #c5c7ce;
}
:root[data-theme="light"] .bug-upload-zone:hover,
:root[data-theme="light"] .bug-upload-zone.drag-over {
    border-color: #85a9fb;
    background: rgba(133, 169, 251, 0.08);
}
.bug-upload-text {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.bug-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.bug-file-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
:root[data-theme="light"] .bug-file-pill {
    background: #e4e6eb;
    border-color: #d0d2d8;
}
.bug-file-pill-icon {
    display: flex;
    opacity: 0.5;
}
.bug-file-pill-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bug-file-pill-remove {
    cursor: pointer;
    color: var(--accent-red, #ff4d4d);
    font-size: 1rem;
    line-height: 1;
    margin-left: 0.15rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.bug-file-pill-remove:hover {
    opacity: 1;
}

/* ── Settings Table ───────────────────────────────────────── */

.settings-count-header {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
}

.settings-sub-tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid #222;
    margin-bottom: 1.25rem;
    padding-bottom: 0;
}

.settings-sub-tab {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
}

.settings-sub-tab:hover {
    color: var(--text-muted);
}

.settings-sub-tab.active {
    color: #fff;
    font-weight: 600;
    border-bottom-color: transparent;
}
:root[data-theme="light"] .settings-sub-tab.active { color: #111827; }

.settings-sub-tab.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.settings-search {
    flex: 1;
    background: #0f0f0f;
    border: 1px solid #2a2a30;
    border-radius: 8px;
    color: var(--text);
    height: 32px;
    padding: 0 1rem;
    font-size: 0.85rem;
    font-family: var(--font);
    box-sizing: border-box;
}

:root[data-theme="light"] .settings-search {
    background: #e4e6eb;
    border-color: #d5d7dd;
}

.settings-search::placeholder {
    color: #555;
}

.settings-invite-btn {
    white-space: nowrap;
}

.settings-table {
    width: 100%;
}

.settings-table-header {
    display: grid;
    grid-template-columns: 1.8fr 1fr 0.8fr 0.9fr 0.5fr;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 600;
    border-bottom: 1px solid #222;
}

.settings-table-row {
    border-bottom: 1px solid #1c1c22;
    transition: background 0.15s;
}

.settings-table-row:hover {
    background: rgba(255, 255, 255, 0.015);
}

.settings-table-row.expanded {
    background: rgba(255, 255, 255, 0.02);
}

.settings-row-summary {
    display: grid;
    grid-template-columns: 1.8fr 1fr 0.8fr 0.9fr 0.5fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.stcol-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

.settings-avatar {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(144, 166, 243, 0.1);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    flex-shrink: 0;
}

.settings-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-accent {
    color: #85a9fb;
}

.settings-inline-select {
    background: #0f0f0f;
    border: 1px solid #2a2a30;
    border-radius: 5px;
    color: var(--text);
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    font-family: var(--font);
    max-width: 115px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.35rem center;
    padding-right: 1.3rem;
}

:root[data-theme="light"] .settings-inline-select {
    background-color: #e4e6eb;
    border-color: #d5d7dd;
}

.stcol-date {
    color: var(--text-dim);
    font-size: 0.78rem;
}

.stcol-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.stcol-status {
    display: flex;
    align-items: center;
}

.settings-editing-label {
    color: #85a9fb;
    font-size: 0.76rem;
    font-weight: 500;
}

.settings-chevron-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px;
    transition: transform 0.2s;
}

.settings-chevron-btn.expanded {
    transform: rotate(180deg);
}

/* Expanded row content */
.settings-row-expand {
    padding: 1.25rem 0.85rem 1.5rem;
    border-top: 1px solid #1c1c22;
}

.settings-row-expand .field-row {
    margin-bottom: 0.75rem;
}

.settings-expand-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--red);
    font-size: 0.84rem;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 500;
}

.btn-text-danger:hover {
    text-decoration: underline;
}
.btn-text-danger:disabled {
    color: var(--text-dim);
    cursor: not-allowed;
}
.btn-text-danger:disabled:hover {
    text-decoration: none;
}

/* Status badges */
.status-pending {
    color: var(--red);
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active {
    color: var(--green);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Approve / Reject buttons */
.btn-approve {
    background: var(--green);
    color: #000;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.25rem 0.75rem;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-approve:hover {
    background: #000;
    color: var(--green);
    border-color: var(--green);
}
.btn-approve:active {
    background: var(--green);
    color: #000;
    border-color: transparent;
}

.btn-reject {
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.btn-reject:hover {
    background: var(--red);
    color: #000;
}
.btn-reject:active {
    background: none;
    color: var(--red);
}

/* ── Asset Pills ──────────────────────────────────────────── */

.settings-asset-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.5rem;
}

.settings-asset-pill {
    display: inline-flex;
    align-items: center;
    position: relative;
    background: #0f0f0f;
    border: 1px solid #2a2a30;
    border-radius: 5px;
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    transition: border-color 0.15s, color 0.15s;
    cursor: default;
}
.settings-asset-pill:hover {
    border-color: var(--red);
    color: var(--red);
}

.pill-remove {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--red);
    border: none;
    color: #000;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.settings-asset-pill:hover .pill-remove {
    display: flex;
}

.settings-add-asset-wrapper {
    position: relative;
}

.settings-add-asset-btn {
    background: none;
    border: none;
    border-radius: 5px;
    color: #85a9fb;
    padding: 0.22rem 0.5rem;
    font-size: 0.72rem;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    transition: opacity 0.15s;
}
.settings-add-asset-btn:hover {
    opacity: 0.8;
}

.settings-asset-autocomplete {
    position: absolute;
    top: 100%;
    z-index: 10;
    background: #1a1a1f;
    border: 1px solid #2a2a30;
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 220px;
    box-shadow: var(--shadow-soft);
}

.settings-asset-autocomplete input {
    width: 100%;
    background: #0f0f0f;
    border: 1px solid #2a2a30;
    border-radius: 6px;
    color: var(--text);
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    margin-bottom: 0.4rem;
}

.autocomplete-item {
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.82rem;
}

.autocomplete-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* ── Expand section (collapsible inside expanded row) ──── */

.settings-expand-section {
    margin-top: 0.75rem;
}

.settings-expand-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.4rem 0;
}

.settings-expand-section-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.settings-expand-section-header.collapsed svg {
    transform: rotate(180deg);
}

/* ── Settings Modal (inside popup) ────────────────────────── */

.settings-modal {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal-content {
    background: #1a1a1f;
    border: 1px solid #2a2a30;
    border-radius: 10px;
    padding: 1.5rem;
    width: 380px;
    max-width: 90%;
}

.settings-modal-content h3 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.settings-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* ── Permissions Grid ─────────────────────────────────────── */

.settings-permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.settings-perm-category {
    background: #0f0f0f;
    border: 1px solid #1e1e24;
    border-radius: 8px;
    padding: 1rem;
}

.settings-perm-category h4 {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: capitalize;
    color: var(--text-muted);
}

.settings-perm-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.82rem;
    cursor: pointer;
}

/* ── System Config Accordion ──────────────────────────────── */

.settings-accordion {
    margin-top: 1rem;
}

.settings-accordion-item {
    border-bottom: 1px solid #1e1e24;
}

.settings-accordion-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0;
    cursor: pointer;
    transition: color 0.15s;
}

.settings-accordion-header:hover {
    color: var(--text);
}

.settings-accordion-icon {
    width: 16px;
    height: 16px;
    text-align: center;
    flex-shrink: 0;
    object-fit: contain;
}

.settings-accordion-label {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.settings-accordion-chevron {
    color: var(--text-dim);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.settings-accordion-header.expanded .settings-accordion-chevron {
    transform: rotate(180deg);
}

.settings-accordion-body {
    padding: 0 0 1rem 0;
}

/* Status indicators inside accordion */
.settings-status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 1rem;
    padding-left: 0.1rem;
}

.settings-status-item {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    color: #414141;
}
.settings-status-item span:first-child {
    min-width: 120px;
}

.settings-status-item .status-ready {
    color: var(--green);
    font-weight: 600;
    font-size: 0.7rem;
}

.settings-status-item .status-missing {
    color: var(--orange);
    font-weight: 600;
    font-size: 0.7rem;
}

.settings-status-item .status-offline {
    color: var(--red);
    font-weight: 600;
    font-size: 0.7rem;
}

/* Config field with description */
.settings-config-field {
    margin-bottom: 1rem;
}

.settings-config-field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.settings-config-field-desc {
    font-size: 0.73rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

/* ── Config History ───────────────────────────────────────── */

.config-history-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #1e1e24;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
}

.config-history-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* ══════════════════════════════════════════════════════════
   LIGHT MODE — Settings & Global overrides
   ══════════════════════════════════════════════════════════ */

:root[data-theme="light"] .settings-overlay {
    background: rgba(240, 240, 240, 0.80);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
:root[data-theme="light"] .settings-popup {
    border-color: #d5d7dd;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
}
:root[data-theme="light"] .settings-content {
    background: #eef0f4;
}
:root[data-theme="light"] .settings-content::-webkit-scrollbar-thumb {
    background: #ccc;
}
:root[data-theme="light"] .settings-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
:root[data-theme="light"] .settings-content {
    scrollbar-color: #ccc transparent;
}

/* Settings text */
:root[data-theme="light"] .settings-tab-content h2,
:root[data-theme="light"] .settings-section-header h2 {
    color: var(--text);
}
:root[data-theme="light"] .settings-greeting,
:root[data-theme="light"] .avatar-initials {
    color: var(--text-muted);
}
:root[data-theme="light"] .settings-nav-btn {
    color: #6b7280;
}
:root[data-theme="light"] .settings-nav-btn:hover {
    color: #374151;
}
:root[data-theme="light"] .settings-nav-btn.active {
    color: #111827;
}
:root[data-theme="light"] .text-accent,
:root[data-theme="light"] .settings-editing-label {
    color: #4a7cf5;
}
:root[data-theme="light"] .settings-close-btn,
:root[data-theme="light"] .image-upload-close-btn {
    color: #6b7280;
}
:root[data-theme="light"] .settings-close-btn:hover,
:root[data-theme="light"] .image-upload-close-btn:hover {
    color: #111827;
}
:root[data-theme="light"] .settings-status-item {
    color: var(--text-dim);
}
:root[data-theme="light"] .settings-config-field-label {
    color: var(--text);
}

/* Settings borders */
:root[data-theme="light"] .settings-header-line,
:root[data-theme="light"] .settings-divider {
    border-top-color: #d5d7dd;
}
:root[data-theme="light"] .settings-sub-tabs {
    border-bottom-color: #d5d7dd;
}
:root[data-theme="light"] .settings-table-header {
    border-bottom-color: #d5d7dd;
    color: var(--text-dim);
}
:root[data-theme="light"] .settings-table-row {
    border-bottom-color: #e4e6eb;
}
:root[data-theme="light"] .settings-row-expand {
    border-top-color: #d5d7dd;
}
:root[data-theme="light"] .settings-accordion-item {
    border-bottom-color: #d5d7dd;
}
:root[data-theme="light"] .config-history-item {
    border-bottom-color: #d5d7dd;
}

/* Settings hovers */
:root[data-theme="light"] .settings-table-row:hover {
    background: rgba(0, 0, 0, 0.02);
}
:root[data-theme="light"] .settings-table-row.expanded {
    background: rgba(0, 0, 0, 0.02);
}
:root[data-theme="light"] .config-history-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Settings backgrounds */
:root[data-theme="light"] .settings-modal-content {
    background: #eef0f4;
    border-color: #d5d7dd;
}
:root[data-theme="light"] .settings-asset-autocomplete {
    background: #eef0f4;
    border-color: #d5d7dd;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
:root[data-theme="light"] .settings-asset-autocomplete input {
    background: #e4e6eb;
    border-color: #d5d7dd;
}
:root[data-theme="light"] .autocomplete-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
:root[data-theme="light"] .settings-asset-pill {
    background: #e4e6eb;
    border-color: #d5d7dd;
    color: var(--text-muted);
}
:root[data-theme="light"] .settings-asset-pill:hover {
    border-color: var(--red);
    color: var(--red);
}
:root[data-theme="light"] .settings-perm-category {
    background: #e4e6eb;
    border-color: #d5d7dd;
}
:root[data-theme="light"] .image-upload-modal {
    background: #eef0f4;
    border-color: #d5d7dd;
    color: #111827;
}
:root[data-theme="light"] .image-upload-preview {
    background: #e4e6eb;
    border-color: #d5d7dd;
    color: #9ca3af;
}
:root[data-theme="light"] .image-upload-title {
    color: var(--text);
}
:root[data-theme="light"] .settings-profile-avatar {
    background: #e4e6eb;
}
:root[data-theme="light"] .settings-add-asset-btn {
    color: #4a7cf5;
}

/* Button light mode hovers */
:root[data-theme="light"] .btn-submit:hover {
    background: #eef0f4;
    color: #4a7cf5;
    border-color: #4a7cf5;
}
:root[data-theme="light"] .btn-secondary:hover {
    background: #eef0f4;
    color: #4a7cf5;
    border-color: #4a7cf5;
}
:root[data-theme="light"] .settings-tab-content .btn-secondary:hover {
    border-color: #4a7cf5;
    color: #4a7cf5;
}
:root[data-theme="light"] .btn-approve:hover {
    background: #eef0f4;
    color: var(--green);
    border-color: var(--green);
}
:root[data-theme="light"] .btn-reject:hover {
    background: var(--red);
    color: #fff;
}
:root[data-theme="light"] .settings-search::placeholder {
    color: #9ca3af;
}
:root[data-theme="light"] .settings-account-badge {
    color: #4a7cf5;
    border-color: rgba(74, 124, 245, 0.5);
}

/* ── Auth pages ── */
:root[data-theme="light"] .auth-card { background: #f5f6f9; border-color: #d5d7dd; }
:root[data-theme="light"] .auth-title { color: #111827; }
:root[data-theme="light"] .auth-subtitle { color: #6b7280; }
:root[data-theme="light"] .auth-field label { color: #4b5563; }
:root[data-theme="light"] .auth-field input[type="text"],
:root[data-theme="light"] .auth-field input[type="email"],
:root[data-theme="light"] .auth-field input[type="password"],
:root[data-theme="light"] .auth-field select { background: #e4e6eb; border-color: #d5d7dd; }
:root[data-theme="light"] .auth-hint { color: #6b7280; }
:root[data-theme="light"] .auth-hint a { color: #4a7cf5; }
:root[data-theme="light"] .auth-link { color: #6b7280; }
:root[data-theme="light"] .auth-link a { color: #4a7cf5; }
:root[data-theme="light"] .auth-pw-toggle { color: #6b7280; }
:root[data-theme="light"] .auth-pw-toggle:hover { color: #4b5563; }
:root[data-theme="light"] .auth-btn { background: #eef0f4 !important; color: #4a7cf5 !important; border-color: #4a7cf5 !important; }
:root[data-theme="light"] .auth-btn:hover { background: #4a7cf5 !important; color: #fff !important; }

/* ══════════════════════════════════════════════════════════
   SETTINGS POPUP — MOBILE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .settings-popup {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: 100vw;
        max-height: none;
        border-radius: 0;
        flex-direction: column;
    }

    /* Settings sidebar becomes a horizontal tab bar at the top */
    .settings-sidebar {
        width: 100%;
        min-width: 100%;
        flex-direction: column;
        padding: 0.75rem 0.75rem 0;
        border-right: none;
        border-bottom: 1px solid #1e1e24;
    }
    :root[data-theme="light"] .settings-sidebar {
        border-bottom-color: #d5d7dd;
    }

    .settings-sidebar-top {
        padding: 0 0.25rem 0.6rem;
    }

    .settings-close-btn {
        font-size: 1.4rem;
        padding: 4px 8px;
    }

    /* Nav buttons scroll horizontally */
    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 0;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .settings-nav::-webkit-scrollbar { display: none; }

    .settings-nav-btn {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.78rem;
        border-radius: 8px;
        flex-shrink: 0;
    }

    /* Settings content fills remaining space */
    .settings-content {
        flex: 1;
        min-height: 0;
    }

    .settings-tab-content {
        padding: 1.25rem 1rem;
    }
}
