/* ═══════════════════════════════════════════════════════════
   MarketHub — Premium Design System v2
   Refined: layered backgrounds, premium typography, smooth motion,
   subtle glows, ambient gradients. Inspired by Linear + Vercel + Stripe.
   ═══════════════════════════════════════════════════════════ */

:root {
    /* Dark (default) — premium layered */
    --bg-app: #08080c;
    --bg-sidebar: #0c0c12;
    --bg-topbar: rgba(8, 8, 12, 0.72);
    --bg-card: #11111a;
    --bg-elevated: #181822;
    --bg-input: #15151f;
    --bg-hover: #1d1d29;
    --bg-active: #25253a;
    --bg-overlay: rgba(0, 0, 0, 0.65);

    --text-primary: #ededf2;
    --text-secondary: #a4a4b6;
    --text-muted: #6e6e84;

    --border: #1f1f2c;
    --border-strong: #2a2a3a;
    --border-glow: rgba(99, 102, 241, 0.18);

    --accent: #6366f1;
    --accent-2: #a855f7;
    --accent-hover: #7c7fff;
    --accent-light: rgba(99, 102, 241, 0.13);
    --accent-soft: rgba(99, 102, 241, 0.06);
    --accent-glow: rgba(99, 102, 241, 0.45);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-gradient-hover: linear-gradient(135deg, #7c7fff 0%, #b667ff 100%);

    --green: #22c55e;
    --green-light: rgba(34, 197, 94, 0.14);
    --green-glow: rgba(34, 197, 94, 0.35);
    --red: #ef4444;
    --red-light: rgba(239, 68, 68, 0.14);
    --red-glow: rgba(239, 68, 68, 0.35);
    --yellow: #eab308;
    --yellow-light: rgba(234, 179, 8, 0.14);
    --blue: #3b82f6;
    --blue-light: rgba(59, 130, 246, 0.14);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 9999px;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 32px -6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 0 3px var(--accent-light), 0 0 24px var(--accent-glow);
    --shadow-glow-soft: 0 0 0 1px var(--border-glow);

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --transition: all 0.18s var(--ease);
    --transition-slow: all 0.32s var(--ease);

    --sidebar-width: 244px;
    --sidebar-width-collapsed: 64px;
    --topbar-height: 60px;

    /* Premium fluid type scale */
    --fs-xs: 11.5px;
    --fs-sm: 12.5px;
    --fs-base: 13.5px;
    --fs-md: 14.5px;
    --fs-lg: 16px;
    --fs-xl: 19px;
    --fs-2xl: 24px;
    --fs-3xl: 32px;
    --fs-display: 44px;
}

[data-theme="light"] {
    --bg-app: #f9f9fb;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.72);
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --bg-input: #f4f4f7;
    --bg-hover: #f0f0f5;
    --bg-active: #e9e9f1;
    --bg-overlay: rgba(20, 20, 30, 0.4);

    --text-primary: #0c0c18;
    --text-secondary: #50506a;
    --text-muted: #8a8a9e;

    --border: #ececf2;
    --border-strong: #d8d8e0;
    --border-glow: rgba(99, 102, 241, 0.22);

    --accent-light: rgba(99, 102, 241, 0.09);
    --accent-soft: rgba(99, 102, 241, 0.045);
    --accent-glow: rgba(99, 102, 241, 0.25);

    --shadow-xs: 0 1px 2px rgba(15, 15, 30, 0.06);
    --shadow-sm: 0 2px 4px rgba(15, 15, 30, 0.04);
    --shadow: 0 4px 16px -2px rgba(15, 15, 30, 0.08);
    --shadow-md: 0 12px 28px -6px rgba(15, 15, 30, 0.1);
    --shadow-lg: 0 24px 60px -12px rgba(15, 15, 30, 0.14);
    --shadow-glow: 0 0 0 3px var(--accent-light);

    --green-light: rgba(34, 197, 94, 0.1);
    --red-light: rgba(239, 68, 68, 0.1);
    --yellow-light: rgba(234, 179, 8, 0.1);
    --blue-light: rgba(59, 130, 246, 0.1);
}

/* ─── Subtle ambient background gradient on dark theme ─── */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(168, 85, 247, 0.08), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(99, 102, 241, 0.07), transparent 60%);
    z-index: 0;
}
[data-theme="light"] body::before { display: none; }
.app, .sidebar, .modal-overlay { position: relative; z-index: 1; }

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

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   APP SHELL: sidebar + main
   ═══════════════════════════════════════════════════════════ */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.2s ease;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* ─── Sidebar ─── */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 18px 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-height);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -2px var(--accent-glow);
}

.sidebar-brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapse-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 10px 8px;
    white-space: nowrap;
    line-height: 1.3;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

/* ─── Collapsible module groups ─── */
.nav-module {
    margin: 2px 0;
}

.nav-module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 0.01em;
}

.nav-module-header:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-module-chev {
    margin-left: auto;
    transition: transform 0.2s ease;
    color: var(--text-muted);
    opacity: 0.6;
}

.nav-module.expanded .nav-module-chev {
    transform: rotate(90deg);
    opacity: 1;
}

.nav-module.has-active .nav-module-header {
    color: var(--text-primary);
}

.nav-module-items {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding-left: 10px;
    margin-top: 2px;
    border-left: 1px solid var(--border);
    margin-left: 17px;
}

.nav-module.expanded .nav-module-items {
    display: flex;
}

.nav-module-items .nav-item {
    font-size: 12.5px;
    padding: 7px 10px;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-module-items .nav-item:hover {
    color: var(--text-primary);
}

.nav-module-items .nav-item.active {
    color: var(--text-primary);
    background: var(--bg-active);
    font-weight: 500;
}

.nav-module-items .nav-item.active::before {
    left: -11px;
    top: 6px;
    bottom: 6px;
}

.nav-module-badge {
    margin-left: auto;
    font-size: 9.5px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-module-badge.new {
    background: var(--accent-light);
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   FORM POLISH — universal improvements for all inputs/textareas/selects
   ═══════════════════════════════════════════════════════════ */

/* Universal input styling — applies to .modal-row and any form-group/.settings-field */
.modal-row input[type="text"],
.modal-row input[type="email"],
.modal-row input[type="password"],
.modal-row input[type="number"],
.modal-row input[type="url"],
.modal-row select,
.modal-row textarea,
.scrape-panel .modal-row input[type="text"],
.scrape-panel .modal-row input[type="email"],
.scrape-panel .modal-row input[type="password"],
.scrape-panel .modal-row input[type="number"],
.scrape-panel .modal-row input[type="url"],
.scrape-panel .modal-row select,
.scrape-panel .modal-row textarea,
.wizard-panel .modal-row input,
.wizard-panel .modal-row select,
.wizard-panel .modal-row textarea {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.modal-row input:hover,
.modal-row select:hover,
.modal-row textarea:hover,
.scrape-panel .modal-row input:hover,
.scrape-panel .modal-row textarea:hover,
.scrape-panel .modal-row select:hover {
    border-color: var(--border-strong);
}

.modal-row input:focus,
.modal-row select:focus,
.modal-row textarea:focus,
.scrape-panel .modal-row input:focus,
.scrape-panel .modal-row textarea:focus,
.scrape-panel .modal-row select:focus,
.wizard-panel .modal-row input:focus,
.wizard-panel .modal-row select:focus,
.wizard-panel .modal-row textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.modal-row input::placeholder,
.scrape-panel .modal-row input::placeholder,
.modal-row textarea::placeholder,
.scrape-panel .modal-row textarea::placeholder {
    color: var(--text-muted);
    font-size: 13.5px;
}

.modal-row textarea,
.scrape-panel .modal-row textarea {
    min-height: 80px;
    line-height: 1.55;
    resize: vertical;
}

.modal-row label,
.scrape-panel .modal-row label,
.wizard-panel .modal-row label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 7px;
    display: block;
}

.modal-row small,
.scrape-panel .modal-row small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Spacing in modals + panels */
.modal-row {
    margin-bottom: 16px;
}

.scrape-panel .modal-row {
    margin-bottom: 14px;
}

.scrape-panel > h2 {
    margin-bottom: 14px;
}

.scrape-panel {
    padding: 24px 26px;
}

/* form-row-2 / form-row-3: equalize input heights + spacing */
.form-row-2,
.form-row-3 {
    margin-bottom: 14px;
    gap: 14px;
}

.form-row-2 input,
.form-row-2 select,
.form-row-2 textarea,
.form-row-3 input,
.form-row-3 select,
.form-row-3 textarea {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    transition: var(--transition);
    outline: none;
}

.form-row-2 input:focus,
.form-row-2 select:focus,
.form-row-2 textarea:focus,
.form-row-3 input:focus,
.form-row-3 select:focus,
.form-row-3 textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-row-2 label,
.form-row-3 label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 7px;
    display: block;
}

/* Button rows in panels — more breathing room */
.scrape-panel .btn {
    padding: 11px 18px;
    font-size: 14px;
}

/* Hero section headers in panels */
.scrape-panel h2 {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

/* ─── Help/guide panels ─── */
.help-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 16px;
}

.help-panel summary {
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    user-select: none;
}

.help-panel summary::-webkit-details-marker { display: none; }

.help-panel summary::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
    background-repeat: no-repeat;
    transition: transform 0.2s ease;
}

.help-panel[open] summary::before {
    transform: rotate(90deg);
}

.help-panel-body {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.help-panel-body h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-panel-body h4:first-child { margin-top: 0; }

.help-panel-body ol, .help-panel-body ul {
    margin: 6px 0 10px 20px;
    padding: 0;
}

.help-panel-body li { margin-bottom: 5px; }

.help-panel-body code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.help-panel-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.help-panel-body a:hover { color: var(--accent-hover); }

.help-cost-table {
    margin: 10px 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.help-cost-table th, .help-cost-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.help-cost-table th {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    background: var(--bg-input);
}

.help-tip {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(234, 179, 8, 0.08);
    border-left: 3px solid var(--yellow);
    border-radius: 6px;
    margin: 10px 0;
    font-size: 12.5px;
    color: var(--text-primary);
}

.help-tip::before {
    content: "💡";
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.help-warn {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: var(--red-light);
    border-left: 3px solid var(--red);
    border-radius: 6px;
    margin: 10px 0;
    font-size: 12.5px;
    color: var(--text-primary);
}

.help-warn::before {
    content: "⚠️";
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

/* Cmd+K item transitions */
.cmdk-item { transition: background 0.1s ease; }
.cmdk-item:last-child { border-bottom: none !important; }

/* Scrape mode cards (Standard vs Deep) */
.scrape-mode-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.scrape-mode-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: var(--bg-card);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.scrape-mode-card input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent);
    cursor: pointer;
}
.scrape-mode-card:hover {
    border-color: var(--accent);
}
.scrape-mode-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
}
.scrape-mode-body { flex: 1; min-width: 0; }
.scrape-mode-title {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.scrape-mode-desc {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}
.scrape-batch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
@media (max-width: 600px) {
    .scrape-mode-row { grid-template-columns: 1fr; }
}

/* Bot setup steps */
.bot-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bot-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.bot-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.bot-step-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.bot-step-desc code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent);
    font-family: ui-monospace, monospace;
}

.bot-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--text-muted);
}

.bot-status-row.ok { border-left-color: var(--green); }
.bot-status-row.error { border-left-color: var(--red); }

.bot-status-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.bot-status-info {
    flex: 1;
    min-width: 0;
}

.bot-status-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.bot-status-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: ui-monospace, monospace;
}

/* Collapsed sidebar hides module text, keeps icons */
.app-shell.sidebar-collapsed .nav-module-header span,
.app-shell.sidebar-collapsed .nav-module-chev,
.app-shell.sidebar-collapsed .nav-module-items {
    display: none;
}

.app-shell.sidebar-collapsed .nav-module {
    text-align: center;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.75;
}

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-weight: 600;
}

.nav-badge.muted { background: var(--bg-elevated); color: var(--text-muted); }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 10px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--border-strong); }

.sidebar-footer-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

/* Collapsed sidebar */
.app-shell.sidebar-collapsed .sidebar-brand,
.app-shell.sidebar-collapsed .nav-item span:not(.nav-badge),
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .sidebar-footer-text {
    display: none;
}

.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.app-shell.sidebar-collapsed .sidebar-header { justify-content: center; flex-wrap: wrap; gap: 6px; }
.app-shell.sidebar-collapsed .sidebar-collapse-btn {
    margin-left: 0;
    transform: rotate(180deg);
}

/* ─── Main area ─── */
.main-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-topbar);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.topbar-search {
    margin-left: auto;
    position: relative;
    width: 260px;
}

.topbar-search input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.topbar-search input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.topbar-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 14px;
    height: 14px;
}

.topbar-kbd {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    pointer-events: none;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.content {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    max-width: 100%;
}

/* ─── Sections ─── */
.section { display: none; }
.section.active { display: block; animation: section-fade 0.2s ease; }

@keyframes section-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 24px;
}

.section-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.stat-card.clickable { cursor: pointer; }

.stat-card.clickable:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 18px -4px var(--accent-glow);
}

.stat-card.clickable:hover .stat-value {
    color: var(--accent);
}

.category-item.clickable { cursor: pointer; }

.category-item.clickable:hover .category-name {
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg { width: 18px; height: 18px; }

/* Compact KPI tiles — used in Rank Overview, Cannibalization summary, etc.
   Smaller footprint than .stat-card for dense overview rows. */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.dash-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: var(--transition);
}
.dash-kpi:hover {
    border-color: var(--border-strong);
}
.kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}
.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-icon.purple { background: var(--accent-light); color: var(--accent); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.stat-icon.yellow { background: var(--yellow-light); color: var(--yellow); }

/* ─── Cards / Panels ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}
.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.card.elevated {
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card-title {
    font-size: var(--fs-lg);
    font-weight: 620;
    color: var(--text-primary);
    letter-spacing: -0.012em;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card.danger { border-color: rgba(239, 68, 68, 0.3); }
.card.danger .card-title { color: var(--red); }

/* legacy alias used by existing HTML blocks */
.scrape-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
}

.scrape-panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ─── Forms ─── */
.scrape-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 12px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* ─── Buttons ─── */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 13.5px;
    font-weight: 540;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn::after {
    /* Subtle hover sheen */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 80% at 50% -10%, rgba(255,255,255,0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.18s var(--ease);
    pointer-events: none;
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-light), 0 0 0 1px var(--accent);
}

.btn svg { width: 15px; height: 15px; stroke-width: 2; }

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px -2px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 6px 22px -4px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.22);
}

.btn-secondary { background: var(--bg-input); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger { background: var(--red-light); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red); color: white; box-shadow: 0 4px 14px -2px var(--red-glow); }

.btn-success { background: var(--green-light); color: var(--green); border-color: transparent; }
.btn-success:hover { background: var(--green); color: white; box-shadow: 0 4px 14px -2px var(--green-glow); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-lg { padding: 13px 22px; font-size: 14.5px; border-radius: var(--radius); }

/* ─── Progress bar ─── */
.progress-container { margin-top: 14px; display: none; }
.progress-container.active { display: block; }

.progress-bar-wrapper {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-bar.indeterminate {
    width: 30%;
    animation: progress-slide 1.3s infinite ease-in-out;
}

@keyframes progress-slide {
    0% { transform: translateX(-150%); }
    100% { transform: translateX(450%); }
}

.progress-text { font-size: 13px; color: var(--text-secondary); }

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* Each filter dropdown should be compact — shrink so all 5 fit on a row on
   typical desktop widths rather than wrapping onto a second row. */
.filter-bar .filter-select {
    max-width: 160px;
    flex: 0 1 auto;
}

.search-wrapper {
    position: relative;
    flex: 1 1 220px;
    min-width: 180px;
}

.search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 15px;
    height: 15px;
}

.filter-select {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    min-width: 150px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.filter-select:focus { border-color: var(--accent); box-shadow: var(--shadow-glow); }

/* ─── Table ─── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.table-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-actions { display: flex; gap: 8px; }

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: var(--transition);
}

thead th:hover { color: var(--accent); }

thead th .sort-arrow { margin-left: 4px; opacity: 0.3; }
thead th.sorted .sort-arrow { opacity: 1; color: var(--accent); }

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--bg-hover); }

tbody td {
    padding: 11px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tbody td.name-cell {
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Badges ─── */
.badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.01em;
}

.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-purple { background: var(--accent-light); color: var(--accent); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }

a.table-link {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a.table-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.empty-state-icon svg { width: 28px; height: 28px; }

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.empty-state p { font-size: 13.5px; color: var(--text-muted); max-width: 400px; margin: 0 auto; }

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ─── Placeholder (coming soon pages) ─── */
.placeholder-card {
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
}

.placeholder-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--accent-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px -4px var(--accent-glow);
}

.placeholder-icon svg { width: 36px; height: 36px; stroke-width: 1.75; }

.placeholder-card h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.placeholder-card p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 18px;
    line-height: 1.6;
}

.placeholder-tag {
    display: inline-block;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}

.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-controls { display: flex; gap: 4px; }

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12.5px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Category list ─── */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 13px;
}

.category-item:hover { background: var(--bg-hover); transform: translateX(3px); }

.category-name { color: var(--text-primary); }

.category-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 9px;
    border-radius: 12px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
    max-width: 400px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--yellow); }

.toast.toast-clickable {
    cursor: pointer;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    transition: transform 0.15s ease, background 0.15s ease;
}
.toast.toast-clickable:hover {
    transform: translateX(-3px);
    background: color-mix(in srgb, var(--bg-card) 92%, var(--accent) 8%);
}
.toast .toast-msg { line-height: 1.4; }
.toast .toast-action {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@keyframes toast-in {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── Spinner ─── */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
    color: var(--text-primary);
    padding-right: 36px;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    width: 120px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
    flex: 1;
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
    :root { --sidebar-width: 64px; }
    .app-shell { grid-template-columns: 64px 1fr; }
    .sidebar-brand,
    .nav-item span:not(.nav-badge),
    .nav-section-label,
    .sidebar-footer-text { display: none; }
    .nav-item { justify-content: center; padding: 10px; }
    .sidebar-header { justify-content: center; }
    .sidebar-collapse-btn { display: none; }
    .topbar-search { width: 180px; }
    .content { padding: 20px; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .topbar-search { display: none; }
    .scrape-form { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-wrapper { min-width: 100%; }
    .content { padding: 16px; }

    /* Section headers — wrap + full-width buttons on small screens */
    .section-header { gap: 8px !important; }
    .section-header > div { width: 100%; }
    .section-header > button, .section-header > div[style*="display:flex"] { width: 100%; }
    .section-title { font-size: 22px !important; }

    /* Campaign wizard — stack steps + tighter spacing */
    .wizard-steps { flex-wrap: wrap; padding: 12px 0; gap: 6px; }
    .wizard-step { flex: 1 1 calc(50% - 6px); min-width: 120px; font-size: 12px; padding: 6px 10px; }
    .wizard-panel { padding: 16px; }
    .wizard-footer { flex-wrap: wrap; gap: 6px; }
    .wizard-footer .btn { flex: 1 1 auto; justify-content: center; }
    .form-row-2, .form-row-3 { grid-template-columns: 1fr !important; }
    .wizard-template-list { grid-template-columns: 1fr; }

    /* Campaign cards stack vertically on mobile */
    .campaign-card { flex-direction: column; align-items: flex-start; }
    .campaign-card-stats { width: 100%; justify-content: space-between; gap: 8px; }
    .campaign-card-actions { width: 100%; flex-wrap: wrap; }

    /* Design Studio — chat full width, preview below */
    .design-studio-layout { grid-template-columns: 1fr !important; height: auto; }
    .design-chat-panel { min-height: 400px; }
    .design-preview-panel { min-height: 420px; }
    .design-preview-iframe { min-height: 500px; }

    /* Template editor — single column */
    .template-editor-topbar { flex-wrap: wrap; gap: 6px; padding: 10px 0; }
    .template-name-input { max-width: 100%; font-size: 15px; }
    .template-editor-topbar > div { width: 100%; justify-content: flex-start !important; }
    .template-editor-layout { grid-template-columns: 1fr; height: auto; }
    .template-preview-panel { min-height: 400px; }

    /* Settings — nav as horizontal scroll chips */
    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { flex-direction: row; overflow-x: auto; padding: 6px; gap: 4px; position: static; }
    .settings-nav-item { flex: 0 0 auto; white-space: nowrap; padding: 7px 12px; font-size: 12.5px; }
    .settings-main { padding: 18px; }
    .settings-field-row { grid-template-columns: 1fr !important; gap: 8px; }

    /* Contacts CRM — single column */
    .crm-layout { grid-template-columns: 1fr !important; }
    .crm-panel { position: static; }
    .bulk-bar { flex-wrap: wrap; padding: 10px 12px; }
    .bulk-bar-actions { width: 100%; flex-wrap: wrap; }

    /* Content Studio cards full width */
    .accounts-grid, .products-grid, .templates-grid { grid-template-columns: 1fr !important; }

    /* Mobile: wizard account/template lists */
    .wizard-accounts-list { gap: 6px; }
    .wizard-account-option { padding: 10px; }
    .wizard-mode-option { padding: 10px; }

    /* AI review panel (per-contact) */
    .ai-review-panel { grid-template-columns: 1fr !important; height: auto; }

    /* Modals — near-full-width */
    .modal { padding: 20px 18px; max-height: 90vh; }
    .modal.wide { max-width: 100%; }
    .modal h2 { font-size: 18px; }

    /* Modal tabs stack if many */
    .modal-tabs { flex-wrap: wrap; gap: 3px; padding: 3px; }
    .modal-tab { flex: 1 1 calc(33% - 3px); font-size: 12px; padding: 6px 8px; }

    /* Hide help-cost-table headers on very small */
    .help-cost-table th, .help-cost-table td { padding: 5px 6px; font-size: 11.5px; }

    /* Copywriter chat full screen on mobile */
    .copywriter-panel { width: 100vw !important; }
    .copywriter-launcher { bottom: 16px; right: 16px; width: 48px; height: 48px; }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 2 — CRM (Contacts, Lists, Tags, Notes, Blacklist)
   ═══════════════════════════════════════════════════════════ */

/* CRM layout — single column, table gets full width.
   Lists + tags moved to a horizontal strip above the table. */
.crm-layout {
    display: block;
}

.crm-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.crm-panel-section {
    flex: 1 1 auto;
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.crm-panel-header {
    padding: 0 !important;
    margin: 0;
    display: inline-flex;
    gap: 4px;
    align-items: center;
    border: none;
}

.crm-panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    margin-right: 4px;
}

/* List buttons become horizontal pills */
.crm-panel .crm-list-item {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    background: var(--bg-soft, #f3f4f6);
    border: 1px solid transparent;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    margin: 0;
}

.crm-panel .crm-list-item.active {
    background: var(--accent);
    color: white;
}

.crm-panel .crm-list-item .crm-list-count {
    background: rgba(0, 0, 0, 0.12);
    color: inherit;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.crm-panel .crm-list-item.active .crm-list-count {
    background: rgba(255, 255, 255, 0.22);
}

#listsContainer {
    display: contents;  /* pills merge into parent flex */
}

.crm-tags-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Right-side main area still needs to clip its table to the card width */
.crm-main {
    min-width: 0;
}

/* Compact header specifically on the Contacts section so the table + lists
   start higher on the page — more rows visible above the fold. */
.section-contacts .section-header-compact {
    margin-bottom: 10px;
}
.section-contacts .section-header-compact .section-title {
    font-size: 22px;
    margin: 0 0 2px;
    line-height: 1.15;
}
.section-contacts .section-header-compact .section-subtitle {
    font-size: 13px;
    margin: 0;
    color: var(--text-secondary);
}

/* Table row density — keep rows tight so ~12 contacts fit per screen */
.section-contacts .table-wrapper table { font-size: 13.5px; }
.section-contacts .table-wrapper th,
.section-contacts .table-wrapper td { padding: 9px 10px; }

.crm-panel-section { margin-bottom: 16px; }
.crm-panel-section:last-child { margin-bottom: 0; }

.crm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 8px;
    gap: 6px;
}

.crm-panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    color: var(--text-muted);
}

.crm-panel-add {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: var(--transition);
    padding: 0;
}

.crm-panel-add:hover { border-color: var(--accent); color: var(--accent); }

.crm-list-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.crm-list-item:hover { background: var(--bg-hover); color: var(--text-primary); }

.crm-list-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
    font-weight: 500;
}

.crm-list-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--bg-card);
}

.crm-list-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.crm-list-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-list-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.crm-list-item.active .crm-list-count {
    background: var(--accent-light);
    color: var(--accent);
}

.crm-list-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 9px;
    font-style: italic;
}

/* ─── Tag chip in list (sidebar) ─── */
.crm-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 8px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    transition: var(--transition);
    white-space: nowrap;
}

.crm-tag-chip:hover { border-color: var(--border-strong); }

.crm-tag-chip.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.crm-tag-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.crm-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px;
}

/* ─── Right panel (contacts area) ─── */
.crm-main {
    min-width: 0;
}

.crm-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.crm-header-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-header-title-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.crm-header-count {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.crm-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ─── Bulk action bar ─── */
.bulk-bar {
    display: none;
    position: sticky;
    top: calc(var(--topbar-height) - 1px);
    z-index: 30;
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 12px;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px -6px var(--accent-glow);
    animation: bulk-in 0.2s ease;
}

.bulk-bar.active { display: flex; }

@keyframes bulk-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.bulk-bar-count {
    font-size: 14px;
    font-weight: 600;
}

.bulk-bar-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.bulk-bar button {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: inherit;
}

.bulk-bar button:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); }

.bulk-bar button svg { width: 14px; height: 14px; }

.bulk-bar-close {
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    opacity: 0.7;
}

.bulk-bar-close:hover { opacity: 1; }

/* ─── Table: checkbox column + tag inline chips ─── */
.row-checkbox, .header-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
}

th.col-check, td.col-check {
    width: 36px;
    padding-left: 16px;
    padding-right: 8px;
}

.inline-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    vertical-align: middle;
    max-width: 160px;
}

.inline-tag {
    font-size: 10.5px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
    border: 1px solid transparent;
}

.row-blacklisted td.name-cell { color: var(--red); text-decoration: line-through; opacity: 0.7; }

/* ─── Contact detail modal tabs ─── */
.modal-tabs {
    display: flex;
    gap: 2px;
    margin: -8px -8px 18px;
    padding: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.modal-tab {
    padding: 7px 14px;
    border-radius: calc(var(--radius-sm) - 2px);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
    font-family: inherit;
}

.modal-tab:hover { color: var(--text-primary); }

.modal-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow);
}

.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; animation: tab-fade 0.15s ease; }

@keyframes tab-fade {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Notes timeline ─── */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-item {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    position: relative;
    border-left: 3px solid var(--accent);
}

.note-text {
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: pre-wrap;
    margin-bottom: 6px;
    line-height: 1.55;
}

.note-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

.note-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition);
}

.note-item:hover .note-delete { opacity: 1; }
.note-delete:hover { color: var(--red); background: var(--red-light); }

.note-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.note-form textarea {
    width: 100%;
    min-height: 70px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

.note-form textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* ─── Contact detail tag row with remove ─── */
.contact-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    min-height: 32px;
    align-items: center;
}

.contact-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
}

.contact-tag-remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.contact-tag-remove:hover { background: rgba(255,255,255,0.3); }

.tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* ─── Color picker (swatches) ─── */
.color-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.color-swatch:hover { transform: scale(1.1); }

.color-swatch.selected {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.color-swatch.selected::after {
    content: '✓';
    position: absolute;
    inset: 0;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ─── Import CSV wizard ─── */
.import-dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.import-dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: var(--accent);
}

.import-dropzone h3 {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.import-dropzone p {
    font-size: 13px;
    color: var(--text-muted);
}

.import-mapping-table {
    width: 100%;
    margin: 14px 0;
    border-collapse: collapse;
}

.import-mapping-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

.import-mapping-table td:first-child {
    color: var(--text-muted);
    width: 40%;
    font-weight: 500;
}

.import-mapping-table select {
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}

.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.import-preview-table th {
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 7px 10px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.import-preview-table td {
    padding: 7px 10px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.import-stat {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    text-align: center;
}

.import-stat-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.import-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.import-stat.success { background: var(--green-light); }
.import-stat.success .import-stat-value { color: var(--green); }
.import-stat.warning { background: var(--yellow-light); }
.import-stat.warning .import-stat-value { color: var(--yellow); }
.import-stat.neutral { background: var(--bg-input); }

/* ─── Inline editable CRM items ─── */
.crm-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    background: var(--bg-input);
    transition: var(--transition);
}

.crm-item-row:hover { border-color: var(--border-strong); }

.crm-item-row input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    padding: 4px 0;
}

.crm-item-row .crm-item-count {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-hover);
    border-radius: 10px;
}

.crm-item-row .btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--transition);
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.danger:hover { color: var(--red); background: var(--red-light); }

/* ─── Modal wide variant (for import, lists management) ─── */
.modal.wide { max-width: 760px; }

/* ─── Form inputs fallback for modals ─── */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="number"],
.modal select,
.modal textarea {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
    width: 100%;
}

.modal input[type="text"]:focus,
.modal input[type="email"]:focus,
.modal input[type="number"]:focus,
.modal select:focus,
.modal textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.modal-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.modal-row label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: 18px;
}

/* ─── Responsive CRM layout ─── */
@media (max-width: 960px) {
    .crm-layout {
        grid-template-columns: 1fr;
    }
    .crm-panel {
        position: static;
    }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 3 — EMAIL ACCOUNTS (SMTP + IMAP)
   ═══════════════════════════════════════════════════════════ */

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.account-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.account-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px -2px var(--accent-glow);
}

.account-info { flex: 1; min-width: 0; }

.account-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-email {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.account-status {
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.account-status.ok { background: var(--green-light); color: var(--green); }
.account-status.error { background: var(--red-light); color: var(--red); }
.account-status.unknown { background: var(--bg-input); color: var(--text-muted); }
.account-status.inactive { background: var(--yellow-light); color: var(--yellow); }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.account-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12px;
}

.account-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-meta-label {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.account-meta-value {
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11.5px;
    word-break: break-all;
}

.account-usage {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.account-usage-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.account-usage-bar {
    height: 5px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.account-usage-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.account-usage-fill.warning { background: linear-gradient(90deg, var(--yellow), #f97316); }
.account-usage-fill.full { background: linear-gradient(90deg, var(--red), #dc2626); }

.account-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.account-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
}

/* ─── Add / Edit account modal ─── */
.account-form-section {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.account-form-section:last-child { border-bottom: none; }

.account-form-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
}

.toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.toggle-row-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.toggle-row-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── DNS check result ─── */
.dns-check-result {
    margin-top: 10px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.dns-check-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dns-score {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.dns-score small { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.dns-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dns-status-badge.excellent { background: var(--green-light); color: var(--green); }
.dns-status-badge.good { background: var(--accent-light); color: var(--accent); }
.dns-status-badge.warning { background: var(--yellow-light); color: var(--yellow); }
.dns-status-badge.critical { background: var(--red-light); color: var(--red); }

.dns-advice {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.dns-record {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid transparent;
}

.dns-record.ok { border-left-color: var(--green); }
.dns-record.fail { border-left-color: var(--red); }

.dns-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.dns-record-type {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dns-record-value {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, monospace;
    word-break: break-all;
    background: var(--bg-input);
    padding: 6px 8px;
    border-radius: 4px;
    margin-top: 6px;
}

/* ─── Test result inline feedback ─── */
.test-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: none;
}

.test-result.active { display: block; }
.test-result.ok { background: var(--green-light); color: var(--green); border-left: 3px solid var(--green); }
.test-result.error { background: var(--red-light); color: var(--red); border-left: 3px solid var(--red); }

.test-result-error-detail {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: ui-monospace, monospace;
    word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════
   PHASE 4 — TEMPLATES (cards + editor)
   ═══════════════════════════════════════════════════════════ */

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
}

.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.template-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.template-card-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    flex: 1;
}

.template-card-subject {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    max-height: 66px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    background: var(--bg-input);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.template-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.template-card-footer .btn {
    padding: 4px 8px;
    font-size: 11.5px;
}

.template-category-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--accent-light);
    color: var(--accent);
}

.template-gallery-badge {
    background: linear-gradient(90deg, var(--accent-light), rgba(168, 85, 247, 0.15));
    color: var(--accent-2);
}

/* ─── Editor layout ─── */
.template-editor-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.template-name-input {
    flex: 1;
    max-width: 400px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    outline: none;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.template-name-input:focus { border-color: var(--accent); box-shadow: var(--shadow-glow); }

.template-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    height: calc(100vh - 220px);
    min-height: 520px;
}

.template-editor-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-y: auto;
}

.template-editor-field { display: flex; flex-direction: column; gap: 6px; }

.template-editor-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.template-subject-input {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.template-subject-input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.template-variables-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.template-variables-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-right: 4px;
}

#tplVariablesButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.var-btn {
    padding: 4px 10px;
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    font-family: ui-monospace, monospace;
    transition: var(--transition);
}

.var-btn:hover { background: var(--accent); color: white; }

/* Quill editor overrides */
#tplQuillEditor { min-height: 260px; flex: 1; display: flex; flex-direction: column; }

.ql-toolbar.ql-snow, .ql-container.ql-snow {
    border-color: var(--border);
}

.ql-toolbar.ql-snow {
    background: var(--bg-input);
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}

.ql-container.ql-snow {
    background: var(--bg-input);
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    flex: 1;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.ql-editor { color: var(--text-primary); min-height: 200px; }
.ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }

[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--text-secondary); }
[data-theme="dark"] .ql-snow .ql-fill,
[data-theme="dark"] .ql-snow .ql-stroke.ql-fill { fill: var(--text-secondary); }
[data-theme="dark"] .ql-snow .ql-picker { color: var(--text-secondary); }
[data-theme="dark"] .ql-snow .ql-picker-options { background: var(--bg-elevated); border-color: var(--border); }
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }

/* Preview panel */
.template-preview-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.template-preview-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
}

.template-preview-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.template-preview-contact {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 2px;
}

.template-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f5f5f8;
}

[data-theme="dark"] .template-preview-body {
    background: #0f0f14;
}

.template-preview-email {
    background: white;
    border-radius: var(--radius-sm);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #111;
    max-width: 600px;
    margin: 0 auto;
    min-height: 300px;
}

.template-preview-subject {
    font-size: 16px;
    font-weight: 600;
    color: #111;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.template-preview-content {
    font-size: 14px;
    line-height: 1.6;
    color: #222;
}

.template-preview-content p { margin-bottom: 12px; }
.template-preview-content a { color: #2563eb; }

/* Spam score */
.spam-score-panel {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border-left: 3px solid var(--text-muted);
}

.spam-score-panel.ok { border-left-color: var(--green); }
.spam-score-panel.warning { border-left-color: var(--yellow); }
.spam-score-panel.critical { border-left-color: var(--red); }

.spam-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.spam-score-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.spam-score-value {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.spam-score-panel.ok .spam-score-value { color: var(--green); }
.spam-score-panel.warning .spam-score-value { color: var(--yellow); }
.spam-score-panel.critical .spam-score-value { color: var(--red); }

/* Attachments list */
.template-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
}

.template-attachment-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.template-attachment-name { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-attachment-size { font-size: 11px; color: var(--text-muted); }

@media (max-width: 960px) {
    .template-editor-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .template-preview-panel {
        min-height: 400px;
    }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 5 — CAMPAIGNS
   ═══════════════════════════════════════════════════════════ */

/* Campaign card */
.campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.campaign-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.campaign-card-main {
    flex: 1;
    min-width: 200px;
}

.campaign-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.campaign-card-meta {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.campaign-card-stats {
    display: flex;
    gap: 18px;
    font-size: 13px;
    color: var(--text-secondary);
}

.campaign-card-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 52px;
}

.campaign-card-stat-value {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.campaign-card-stat-value.sent { color: var(--green); }
.campaign-card-stat-value.failed { color: var(--red); }
.campaign-card-stat-value.replied { color: var(--accent-2); }

.campaign-card-stat-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.campaign-card-actions {
    display: flex;
    gap: 6px;
}

.campaign-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-block;
}

.campaign-status-badge.draft { background: var(--bg-input); color: var(--text-muted); }
.campaign-status-badge.running { background: var(--accent-light); color: var(--accent); }
.campaign-status-badge.paused { background: var(--yellow-light); color: var(--yellow); }
.campaign-status-badge.completed { background: var(--green-light); color: var(--green); }
.campaign-status-badge.cancelled { background: var(--red-light); color: var(--red); }

/* Wizard */
.wizard-steps {
    display: flex;
    gap: 8px;
    padding: 18px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    transition: var(--transition);
    flex: 1;
    justify-content: center;
}

.wizard-step.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.wizard-step.done {
    color: var(--green);
}

.wizard-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-input);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.wizard-step.active .wizard-step-num {
    background: var(--accent);
    color: white;
}

.wizard-step.done .wizard-step-num {
    background: var(--green);
    color: white;
}

.wizard-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.wizard-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

.wizard-footer .btn svg { width: 14px; height: 14px; }

.wizard-template-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.wizard-template-option {
    padding: 12px 14px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.wizard-template-option:hover {
    border-color: var(--border-strong);
}

.wizard-template-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.wizard-template-option-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wizard-template-option-subject {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.wizard-mode-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.wizard-mode-option {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    align-items: flex-start;
}

.wizard-mode-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
}

.wizard-mode-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent);
}

.wizard-mode-option small { color: var(--text-muted); font-size: 12px; }

.wizard-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.wizard-account-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.wizard-account-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
}

.wizard-account-option input[type="checkbox"] {
    accent-color: var(--accent);
}

.wizard-account-option-info {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.wizard-account-option-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Recipient preview box */
.recipient-preview {
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.recipient-preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.recipient-preview-stat {
    text-align: center;
}

.recipient-preview-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.recipient-preview-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.recipient-preview-sample {
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* Review summary */
.review-section {
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.review-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.review-section-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Campaign detail (progress view) */
.campaign-progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.progress-big-bar {
    height: 10px;
    background: var(--bg-input);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 14px;
}

.progress-big-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    transition: width 0.5s ease;
    border-radius: 5px;
}

.progress-live-text {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.recipient-status-row {
    display: grid;
    grid-template-columns: 24px 1fr 160px 100px;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    align-items: center;
}

.recipient-status-row:hover { background: var(--bg-hover); }

.recipient-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.recipient-status-dot.pending { background: var(--text-muted); }
.recipient-status-dot.sent { background: var(--green); }
.recipient-status-dot.failed { background: var(--red); }
.recipient-status-dot.replied { background: var(--accent-2); }
.recipient-status-dot.unsubscribed { background: var(--yellow); }
.recipient-status-dot.bounced { background: var(--red); }

/* ═══════════════════════════════════════════════════════════
   SETTINGS — redesign with side nav + clean sections
   ═══════════════════════════════════════════════════════════ */

.settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: flex-start;
}

.settings-nav {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: var(--transition);
    font-family: inherit;
}

.settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.settings-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    min-height: 400px;
}

.settings-tab { display: none; animation: tab-fade 0.15s ease; }
.settings-tab.active { display: block; }

.settings-tab-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.settings-tab-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-tab-header p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 640px;
}

.settings-field {
    margin-bottom: 20px;
    max-width: 680px;
}

.settings-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.settings-field input[type="text"],
.settings-field input[type="email"],
.settings-field input[type="password"],
.settings-field input[type="number"],
.settings-field select,
.settings-field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.settings-field textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.settings-field small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.settings-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.settings-field-row .settings-field { margin-bottom: 16px; }

.settings-key-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.settings-key-row input { flex: 1; }
.settings-key-row .btn { white-space: nowrap; }

.settings-key-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-key-status.set { background: var(--green-light); color: var(--green); }
.settings-key-status.empty { background: var(--yellow-light); color: var(--yellow); }

.settings-save-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.settings-save-row small { color: var(--text-muted); font-size: 12px; }

.settings-info-card {
    background: var(--bg-input);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    gap: 32px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.settings-info-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 3px;
}

.settings-info-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.settings-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.settings-info-grid .stat-card {
    padding: 14px;
}

.settings-info-grid .stat-value {
    font-size: 22px;
}

@media (max-width: 960px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
    }
    .settings-nav-item { flex: 0 0 auto; justify-content: center; }
    .settings-field-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   AI COPYWRITER STUDIO — Products + Chat + Subject Lab + Critique
   ═══════════════════════════════════════════════════════════ */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}

.product-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.product-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.product-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-weight: 700;
    box-shadow: 0 4px 10px -2px var(--accent-glow);
}

.product-card-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.product-card-url {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, monospace;
    word-break: break-all;
}

.product-card-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.product-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.product-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.product-card-actions {
    display: flex;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.product-card-actions .btn { padding: 5px 10px; font-size: 12px; }

/* Product add/edit modal with preview step */
.product-preview-section {
    margin-top: 12px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    max-height: 380px;
    overflow-y: auto;
}

.product-preview-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.product-preview-row:last-child { border-bottom: none; }

.product-preview-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.product-preview-value {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ─── Copywriter chat panel (slides in from right) ─── */
.copywriter-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: none;
    flex-direction: column;
    z-index: 150;
    box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}

.copywriter-panel.active { display: flex; animation: slide-in 0.22s ease; }

@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }

.copywriter-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.copywriter-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.copywriter-title svg { color: var(--accent); }

.copywriter-close {
    width: 28px; height: 28px; border-radius: 6px;
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}

.copywriter-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.copywriter-config {
    padding: 12px 18px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.copywriter-config-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copywriter-config-row label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    min-width: 70px;
}

.copywriter-config-row select,
.copywriter-config-row input {
    flex: 1;
    padding: 5px 8px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
}

.copywriter-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.copywriter-msg {
    display: flex;
    gap: 10px;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.copywriter-avatar {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.copywriter-avatar.user {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.copywriter-avatar.assistant {
    background: var(--accent-gradient);
    color: white;
}

.copywriter-bubble {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-primary);
    word-break: break-word;
    min-width: 0;
}

.copywriter-bubble p { margin-bottom: 8px; }
.copywriter-bubble p:last-child { margin-bottom: 0; }
.copywriter-bubble strong { color: var(--text-primary); }
.copywriter-bubble em { color: var(--text-secondary); }
.copywriter-bubble ul, .copywriter-bubble ol { margin: 6px 0 6px 20px; }

.copywriter-draft-card {
    margin-top: 10px;
    padding: 12px;
    background: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
}

.copywriter-draft-subject {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.copywriter-draft-body {
    font-size: 12.5px;
    color: var(--text-secondary);
    max-height: 160px;
    overflow-y: auto;
    line-height: 1.55;
}

.copywriter-draft-body p { margin-bottom: 6px; }

.copywriter-apply-btn {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
}

.copywriter-apply-btn:hover { background: var(--accent-hover); }

.copywriter-input-area {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.copywriter-textarea {
    flex: 1;
    min-height: 48px;
    max-height: 160px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: var(--transition);
}

.copywriter-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.copywriter-send {
    width: 40px; height: 40px;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.copywriter-send:hover { filter: brightness(1.1); }
.copywriter-send:disabled { opacity: 0.5; cursor: not-allowed; }

.copywriter-quick-actions {
    padding: 10px 18px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
}

.copywriter-quick-btn {
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 11.5px;
    font-family: inherit;
    transition: var(--transition);
}

.copywriter-quick-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.copywriter-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px -4px var(--accent-glow);
    z-index: 100;
    transition: var(--transition);
}

.copywriter-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 28px -4px var(--accent-glow);
}

.copywriter-launcher.visible { display: flex; }

/* ─── Subject Lab modal ─── */
.subject-list {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subject-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.subject-row:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.subject-row.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.subject-row-main { flex: 1; min-width: 0; }

.subject-row-text {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.subject-row-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subject-row-style {
    font-size: 10.5px;
    padding: 1px 6px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Critique modal ─── */
.critique-score {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}

.critique-section {
    margin-bottom: 14px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
}

.critique-section.strengths { border-left-color: var(--green); }
.critique-section.weaknesses { border-left-color: var(--red); }
.critique-section.improvements { border-left-color: var(--yellow); }
.critique-section.tips { border-left-color: var(--accent); }

.critique-section h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.critique-section ul {
    margin: 0 0 0 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.critique-section li { margin-bottom: 4px; }

.critique-improvement {
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 6px;
}

.critique-improvement-issue {
    font-size: 12.5px;
    color: var(--red);
    font-weight: 600;
    margin-bottom: 3px;
}

.critique-improvement-fix {
    font-size: 12.5px;
    color: var(--text-primary);
}

/* ─── Per-contact review list (Faza C) ─── */
.ai-review-panel {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 14px;
    height: calc(100vh - 260px);
    min-height: 520px;
}

.ai-review-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ai-review-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-review-item:hover { background: var(--bg-hover); }
.ai-review-item.active { background: var(--accent-light); border-left: 3px solid var(--accent); }

.ai-review-item-info {
    flex: 1;
    min-width: 0;
}

.ai-review-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-review-item-subject {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-review-status {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-review-status.generated { background: var(--accent); }
.ai-review-status.approved { background: var(--green); }
.ai-review-status.rejected { background: var(--red); opacity: 0.5; }
.ai-review-status.pending, .ai-review-status.none { background: var(--text-muted); }
.ai-review-status.failed { background: var(--red); }

.ai-review-detail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-review-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.ai-review-research {
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-2);
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.ai-review-research-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-2);
    font-weight: 600;
    margin-bottom: 6px;
}

.ai-review-email-preview {
    background: #fafafa;
    color: #111;
    border-radius: var(--radius-sm);
    padding: 20px;
    font-size: 13.5px;
    line-height: 1.6;
}

[data-theme="dark"] .ai-review-email-preview { background: #f5f5f8; }

.ai-review-email-subject {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.ai-review-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 960px) {
    .copywriter-panel { width: 100vw; }
    .ai-review-panel { grid-template-columns: 1fr; height: auto; }
}

/* ═══════════════════════════════════════════════════════════
   DESIGN STUDIO — Landing-page style email builder
   ═══════════════════════════════════════════════════════════ */

.design-mode-toggle {
    display: inline-flex;
    background: var(--bg-input);
    border-radius: 999px;
    padding: 3px;
    margin-right: 12px;
}

.design-mode-toggle button {
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
}

.design-mode-toggle button.active {
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
}

.design-studio-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    height: calc(100vh - 220px);
    min-height: 560px;
}

.design-editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.design-editor-panel h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.design-editor-panel h3:first-child { margin-top: 0; }

.design-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.design-field label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.design-field input[type="text"],
.design-field input[type="url"],
.design-field textarea,
.design-field select {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.design-field input:focus,
.design-field textarea:focus,
.design-field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.design-field textarea { resize: vertical; min-height: 56px; }

.design-color-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.design-color-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    cursor: pointer;
}

.design-color-swatch input[type="color"] {
    width: 28px; height: 28px;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
}

.design-color-swatch span {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
    flex: 1;
}

.design-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.design-theme-card {
    padding: 10px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.design-theme-card:hover { border-color: var(--border-strong); }
.design-theme-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.design-theme-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.design-theme-card-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.35;
}

.design-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.design-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.design-section-type {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    padding: 2px 7px;
    background: var(--accent-light);
    border-radius: 4px;
}

.design-section-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
}

.design-section-del:hover { color: var(--red); }

.design-add-section {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.design-add-section button {
    padding: 5px 10px;
    border-radius: 12px;
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11.5px;
    font-family: inherit;
    transition: var(--transition);
}

.design-add-section button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.design-feature-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 6px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: 5px;
    align-items: flex-start;
}

.design-feature-item input,
.design-feature-item textarea {
    font-size: 12px !important;
    padding: 5px 7px !important;
}

.design-feature-item button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}

.design-preview-panel {
    background: #e8e8ee;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .design-preview-panel { background: #0a0a0f; }

.design-preview-header {
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.design-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.design-preview-device-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-input);
    padding: 2px;
    border-radius: 6px;
}

.design-preview-device-toggle button {
    padding: 4px 10px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
}

.design-preview-device-toggle button.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.design-preview-frame-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    justify-content: center;
}

.design-preview-iframe {
    border: none;
    background: white;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.2);
    border-radius: 4px;
    width: 100%;
    max-width: 700px;
    min-height: 700px;
    transition: max-width 0.25s ease;
}

.design-preview-iframe.mobile {
    max-width: 360px;
}

/* AI Design Brief modal */
.design-brief-modal textarea { min-height: 70px; }

.brand-assets-preview {
    padding: 10px;
    background: var(--bg-input);
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.brand-asset-thumb {
    width: 56px;
    height: 56px;
    border-radius: 5px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.brand-asset-thumb:hover { border-color: var(--border-strong); }
.brand-asset-thumb.selected { border-color: var(--accent); }

/* ─── Design Studio: chat-only mode ─── */
.design-chat-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.design-chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(168,85,247,0.06));
}

.design-chat-product {
    flex: 1;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12.5px;
    font-family: inherit;
}

.design-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 200px;
}

.design-chat-msg {
    display: flex;
    gap: 10px;
    animation: fade-in 0.2s ease;
}

.design-chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.design-chat-avatar.user { background: var(--bg-input); color: var(--text-secondary); }
.design-chat-avatar.assistant { background: var(--accent-gradient); color: white; }

.design-chat-bubble {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-primary);
    word-break: break-word;
    min-width: 0;
}

.design-chat-bubble .status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 600;
    margin-top: 6px;
}

.design-chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.design-chat-empty h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px;
}

.design-chat-empty p {
    font-size: 13px;
    line-height: 1.55;
    max-width: 340px;
    margin: 0 auto 16px;
}

.design-chat-empty-examples {
    text-align: left;
    margin: 0 auto;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.design-chat-example {
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-secondary);
    transition: var(--transition);
    text-align: left;
    font-family: inherit;
}

.design-chat-example:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.design-chat-input-area {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.design-chat-textarea {
    flex: 1;
    min-height: 44px;
    max-height: 140px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: var(--transition);
}

.design-chat-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.design-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.design-chat-send:hover { filter: brightness(1.1); }
.design-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.design-chat-attach-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.design-chat-attach-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.design-chat-attachments {
    display: flex;
    gap: 6px;
    padding: 8px 14px 0;
    flex-wrap: wrap;
}

.design-chat-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.design-chat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.design-chat-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.design-chat-msg-images {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.design-chat-msg-images img {
    max-width: 110px;
    max-height: 110px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: cover;
    display: block;
}

.design-chat-droparea.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
    background: var(--accent-light);
}

.design-chat-quick {
    padding: 8px 14px 0;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.design-chat-quick button {
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11.5px;
    font-family: inherit;
    transition: var(--transition);
}

.design-chat-quick button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Legacy (kept for backwards compat on old rendered templates) */
.design-refine-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    margin: -18px -18px 14px;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(168,85,247,0.08));
    border-color: rgba(99,102,241,0.3);
}

.design-refine-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.design-refine-input-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.design-refine-input {
    flex: 1;
    padding: 9px 11px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    transition: var(--transition);
}

.design-refine-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.design-refine-send {
    width: 42px;
    height: 42px;
    border-radius: 7px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.design-refine-send:hover { filter: brightness(1.1); }
.design-refine-send:disabled { opacity: 0.5; cursor: not-allowed; }

.design-refine-quick {
    display: flex;
    gap: 5px;
    margin-top: 7px;
    flex-wrap: wrap;
}

.design-refine-quick button {
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    transition: var(--transition);
}

.design-refine-quick button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.design-refine-history {
    margin-top: 8px;
    max-height: 90px;
    overflow-y: auto;
    border-top: 1px solid rgba(99,102,241,0.2);
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.design-refine-entry {
    font-size: 11.5px;
    line-height: 1.4;
    padding: 5px 8px;
    border-radius: 5px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-left: 2px solid var(--accent);
}

.design-refine-entry strong { color: var(--text-primary); font-weight: 600; }

@media (max-width: 960px) {
    .design-studio-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* ═══════════════════════════════════════════════════════════
   PREMIUM ADDITIONS — Wave 5
   Empty states, pricing cards, billing dashboard, polished polls
   ═══════════════════════════════════════════════════════════ */

/* ─── Premium empty state ─── */
.empty-state-premium {
    text-align: center;
    padding: 56px 32px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
}
.empty-state-premium::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(400px 200px at 50% 0%, var(--accent-light), transparent 70%);
    pointer-events: none;
}
.empty-state-premium-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px -6px var(--accent-glow);
    position: relative;
}
.empty-state-premium-icon svg { width: 26px; height: 26px; stroke-width: 2; }
.empty-state-premium h3 {
    font-size: var(--fs-xl);
    font-weight: 640;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.012em;
    position: relative;
}
.empty-state-premium p {
    font-size: var(--fs-base);
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto 22px;
    line-height: 1.6;
    position: relative;
}
.empty-state-premium-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
}

/* ─── Pricing page ─── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 24px;
}
.pricing-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.pricing-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.pricing-card.featured {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 12px 40px -10px var(--accent-glow);
}
.pricing-card.featured::before {
    content: "Cel mai popular";
    position: absolute;
    top: 14px;
    right: 14px;
    background: var(--accent-gradient);
    color: white;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
}
.pricing-name {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}
.pricing-price {
    font-size: var(--fs-display);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.022em;
    margin-bottom: 4px;
}
.pricing-price-suffix {
    font-size: var(--fs-base);
    color: var(--text-muted);
    font-weight: 500;
}
.pricing-features {
    margin: 22px 0;
    list-style: none;
    padding: 0;
}
.pricing-features li {
    font-size: var(--fs-base);
    color: var(--text-secondary);
    padding: 7px 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.5;
}
.pricing-features li::before {
    content: "✓";
    color: var(--green);
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── Billing dashboard meters ─── */
.usage-meter {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: var(--transition);
}
.usage-meter:hover { border-color: var(--border-strong); }
.usage-meter-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.usage-meter-label {
    font-size: 12.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.usage-meter-value {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.usage-meter-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}
.usage-meter-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.4s var(--ease);
}
.usage-meter-fill.warning { background: linear-gradient(90deg, #eab308, #f59e0b); }
.usage-meter-fill.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ─── Polished section title ─── */
.section-title {
    font-weight: 660 !important;
    letter-spacing: -0.018em !important;
}

/* ─── Modal overlay polish ─── */
.modal-overlay {
    background: var(--bg-overlay) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ─── Sidebar polish ─── */
.sidebar {
    border-right: 1px solid var(--border);
}

/* ─── Premium badge ─── */
.badge-premium {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px -2px var(--accent-glow);
}

/* ─── Scroll-on-mount fade-in ─── */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.section.active { animation: fade-in-up 0.32s var(--ease); }

/* ─── Quick polish: crisper focus rings everywhere ─── */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
}

/* ─── Pricing CTA inside settings ─── */
.plan-status-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.plan-status-card::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}
.plan-status-tier {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
}
.plan-status-name {
    font-size: var(--fs-2xl);
    font-weight: 660;
    color: var(--text-primary);
    margin: 4px 0 6px;
    letter-spacing: -0.018em;
}
.plan-status-price {
    font-size: var(--fs-base);
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   PREMIUM v3 — ambient, depth, gradients, micro-interactions
   Overrides for a richer, "game-changer" feel on top of v2.
   ═══════════════════════════════════════════════════════════ */

:root {
    --brand-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --brand-gradient-soft: linear-gradient(135deg, #7c7fff, #b667ff, #f472b6);
    --glow-primary: 0 8px 30px -6px rgba(99, 102, 241, 0.5), 0 0 0 1px rgba(168, 85, 247, 0.12);
    --glow-primary-soft: 0 6px 20px -6px rgba(99, 102, 241, 0.35), 0 0 0 1px rgba(168, 85, 247, 0.08);
    --border-hairline: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] {
    --border-hairline: rgba(15, 23, 42, 0.06);
    --bg-app: #f6f7fb;
    --bg-sidebar: #ffffffcc;
    --bg-topbar: rgba(255, 255, 255, 0.72);
    --bg-card: #ffffff;
    --bg-input: #f3f4f9;
    --bg-hover: #eef0f7;
    --bg-active: #e4e7f2;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 4px 12px -2px rgba(15, 23, 42, 0.07);
    --shadow: 0 10px 28px -8px rgba(15, 23, 42, 0.12);
    --shadow-md: 0 20px 44px -10px rgba(15, 23, 42, 0.16);
    --glow-primary: 0 10px 34px -8px rgba(99, 102, 241, 0.42), 0 0 0 1px rgba(168, 85, 247, 0.12);
    --glow-primary-soft: 0 6px 22px -8px rgba(99, 102, 241, 0.26);
}

/* ─── Ambient aurora background on BOTH themes ───────────── */
body::before {
    background:
        radial-gradient(1100px 520px at 85% -8%, rgba(217, 70, 239, 0.10), transparent 60%),
        radial-gradient(900px 480px at 12% -6%, rgba(99, 102, 241, 0.10), transparent 60%),
        radial-gradient(800px 420px at -10% 115%, rgba(139, 92, 246, 0.08), transparent 60%) !important;
}
[data-theme="light"] body::before {
    display: block !important;
    background:
        radial-gradient(1000px 480px at 88% -10%, rgba(217, 70, 239, 0.08), transparent 60%),
        radial-gradient(900px 460px at -4% -4%, rgba(99, 102, 241, 0.08), transparent 60%),
        radial-gradient(700px 380px at 50% 108%, rgba(168, 85, 247, 0.05), transparent 60%) !important;
}

/* ─── Body + typographic polish ────────────────────────── */
body {
    letter-spacing: -0.005em;
}

/* ─── Sidebar: frosted glass + premium separators ───────── */
.sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-right: 1px solid var(--border-hairline);
}
[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.78);
}

.sidebar-logo {
    background: var(--brand-gradient);
    box-shadow: 0 10px 24px -6px rgba(139, 92, 246, 0.55), inset 0 1px 0 rgba(255,255,255,0.25);
    border-radius: 9px;
    position: relative;
}
.sidebar-logo::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent 60%);
    pointer-events: none;
}

.sidebar-brand {
    letter-spacing: -0.015em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-primary) 40%, var(--accent-2) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-section-label {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    opacity: 0.9;
}

.nav-item {
    border-radius: 10px;
    transition: background-color .16s var(--ease), color .16s var(--ease), transform .18s var(--ease), box-shadow .2s var(--ease);
}
.nav-item:hover { transform: translateX(1px); }

.nav-item.active {
    background: linear-gradient(90deg, rgba(99,102,241,0.14), rgba(168,85,247,0.08));
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.14);
}
[data-theme="light"] .nav-item.active {
    background: linear-gradient(90deg, rgba(99,102,241,0.10), rgba(168,85,247,0.06));
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.18);
}
.nav-item.active::before {
    background: var(--brand-gradient);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
    width: 3px;
}

.nav-item svg { transition: color .18s var(--ease); }
.nav-item.active svg { color: var(--accent); }

/* ─── Topbar: frosted glass + thin hairline ───────────── */
.topbar {
    background: var(--bg-topbar);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border-hairline);
}

.breadcrumb-current { letter-spacing: -0.012em; }

.topbar-search input {
    background: var(--bg-input);
    border-color: transparent;
    box-shadow: inset 0 0 0 1px var(--border-hairline);
    transition: box-shadow .18s var(--ease), background .18s var(--ease);
}
.topbar-search input:focus {
    box-shadow: inset 0 0 0 1.5px var(--accent), 0 6px 20px -6px var(--accent-glow);
    background: var(--bg-card);
}

/* ─── Section headers: gradient title ─────────────────── */
.section-title {
    font-size: 30px;
    font-weight: 740;
    letter-spacing: -0.028em;
    background: linear-gradient(140deg, var(--text-primary) 20%, #6366f1 70%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    line-height: 1.15;
}
[data-theme="light"] .section-title {
    background: linear-gradient(140deg, #0c0c18 0%, #4338ca 60%, #9333ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.section-subtitle {
    font-size: 14.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    max-width: 720px;
}

/* ─── Stat cards: gradient top accent, premium hover lift ─ */
.stat-card {
    border-color: var(--border-hairline);
    border-radius: 14px;
    padding: 20px 22px;
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99,102,241,0.35), rgba(168,85,247,0.35), transparent);
    opacity: 0;
    transition: opacity .28s var(--ease);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(99, 102, 241, 0.25);
}
.stat-card:hover::before { opacity: 1; }

.stat-label {
    font-size: 10.5px;
    letter-spacing: 0.14em;
    font-weight: 700;
    color: var(--text-muted);
}

.stat-value {
    font-size: 30px;
    font-weight: 720;
    letter-spacing: -0.03em;
    background: linear-gradient(140deg, var(--text-primary), var(--text-primary) 55%, var(--accent) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.stat-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    top: 18px; right: 18px;
    box-shadow: inset 0 0 0 1px var(--border-hairline);
}
.stat-icon.purple { background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(168,85,247,0.14)); color: var(--accent); }
.stat-icon.green  { background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(16,185,129,0.12));  color: var(--green); }
.stat-icon.red    { background: linear-gradient(135deg, rgba(239,68,68,0.18),  rgba(244,63,94,0.14));  color: var(--red); }
.stat-icon.blue   { background: linear-gradient(135deg, rgba(59,130,246,0.18), rgba(14,165,233,0.14)); color: var(--blue); }
.stat-icon.yellow { background: linear-gradient(135deg, rgba(234,179,8,0.22),  rgba(250,204,21,0.14)); color: var(--yellow); }

/* ─── Cards: softer hairlines + elevated hover ──────────── */
.card {
    border-color: var(--border-hairline);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
}
.card:hover {
    border-color: var(--border-hairline);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.card-title {
    font-size: 15.5px;
    font-weight: 650;
    letter-spacing: -0.014em;
}

/* ─── Buttons: gradient primary with glow + shine ───────── */
.btn {
    border-radius: 10px;
    border-color: var(--border-hairline);
    font-weight: 560;
}

.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--glow-primary-soft);
    background-size: 180% 180%;
    background-position: 0% 0%;
    transition: background-position .6s var(--ease), box-shadow .22s var(--ease), transform .18s var(--ease);
}
.btn-primary:hover {
    background-position: 100% 0%;
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.btn-ghost:hover { background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--border-hairline); }

/* ─── Plan status card: richer glass ─────────────────── */
.plan-status-card {
    background: linear-gradient(135deg, rgba(99,102,241,0.09), rgba(217,70,239,0.05));
    border: 1px solid rgba(139, 92, 246, 0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ─── Badges: pill with gradient tint ────────────────── */
.badge {
    letter-spacing: 0.02em;
    font-weight: 600;
    border-radius: 999px;
}
.badge-premium {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(217,70,239,0.5);
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* ─── Scrollbar refinement ─────────────────────────── */
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(99,102,241,0.25), rgba(168,85,247,0.18));
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99,102,241,0.45), rgba(168,85,247,0.35));
}

/* ─── Modal polish + scrollable body (global fix) ───────
   Structure: .modal is a flex column; header stays pinned, body scrolls
   internally. Rounded corners preserved via overflow:hidden on .modal. */
.modal-overlay {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto !important;     /* tall modals scroll with overlay on tiny screens */
    padding: 20px !important;
    align-items: flex-start !important;  /* top-align when tall, instead of centering */
    justify-content: center !important;
}
.modal {
    border-radius: 18px !important;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-hairline);
    overflow: hidden !important;       /* keep rounded corners */
    display: flex !important;
    flex-direction: column !important;
    max-height: calc(100vh - 40px) !important;
    padding: 0 !important;              /* body gets own padding for scroll UX */
    margin: auto;                       /* center vertically when short */
}
.modal-header {
    flex-shrink: 0;
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--border-hairline);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 2;
}
.modal-header h3 {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.012em;
    margin: 0;
}
.modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 22px 26px 24px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
/* Close button inside modal-header — push to the right via flex */
.modal-header .modal-close {
    position: static !important;
    margin-left: auto;
}
/* Mobile: use most of the screen, dock close button on right */
@media (max-width: 640px) {
    .modal-overlay { padding: 10px !important; }
    .modal { max-height: calc(100vh - 20px) !important; border-radius: 14px !important; }
    .modal-header { padding: 16px 18px 14px; }
    .modal-body { padding: 16px 18px 20px; }
}

/* ─── Safety net: modals WITHOUT a .modal-body wrapper ───
   Many modals put form content directly inside .modal without the header/body
   split. They need the modal itself to be scrollable, otherwise tall forms
   get clipped. We target ONLY modals missing .modal-body via :has(). */
.modal:not(:has(.modal-body)) {
    overflow-y: auto !important;         /* scroll internally */
    overflow-x: hidden !important;
    padding: 22px 26px 24px !important;  /* reinstate padding since we removed it for body-wrapped modals */
    display: block !important;            /* flex was needed only for header+body layout */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
/* Close button inside such modals: position it absolute top-right so it stays
   visible while content scrolls. Users expect it to always be reachable. */
.modal:not(:has(.modal-body)) > .modal-close {
    position: sticky !important;
    top: 0 !important;
    float: right;
    margin: 0 0 0 auto !important;
    z-index: 3;
    background: var(--bg-card, #fff) !important;
}

/* ─── Inputs polish (hairline + focus ring) ─────────── */
.modal-row input[type="text"],
.modal-row input[type="email"],
.modal-row input[type="password"],
.modal-row input[type="number"],
.modal-row input[type="url"],
.modal-row select,
.modal-row textarea,
.form-row-2 input, .form-row-2 select, .form-row-2 textarea,
.form-row-3 input, .form-row-3 select, .form-row-3 textarea {
    border-width: 1px;
    border-color: var(--border-hairline);
    box-shadow: inset 0 0 0 1px var(--border-hairline);
    border-radius: 11px;
}
.modal-row input:focus,
.modal-row select:focus,
.modal-row textarea:focus,
.form-row-2 input:focus, .form-row-2 select:focus, .form-row-2 textarea:focus,
.form-row-3 input:focus, .form-row-3 select:focus, .form-row-3 textarea:focus {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1.5px var(--accent), 0 6px 18px -6px var(--accent-glow);
}

/* ─── Section animation softer ─────────────────────── */
.section.active { animation: section-fade 0.28s var(--ease); }

/* ─── "NEW" pill in sidebar: gradient glow ─────────── */
.nav-module-badge.new {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 4px 14px -4px rgba(168,85,247,0.6);
}

/* ═══════════════════════════════════════════════════════════
   PREMIUM v4 — dramatic typography, mesh bg, spatial depth
   ═══════════════════════════════════════════════════════════ */

/* Real mesh gradient with conic + radial on both themes */
body::before {
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(217, 70, 239, 0.10), transparent 55%),
        radial-gradient(900px 520px at 10% 5%, rgba(99, 102, 241, 0.12), transparent 55%),
        radial-gradient(800px 480px at 110% 75%, rgba(139, 92, 246, 0.09), transparent 55%),
        radial-gradient(700px 420px at -5% 110%, rgba(34, 211, 238, 0.06), transparent 55%) !important;
}
[data-theme="light"] body::before {
    background:
        radial-gradient(1000px 520px at 88% -8%, rgba(217, 70, 239, 0.07), transparent 55%),
        radial-gradient(900px 480px at -2% 0%, rgba(99, 102, 241, 0.10), transparent 55%),
        radial-gradient(800px 440px at 108% 70%, rgba(139, 92, 246, 0.06), transparent 55%),
        radial-gradient(700px 400px at 50% 108%, rgba(168, 85, 247, 0.04), transparent 55%) !important;
}

/* Subtle grain overlay (invisible on light, faint on dark) */
body {
    position: relative;
}
[data-theme="dark"] body::after {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
    mix-blend-mode: overlay;
}

/* ─── Section header: massive hierarchy ───────────────── */
.section-header {
    margin-bottom: 32px;
    position: relative;
}
.section-title {
    font-size: clamp(28px, 3.4vw, 40px) !important;
    font-weight: 780 !important;
    letter-spacing: -0.035em !important;
    line-height: 1.08 !important;
    margin-bottom: 8px !important;
}
[data-theme="dark"] .section-title {
    background: linear-gradient(135deg, #ffffff 30%, #c4b5fd 70%, #f0abfc 100%) !important;
    -webkit-background-clip: text; background-clip: text; color: transparent !important;
}
.section-subtitle {
    font-size: 15px !important;
    color: var(--text-secondary);
    max-width: 680px;
    line-height: 1.6;
}

/* ─── Brand in sidebar: bigger, tighter ──────────────── */
.sidebar-brand {
    font-size: 17px !important;
    font-weight: 780 !important;
    letter-spacing: -0.02em !important;
}

/* ─── Sidebar logo: bigger, more glow ────────────────── */
.sidebar-logo {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    font-size: 17px !important;
    box-shadow: 0 14px 32px -8px rgba(139, 92, 246, 0.6), inset 0 1px 0 rgba(255,255,255,0.3) !important;
}

/* ─── Stat cards: premium with gradient corner blob ──── */
.stat-card {
    padding: 22px 24px !important;
    border-radius: 16px !important;
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}
/* Soft corner glow inside each card (disabled on light to avoid dark blobs) */
[data-theme="dark"] .stat-card::after {
    content: "";
    position: absolute;
    width: 140px; height: 140px;
    top: -50px; right: -50px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18), transparent 70%);
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}
[data-theme="dark"] .stat-card:hover::after { opacity: 0.8; }
.stat-value {
    font-size: 34px !important;
    font-weight: 780 !important;
    letter-spacing: -0.03em !important;
    line-height: 1.05 !important;
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent-2) 130%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    margin-top: 4px;
    display: inline-block;
}
[data-theme="light"] .stat-value {
    background: linear-gradient(135deg, #0c0c18 0%, #6366f1 90%, #d946ef 130%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}
.stat-label {
    font-size: 10.5px !important;
    letter-spacing: 0.16em !important;
    font-weight: 720 !important;
    color: var(--text-muted);
    margin-bottom: 14px !important;
}
.stat-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 11px !important;
    top: 20px !important; right: 20px !important;
    box-shadow: 0 4px 12px -4px rgba(139, 92, 246, 0.25), inset 0 1px 0 rgba(255,255,255,0.1) !important;
}

/* ─── Card: sharper hairlines, cleaner depth ─────────── */
.card {
    border-radius: 16px !important;
    border: 1px solid var(--border-hairline) !important;
    box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, var(--shadow-xs) !important;
}
[data-theme="light"] .card {
    box-shadow: 0 1px 0 rgba(15,23,42,0.02) inset, 0 1px 2px rgba(15,23,42,0.03) !important;
}
.card:hover {
    border-color: rgba(139, 92, 246, 0.2) !important;
    transform: translateY(-1px);
    box-shadow: 0 20px 50px -20px rgba(139, 92, 246, 0.2) !important;
}

/* ─── Topbar: subtle gradient divider ─────────────────── */
.topbar {
    border-bottom: 1px solid transparent !important;
    background:
        linear-gradient(var(--bg-topbar), var(--bg-topbar)) padding-box,
        linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.15), transparent) border-box !important;
    border-bottom-width: 1px !important;
    border-bottom-style: solid !important;
}

/* ─── Primary button: deeper gradient + pulse ring ───── */
.btn-primary {
    background: var(--brand-gradient) !important;
    background-size: 200% 100% !important;
    font-weight: 600 !important;
    letter-spacing: -0.005em;
    padding: 10px 18px;
    box-shadow: 0 8px 24px -6px rgba(139, 92, 246, 0.45), inset 0 1px 0 rgba(255,255,255,0.2) !important;
    position: relative;
    overflow: visible;
}
.btn-primary:hover {
    background-position: 100% 0 !important;
    box-shadow: 0 12px 32px -6px rgba(217, 70, 239, 0.55), inset 0 1px 0 rgba(255,255,255,0.25) !important;
    transform: translateY(-1.5px);
}

/* ─── Badges: richer glow for premium ─────────────────── */
.badge-premium {
    background: var(--brand-gradient) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px -6px rgba(217, 70, 239, 0.5), inset 0 1px 0 rgba(255,255,255,0.25) !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
}

/* ─── Plan status / ambient cards: richer gradient ───── */
.plan-status-card {
    background:
        radial-gradient(600px 200px at 100% 0%, rgba(217, 70, 239, 0.12), transparent 60%),
        linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.04)) !important;
    border: 1px solid rgba(139, 92, 246, 0.18) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ─── Nav active state: softer glow ──────────────────── */
.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.18) 0%, rgba(217, 70, 239, 0.06) 100%) !important;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.18) !important;
}
[data-theme="light"] .nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.12) 0%, rgba(217, 70, 239, 0.04) 100%) !important;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.22) !important;
}

/* ─── Onboarding / help panels — ambient glow ────────── */
.help-panel {
    background:
        radial-gradient(400px 200px at 0% 0%, rgba(139, 92, 246, 0.08), transparent 60%),
        linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.03)) !important;
}

/* ─── Dropdown / modal: richer corners ───────────────── */
.modal {
    border-radius: 20px !important;
    box-shadow:
        0 48px 96px -24px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--border-hairline) !important;
}
[data-theme="light"] .modal {
    box-shadow:
        0 48px 96px -24px rgba(15, 23, 42, 0.25),
        0 0 0 1px var(--border-hairline) !important;
}

/* ─── Table rows hover lift ──────────────────────────── */
table tr { transition: background-color 0.16s var(--ease); }
table tbody tr:hover { background-color: rgba(139, 92, 246, 0.04); }

/* ─── Focus states: premium glow ─────────────────────── */
input:focus, textarea:focus, select:focus {
    outline: none !important;
}

/* ─── Section transition — smoother ─────────────────── */
.section.active { animation: section-fade 0.4s var(--ease); }
@keyframes section-fade {
    from { opacity: 0; transform: translateY(8px) scale(0.995); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════
   UI v7 — iOS NATIVE · SF Pro · cinematic motion
   Think: macOS Sonoma + iPadOS stage + Apple.com marketing.
   Clean neutrals, vibrant system blue, SF type, spring physics.
   ═══════════════════════════════════════════════════════════ */

/* Load SF Pro from Apple CDN (progressive) — fallback to system */
@font-face {
    font-family: "SF Pro Display";
    font-weight: 400 900;
    font-display: swap;
    src: local("SF Pro Display"), local("-apple-system"), local("BlinkMacSystemFont");
}
@font-face {
    font-family: "SF Pro Text";
    font-weight: 400 700;
    font-display: swap;
    src: local("SF Pro Text"), local("-apple-system"), local("BlinkMacSystemFont");
}

:root, [data-theme], [data-theme="light"], [data-theme="dark"] {
    /* iOS system palette */
    --ios-bg: #F5F5F7;                 /* Apple.com light gray */
    --ios-bg-2: #FBFBFD;
    --ios-paper: #FFFFFF;
    --ios-sidebar-bg: rgba(251, 251, 253, 0.72);
    --ios-topbar-bg: rgba(245, 245, 247, 0.72);

    --ios-label: #1D1D1F;              /* Apple's primary text */
    --ios-label-2: #424245;
    --ios-label-3: #6E6E73;            /* Apple's secondary */
    --ios-label-4: #86868B;            /* Apple's tertiary */

    --ios-divider: #D2D2D7;
    --ios-divider-soft: rgba(60, 60, 67, 0.12);
    --ios-fill: rgba(120, 120, 128, 0.08);   /* iOS Fill (like toggles bg) */
    --ios-fill-2: rgba(120, 120, 128, 0.12);

    /* System colors — iOS palette */
    --ios-blue: #0071E3;               /* Apple.com blue */
    --ios-blue-2: #0077ED;
    --ios-blue-soft: rgba(0, 113, 227, 0.10);
    --ios-indigo: #5856D6;
    --ios-purple: #AF52DE;
    --ios-pink: #FF375F;
    --ios-orange: #FF9500;
    --ios-yellow: #FFCC00;
    --ios-green: #30D158;
    --ios-teal: #40C8E0;
    --ios-red: #FF3B30;

    /* Shadows — apple.com subtle */
    --ios-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --ios-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --ios-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    --ios-shadow-md: 0 12px 32px -8px rgba(0, 0, 0, 0.10);
    --ios-shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.18);
    --ios-shadow-blue: 0 10px 30px -8px rgba(0, 113, 227, 0.35);

    /* Motion — iOS spring */
    --ios-spring: cubic-bezier(0.35, 1.55, 0.55, 1);
    --ios-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ios-ease-out: cubic-bezier(0, 0, 0.2, 1);

    /* Radii (iOS HIG) */
    --ios-r-sm: 8px;
    --ios-r: 12px;              /* standard control */
    --ios-r-lg: 18px;           /* card */
    --ios-r-xl: 22px;           /* sheet */
    --ios-r-pill: 999px;

    /* Override old tokens */
    --bg-app: var(--ios-bg) !important;
    --bg-sidebar: var(--ios-sidebar-bg) !important;
    --bg-topbar: var(--ios-topbar-bg) !important;
    --bg-card: var(--ios-paper) !important;
    --bg-elevated: var(--ios-paper) !important;
    --bg-input: var(--ios-paper) !important;
    --bg-hover: var(--ios-fill) !important;
    --bg-active: var(--ios-fill-2) !important;
    --text-primary: var(--ios-label) !important;
    --text-secondary: var(--ios-label-2) !important;
    --text-muted: var(--ios-label-3) !important;
    --border: var(--ios-divider-soft) !important;
    --border-strong: var(--ios-divider) !important;
    --border-hairline: var(--ios-divider-soft);
    --accent: var(--ios-blue);
    --accent-2: var(--ios-indigo);
    --accent-light: var(--ios-blue-soft);
}

/* Body — SF Pro, iOS feel */
body {
    background: var(--ios-bg) !important;
    color: var(--ios-label) !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "Inter", "Segoe UI", system-ui, sans-serif !important;
    font-feature-settings: "liga", "kern" !important;
    letter-spacing: -0.011em !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Global aurora — extremely subtle (Apple doesn't overdo it) */
body::before {
    content: "" !important;
    position: fixed !important; inset: 0 !important;
    pointer-events: none !important; z-index: 0 !important;
    background:
        radial-gradient(900px 500px at 90% -5%, rgba(88, 86, 214, 0.05), transparent 55%),
        radial-gradient(800px 440px at -5% 8%, rgba(0, 113, 227, 0.05), transparent 55%) !important;
}
body::after { display: none !important; }

/* ══════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════ */
.app-shell { grid-template-columns: 248px 1fr !important; }

/* Sidebar — vibrancy glass (like Finder) */
.sidebar {
    background: var(--ios-sidebar-bg) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    border-right: 1px solid var(--ios-divider-soft) !important;
    padding: 0 !important;
}
.sidebar-header {
    padding: 20px 16px 14px !important;
    border-bottom: 1px solid var(--ios-divider-soft) !important;
    background: transparent !important;
}
.sidebar-logo {
    width: 32px !important; height: 32px !important;
    border-radius: 8px !important;
    background: var(--ios-blue) !important;
    color: #fff !important;
    font-weight: 700 !important; font-size: 16px !important;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.32),
                inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}
.sidebar-brand {
    font-size: 15.5px !important;
    font-weight: 650 !important;
    letter-spacing: -0.018em !important;
    color: var(--ios-label) !important;
    background: none !important;
    -webkit-text-fill-color: unset !important;
}
.sidebar-nav { padding: 10px 10px !important; gap: 1px !important; }
.nav-section-label {
    font-size: 11px !important;
    font-weight: 590 !important;
    letter-spacing: 0.08em !important;
    color: var(--ios-label-3) !important;
    text-transform: uppercase !important;
    padding: 14px 12px 6px !important;
}
.nav-item {
    padding: 7px 10px !important;
    border-radius: 8px !important;
    color: var(--ios-label-2) !important;
    font-size: 13.5px !important;
    font-weight: 420 !important;
    letter-spacing: -0.004em !important;
    transition: background .18s var(--ios-ease),
                transform .4s var(--ios-spring),
                color .15s ease !important;
}
.nav-item:hover {
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
}
.nav-item.active {
    background: var(--ios-fill-2) !important;
    color: var(--ios-blue) !important;
    font-weight: 550 !important;
    box-shadow: none !important;
}
.nav-item.active::before { display: none !important; }
.nav-item svg, .nav-item .nav-icon { width: 16px !important; height: 16px !important; }
.nav-item.active svg, .nav-item.active .nav-icon { color: var(--ios-blue) !important; }
.nav-module-items {
    border-left: 1px solid var(--ios-divider-soft) !important;
    margin-left: 16px !important;
    padding-left: 8px !important;
}
.nav-module-badge.new {
    background: var(--ios-blue) !important;
    color: #fff !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(0, 113, 227, 0.30) !important;
}

/* Topbar — vibrancy */
.topbar {
    height: 52px !important;
    background: var(--ios-topbar-bg) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    border-bottom: 1px solid var(--ios-divider-soft) !important;
    padding: 0 22px !important;
}
.breadcrumb {
    font-size: 13px !important;
    color: var(--ios-label-3) !important;
    font-weight: 420;
}
.breadcrumb-current {
    color: var(--ios-label) !important;
    font-weight: 590 !important;
    letter-spacing: -0.01em !important;
}
.topbar-search { margin-left: auto !important; width: 280px !important; }
.topbar-search input {
    width: 100%;
    padding: 6px 10px 6px 32px !important;
    background: var(--ios-fill) !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: var(--ios-label) !important;
    transition: background .2s ease, box-shadow .2s ease !important;
}
.topbar-search input:focus {
    background: #fff !important;
    box-shadow: 0 0 0 3px var(--ios-blue-soft) !important;
}
.topbar-kbd {
    background: var(--ios-fill-2) !important;
    color: var(--ios-label-3) !important;
    border: none !important;
    font-size: 10px !important;
}

/* Main area */
.main-area { padding: 28px 32px 56px !important; max-width: 1440px; margin: 0 auto; width: 100%; box-sizing: border-box; }

/* ══════════════════════════════════════
   DASHBOARD — BENTO HERO
   ══════════════════════════════════════ */

.dash-hero {
    position: relative;
    border-radius: 24px;
    padding: 40px 44px;
    margin-bottom: 24px;
    background:
        radial-gradient(900px 400px at 85% 0%, rgba(0, 113, 227, 0.12), transparent 60%),
        radial-gradient(700px 300px at 0% 100%, rgba(88, 86, 214, 0.10), transparent 60%),
        linear-gradient(135deg, #FFFFFF 0%, #FBFBFD 100%);
    border: 1px solid var(--ios-divider-soft);
    box-shadow: var(--ios-shadow);
    overflow: hidden;
    animation: dashHeroIn .85s var(--ios-spring) both;
}
@keyframes dashHeroIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.dash-hero-decor {
    position: absolute;
    top: -60px; right: -40px;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(0, 113, 227, 0.08), rgba(88, 86, 214, 0.08), rgba(175, 82, 222, 0.06), rgba(0, 113, 227, 0.08));
    filter: blur(40px);
    animation: dashHeroSpin 30s linear infinite;
    pointer-events: none;
}
@keyframes dashHeroSpin { to { transform: rotate(360deg); } }

.dash-hero-inner { position: relative; z-index: 1; max-width: 720px; }

.dash-hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px 5px 8px;
    border-radius: 999px;
    background: var(--ios-paper);
    border: 1px solid var(--ios-divider-soft);
    font-size: 12px;
    font-weight: 500;
    color: var(--ios-label-3);
    margin-bottom: 18px;
    box-shadow: var(--ios-shadow-xs);
    animation: fadeSlide .7s var(--ios-spring) .15s both;
}
.dash-hero-dot {
    width: 7px; height: 7px; border-radius: 999px;
    background: var(--ios-green);
    box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5);
    animation: pulseDot 1.8s ease-out infinite;
}
@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5); }
    100% { box-shadow: 0 0 0 10px rgba(48, 209, 88, 0); }
}

.dash-hero-title {
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: clamp(34px, 3.8vw, 52px) !important;
    font-weight: 700 !important;
    letter-spacing: -0.033em !important;
    line-height: 1.05 !important;
    color: var(--ios-label) !important;
    margin: 0 0 10px !important;
    animation: fadeSlide .75s var(--ios-spring) .1s both;
}
.dash-hero-title .grad {
    background: linear-gradient(135deg, #0071E3 0%, #5856D6 55%, #AF52DE 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.dash-hero-sub {
    font-size: 17px !important;
    color: var(--ios-label-3) !important;
    margin-bottom: 26px !important;
    line-height: 1.5;
    letter-spacing: -0.012em;
    animation: fadeSlide .75s var(--ios-spring) .2s both;
}
.dash-hero-cta {
    display: flex; gap: 10px; flex-wrap: wrap;
    animation: fadeSlide .75s var(--ios-spring) .28s both;
}

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

/* BENTO grid */
.bento-dash {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
    grid-auto-rows: minmax(116px, auto);
}
.bento-tile {
    background: var(--ios-paper);
    border: 1px solid var(--ios-divider-soft);
    border-radius: var(--ios-r-lg);
    padding: 18px 20px;
    box-shadow: var(--ios-shadow-xs);
    position: relative;
    overflow: hidden;
    transition: transform .35s var(--ios-spring),
                box-shadow .3s var(--ios-ease),
                border-color .3s var(--ios-ease);
    animation: bentoIn .6s var(--ios-spring) both;
}
.bento-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--ios-shadow);
}
@keyframes bentoIn {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
/* Stagger entrance for visual flow */
.bento-tile:nth-child(1) { animation-delay: .15s; }
.bento-tile:nth-child(2) { animation-delay: .22s; }
.bento-tile:nth-child(3) { animation-delay: .29s; }
.bento-tile:nth-child(4) { animation-delay: .36s; }
.bento-tile:nth-child(5) { animation-delay: .43s; }
.bento-tile:nth-child(6) { animation-delay: .50s; }
.bento-tile:nth-child(7) { animation-delay: .57s; }
.bento-tile:nth-child(8) { animation-delay: .64s; }
.bento-tile:nth-child(9) { animation-delay: .71s; }
.bento-tile:nth-child(10) { animation-delay: .78s; }

.bento-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}
.bento-label {
    font-size: 12px;
    font-weight: 590;
    color: var(--ios-label-3);
    letter-spacing: -0.006em;
    display: flex; align-items: center; gap: 8px;
}
.live-dot {
    width: 7px; height: 7px; border-radius: 999px;
    background: var(--ios-green);
    box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5);
    animation: pulseDot 1.8s ease-out infinite;
}

.bento-big-num {
    font-family: "SF Pro Display", -apple-system, sans-serif;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.028em;
    color: var(--ios-label);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
}
.bento-trend {
    font-size: 12px;
    color: var(--ios-label-3);
    margin-top: 8px;
    letter-spacing: -0.005em;
}

/* Stat tile variant */
.tile-stat {
    cursor: pointer;
    background: linear-gradient(135deg, #fff 0%, #fbfbfd 100%);
}
.tile-stat:hover { border-color: var(--ios-blue-soft); }

/* Mini stats (bottom row) */
.mini-stat {
    padding: 14px 16px !important;
    cursor: pointer;
}
.mini-label {
    font-size: 11px;
    font-weight: 590;
    color: var(--ios-label-3);
    letter-spacing: -0.005em;
    margin-bottom: 6px;
}
.mini-num {
    font-family: "SF Pro Display", sans-serif;
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.024em;
    color: var(--ios-label);
    font-variant-numeric: tabular-nums;
}

/* Activity feed tile */
.tile-activity {
    background: #fff;
}
.dash-activity {
    display: flex; flex-direction: column;
    gap: 2px;
    max-height: 340px;
    overflow-y: auto;
}
.activity-row {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 0;
    border-top: 1px solid var(--ios-divider-soft);
    animation: fadeSlide .5s var(--ios-spring) both;
}
.activity-row:first-child { border-top: none; padding-top: 0; }
.activity-ic {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.activity-ic.mail { background: rgba(0, 113, 227, 0.10); color: var(--ios-blue); }
.activity-ic.voice { background: rgba(175, 82, 222, 0.10); color: var(--ios-purple); }
.activity-ic.meet { background: rgba(48, 209, 88, 0.12); color: var(--ios-green); }
.activity-ic.sms { background: rgba(64, 200, 224, 0.15); color: #0891b2; }
.activity-ic.lead { background: rgba(255, 149, 0, 0.12); color: var(--ios-orange); }
.activity-text { flex: 1; font-size: 13px; line-height: 1.45; color: var(--ios-label-2); }
.activity-text strong { color: var(--ios-label); font-weight: 590; }
.activity-time { font-size: 11.5px; color: var(--ios-label-4); flex-shrink: 0; }

/* Quick actions grid */
.tile-quick { background: #fff; }
.dash-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}
.dash-action {
    display: flex; flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    background: var(--ios-fill);
    border-radius: 12px;
    text-decoration: none;
    color: var(--ios-label);
    font-size: 13px;
    font-weight: 540;
    cursor: pointer;
    transition: transform .35s var(--ios-spring), background .2s ease;
}
.dash-action:hover {
    background: var(--ios-fill-2);
    transform: translateY(-2px);
}
.dash-action-ic {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    margin-bottom: 10px;
    background: var(--ios-paper);
    box-shadow: var(--ios-shadow-xs);
}
.dash-action-ic.g1 { background: linear-gradient(135deg, #0071E3, #5856D6); }
.dash-action-ic.g2 { background: linear-gradient(135deg, #AF52DE, #FF375F); }
.dash-action-ic.g3 { background: linear-gradient(135deg, #FF9500, #FF375F); }
.dash-action-ic.g4 { background: linear-gradient(135deg, #30D158, #40C8E0); }

/* Categories / locations chip lists */
.dash-chip-list {
    display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.dash-chip-list .category-item,
.dash-chip-list > div {
    display: inline-flex;
    align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--ios-fill);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ios-label-2);
    cursor: pointer;
    transition: all .2s var(--ios-ease);
}
.dash-chip-list > div:hover {
    background: var(--ios-blue-soft);
    color: var(--ios-blue);
}

/* ══════════════════════════════════════
   GENERIC COMPONENTS — all sections
   ══════════════════════════════════════ */

/* Section headers */
.section-header { margin-bottom: 26px !important; }
.section-title {
    font-family: "SF Pro Display", -apple-system, sans-serif !important;
    font-size: clamp(28px, 3.2vw, 40px) !important;
    font-weight: 700 !important;
    letter-spacing: -0.035em !important;
    line-height: 1.08 !important;
    color: var(--ios-label) !important;
    background: none !important;
    -webkit-text-fill-color: unset !important;
    margin-bottom: 6px !important;
    animation: fadeSlide .6s var(--ios-spring) both;
}
.section-subtitle {
    font-size: 16px !important;
    color: var(--ios-label-3) !important;
    letter-spacing: -0.012em !important;
    line-height: 1.5;
    max-width: 720px;
    animation: fadeSlide .6s var(--ios-spring) .08s both;
}

/* Cards */
.card {
    background: var(--ios-paper) !important;
    border: 1px solid var(--ios-divider-soft) !important;
    border-radius: var(--ios-r-lg) !important;
    padding: 22px !important;
    box-shadow: var(--ios-shadow-xs) !important;
    transition: transform .35s var(--ios-spring),
                box-shadow .3s var(--ios-ease),
                border-color .3s var(--ios-ease) !important;
}
.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--ios-shadow-sm) !important;
}
.card-title {
    font-size: 15px !important;
    font-weight: 590 !important;
    letter-spacing: -0.015em !important;
    color: var(--ios-label) !important;
}
.card-subtitle { color: var(--ios-label-3) !important; }

/* Legacy stats-grid — keep compat */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 14px !important;
    margin-bottom: 24px !important;
}
.stat-card {
    background: var(--ios-paper) !important;
    border: 1px solid var(--ios-divider-soft) !important;
    border-radius: var(--ios-r-lg) !important;
    padding: 20px 22px !important;
    box-shadow: var(--ios-shadow-xs) !important;
    transition: all .3s var(--ios-spring) !important;
    animation: bentoIn .5s var(--ios-spring) both;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ios-shadow);
    border-color: var(--ios-blue-soft) !important;
}
.stat-label {
    font-size: 11px !important;
    font-weight: 590 !important;
    letter-spacing: 0.04em !important;
    color: var(--ios-label-3) !important;
    text-transform: uppercase !important;
    margin-bottom: 10px !important;
}
.stat-value {
    font-family: "SF Pro Display", sans-serif !important;
    font-size: 32px !important;
    font-weight: 700 !important;
    letter-spacing: -0.028em !important;
    color: var(--ios-label) !important;
    background: none !important;
    -webkit-text-fill-color: unset !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
}
.stat-icon {
    top: 18px !important; right: 18px !important;
    width: 36px !important; height: 36px !important;
    border-radius: 9px !important;
    box-shadow: var(--ios-shadow-xs) !important;
}
.stat-icon.purple { background: rgba(175, 82, 222, 0.12) !important; color: var(--ios-purple) !important; }
.stat-icon.green { background: rgba(48, 209, 88, 0.13) !important; color: var(--ios-green) !important; }
.stat-icon.red { background: rgba(255, 59, 48, 0.12) !important; color: var(--ios-red) !important; }
.stat-icon.blue { background: rgba(0, 113, 227, 0.10) !important; color: var(--ios-blue) !important; }
.stat-icon.yellow { background: rgba(255, 204, 0, 0.18) !important; color: #B8860B !important; }

/* Buttons — iOS HIG */
.btn {
    padding: 9px 16px !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    font-weight: 540 !important;
    letter-spacing: -0.008em !important;
    border: none !important;
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
    box-shadow: none !important;
    transition: transform .35s var(--ios-spring),
                background .2s var(--ios-ease) !important;
}
.btn:hover {
    background: var(--ios-fill-2) !important;
    transform: translateY(-0.5px);
}
.btn:active { transform: scale(0.97); transition: transform .1s; }

.btn-primary {
    background: var(--ios-blue) !important;
    color: #fff !important;
    box-shadow: var(--ios-shadow-blue) !important;
    font-weight: 600 !important;
}
.btn-primary:hover {
    background: var(--ios-blue-2) !important;
    box-shadow: 0 12px 28px -6px rgba(0, 113, 227, 0.48) !important;
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent !important;
    color: var(--ios-label-2) !important;
}
.btn-ghost:hover {
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
}
.btn-danger {
    background: var(--ios-red) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px -6px rgba(255, 59, 48, 0.42) !important;
}
.btn-success {
    background: var(--ios-green) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px -6px rgba(48, 209, 88, 0.42) !important;
}
.btn-sm { padding: 6px 12px !important; font-size: 12px !important; }
.btn-lg { padding: 12px 22px !important; font-size: 14.5px !important; }

/* Inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="search"],
input[type="time"], input[type="date"], input[type="datetime-local"],
select, textarea,
.modal-row input, .modal-row select, .modal-row textarea,
.form-row-2 input, .form-row-2 select, .form-row-2 textarea,
.form-row-3 input, .form-row-3 select, .form-row-3 textarea {
    padding: 10px 14px !important;
    background: var(--ios-paper) !important;
    border: 1px solid var(--ios-divider-soft) !important;
    border-radius: 10px !important;
    color: var(--ios-label) !important;
    font-size: 14px !important;
    font-family: inherit !important;
    letter-spacing: -0.008em !important;
    transition: border-color .18s ease, box-shadow .22s ease !important;
    outline: none !important;
}
input:focus, textarea:focus, select:focus,
.modal-row input:focus, .modal-row select:focus, .modal-row textarea:focus,
.form-row-2 input:focus, .form-row-2 select:focus, .form-row-2 textarea:focus,
.form-row-3 input:focus, .form-row-3 select:focus, .form-row-3 textarea:focus {
    border-color: var(--ios-blue) !important;
    box-shadow: 0 0 0 3px var(--ios-blue-soft) !important;
}
input::placeholder, textarea::placeholder {
    color: var(--ios-label-4) !important;
    font-weight: 400;
}
label, .modal-row label {
    font-size: 12px !important;
    font-weight: 540 !important;
    letter-spacing: -0.005em !important;
    color: var(--ios-label-2) !important;
    text-transform: none !important;
    margin-bottom: 6px !important;
    display: block;
}

/* Badges — iOS capsule */
.badge {
    border-radius: 999px !important;
    font-weight: 590 !important;
    font-size: 11.5px !important;
    padding: 2px 10px !important;
    letter-spacing: -0.005em !important;
}
.badge-green { background: rgba(48, 209, 88, 0.15) !important; color: #248A3D !important; }
.badge-red { background: rgba(255, 59, 48, 0.12) !important; color: #D70015 !important; }
.badge-blue { background: rgba(0, 113, 227, 0.10) !important; color: var(--ios-blue) !important; }
.badge-purple { background: rgba(175, 82, 222, 0.12) !important; color: var(--ios-purple) !important; }
.badge-yellow { background: rgba(255, 204, 0, 0.20) !important; color: #805B10 !important; }
.badge-premium {
    background: linear-gradient(135deg, #0071E3, #5856D6) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px -4px rgba(0, 113, 227, 0.45) !important;
    font-weight: 640 !important;
    letter-spacing: 0.03em !important;
}

/* Modals — iOS sheet */
.modal-overlay {
    background: rgba(0, 0, 0, 0.32) !important;
    backdrop-filter: blur(18px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(180%) !important;
}
.modal {
    background: var(--ios-paper) !important;
    border: 1px solid var(--ios-divider-soft) !important;
    border-radius: var(--ios-r-xl) !important;
    box-shadow: var(--ios-shadow-lg) !important;
    animation: modalIOSin .45s var(--ios-spring);
}
@keyframes modalIOSin {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    padding: 20px 24px 16px !important;
    border-bottom: 1px solid var(--ios-divider-soft) !important;
}
.modal-header h3 {
    font-family: "SF Pro Display", sans-serif !important;
    font-size: 17px !important;
    font-weight: 650 !important;
    letter-spacing: -0.018em !important;
    color: var(--ios-label) !important;
}
.modal-body { padding: 22px 24px 24px !important; }
.modal-close {
    color: var(--ios-label-3) !important;
    border-radius: 8px !important;
    width: 28px !important; height: 28px !important;
}
.modal-close:hover {
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
}

/* Tables */
table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
table thead tr { background: var(--ios-bg-2) !important; }
table th {
    padding: 10px 14px !important;
    font-size: 11.5px !important;
    font-weight: 590 !important;
    letter-spacing: 0.02em !important;
    color: var(--ios-label-3) !important;
    border-bottom: 1px solid var(--ios-divider) !important;
    text-transform: none !important;
}
table td {
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--ios-divider-soft) !important;
    font-size: 13.5px !important;
    color: var(--ios-label-2) !important;
}
table tbody tr { transition: background .15s ease; }
table tbody tr:hover { background: var(--ios-fill) !important; }

/* Plan status / help */
.plan-status-card {
    background:
        radial-gradient(600px 260px at 100% 0%, rgba(0, 113, 227, 0.10), transparent 60%),
        linear-gradient(135deg, rgba(88, 86, 214, 0.05), rgba(0, 113, 227, 0.03)) !important;
    border: 1px solid rgba(0, 113, 227, 0.18) !important;
    border-radius: 20px !important;
    padding: 26px !important;
}
.help-panel {
    background: var(--ios-bg-2) !important;
    border: 1px solid var(--ios-divider-soft) !important;
    border-radius: 14px !important;
}
.help-panel summary { color: var(--ios-blue) !important; font-weight: 550; }

/* Section transitions */
.section.active { animation: sectionIOSin .55s var(--ios-spring); }
@keyframes sectionIOSin {
    from { opacity: 0; transform: translateY(12px); filter: blur(2px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px !important; height: 10px !important; }
::-webkit-scrollbar-track { background: transparent !important; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18) !important;
    border-radius: 999px !important;
    border: 2px solid var(--ios-bg) !important;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3) !important; }

/* Links */
a.table-link, a[class*="link"] {
    color: var(--ios-blue) !important;
    text-decoration: none !important;
    transition: color .15s;
}
a.table-link:hover { color: var(--ios-blue-2) !important; text-decoration: underline; }

/* Code inline */
code {
    background: var(--ios-fill) !important;
    border: none !important;
    padding: 1px 7px !important;
    border-radius: 5px !important;
    font-size: 12.5px !important;
    color: var(--ios-label) !important;
    font-family: "SF Mono", ui-monospace, monospace !important;
}

/* Copilot FAB */
#aiFab {
    background: var(--ios-blue) !important;
    box-shadow: 0 14px 38px -8px rgba(0, 113, 227, 0.55),
                inset 0 1px 0 rgba(255,255,255,0.25) !important;
}
#aiFab:hover { transform: scale(1.06) translateY(-2px); }
#aiPanel {
    background: var(--ios-paper) !important;
    border: 1px solid var(--ios-divider-soft) !important;
    border-radius: 22px !important;
    box-shadow: var(--ios-shadow-lg) !important;
}
#aiPanel .ai-head {
    background: var(--ios-bg-2) !important;
    border-bottom: 1px solid var(--ios-divider-soft) !important;
}
.ai-msg.assistant .ai-msg-bubble {
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
    border-radius: 18px 18px 18px 4px !important;
}
.ai-msg.user .ai-msg-bubble {
    background: var(--ios-blue) !important;
    color: #fff !important;
    border-radius: 18px 18px 4px 18px !important;
}
.ai-suggestion-chip {
    background: var(--ios-fill) !important;
    border: none !important;
    color: var(--ios-label-2) !important;
    font-weight: 500;
}
.ai-suggestion-chip:hover {
    background: var(--ios-blue-soft) !important;
    color: var(--ios-blue) !important;
}

/* Admin sub-tabs */
button[data-admin-tab] {
    background: transparent !important;
    border: none !important;
    border-radius: 10px 10px 0 0 !important;
    color: var(--ios-label-3) !important;
    font-weight: 500 !important;
    padding: 10px 16px !important;
}
button[data-admin-tab]:hover {
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
}

/* ══════════════════════════════════════
   MOBILE
   ══════════════════════════════════════ */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr !important; }
    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 -280px;
        width: 260px;
        z-index: 500;
        transition: inset .4s var(--ios-spring);
        background: rgba(251, 251, 253, 0.95) !important;
    }
    .sidebar.mobile-open { inset: 0 auto 0 0 !important; }
    .topbar { padding: 0 16px !important; }
    .topbar::before {
        content: "≡";
        font-size: 26px; line-height: 1;
        padding: 6px 12px; margin-right: 6px;
        color: var(--ios-label-2);
        cursor: pointer;
    }
    .main-area { padding: 18px 14px 48px !important; }
    .dash-hero { padding: 28px 22px !important; border-radius: 20px !important; }
    .dash-hero-title { font-size: clamp(26px, 7vw, 36px) !important; }
    .bento-dash { grid-template-columns: repeat(4, 1fr) !important; gap: 10px !important; }
    .bento-dash > .bento-tile {
        grid-column: span 4 !important;
        grid-row: span 1 !important;
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .form-row-2, .form-row-3 { grid-template-columns: 1fr !important; }
    .topbar-search { display: none !important; }
    .card table, .scrape-panel table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
@media (max-width: 500px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .dash-actions-grid { grid-template-columns: 1fr 1fr !important; }
    .section-title { font-size: 26px !important; }
}

/* ═══════════════════════════════════════════════════════════
   UI v7.1 — Sidebar colored tiles + DARK MODE + submenu polish
   ═══════════════════════════════════════════════════════════ */

/* ──────── SIDEBAR — colored icon tiles per module ──────── */
.sidebar-nav { padding: 12px 10px !important; gap: 2px !important; }

.nav-item {
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    padding: 6px 8px !important;
    border-radius: 10px !important;
    position: relative;
}
.nav-item > svg:not(.nav-module-chev),
.nav-item > .nav-icon {
    width: 28px !important; height: 28px !important;
    flex-shrink: 0 !important;
    border-radius: 7px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    padding: 6px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
    transition: transform .35s var(--ios-spring),
                box-shadow .25s ease !important;
}
.nav-item > svg:not(.nav-module-chev) > *,
.nav-item > .nav-icon > * {
    stroke-width: 2 !important;
}
.nav-item:hover > svg:not(.nav-module-chev),
.nav-item:hover > .nav-icon {
    transform: scale(1.05);
}
.nav-item span:not(.nav-badge) {
    font-size: 13.5px !important;
    font-weight: 450 !important;
    letter-spacing: -0.008em !important;
    color: var(--ios-label) !important;
}
.nav-item.active > span:not(.nav-badge) { font-weight: 550 !important; color: var(--ios-label) !important; }

/* Colorful icon tiles — one per module */
.nav-item[data-nav="dashboard"] > svg,
.nav-item[data-nav="dashboard"] > .nav-icon {
    background: linear-gradient(135deg, #007AFF, #5AC8FA) !important;
}
.nav-item[data-nav="agents"] > svg,
.nav-item[data-nav="agents"] > .nav-icon {
    background: linear-gradient(135deg, #AF52DE, #FF2D55) !important;
}
.nav-item[data-nav="contacts"] > svg,
.nav-item[data-nav="contacts"] > .nav-icon {
    background: linear-gradient(135deg, #5856D6, #AF52DE) !important;
}
.nav-item[data-nav="products"] > svg,
.nav-item[data-nav="products"] > .nav-icon {
    background: linear-gradient(135deg, #FF9500, #FF3B30) !important;
}
.nav-item[data-nav="settings"] > svg,
.nav-item[data-nav="settings"] > .nav-icon {
    background: linear-gradient(135deg, #8E8E93, #48484A) !important;
}
.nav-item[data-nav="team"] > svg,
.nav-item[data-nav="team"] > .nav-icon {
    background: linear-gradient(135deg, #FF2D55, #FF9500) !important;
}
.nav-item[data-nav="developer"] > svg,
.nav-item[data-nav="developer"] > .nav-icon {
    background: linear-gradient(135deg, #32D74B, #00C7BE) !important;
}
.nav-item[data-nav="admin"] > svg,
.nav-item[data-nav="admin"] > .nav-icon {
    background: linear-gradient(135deg, #FFD60A, #FF9500) !important;
}

/* Module headers — colored icons too */
.nav-module-header {
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    padding: 6px 8px !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--ios-label) !important;
    font-size: 13.5px !important;
    font-weight: 550 !important;
    letter-spacing: -0.008em !important;
    cursor: pointer;
    transition: background .18s ease;
}
.nav-module-header:hover { background: var(--ios-fill) !important; }
.nav-module-header > svg:not(.nav-module-chev),
.nav-module-header > .nav-icon {
    width: 28px !important; height: 28px !important;
    flex-shrink: 0 !important;
    border-radius: 7px !important;
    padding: 6px !important;
    color: #fff !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}
.nav-module-chev {
    margin-left: auto !important;
    width: 11px !important; height: 11px !important;
    color: var(--ios-label-4) !important;
    opacity: 0.9 !important;
    transition: transform .28s var(--ios-spring) !important;
}
.nav-module.expanded .nav-module-chev { transform: rotate(90deg) !important; }

/* Module colors */
.nav-module[data-module="email"] .nav-module-header > svg,
.nav-module[data-module="email"] .nav-module-header > .nav-icon {
    background: linear-gradient(135deg, #007AFF, #5AC8FA) !important;
}
.nav-module[data-module="sms"] .nav-module-header > svg,
.nav-module[data-module="sms"] .nav-module-header > .nav-icon {
    background: linear-gradient(135deg, #32D74B, #30D158) !important;
}
.nav-module[data-module="content"] .nav-module-header > svg,
.nav-module[data-module="content"] .nav-module-header > .nav-icon {
    background: linear-gradient(135deg, #FF9500, #FF6B00) !important;
}
.nav-module[data-module="bot"] .nav-module-header > svg,
.nav-module[data-module="bot"] .nav-module-header > .nav-icon {
    background: linear-gradient(135deg, #00C7BE, #32ADE6) !important;
}
.nav-module[data-module="analytics"] .nav-module-header > svg,
.nav-module[data-module="analytics"] .nav-module-header > .nav-icon {
    background: linear-gradient(135deg, #FF3B30, #FF375F) !important;
}

/* Submenu items — indented with continuous line */
.nav-module-items {
    border-left: none !important;
    margin-left: 20px !important;
    padding-left: 18px !important;
    margin-top: 2px !important;
    position: relative;
}
.nav-module-items::before {
    content: "";
    position: absolute;
    left: 14px; top: 0; bottom: 0;
    width: 1.5px;
    background: var(--ios-divider-soft);
    border-radius: 1px;
}
.nav-module-items .nav-item {
    padding: 6px 8px !important;
    font-size: 13px !important;
}
.nav-module-items .nav-item > span:not(.nav-badge) { font-size: 13px !important; }
.nav-module-items .nav-item::before {
    content: "";
    position: absolute;
    left: -12px; top: 50%;
    width: 10px; height: 1.5px;
    background: var(--ios-divider-soft);
    border-radius: 1px;
    transform: translateY(-50%);
}
.nav-module-items .nav-item.active { background: var(--ios-fill-2) !important; }
.nav-module-items .nav-item.active::before { background: var(--ios-blue) !important; }

/* Sidebar footer — theme toggle */
.sidebar-footer {
    border-top: 1px solid var(--ios-divider-soft) !important;
    padding: 14px 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    background: transparent !important;
}
.theme-toggle {
    width: 32px !important; height: 32px !important;
    border-radius: 9px !important;
    background: var(--ios-fill) !important;
    border: none !important;
    color: var(--ios-label-2) !important;
    cursor: pointer;
    display: flex !important; align-items: center !important; justify-content: center !important;
    transition: background .2s ease, transform .3s var(--ios-spring) !important;
}
.theme-toggle:hover {
    background: var(--ios-fill-2) !important;
    transform: rotate(20deg) scale(1.05);
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE — iOS dark
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --ios-bg: #000000;                /* true iOS dark */
    --ios-bg-2: #1C1C1E;
    --ios-paper: #1C1C1E;
    --ios-sidebar-bg: rgba(22, 22, 25, 0.72);
    --ios-topbar-bg: rgba(22, 22, 25, 0.72);

    --ios-label: #FFFFFF;
    --ios-label-2: rgba(235, 235, 245, 0.85);
    --ios-label-3: rgba(235, 235, 245, 0.60);
    --ios-label-4: rgba(235, 235, 245, 0.40);

    --ios-divider: #38383A;
    --ios-divider-soft: rgba(84, 84, 88, 0.42);
    --ios-fill: rgba(120, 120, 128, 0.18);
    --ios-fill-2: rgba(120, 120, 128, 0.28);

    --ios-blue: #0A84FF;               /* iOS dark blue */
    --ios-blue-2: #409CFF;
    --ios-blue-soft: rgba(10, 132, 255, 0.18);
    --ios-indigo: #5E5CE6;
    --ios-purple: #BF5AF2;
    --ios-pink: #FF375F;
    --ios-orange: #FF9F0A;
    --ios-yellow: #FFD60A;
    --ios-green: #32D74B;
    --ios-teal: #40C8E0;
    --ios-red: #FF453A;

    --ios-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
    --ios-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
    --ios-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
    --ios-shadow-md: 0 14px 40px -10px rgba(0, 0, 0, 0.6);
    --ios-shadow-lg: 0 30px 70px -18px rgba(0, 0, 0, 0.7);
    --ios-shadow-blue: 0 10px 30px -8px rgba(10, 132, 255, 0.55);

    --bg-app: var(--ios-bg) !important;
    --bg-sidebar: var(--ios-sidebar-bg) !important;
    --bg-topbar: var(--ios-topbar-bg) !important;
    --bg-card: var(--ios-paper) !important;
    --bg-elevated: #2C2C2E !important;
    --bg-input: #1C1C1E !important;
    --bg-hover: var(--ios-fill) !important;
    --bg-active: var(--ios-fill-2) !important;
    --text-primary: var(--ios-label) !important;
    --text-secondary: var(--ios-label-2) !important;
    --text-muted: var(--ios-label-3) !important;
    --border: var(--ios-divider-soft) !important;
    --border-strong: var(--ios-divider) !important;
    --border-hairline: var(--ios-divider-soft);
    --accent: var(--ios-blue);
    --accent-2: var(--ios-indigo);
}

/* Dark-specific tweaks */
[data-theme="dark"] body {
    background: var(--ios-bg) !important;
    color: var(--ios-label) !important;
}
[data-theme="dark"] body::before {
    background:
        radial-gradient(900px 500px at 90% -5%, rgba(88, 86, 214, 0.15), transparent 55%),
        radial-gradient(800px 440px at -5% 8%, rgba(10, 132, 255, 0.12), transparent 55%),
        radial-gradient(700px 400px at 30% 110%, rgba(191, 90, 242, 0.10), transparent 55%) !important;
}

/* Dark: sidebar brand + inputs */
[data-theme="dark"] .sidebar-brand { color: var(--ios-label) !important; }
[data-theme="dark"] .sidebar-logo {
    background: var(--ios-blue) !important;
    box-shadow: 0 4px 14px rgba(10, 132, 255, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] select, [data-theme="dark"] textarea,
[data-theme="dark"] .modal-row input, [data-theme="dark"] .modal-row select, [data-theme="dark"] .modal-row textarea {
    background: #1C1C1E !important;
    border-color: var(--ios-divider-soft) !important;
    color: var(--ios-label) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--ios-label-4) !important; }

/* Dark: hero card */
[data-theme="dark"] .dash-hero {
    background:
        radial-gradient(900px 400px at 85% 0%, rgba(10, 132, 255, 0.14), transparent 60%),
        radial-gradient(700px 300px at 0% 100%, rgba(191, 90, 242, 0.12), transparent 60%),
        linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 100%) !important;
    border-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] .dash-hero-badge {
    background: rgba(28, 28, 30, 0.88) !important;
    border-color: var(--ios-divider-soft) !important;
    color: var(--ios-label-2) !important;
}

/* Dark: cards */
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .bento-tile {
    background: #1C1C1E !important;
    border-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] .card:hover,
[data-theme="dark"] .stat-card:hover,
[data-theme="dark"] .bento-tile:hover {
    background: #232325 !important;
    border-color: rgba(10, 132, 255, 0.3) !important;
}
[data-theme="dark"] .tile-stat {
    background: linear-gradient(135deg, #1C1C1E 0%, #242426 100%) !important;
}

/* Dark: dash-action cards */
[data-theme="dark"] .dash-action {
    background: rgba(120, 120, 128, 0.18) !important;
    color: var(--ios-label) !important;
}
[data-theme="dark"] .dash-action:hover {
    background: rgba(120, 120, 128, 0.28) !important;
}
[data-theme="dark"] .dash-action-ic {
    background: #1C1C1E !important;
}

/* Dark: tables */
[data-theme="dark"] table thead tr { background: rgba(120, 120, 128, 0.10) !important; }
[data-theme="dark"] table th { color: var(--ios-label-3) !important; border-bottom-color: var(--ios-divider) !important; }
[data-theme="dark"] table td { color: var(--ios-label-2) !important; border-bottom-color: var(--ios-divider-soft) !important; }
[data-theme="dark"] table tbody tr:hover { background: var(--ios-fill) !important; }

/* Dark: scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: var(--ios-bg) !important;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Dark: AI panel */
[data-theme="dark"] #aiPanel {
    background: #1C1C1E !important;
    border-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] #aiPanel .ai-head {
    background: rgba(120, 120, 128, 0.10) !important;
    border-bottom-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] .ai-msg.assistant .ai-msg-bubble {
    background: rgba(120, 120, 128, 0.25) !important;
    color: var(--ios-label) !important;
}
[data-theme="dark"] .ai-suggestion-chip {
    background: rgba(120, 120, 128, 0.20) !important;
    color: var(--ios-label-2) !important;
}
[data-theme="dark"] #aiPanel .ai-input {
    background: #2C2C2E !important;
    color: var(--ios-label) !important;
    border-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] #aiPanel .ai-input:focus {
    border-color: var(--ios-blue) !important;
}

/* Dark: modal */
[data-theme="dark"] .modal {
    background: #1C1C1E !important;
    border-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] .modal-header {
    border-bottom-color: var(--ios-divider-soft) !important;
}
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.55) !important;
}

/* Dark: help panel */
[data-theme="dark"] .help-panel {
    background: rgba(120, 120, 128, 0.10) !important;
    border-color: var(--ios-divider-soft) !important;
}

/* Dark: plan status */
[data-theme="dark"] .plan-status-card {
    background:
        radial-gradient(600px 260px at 100% 0%, rgba(10, 132, 255, 0.18), transparent 60%),
        linear-gradient(135deg, rgba(88, 86, 214, 0.12), rgba(10, 132, 255, 0.08)) !important;
    border-color: rgba(10, 132, 255, 0.25) !important;
}

/* Dark: code */
[data-theme="dark"] code {
    background: rgba(120, 120, 128, 0.24) !important;
    color: var(--ios-label) !important;
}

/* Dark: chip lists */
[data-theme="dark"] .dash-chip-list > div {
    background: rgba(120, 120, 128, 0.20) !important;
    color: var(--ios-label-2) !important;
}
[data-theme="dark"] .dash-chip-list > div:hover {
    background: var(--ios-blue-soft) !important;
    color: var(--ios-blue-2) !important;
}

/* Dark: activity feed icons */
[data-theme="dark"] .activity-ic.mail { background: rgba(10, 132, 255, 0.20) !important; color: #5AC8FA !important; }
[data-theme="dark"] .activity-ic.voice { background: rgba(191, 90, 242, 0.20) !important; color: #DA8FFF !important; }
[data-theme="dark"] .activity-ic.meet { background: rgba(50, 215, 75, 0.22) !important; color: #30DB5B !important; }
[data-theme="dark"] .activity-ic.sms { background: rgba(64, 200, 224, 0.22) !important; color: #64D2FF !important; }
[data-theme="dark"] .activity-ic.lead { background: rgba(255, 159, 10, 0.22) !important; color: #FFD60A !important; }

/* Dark: stat-icons */
[data-theme="dark"] .stat-icon.purple { background: rgba(191, 90, 242, 0.22) !important; color: #DA8FFF !important; }
[data-theme="dark"] .stat-icon.green { background: rgba(50, 215, 75, 0.22) !important; color: #30DB5B !important; }
[data-theme="dark"] .stat-icon.red { background: rgba(255, 69, 58, 0.22) !important; color: #FF6961 !important; }
[data-theme="dark"] .stat-icon.blue { background: rgba(10, 132, 255, 0.22) !important; color: #64D2FF !important; }
[data-theme="dark"] .stat-icon.yellow { background: rgba(255, 214, 10, 0.24) !important; color: #FFD60A !important; }

/* Dark: badges (lighter text on darker bg) */
[data-theme="dark"] .badge-green { background: rgba(50, 215, 75, 0.18) !important; color: #30DB5B !important; }
[data-theme="dark"] .badge-red { background: rgba(255, 69, 58, 0.18) !important; color: #FF6961 !important; }
[data-theme="dark"] .badge-blue { background: rgba(10, 132, 255, 0.18) !important; color: #64D2FF !important; }
[data-theme="dark"] .badge-purple { background: rgba(191, 90, 242, 0.18) !important; color: #DA8FFF !important; }
[data-theme="dark"] .badge-yellow { background: rgba(255, 214, 10, 0.22) !important; color: #FFD60A !important; }

/* Dark: buttons */
[data-theme="dark"] .btn {
    background: rgba(120, 120, 128, 0.24) !important;
    color: var(--ios-label) !important;
}
[data-theme="dark"] .btn:hover {
    background: rgba(120, 120, 128, 0.34) !important;
}
[data-theme="dark"] .btn-primary {
    background: var(--ios-blue) !important;
    color: #fff !important;
    box-shadow: 0 8px 24px -6px rgba(10, 132, 255, 0.55) !important;
}
[data-theme="dark"] .btn-primary:hover {
    background: var(--ios-blue-2) !important;
}
[data-theme="dark"] .btn-ghost {
    background: transparent !important;
    color: var(--ios-label-2) !important;
}
[data-theme="dark"] .btn-ghost:hover {
    background: var(--ios-fill) !important;
    color: var(--ios-label) !important;
}

/* Dark: bento-big-num, stat-value, dash-hero-title */
[data-theme="dark"] .bento-big-num,
[data-theme="dark"] .stat-value,
[data-theme="dark"] .mini-num,
[data-theme="dark"] .dash-hero-title {
    color: var(--ios-label) !important;
}
[data-theme="dark"] .section-title {
    color: var(--ios-label) !important;
}
[data-theme="dark"] .modal-header h3 { color: var(--ios-label) !important; }

/* Dark: topbar search */
[data-theme="dark"] .topbar-search input:focus {
    background: #2C2C2E !important;
}

/* Dark: nav items keep iOS feel */
[data-theme="dark"] .nav-item:hover { background: var(--ios-fill) !important; }
[data-theme="dark"] .nav-item.active {
    background: var(--ios-fill-2) !important;
    color: var(--ios-blue-2) !important;
}
[data-theme="dark"] .nav-item.active > span:not(.nav-badge) { color: var(--ios-label) !important; }
[data-theme="dark"] .nav-module-items::before { background: var(--ios-divider-soft) !important; }
[data-theme="dark"] .nav-module-items .nav-item::before { background: var(--ios-divider-soft) !important; }
[data-theme="dark"] .nav-module-items .nav-item.active::before { background: var(--ios-blue-2) !important; }

/* Dark: theme-toggle */
[data-theme="dark"] .theme-toggle {
    background: rgba(120, 120, 128, 0.22) !important;
    color: var(--ios-label-2) !important;
}
[data-theme="dark"] .theme-toggle:hover {
    background: rgba(120, 120, 128, 0.32) !important;
}

/* ═══════════════════════════════════════════════════════════
   Sidebar — NO flex shrink, scroll instead
   ═══════════════════════════════════════════════════════════ */
.sidebar {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    overflow: hidden !important;
}
.sidebar-header { flex-shrink: 0 !important; }
.sidebar-footer { flex-shrink: 0 !important; }

.sidebar-nav {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0 !important;
    /* Slim scrollbar, nearly invisible until hover */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.sidebar-nav:hover {
    scrollbar-color: rgba(120, 120, 128, 0.35) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px !important; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent !important; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: transparent !important;
    border: none !important;
    border-radius: 999px !important;
    transition: background .2s;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(120, 120, 128, 0.35) !important;
}
[data-theme="dark"] .sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22) !important;
}

/* All nav children must keep their size — NO squish */
.sidebar-nav > *,
.nav-item,
.nav-module,
.nav-module-header,
.nav-module-items,
.nav-module-items .nav-item,
.nav-section-label {
    flex-shrink: 0 !important;
}

/* Make sure expanded submodules display their children (override height collapses) */
.nav-module.expanded .nav-module-items {
    display: flex !important;
    flex-direction: column !important;
}


/* ═══ SEO Autopilot ═══ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #737373);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border, #e5e5e5);
    background: var(--bg-soft, #f8f8f8);
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #f0f0f0);
    vertical-align: middle;
}
.data-table tbody tr:hover td {
    background: rgba(16, 185, 129, 0.04);
}
.badge-intent {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}
.badge-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-soft, #f5f5f5);
    color: var(--text-secondary, #525252);
}
.badge-status.badge-published, .badge-status.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.badge-status.badge-draft, .badge-status.badge-new, .badge-status.badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.badge-status.badge-failed, .badge-status.badge-lost, .badge-status.badge-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.spinner-small {
    width: 16px; height: 16px;
    border: 2px solid rgba(16, 185, 129, 0.2);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin-small 0.8s linear infinite;
}
@keyframes spin-small { to { transform: rotate(360deg); } }
.article-preview h1 { font-size: 26px; font-weight: 700; margin: 0 0 14px; }
.article-preview h2 { font-size: 20px; font-weight: 600; margin: 24px 0 10px; }
.article-preview h3 { font-size: 16px; font-weight: 600; margin: 18px 0 8px; }
.article-preview p { margin: 10px 0; }
.article-preview ul, .article-preview ol { padding-left: 24px; margin: 10px 0; }
.article-preview li { margin: 4px 0; }
.article-preview a { color: #3b82f6; text-decoration: underline; }
.article-preview blockquote {
    border-left: 3px solid #10b981;
    padding: 6px 14px;
    margin: 14px 0;
    color: var(--text-secondary, #525252);
    background: var(--bg-soft, #fafafa);
    border-radius: 0 8px 8px 0;
}

/* ═══ Responsive breakpoints (1024 / 768 / 480) ═══ */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main { margin-left: 220px; }
    .grid-3, .grid-cols-3 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1000;
    }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; padding: 14px; }
    .grid-2, .grid-3, .grid-4,
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr !important; }
    .section-header { flex-wrap: wrap; gap: 10px; }
    .pagination { flex-wrap: wrap; }
    .crm-table-wrap, .table-wrap { overflow-x: auto; }
}
@media (max-width: 480px) {
    html { font-size: 14px; }
    .main { padding: 10px; }
    .topbar, .nav { flex-direction: column; align-items: stretch; gap: 8px; }
    .btn, .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
    .modal, .modal-content {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        transform: none;
        max-height: 90vh;
        overflow-y: auto;
    }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
}

/* ═══ Polish v2: modal scroll-lock, mobile refinements, focus rings ═══ */
body.modal-open { overflow: hidden; }

/* Keyboard accessibility: clear focus ring on all interactive elements. */
:focus-visible {
    outline: 2px solid var(--accent, #6366f1);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Tablet (≤1024px): shrink sidebar, tighten spacing */
@media (max-width: 1024px) {
    .app-shell, body { overflow-x: hidden; }
    .sidebar { width: 200px; }
    .main { padding: 16px; }
    table { font-size: 13px; }
}

/* Mobile (≤768px): collapse sidebar to overlay drawer + full-width tables */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main { padding: 12px; margin-left: 0 !important; }
    .topbar { padding: 8px 12px; }
    button, .btn { min-height: 44px; min-width: 44px; }
    .data-table { font-size: 12px; }
    .data-table td, .data-table th { padding: 8px 10px; }
    .card, .panel { border-radius: 10px; padding: 14px; }
    .modal-content { width: 95vw; max-height: 92vh; overflow-y: auto; }
    h1 { font-size: 20px; }
    .kpi-row, .kpi-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Small mobile (≤480px): 1-col KPI, hide less-critical nav icons */
@media (max-width: 480px) {
    .kpi-row, .kpi-grid { grid-template-columns: 1fr !important; }
    .btn-secondary:not(.keep-mobile) { display: none; }
    .breadcrumb { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   DESIGN STUDIO v5 — edge-to-edge preview, floating toolbar, thin bottom bar
   ═══════════════════════════════════════════════════════════ */

.design-studio {
    position: relative;
    /* Break out of the .content 28px/32px padding + .main-area padding so the
       preview really goes edge-to-edge within the template editor shell. */
    margin: 0 -32px -56px -32px;
    height: calc(100vh - 170px);
    min-height: 600px;
    background: #fff;
    border: 0;
    border-radius: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
@media (max-width: 900px) {
    .design-studio { margin: 0 -14px -48px -14px; height: calc(100vh - 180px); }
}

.ds-stage {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #fff;
}
.ds-stage[data-device="dark"] { background: #1a1a1f; }

/* Floating mini-toolbar top-right */
.ds-stage-toolbar {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.ds-stage[data-device="dark"] .ds-stage-toolbar {
    background: rgba(30, 30, 35, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
}
.ds-stage-subject { display: none !important; }  /* subject text not needed floating */
.ds-device-toggle { display: inline-flex; border-radius: 6px; overflow: hidden; }
.ds-device-toggle button {
    background: transparent;
    border: 0;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--text-secondary);
    border-radius: 4px;
}
.ds-device-toggle button.active { background: var(--accent); color: #fff; }
.ds-product-select {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,.08);
    background: transparent;
    font-size: 11px;
    max-width: 160px;
}

/* Iframe wrap — full bleed. No padding, no background seen. */
.ds-stage-frame-wrap {
    flex: 1;
    overflow: auto;
    display: block;
    padding: 0;
    margin: 0;
    min-height: 0;
    background: #fff;
}
.ds-stage[data-device="dark"] .ds-stage-frame-wrap { background: #1a1a1f; }

.ds-stage-frame {
    border: 0;
    background: #fff;
    box-shadow: none;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 420px;
    display: block;
}
.ds-stage[data-device="mobile"] .ds-stage-frame-wrap {
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 8px;
    background: var(--bg-soft, #f3f4f6);
}
.ds-stage[data-device="mobile"] .ds-stage-frame { max-width: 420px; }

/* Bottom dock — thin single-line input. Pinned, not floating, to avoid
   overlapping the end of email preview. */
.ds-dock {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    min-height: 54px;
}
.ds-dock .design-chat-messages,
.ds-dock .design-chat-attachments,
.ds-dock .design-chat-quick { display: none !important; }
.ds-dock .design-chat-input-area {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
}
.ds-dock .design-chat-attach-btn {
    background: var(--bg-soft, #fafafa);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.ds-dock .design-chat-attach-btn:hover { border-color: var(--accent); color: var(--accent); }
.ds-dock .design-chat-textarea {
    flex: 1;
    min-width: 0;
    max-height: 80px;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    resize: none;
    background: var(--bg-input);
    color: var(--text-primary);
    line-height: 1.35;
}
.ds-dock .design-chat-textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.ds-dock .design-chat-send {
    background: var(--accent);
    color: #fff;
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.ds-dock .design-chat-send:hover { filter: brightness(1.08); }
.ds-dock .design-chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* Hide everything from the old multi-tab/inspector attempt. */
.ds-rail, .ds-tabs, .ds-tabs-h, .ds-tab, .ds-tab-h,
.ds-panel, .ds-pane, .ds-inspector, .ds-inspector-empty,
.ds-inspector-actions, .ds-insp-btn, .ds-blocks-grid,
.ds-style-grid, .ds-theme-chips, .ds-radio-row,
.ds-sections-list, .ds-history-list, .ds-dock-resize,
.ds-section-title, .ds-section-hint, .ds-pane-header,
.ds-color-row, .ds-block, .ds-insp-divider, .ds-zoom { display: none !important; }

/* ═══ Copilot button in topbar (replaces bottom-right FAB) ═══ */
.topbar-copilot {
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.topbar-copilot:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35); }
.topbar-copilot:active { transform: translateY(0); }
.topbar-copilot svg { color: #fff; }
.topbar-copilot-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #f43f5e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-topbar, #fff);
}
@media (max-width: 640px) {
    .topbar-copilot span:not(.topbar-copilot-badge) { display: none; }
    .topbar-copilot { padding: 7px; }
}

/* Force-hide the old floating FAB even if stylesheets load out of order. */
#aiFab { display: none !important; }

@keyframes topbar-copilot-pulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.18), 0 4px 16px rgba(99, 102, 241, 0.40); }
}
.topbar-copilot.pulsing { animation: topbar-copilot-pulse 1.6s ease-in-out infinite; }

/* ═══════════════════════════════════════════════════════════
   APP MOBILE RESPONSIVE — sidebar drawer, compact topbar, stack
   Target breakpoints: 1024 / 768 / 480 / 375
   ═══════════════════════════════════════════════════════════ */

/* Hamburger is hidden by default (desktop), shown only on mobile. */
.topbar-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }

/* Backdrop — invisible on desktop; shown as dark overlay when drawer open. */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 59;
    opacity: 0;
    transition: opacity .2s ease;
}

@media (max-width: 1024px) {
    .topbar-copilot span:not(.topbar-copilot-badge) { display: none; }
    .topbar-copilot { padding: 8px; }
    .topbar-search input::placeholder { content: "Cautare..."; }
}

@media (max-width: 768px) {
    /* App shell becomes single-column. Sidebar is positioned off-canvas. */
    .app-shell {
        grid-template-columns: 1fr !important;
        min-height: 100vh;
    }
    .app-shell .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    }
    .app-shell.sidebar-mobile-open .sidebar { transform: translateX(0); }
    .app-shell.sidebar-mobile-open .sidebar-backdrop { display: block; opacity: 1; }

    /* Hamburger visible; desktop collapse button hidden. */
    .topbar-hamburger { display: inline-flex; }
    .sidebar-collapse-btn { display: none !important; }

    /* Topbar compact */
    .topbar {
        padding: 0 14px;
        height: auto;
        min-height: 56px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .breadcrumb { font-size: 12.5px; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .breadcrumb span:not(.breadcrumb-current) { display: none; }  /* show only current crumb */
    .breadcrumb-current { font-weight: 600; }

    /* Global search input shrinks to icon-only trigger */
    .topbar-search {
        width: 40px; min-width: 40px; max-width: 40px;
        justify-content: center;
        padding: 0;
    }
    .topbar-search input,
    .topbar-search .topbar-kbd { display: none; }

    /* Content padding reduced */
    .content, .main-area {
        padding: 14px 14px 40px !important;
        max-width: 100% !important;
    }

    /* Section header compact */
    .section-title { font-size: 22px !important; line-height: 1.15; }
    .section-subtitle { font-size: 13px !important; }
    .section-header { margin-bottom: 14px; }

    /* Default grid stack: any grid with 2+ columns collapses to 1 on phones. */
    .grid-2, .grid-3, .grid-4,
    .grid-cols-2, .grid-cols-3, .grid-cols-4,
    .kpi-grid, .kpi-row,
    .stats-grid, .accounts-grid, .products-grid, .templates-grid,
    .feat-grid, .stack-grid, .tests-grid,
    .stack-savings, .foot-grid,
    .dashboard-bento, .bento-grid,
    .design-theme-grid, .design-color-row,
    .settings-layout,
    .template-editor-layout { grid-template-columns: 1fr !important; gap: 12px !important; }

    /* Tables: horizontal scroll wrap, don't let them explode layout */
    .table-container, .table-wrapper, .crm-table-wrap, .crm-tbl-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
    table { font-size: 12.5px; }

    /* Buttons tap-friendly */
    .btn, button { min-height: 40px; }
    .btn-sm { min-height: 36px; }

    /* Bulk action bar at bottom becomes a sticky pill */
    .bulk-bar { left: 8px; right: 8px; bottom: 8px; padding: 10px 12px; font-size: 12px; flex-wrap: wrap; }
    .bulk-bar-actions { flex-wrap: wrap; gap: 6px; }

    /* Modals — full-screen sheets on mobile */
    .modal, .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        height: 100vh;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: auto;
    }
    .modal-overlay { padding: 0 !important; }

    /* Filter bar wraps onto multiple rows */
    .filter-bar { gap: 8px; }
    .filter-bar .filter-select { max-width: none; flex: 1 1 140px; }
    .search-wrapper { flex: 1 1 100%; min-width: 100%; }

    /* Topbar Copilot: keep icon, drop label */
    .topbar-copilot {
        margin-left: auto;
        padding: 7px 10px;
        min-height: 38px;
    }
    .topbar-copilot span:not(.topbar-copilot-badge) { display: none; }
}

/* ── Below 480px (standard phones) ─────────────────────────── */
@media (max-width: 480px) {
    .content, .main-area { padding: 10px 10px 40px !important; }
    .topbar { padding: 0 10px; min-height: 52px; }
    .section-title { font-size: 20px !important; }
    .btn { padding: 9px 12px; font-size: 13px; }
    .filter-bar .filter-select { flex: 1 1 100%; }

    /* Dashboard KPI cards stack tighter */
    .kpi-card { padding: 14px 12px; }
    .kpi-card .kpi-value { font-size: 24px; }

    /* Form rows stack */
    .field-row, .settings-field-row { grid-template-columns: 1fr !important; gap: 8px; }

    /* Sidebar drawer takes more of the screen */
    .app-shell .sidebar { width: 260px; max-width: 88vw; }
}

/* ── Below 375px (iPhone SE 1st gen) ────────────────────────── */
@media (max-width: 375px) {
    .topbar { padding: 0 8px; }
    .topbar-hamburger { width: 34px; height: 34px; margin-right: 6px; }
    .section-title { font-size: 18px !important; }
    .btn { padding: 9px 10px; font-size: 12.5px; }
    .topbar-copilot { padding: 6px 8px; }
}

/* ═══ Mobile drawer — force labels + hide collapse affordances ═══ */
@media (max-width: 768px) {
    /* Never let the desktop "collapsed" classes hide nav content inside the
       drawer. Override them all with inherit/visible. */
    .app-shell.sidebar-collapsed .sidebar-brand,
    .app-shell.sidebar-collapsed .nav-item span:not(.nav-badge),
    .app-shell.sidebar-collapsed .nav-section-label,
    .app-shell.sidebar-collapsed .nav-module-header span,
    .app-shell.sidebar-collapsed .nav-module-chev,
    .app-shell.sidebar-collapsed .nav-module-items,
    .app-shell.sidebar-collapsed .sidebar-footer-text,
    .app-shell.sidebar-collapsed .sidebar-header {
        display: initial !important;
    }
    .app-shell.sidebar-collapsed .sidebar-nav {
        display: block !important;
    }
    .app-shell.sidebar-collapsed .nav-item,
    .app-shell.sidebar-collapsed .nav-module-header {
        justify-content: flex-start !important;
        padding: 10px 12px !important;
    }

    /* The sidebar-collapse chevron is a desktop-only affordance. Kill it. */
    .sidebar-collapse-btn { display: none !important; }

    /* Sidebar logo "M" shrinks so it doesn't dominate the drawer header. */
    .sidebar-logo { width: 36px; height: 36px; font-size: 16px; }
    .sidebar-header { padding: 14px 14px 10px; gap: 10px; justify-content: flex-start; }

    /* Topbar hamburger — make sure there's ONLY ONE on screen. Anything that
       looks like a menu toggle but isn't in the topbar is hidden. */
    .topbar .topbar-hamburger ~ .topbar-hamburger { display: none !important; }
    /* The 3-line icon that sits inside sidebar-header on some themes. */
    .sidebar .topbar-hamburger,
    .sidebar-header .topbar-hamburger { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   GROWTH AUTOPILOT — proper component system (no more inline gradients)
   ═══════════════════════════════════════════════════════════ */

:root {
    --growth-accent: #fb923c;
    --growth-accent-2: #ef4444;
    --growth-grad: linear-gradient(135deg, #fb923c 0%, #ef4444 100%);
    --growth-grad-soft: linear-gradient(135deg, rgba(251,146,60,0.14) 0%, rgba(239,68,68,0.08) 100%);
    --growth-grad-border: rgba(251, 146, 60, 0.35);
}

/* Hero score card at top of Growth Dashboard */
.growth-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    padding: 24px 26px;
    border-radius: 16px;
    border: 1px solid var(--growth-grad-border);
    background: var(--growth-grad-soft);
    margin-bottom: 18px;
}
@media (max-width: 768px) { .growth-hero { grid-template-columns: 1fr; padding: 18px 16px; gap: 14px; } }

.growth-hero-left h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}
.growth-hero-sub { color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.growth-hero-cta { display: flex; gap: 8px; flex-wrap: wrap; }
.growth-hero-cta .btn {
    background: var(--growth-grad);
    border-color: transparent;
    color: #fff;
}
.growth-hero-cta .btn:hover { filter: brightness(1.08); }
.growth-hero-cta .btn.ghost { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-primary); }

.growth-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
}
.growth-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 10px;
}
.growth-score-ring svg { transform: rotate(-90deg); }
.growth-score-ring .track { stroke: rgba(255,255,255,0.08); }
.growth-score-ring .fill { stroke: url(#growthGrad); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.growth-score-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--growth-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.growth-score-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }

/* KPI strip under hero */
.growth-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 900px) { .growth-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .growth-kpis { grid-template-columns: 1fr 1fr; gap: 8px; } }

.growth-kpi {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.growth-kpi:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    border-color: var(--growth-grad-border, rgba(99,102,241,0.35));
}
.growth-kpi-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: .03em;
}
.growth-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.growth-kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.growth-kpi-sub { font-size: 12px; color: var(--text-secondary); }
.growth-kpi.warn { border-color: rgba(251, 146, 60, 0.35); background: rgba(251, 146, 60, 0.04); }
.growth-kpi.good { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.04); }

/* ─── Loading skeletons ─── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 0%, var(--bg-card) 50%, var(--bg-input) 100%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}
@keyframes skel-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-line { height: 14px; margin: 6px 0; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-card {
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
}

/* ─── Mobile responsive fixes ─── */
@media (max-width: 768px) {
    /* Agent cards scale to 1-col on mobile */
    #agentsList > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    /* Tables — enable horizontal scroll */
    .account-card .account-actions { flex-wrap: wrap; }
    .account-card .account-actions .btn { flex: 1 1 auto; min-width: 0; }
    /* Modal — fit viewport */
    .modal { max-width: 98vw !important; }
    .modal-body { padding: 12px !important; }
    /* Agent detail tabs scroll horizontally */
    #agentDetailBody > div > div[style*="display:flex"][style*="gap:6px"] {
        overflow-x: auto;
        white-space: nowrap;
    }
    #agentDetailBody > div > div[style*="display:flex"][style*="gap:6px"] button {
        white-space: nowrap;
        flex-shrink: 0;
    }
    /* Lead table: hide Reply column on small screens */
    @media (max-width: 520px) {
        table th:nth-child(6), table td:nth-child(6) { display: none; }
    }
}

/* ─── Wins panel — "Ultimele realizări" ─── */
.growth-wins-host { margin-bottom: 18px; }
.growth-wins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}
.growth-wins-empty {
    padding: 36px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 12px;
}
.growth-win-card {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.growth-win-card.is-clickable { cursor: pointer; }
.growth-win-card.is-clickable:hover {
    transform: translateY(-1px);
    border-color: var(--growth-grad-border, rgba(99, 102, 241, 0.35));
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.growth-win-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-soft);
    border-radius: 10px;
}
.growth-win-body { flex: 1; min-width: 0; }
.growth-win-title {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}
.growth-win-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.growth-win-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
}
.growth-win-metric {
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.growth-win-ts { color: var(--text-muted); margin-left: auto; }
.growth-win-arrow { color: var(--text-muted); font-size: 14px; }
.growth-win-card.is-clickable:hover .growth-win-arrow { color: var(--growth-accent, #6366f1); transform: translateX(2px); transition: transform .14s ease, color .14s ease; }

/* Daily cost cap bar */
.growth-cap-bar {
    margin-top: 6px;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
}
.growth-cap-fill {
    height: 100%;
    background: var(--growth-grad);
    border-radius: 999px;
    transition: width .3s ease;
}

/* Section titles inside dashboard */
.growth-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 26px 0 10px;
    gap: 10px;
    flex-wrap: wrap;
}
.growth-section-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Plan list tiles */
.growth-plans-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}
@media (max-width: 480px) { .growth-plans-list { grid-template-columns: 1fr; } }

.growth-plan-card {
    padding: 18px 18px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform .14s ease, border-color .14s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.growth-plan-card:hover { transform: translateY(-2px); border-color: var(--growth-accent); }
.growth-plan-card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.growth-plan-card-goal { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.growth-plan-card-row { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }

/* Status badges */
.growth-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}
.growth-badge.active   { background: rgba(34,197,94,0.14);  color: #86efac; border-color: rgba(34,197,94,0.28); }
.growth-badge.paused   { background: rgba(148,163,184,0.14);color: #cbd5e1; border-color: rgba(148,163,184,0.28); }
.growth-badge.draft    { background: rgba(251,146,60,0.14); color: #fb923c; border-color: rgba(251,146,60,0.28); }
.growth-badge.pending  { background: rgba(99,102,241,0.14); color: #a5b4fc; border-color: rgba(99,102,241,0.28); }
.growth-badge.running  { background: rgba(56,189,248,0.14); color: #7dd3fc; border-color: rgba(56,189,248,0.28); }
.growth-badge.done     { background: rgba(34,197,94,0.14);  color: #86efac; border-color: rgba(34,197,94,0.28); }
.growth-badge.failed   { background: rgba(239,68,68,0.14);  color: #fca5a5; border-color: rgba(239,68,68,0.28); }
.growth-badge.skipped  { background: rgba(148,163,184,0.1); color: #94a3b8; border-color: rgba(148,163,184,0.2); }
.growth-badge.manual   { background: rgba(168,85,247,0.14); color: #d8b4fe; border-color: rgba(168,85,247,0.28); }

/* Weekly timeline on plan detail */
.growth-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.growth-week {
    padding: 14px 14px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.growth-week.is-current { border-color: var(--growth-accent); box-shadow: 0 0 0 1px var(--growth-accent) inset; }
.growth-week-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.growth-week-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--growth-accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.growth-week-count { font-size: 11px; color: var(--text-muted); }
.growth-week-focus {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    min-height: 36px;
}

/* Action pill */
.growth-action-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color .12s;
}
.growth-action-pill:hover { border-color: var(--growth-accent); }
.growth-action-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.growth-action-pill.status-pending_approval .dot { background: #a5b4fc; }
.growth-action-pill.status-approved .dot        { background: #7dd3fc; }
.growth-action-pill.status-running .dot         { background: #38bdf8; animation: growthPulse 1.2s ease-in-out infinite; }
.growth-action-pill.status-done .dot            { background: #86efac; }
.growth-action-pill.status-failed .dot          { background: #fca5a5; }
.growth-action-pill.status-skipped .dot         { background: #94a3b8; }
.growth-action-pill.status-manual_required .dot { background: #d8b4fe; }
.growth-action-pill-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.growth-action-pill-cost { font-size: 11px; color: var(--text-muted); }
@keyframes growthPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Inbox cards */
.growth-inbox-plan {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    overflow: hidden;
}
.growth-inbox-plan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(251,146,60,0.04);
}
.growth-inbox-plan-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.growth-inbox-plan-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.growth-inbox-action {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.growth-inbox-action:last-child { border-bottom: 0; }
.growth-inbox-action:hover { background: rgba(255,255,255,0.02); }
.growth-inbox-action-body { min-width: 0; }
.growth-inbox-action-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.growth-inbox-action-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.growth-inbox-action-meta { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); }
.growth-inbox-action-actions { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 640px) {
    .growth-inbox-action { grid-template-columns: 20px 1fr; }
    .growth-inbox-action-actions { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
}

.growth-inbox-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    border: 2px dashed var(--border);
    border-radius: 14px;
}
.growth-inbox-empty h3 { color: var(--text-primary); font-size: 18px; margin: 10px 0 4px; }

/* Diagnostic checklist */
.growth-diag {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 10px;
}
.growth-diag-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.growth-diag-item .icon { font-size: 18px; flex-shrink: 0; }
.growth-diag-item .label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.growth-diag-item .desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.growth-diag-item.ok     { border-color: rgba(34,197,94,0.28); background: rgba(34,197,94,0.04); }
.growth-diag-item.warn   { border-color: rgba(251,146,60,0.28); background: rgba(251,146,60,0.04); }
.growth-diag-item.missing{ border-color: rgba(148,163,184,0.25); }
.growth-diag-delta { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.growth-diag-delta.up { color: #86efac; }
.growth-diag-delta.down { color: #fca5a5; }

/* Activity feed */
.growth-feed {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    overflow: hidden;
}
.growth-feed-item {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    align-items: center;
}
.growth-feed-item:last-child { border-bottom: 0; }
.growth-feed-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.growth-feed-item .txt { color: var(--text-primary); }
.growth-feed-item .when { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.growth-feed-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Autonomy selector */
.growth-autonomy {
    display: flex;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    width: fit-content;
}
.growth-autonomy button {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.growth-autonomy button.active {
    background: var(--growth-grad);
    color: #fff;
}

/* Review card */
.growth-review {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    margin-top: 12px;
}
.growth-review-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 720px) { .growth-review-grid { grid-template-columns: 1fr; } }
.growth-review-col h4 {
    margin: 0 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.growth-review-col ul { padding-left: 18px; margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.growth-review-col.wins h4    { color: #86efac; }
.growth-review-col.losses h4  { color: #fca5a5; }
.growth-review-col.recs h4    { color: #7dd3fc; }

/* Growth modal header/body/close — reuse generic modal but style inner padding */
#growthActionDetailsModal .modal,
#growthEditParamsModal .modal { padding: 0; }
#growthActionDetailsModal .modal-header,
#growthEditParamsModal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
#growthActionDetailsModal .modal-close,
#growthEditParamsModal .modal-close {
    background: transparent;
    border: 0;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
}
#growthActionDetailsModal .modal-body,
#growthEditParamsModal .modal-body { padding: 18px; }

/* Mobile: plan detail hero collapses to 1-col under 640 */
@media (max-width: 640px) {
    .design-studio .growth-hero,
    .growth-hero[style*="220px"] { grid-template-columns: 1fr !important; }
    .growth-score { margin: 0 auto; max-width: 280px; }
    .growth-hero-cta { gap: 6px; }
    .growth-hero-cta .btn { flex: 1 1 auto; font-size: 12.5px; padding: 8px 12px; }
    .growth-timeline { grid-template-columns: 1fr !important; }
    .growth-review-grid { grid-template-columns: 1fr !important; }
}

.growth-plan-card-del {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .14s;
    flex-shrink: 0;
}
.growth-plan-card-del:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════════
   TYPELAB — Modernist Type Lab theme for #section-dashboard
   Scoped entirely via [data-theme="typelab"] so nothing else is touched.
   Palette: off-white paper, off-black ink, lime-acid accent.
   Typography: Instrument Serif (display) + IBM Plex Sans (UI) + JetBrains Mono (labels).
   ═══════════════════════════════════════════════════════════════════ */

#section-dashboard[data-theme="typelab"] {
    --tl-paper: #fafaf7;
    --tl-paper-sunk: #f2f1eb;
    --tl-ink: #0d0d0e;
    --tl-ink-soft: #6b6b69;
    --tl-ink-faint: #a8a8a4;
    --tl-rule: #e5e4dd;
    --tl-accent: #c7f238;         /* lime acid */
    --tl-accent-ink: #0d0d0e;     /* text that sits on accent */
    --tl-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --tl-serif: 'Instrument Serif', Georgia, serif;
    --tl-mono: 'JetBrains Mono', 'SFMono-Regular', monospace;
    background: var(--tl-paper);
    color: var(--tl-ink);
    padding: 56px 64px 80px;
    margin: -24px -28px;
    min-height: calc(100vh - 56px);
    font-family: var(--tl-sans);
    position: relative;
    /* subtle dot-grid texture */
    background-image: radial-gradient(circle, rgba(13,13,14,0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: 0 0;
}
#section-dashboard[data-theme="typelab"] * { box-sizing: border-box; }

/* ─── HERO ─── */
#section-dashboard[data-theme="typelab"] .tl-hero {
    padding-bottom: 44px;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--tl-rule);
}
#section-dashboard[data-theme="typelab"] .tl-eyebrow {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--tl-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tl-ink-soft);
    margin-bottom: 34px;
}
#section-dashboard[data-theme="typelab"] .tl-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tl-accent);
    box-shadow: 0 0 0 3px rgba(199,242,56,0.22);
    animation: tlPulse 2s ease-in-out infinite;
}
@keyframes tlPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(199,242,56,0.22); }
    50% { box-shadow: 0 0 0 6px rgba(199,242,56,0.08); }
}
#section-dashboard[data-theme="typelab"] .tl-mono-divider {
    color: var(--tl-ink-faint);
}
#section-dashboard[data-theme="typelab"] .tl-hero-title {
    font-family: var(--tl-serif);
    font-weight: 400;
    font-size: clamp(56px, 8vw, 112px);
    line-height: 0.95;
    letter-spacing: -0.035em;
    margin: 0 0 18px;
    color: var(--tl-ink);
}
#section-dashboard[data-theme="typelab"] .tl-hero-greet {
    font-style: normal;
    color: var(--tl-ink);
}
#section-dashboard[data-theme="typelab"] .tl-hero-name {
    font-style: italic;
    color: var(--tl-ink);
    position: relative;
    padding: 0 4px;
    background-image: linear-gradient(transparent 62%, var(--tl-accent) 62%, var(--tl-accent) 92%, transparent 92%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}
#section-dashboard[data-theme="typelab"] .tl-hero-dot {
    color: var(--tl-accent);
    font-style: normal;
}
#section-dashboard[data-theme="typelab"] .tl-hero-sub {
    font-family: var(--tl-serif);
    font-style: italic;
    font-size: 22px;
    line-height: 1.4;
    color: var(--tl-ink-soft);
    margin: 0 0 28px;
    max-width: 620px;
}
#section-dashboard[data-theme="typelab"] .tl-hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
#section-dashboard[data-theme="typelab"] .tl-btn {
    font-family: var(--tl-sans);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.005em;
    padding: 13px 22px;
    border: 1px solid var(--tl-ink);
    border-radius: 2px;
    background: transparent;
    color: var(--tl-ink);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#section-dashboard[data-theme="typelab"] .tl-btn-primary {
    background: var(--tl-ink);
    color: var(--tl-paper);
}
#section-dashboard[data-theme="typelab"] .tl-btn-primary:hover {
    background: var(--tl-accent);
    color: var(--tl-accent-ink);
    border-color: var(--tl-accent);
}
#section-dashboard[data-theme="typelab"] .tl-btn-primary:hover .tl-btn-arrow {
    transform: translateX(4px);
}
#section-dashboard[data-theme="typelab"] .tl-btn-arrow {
    transition: transform 0.22s cubic-bezier(0.2,0.7,0.2,1);
    display: inline-block;
}
#section-dashboard[data-theme="typelab"] .tl-btn-ghost:hover {
    background: var(--tl-ink);
    color: var(--tl-paper);
}

/* ─── ROWS & COLUMNS ─── */
#section-dashboard[data-theme="typelab"] .tl-row {
    margin-bottom: 56px;
}
#section-dashboard[data-theme="typelab"] .tl-row-split {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 64px;
    align-items: stretch;
}

/* ─── SECTION HEAD ─── */
#section-dashboard[data-theme="typelab"] .tl-section-head {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding-bottom: 12px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--tl-rule);
}
#section-dashboard[data-theme="typelab"] .tl-section-num {
    font-family: var(--tl-mono);
    font-size: 10.5px;
    letter-spacing: 0.18em;
    color: var(--tl-accent-ink);
    background: var(--tl-accent);
    padding: 2px 7px;
    border-radius: 2px;
}
#section-dashboard[data-theme="typelab"] .tl-section-label {
    font-family: var(--tl-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--tl-ink-soft);
    flex: 1;
}
#section-dashboard[data-theme="typelab"] .tl-link {
    font-family: var(--tl-sans);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--tl-ink);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.18s;
}
#section-dashboard[data-theme="typelab"] .tl-link:hover { color: var(--tl-ink-soft); }

/* ─── ACTIVITY FEED ─── */
#section-dashboard[data-theme="typelab"] .tl-activity {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 320px;
}
#section-dashboard[data-theme="typelab"] .tl-activity > * {
    padding: 14px 0;
    border-bottom: 1px solid var(--tl-rule);
    font-family: var(--tl-sans);
    font-size: 14px;
    color: var(--tl-ink);
}
#section-dashboard[data-theme="typelab"] .tl-activity > *:last-child {
    border-bottom: none;
}
#section-dashboard[data-theme="typelab"] .tl-activity:empty::before {
    content: 'Nu-s evenimente încă. Pornește un agent pentru a vedea activitate live.';
    font-family: var(--tl-serif);
    font-style: italic;
    color: var(--tl-ink-faint);
    font-size: 16px;
}

/* ─── NUMBERS STACK ─── */
#section-dashboard[data-theme="typelab"] .tl-num-stack {
    display: flex;
    flex-direction: column;
}
#section-dashboard[data-theme="typelab"] .tl-num-row {
    display: block;
    padding: 20px 0;
    border-bottom: 1px solid var(--tl-rule);
    cursor: pointer;
    transition: padding-left 0.22s cubic-bezier(0.2,0.7,0.2,1);
    text-decoration: none;
    color: var(--tl-ink);
}
#section-dashboard[data-theme="typelab"] .tl-num-row:hover {
    padding-left: 10px;
}
#section-dashboard[data-theme="typelab"] .tl-num-row:last-child {
    border-bottom: none;
}
#section-dashboard[data-theme="typelab"] .tl-num-label {
    font-family: var(--tl-mono);
    font-size: 10.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--tl-ink-soft);
    margin-bottom: 6px;
}
#section-dashboard[data-theme="typelab"] .tl-num-big {
    font-family: var(--tl-serif);
    font-weight: 400;
    font-size: 64px;
    line-height: 0.95;
    letter-spacing: -0.035em;
    color: var(--tl-ink);
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}
#section-dashboard[data-theme="typelab"] .tl-num-row:hover .tl-num-big {
    font-style: italic;
}
#section-dashboard[data-theme="typelab"] .tl-num-trend {
    font-family: var(--tl-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--tl-ink-soft);
}

/* ─── ACCESS GRID (quick actions) ─── */
#section-dashboard[data-theme="typelab"] .tl-access-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-top: 1px solid var(--tl-ink);
    border-bottom: 1px solid var(--tl-ink);
}
#section-dashboard[data-theme="typelab"] .tl-access-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 28px 24px;
    border-right: 1px solid var(--tl-rule);
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: var(--tl-ink);
    background: transparent;
}
#section-dashboard[data-theme="typelab"] .tl-access-card:last-child { border-right: none; }
#section-dashboard[data-theme="typelab"] .tl-access-card:hover { background: var(--tl-paper-sunk); }
#section-dashboard[data-theme="typelab"] .tl-access-num {
    font-family: var(--tl-mono);
    font-size: 10.5px;
    letter-spacing: 0.2em;
    color: var(--tl-ink-faint);
}
#section-dashboard[data-theme="typelab"] .tl-access-title {
    font-family: var(--tl-serif);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: var(--tl-ink);
}
#section-dashboard[data-theme="typelab"] .tl-access-card:hover .tl-access-title {
    font-style: italic;
}
#section-dashboard[data-theme="typelab"] .tl-access-desc {
    font-family: var(--tl-sans);
    font-size: 13px;
    line-height: 1.45;
    color: var(--tl-ink-soft);
}

/* ─── CHIP LIST (categories + locations) ─── */
#section-dashboard[data-theme="typelab"] .tl-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#section-dashboard[data-theme="typelab"] .tl-chip-list > * {
    font-family: var(--tl-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--tl-ink);
    background: transparent;
    border: 1px solid var(--tl-rule);
    border-radius: 2px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.18s;
}
#section-dashboard[data-theme="typelab"] .tl-chip-list > *:hover {
    background: var(--tl-ink);
    color: var(--tl-paper);
    border-color: var(--tl-ink);
}

/* ─── MINI GRID (extra stats) ─── */
#section-dashboard[data-theme="typelab"] .tl-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
#section-dashboard[data-theme="typelab"] .tl-mini-cell {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 18px 20px;
    border: 1px solid var(--tl-rule);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--tl-ink);
    background: transparent;
}
#section-dashboard[data-theme="typelab"] .tl-mini-cell:hover {
    border-color: var(--tl-ink);
    background: var(--tl-paper-sunk);
}
#section-dashboard[data-theme="typelab"] .tl-mini-label {
    font-family: var(--tl-mono);
    font-size: 10.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--tl-ink-soft);
}
#section-dashboard[data-theme="typelab"] .tl-mini-num {
    font-family: var(--tl-serif);
    font-size: 32px;
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 1;
    color: var(--tl-ink);
    font-variant-numeric: tabular-nums;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
    #section-dashboard[data-theme="typelab"] {
        padding: 32px 24px 60px;
        margin: -20px -16px;
    }
    #section-dashboard[data-theme="typelab"] .tl-row-split {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    #section-dashboard[data-theme="typelab"] .tl-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    #section-dashboard[data-theme="typelab"] .tl-access-card:nth-child(2) { border-right: none; }
    #section-dashboard[data-theme="typelab"] .tl-access-card:nth-child(1),
    #section-dashboard[data-theme="typelab"] .tl-access-card:nth-child(2) {
        border-bottom: 1px solid var(--tl-rule);
    }
    #section-dashboard[data-theme="typelab"] .tl-mini-grid {
        grid-template-columns: 1fr;
    }
    #section-dashboard[data-theme="typelab"] .tl-num-big { font-size: 48px; }
}

/* ═══════════════════════════════════════════════════════════════════
   SONOMA — macOS / iOS-inspired dashboard theme
   Scoped entirely via [data-theme="sonoma"] — translucent materials,
   squircle widgets (Control Center), SF Pro typography, soft wallpaper
   gradient. Keeps all `tl-*` class markup from the HTML but restyles it
   iOS-native so no other section is touched.
   ═══════════════════════════════════════════════════════════════════ */

#section-dashboard[data-theme="sonoma"] {
    --so-card: rgba(255,255,255,0.72);
    --so-card-strong: rgba(255,255,255,0.92);
    --so-border: rgba(255,255,255,0.7);
    --so-border-inner: rgba(0,0,0,0.06);
    --so-text: #1d1d1f;
    --so-text-soft: rgba(60,60,67,0.72);
    --so-text-faint: rgba(60,60,67,0.44);
    --so-blue: #0071e3;
    --so-indigo: #5e5ce6;
    --so-purple: #af52de;
    --so-pink: #ff375f;
    --so-orange: #ff9500;
    --so-green: #30d158;
    --so-teal: #40c8e0;
    --so-mint: #00c7be;
    --so-shadow-1: 0 1px 1px rgba(0,0,0,0.03), 0 2px 8px rgba(0,0,0,0.06), 0 16px 36px rgba(0,0,0,0.06);
    --so-shadow-2: 0 2px 8px rgba(0,0,0,0.06), 0 24px 48px rgba(0,0,0,0.1), 0 48px 96px rgba(0,0,0,0.08);
    --so-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
    --so-mono: ui-monospace, 'SF Mono', 'Menlo', 'JetBrains Mono', monospace;
    font-family: var(--so-sans);
    color: var(--so-text);
    /* macOS Sonoma LIGHT — cinematic pastel gradient smears */
    background:
      radial-gradient(1400px 900px at 5% 0%, rgba(175,82,222,0.26) 0%, transparent 55%),
      radial-gradient(1200px 800px at 95% 10%, rgba(255,149,0,0.22) 0%, transparent 60%),
      radial-gradient(1300px 900px at 90% 100%, rgba(0,122,255,0.30) 0%, transparent 55%),
      radial-gradient(900px 700px at 10% 95%, rgba(48,209,88,0.22) 0%, transparent 60%),
      #f2f0f7;
    padding: 40px 48px 72px;
    margin: -24px -28px;
    min-height: calc(100vh - 56px);
    letter-spacing: -0.008em;
}
#section-dashboard[data-theme="sonoma"] * { box-sizing: border-box; }

/* Subtle noise over the wallpaper for iOS-like texture */
#section-dashboard[data-theme="sonoma"]::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.7;
    z-index: 0;
}
#section-dashboard[data-theme="sonoma"] > * { position: relative; z-index: 1; }

/* ─── HERO — Today widget style ─── */
#section-dashboard[data-theme="sonoma"] .tl-hero {
    background: var(--so-card);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--so-border);
    border-radius: 22px;
    padding: 32px 36px;
    margin-bottom: 28px;
    box-shadow: var(--so-shadow-1);
    position: relative;
}
#section-dashboard[data-theme="sonoma"] .tl-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--so-sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--so-text-soft);
    margin-bottom: 18px;
}
#section-dashboard[data-theme="sonoma"] .tl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--so-green);
    box-shadow: 0 0 0 0 rgba(48,209,88,0.5);
    animation: soPulse 1.8s ease-out infinite;
}
@keyframes soPulse {
    0%   { box-shadow: 0 0 0 0 rgba(48,209,88,0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(48,209,88,0); }
    100% { box-shadow: 0 0 0 0 rgba(48,209,88,0); }
}
#section-dashboard[data-theme="sonoma"] .tl-mono-divider {
    color: var(--so-text-faint);
}
#section-dashboard[data-theme="sonoma"] .tl-mono-label { text-transform: none; letter-spacing: -0.01em; }
#section-dashboard[data-theme="sonoma"] .tl-hero-title {
    font-family: var(--so-sans);
    font-weight: 800;
    font-size: clamp(40px, 5.2vw, 60px);
    line-height: 1.02;
    letter-spacing: -0.035em;
    margin: 0 0 10px;
    color: var(--so-text);
}
#section-dashboard[data-theme="sonoma"] .tl-hero-greet { font-weight: 800; }
#section-dashboard[data-theme="sonoma"] .tl-hero-name {
    font-style: normal;
    font-weight: 800;
    background: linear-gradient(135deg, var(--so-blue), var(--so-purple) 60%, var(--so-pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding: 0;
}
#section-dashboard[data-theme="sonoma"] .tl-hero-dot { color: var(--so-text); font-weight: 800; }
#section-dashboard[data-theme="sonoma"] .tl-hero-sub {
    font-family: var(--so-sans);
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    line-height: 1.45;
    color: var(--so-text-soft);
    margin: 0 0 22px;
    max-width: 640px;
    letter-spacing: -0.01em;
}
#section-dashboard[data-theme="sonoma"] .tl-hero-cta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
#section-dashboard[data-theme="sonoma"] .tl-btn {
    font-family: var(--so-sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.008em;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.32, 0.72, 0, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.55);
    color: var(--so-text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.05);
}
#section-dashboard[data-theme="sonoma"] .tl-btn:hover {
    background: rgba(255,255,255,0.85);
    transform: scale(1.02);
}
#section-dashboard[data-theme="sonoma"] .tl-btn:active { transform: scale(0.98); }
#section-dashboard[data-theme="sonoma"] .tl-btn-primary {
    background: linear-gradient(180deg, var(--so-blue), #0062cc);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0,122,255,0.35), 0 4px 12px rgba(0,122,255,0.25);
}
#section-dashboard[data-theme="sonoma"] .tl-btn-primary:hover {
    background: linear-gradient(180deg, #2a8cff, var(--so-blue));
}
#section-dashboard[data-theme="sonoma"] .tl-btn-arrow { transition: transform 0.18s cubic-bezier(0.32,0.72,0,1); }
#section-dashboard[data-theme="sonoma"] .tl-btn-primary:hover .tl-btn-arrow { transform: translateX(3px); }

/* ─── ROWS & COLUMNS ─── */
#section-dashboard[data-theme="sonoma"] .tl-row { margin-bottom: 28px; }
#section-dashboard[data-theme="sonoma"] .tl-row-split {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 20px;
    align-items: stretch;
}
#section-dashboard[data-theme="sonoma"] .tl-col {
    background: var(--so-card);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--so-border);
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: var(--so-shadow-1);
}

/* ─── SECTION HEAD ─── */
#section-dashboard[data-theme="sonoma"] .tl-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--so-border-inner);
}
#section-dashboard[data-theme="sonoma"] .tl-section-num {
    display: none; /* macOS doesn't use numbered labels */
}
#section-dashboard[data-theme="sonoma"] .tl-section-label {
    font-family: var(--so-sans);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.015em;
    text-transform: none;
    color: var(--so-text);
    flex: 1;
}
#section-dashboard[data-theme="sonoma"] .tl-link {
    font-family: var(--so-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--so-blue);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    letter-spacing: -0.01em;
}
#section-dashboard[data-theme="sonoma"] .tl-link:hover { background: rgba(0,122,255,0.1); }

/* ─── ACTIVITY FEED (Live Activity style) ─── */
#section-dashboard[data-theme="sonoma"] .tl-activity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 320px;
}
#section-dashboard[data-theme="sonoma"] .tl-activity > * {
    padding: 12px 14px;
    border-radius: 12px;
    background: transparent;
    border: none;
    font-family: var(--so-sans);
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--so-text);
    transition: background 0.15s;
    letter-spacing: -0.008em;
}
#section-dashboard[data-theme="sonoma"] .tl-activity > *:hover {
    background: rgba(0,0,0,0.03);
}
#section-dashboard[data-theme="sonoma"] .tl-activity:empty::before {
    content: 'Nu-s evenimente încă. Pornește un agent pentru activitate live.';
    font-family: var(--so-sans);
    font-style: normal;
    font-size: 14px;
    color: var(--so-text-faint);
    padding: 18px 14px;
    display: block;
}

/* ─── NUMBERS STACK (Control Center widget style) ─── */
#section-dashboard[data-theme="sonoma"] .tl-num-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#section-dashboard[data-theme="sonoma"] .tl-num-row {
    display: grid;
    grid-template-areas: "label trend" "big big";
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    padding: 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.18s cubic-bezier(0.32,0.72,0,1);
    text-decoration: none;
    color: var(--so-text);
    background: transparent;
}
#section-dashboard[data-theme="sonoma"] .tl-num-row:hover { background: rgba(0,0,0,0.04); }
#section-dashboard[data-theme="sonoma"] .tl-num-label {
    grid-area: label;
    font-family: var(--so-sans);
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: -0.008em;
    color: var(--so-text-soft);
}
#section-dashboard[data-theme="sonoma"] .tl-num-big {
    grid-area: big;
    font-family: var(--so-sans);
    font-weight: 700;
    font-size: 40px;
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--so-text);
    font-variant-numeric: tabular-nums;
    font-style: normal;
}
#section-dashboard[data-theme="sonoma"] .tl-num-row:hover .tl-num-big { font-style: normal; }
#section-dashboard[data-theme="sonoma"] .tl-num-trend {
    grid-area: trend;
    font-family: var(--so-sans);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--so-text-faint);
    text-align: right;
    font-style: normal;
}

/* ─── ACCESS GRID (Control Center quick tiles) ─── */
#section-dashboard[data-theme="sonoma"] .tl-access-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    border: none;
    padding: 0;
}
#section-dashboard[data-theme="sonoma"] .tl-access-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--so-border);
    border-radius: 18px;
    background: var(--so-card);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    text-decoration: none;
    color: var(--so-text);
    box-shadow: var(--so-shadow-1);
    position: relative;
    overflow: hidden;
}
#section-dashboard[data-theme="sonoma"] .tl-access-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--so-shadow-2);
    background: var(--so-card-strong);
}
#section-dashboard[data-theme="sonoma"] .tl-access-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--so-blue), var(--so-indigo));
    margin: 18px;
}
#section-dashboard[data-theme="sonoma"] .tl-access-card:nth-child(2)::before {
    background: linear-gradient(135deg, var(--so-pink), var(--so-orange));
}
#section-dashboard[data-theme="sonoma"] .tl-access-card:nth-child(3)::before {
    background: linear-gradient(135deg, var(--so-purple), var(--so-pink));
}
#section-dashboard[data-theme="sonoma"] .tl-access-card:nth-child(4)::before {
    background: linear-gradient(135deg, var(--so-green), var(--so-teal));
}
#section-dashboard[data-theme="sonoma"] .tl-access-num {
    display: none; /* replaced by the colored icon pill via ::before */
}
#section-dashboard[data-theme="sonoma"] .tl-access-title {
    font-family: var(--so-sans);
    font-weight: 700;
    font-size: 17px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--so-text);
    margin-top: 56px;
    font-style: normal;
}
#section-dashboard[data-theme="sonoma"] .tl-access-card:hover .tl-access-title { font-style: normal; }
#section-dashboard[data-theme="sonoma"] .tl-access-desc {
    font-family: var(--so-sans);
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--so-text-soft);
    letter-spacing: -0.006em;
}

/* ─── CHIP LIST (pill shape, iOS-like) ─── */
#section-dashboard[data-theme="sonoma"] .tl-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
#section-dashboard[data-theme="sonoma"] .tl-chip-list > * {
    font-family: var(--so-sans);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: -0.008em;
    color: var(--so-text);
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
}
#section-dashboard[data-theme="sonoma"] .tl-chip-list > *:hover {
    background: var(--so-blue);
    color: #fff;
}

/* ─── MINI GRID (extra stats) ─── */
#section-dashboard[data-theme="sonoma"] .tl-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
#section-dashboard[data-theme="sonoma"] .tl-mini-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    background: var(--so-card);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    border: 1px solid var(--so-border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.32,0.72,0,1);
    text-decoration: none;
    color: var(--so-text);
    box-shadow: var(--so-shadow-1);
}
#section-dashboard[data-theme="sonoma"] .tl-mini-cell:hover {
    transform: translateY(-1px);
    background: var(--so-card-strong);
}
#section-dashboard[data-theme="sonoma"] .tl-mini-label {
    font-family: var(--so-sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.008em;
    text-transform: none;
    color: var(--so-text-soft);
}
#section-dashboard[data-theme="sonoma"] .tl-mini-num {
    font-family: var(--so-sans);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--so-text);
    font-variant-numeric: tabular-nums;
    font-style: normal;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
    #section-dashboard[data-theme="sonoma"] {
        padding: 24px 18px 60px;
        margin: -20px -16px;
    }
    #section-dashboard[data-theme="sonoma"] .tl-row-split {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    #section-dashboard[data-theme="sonoma"] .tl-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    #section-dashboard[data-theme="sonoma"] .tl-mini-grid {
        grid-template-columns: 1fr;
    }
    #section-dashboard[data-theme="sonoma"] .tl-num-big { font-size: 34px; }
    #section-dashboard[data-theme="sonoma"] .tl-hero-title { font-size: 38px; }
}

/* Dark-mode support — iOS-like materials flip to dark */
@media (prefers-color-scheme: dark) {
    #section-dashboard[data-theme="sonoma"] {
        --so-card: rgba(28,28,30,0.72);
        --so-card-strong: rgba(28,28,30,0.88);
        --so-border: rgba(255,255,255,0.08);
        --so-border-inner: rgba(255,255,255,0.08);
        --so-text: #f5f5f7;
        --so-text-soft: rgba(235,235,245,0.60);
        --so-text-faint: rgba(235,235,245,0.35);
        background:
          radial-gradient(1200px 700px at 10% 0%, rgba(94,92,230,0.32) 0%, transparent 55%),
          radial-gradient(900px 600px at 95% 20%, rgba(255,55,95,0.22) 0%, transparent 60%),
          radial-gradient(1000px 800px at 85% 100%, rgba(0,122,255,0.24) 0%, transparent 55%),
          radial-gradient(700px 500px at 20% 90%, rgba(48,209,88,0.18) 0%, transparent 60%),
          #0a0a0c;
    }
    #section-dashboard[data-theme="sonoma"] .tl-btn {
        background: rgba(255,255,255,0.1);
        color: var(--so-text);
    }
    #section-dashboard[data-theme="sonoma"] .tl-chip-list > * {
        background: rgba(255,255,255,0.08);
        color: var(--so-text);
    }
    #section-dashboard[data-theme="sonoma"] .tl-activity > *:hover { background: rgba(255,255,255,0.06); }
    #section-dashboard[data-theme="sonoma"] .tl-num-row:hover { background: rgba(255,255,255,0.05); }
}

/* ═══════════════════════════════════════════════════════════════════
   SONOMA GLOBAL — app-wide macOS/iOS overrides
   All scoped via body[data-app-theme="sonoma"]. Remove that attribute
   from <body> to revert to the original styling. NO structural HTML
   changes required — only CSS, overriding existing selectors with
   higher specificity.
   ═══════════════════════════════════════════════════════════════════ */

body[data-app-theme="sonoma"] {
    /* Sonoma LIGHT — macOS Sonoma wallpaper aesthetic.
       We override platform CSS variables so existing rules reading from
       var(--ios-sidebar-bg), var(--bg-card) etc. resolve to light values. */
    --ios-sidebar-bg: rgba(251,251,253,0.72) !important;
    --ios-topbar-bg: rgba(245,245,247,0.72) !important;
    --bg-sidebar: rgba(251,251,253,0.72) !important;
    --bg-topbar: rgba(245,245,247,0.72) !important;

    --so-card: rgba(255,255,255,0.72);
    --so-card-strong: rgba(255,255,255,0.92);
    --so-border: rgba(255,255,255,0.7);
    --so-border-inner: rgba(0,0,0,0.06);
    --so-text: #1d1d1f;
    --so-text-soft: rgba(60,60,67,0.72);
    --so-text-faint: rgba(60,60,67,0.44);
    --so-blue: #007aff;
    --so-indigo: #5e5ce6;
    --so-purple: #af52de;
    --so-pink: #ff375f;
    --so-orange: #ff9500;
    --so-green: #30d158;
    --so-teal: #40c8e0;
    --so-red: #ff3b30;
    --so-yellow: #ffcc00;
    --so-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
    --so-shadow-1: 0 1px 1px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.06), 0 12px 24px rgba(0,0,0,0.05);
    --so-shadow-2: 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08), 0 32px 64px rgba(0,0,0,0.06);
    font-family: var(--so-sans);
    color: var(--so-text);
    /* macOS Sonoma LIGHT wallpaper — cinematic pastel smears */
    background:
      radial-gradient(1600px 1000px at 0% 0%, rgba(175,82,222,0.28) 0%, transparent 55%),
      radial-gradient(1400px 900px at 100% 5%, rgba(255,149,0,0.22) 0%, transparent 60%),
      radial-gradient(1500px 1000px at 100% 100%, rgba(0,122,255,0.32) 0%, transparent 55%),
      radial-gradient(1100px 800px at 0% 100%, rgba(48,209,88,0.26) 0%, transparent 60%),
      #f1eff6 !important;
    background-attachment: fixed;
    letter-spacing: -0.008em;
}

/* App shell transparent so wallpaper shows */
body[data-app-theme="sonoma"] .app-shell,
body[data-app-theme="sonoma"] .app-main {
    background: transparent !important;
}

/* ─── SIDEBAR — glass vibrant material (light) ─── */
body[data-app-theme="sonoma"] .sidebar {
    background: rgba(251,251,253,0.68) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    border-right: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: none !important;
}
body[data-app-theme="sonoma"] .sidebar .nav-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--so-text-faint) !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px 16px 6px !important;
}
body[data-app-theme="sonoma"] .nav-item {
    font-family: var(--so-sans) !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    letter-spacing: -0.01em !important;
    border-radius: 8px !important;
    padding: 7px 10px !important;
    color: #1d1d1f !important;
    background: transparent !important;
    border: none !important;
    transition: background 0.15s, transform 0.12s;
}
body[data-app-theme="sonoma"] .nav-item:hover {
    background: rgba(0,0,0,0.05) !important;
}
body[data-app-theme="sonoma"] .nav-item.active {
    background: linear-gradient(180deg, var(--so-blue), #0062cc) !important;
    color: #fff !important;
    box-shadow: 0 1px 2px rgba(0,122,255,0.35), 0 4px 12px rgba(0,122,255,0.18);
}
body[data-app-theme="sonoma"] .nav-item.active .nav-icon {
    color: #fff !important;
}
body[data-app-theme="sonoma"] .nav-module-header {
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: #1d1d1f !important;
    background: transparent !important;
    border-radius: 8px !important;
}
body[data-app-theme="sonoma"] .nav-module-header:hover {
    background: rgba(0,0,0,0.05) !important;
}
body[data-app-theme="sonoma"] .nav-module-items .nav-item {
    font-size: 12.5px !important;
    padding: 5px 10px 5px 32px !important;
}
/* Brand card at the top of sidebar */
body[data-app-theme="sonoma"] .sidebar-brand,
body[data-app-theme="sonoma"] .sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

/* ─── TOPBAR — thin glass bar (light) ─── */
body[data-app-theme="sonoma"] .topbar {
    background: rgba(245,245,247,0.72) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: none !important;
}

/* ─── SECTIONS — neutral transparent base ─── */
body[data-app-theme="sonoma"] .section {
    background: transparent;
    color: var(--so-text);
}
body[data-app-theme="sonoma"] .section-header {
    background: transparent;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
body[data-app-theme="sonoma"] .section-title {
    font-family: var(--so-sans) !important;
    font-weight: 700 !important;
    font-size: clamp(28px, 3.5vw, 36px) !important;
    letter-spacing: -0.025em !important;
    color: var(--so-text) !important;
}
body[data-app-theme="sonoma"] .section-subtitle {
    font-family: var(--so-sans) !important;
    font-size: 15px !important;
    color: var(--so-text-soft) !important;
    letter-spacing: -0.008em !important;
    font-weight: 400;
}

/* ─── CARDS — frosted glass (light) ─── */
body[data-app-theme="sonoma"] .card,
body[data-app-theme="sonoma"] .stat-card,
body[data-app-theme="sonoma"] .plan-status-card,
body[data-app-theme="sonoma"] .agent-card {
    background: rgba(255,255,255,0.72) !important;
    backdrop-filter: blur(30px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
    border: 1px solid rgba(255,255,255,0.7) !important;
    border-radius: 18px !important;
    box-shadow: 0 1px 1px rgba(0,0,0,0.03), 0 2px 8px rgba(0,0,0,0.05), 0 12px 36px rgba(0,0,0,0.06) !important;
    color: #1d1d1f !important;
    transition: transform 0.25s cubic-bezier(0.32,0.72,0,1), box-shadow 0.25s, background 0.2s;
}
body[data-app-theme="sonoma"] .card:hover,
body[data-app-theme="sonoma"] .stat-card:hover {
    background: rgba(255,255,255,0.92) !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.1), 0 32px 72px rgba(0,0,0,0.08) !important;
}
body[data-app-theme="sonoma"] .card-header {
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding-bottom: 14px;
    margin-bottom: 16px;
}
body[data-app-theme="sonoma"] .card-title {
    font-family: var(--so-sans) !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    letter-spacing: -0.015em !important;
    color: var(--so-text) !important;
}

/* ─── BUTTONS — iOS style ─── */
body[data-app-theme="sonoma"] .btn {
    font-family: var(--so-sans) !important;
    font-weight: 600 !important;
    letter-spacing: -0.008em !important;
    border-radius: 10px !important;
    transition: transform 0.12s cubic-bezier(0.32,0.72,0,1), background 0.18s, box-shadow 0.18s;
}
body[data-app-theme="sonoma"] .btn:active {
    transform: scale(0.97);
}
body[data-app-theme="sonoma"] .btn-primary {
    background: linear-gradient(180deg, var(--so-blue), #0062cc) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0,122,255,0.35), 0 4px 12px rgba(0,122,255,0.22) !important;
}
body[data-app-theme="sonoma"] .btn-primary:hover {
    background: linear-gradient(180deg, #2a8cff, var(--so-blue)) !important;
    transform: translateY(-1px);
}
body[data-app-theme="sonoma"] .btn-ghost {
    background: rgba(255,255,255,0.6) !important;
    color: #1d1d1f !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
}
body[data-app-theme="sonoma"] .btn-ghost:hover {
    background: rgba(255,255,255,0.9) !important;
}
body[data-app-theme="sonoma"] .btn-danger {
    background: linear-gradient(180deg, var(--so-red), #d70015) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(255,59,48,0.35), 0 4px 12px rgba(255,59,48,0.22) !important;
}
body[data-app-theme="sonoma"] .btn-sm {
    font-size: 13px !important;
    padding: 7px 12px !important;
    border-radius: 8px !important;
}
body[data-app-theme="sonoma"] .btn-lg {
    font-size: 15px !important;
    padding: 12px 22px !important;
    border-radius: 12px !important;
}

/* ─── INPUTS — iOS rounded (light) ─── */
body[data-app-theme="sonoma"] input[type="text"],
body[data-app-theme="sonoma"] input[type="email"],
body[data-app-theme="sonoma"] input[type="url"],
body[data-app-theme="sonoma"] input[type="number"],
body[data-app-theme="sonoma"] input[type="password"],
body[data-app-theme="sonoma"] input[type="search"],
body[data-app-theme="sonoma"] select,
body[data-app-theme="sonoma"] textarea {
    font-family: var(--so-sans) !important;
    font-size: 14px !important;
    background: rgba(255,255,255,0.7) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 10px !important;
    color: #1d1d1f !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}
body[data-app-theme="sonoma"] input:focus,
body[data-app-theme="sonoma"] select:focus,
body[data-app-theme="sonoma"] textarea:focus {
    outline: none;
    border-color: var(--so-blue) !important;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15) !important;
}

/* ─── MODALS — vibrancy sheet (light) ─── */
body[data-app-theme="sonoma"] .modal-overlay {
    background: rgba(0,0,0,0.35) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
body[data-app-theme="sonoma"] .modal {
    background: rgba(252,252,254,0.9) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    border: 1px solid rgba(255,255,255,0.6) !important;
    border-radius: 20px !important;
    color: #1d1d1f !important;
    box-shadow: 0 24px 48px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.06) !important;
}
body[data-app-theme="sonoma"] .modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}
body[data-app-theme="sonoma"] .modal-close {
    background: rgba(0,0,0,0.06) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    color: rgba(60,60,67,0.7) !important;
}
body[data-app-theme="sonoma"] .modal-close:hover {
    background: rgba(0,0,0,0.12) !important;
}

/* ─── BADGES & CHIPS — pill iOS ─── */
body[data-app-theme="sonoma"] .badge {
    font-family: var(--so-sans) !important;
    font-weight: 500 !important;
    font-size: 11.5px !important;
    letter-spacing: -0.005em !important;
    border-radius: 12px !important;
    padding: 3px 9px !important;
}

/* ─── TABLES — clean (light) ─── */
body[data-app-theme="sonoma"] table {
    font-family: var(--so-sans) !important;
    font-size: 14px !important;
    color: #1d1d1f !important;
}
body[data-app-theme="sonoma"] table th {
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: none !important;
    letter-spacing: -0.008em !important;
    color: rgba(60,60,67,0.7) !important;
    border-bottom: 1px solid rgba(0,0,0,0.08) !important;
}
body[data-app-theme="sonoma"] table td {
    border-bottom: 1px solid rgba(0,0,0,0.04) !important;
}

/* ─── SCROLLBAR — macOS thin overlay (light) ─── */
body[data-app-theme="sonoma"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
body[data-app-theme="sonoma"] ::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
body[data-app-theme="sonoma"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.35);
    background-clip: padding-box;
    border: 2px solid transparent;
}
body[data-app-theme="sonoma"] ::-webkit-scrollbar-track {
    background: transparent;
}

/* ─── ANCHORS / LINKS — systemBlue ─── */
body[data-app-theme="sonoma"] a:not(.btn):not(.nav-item):not(.dispatch-classified):not(.tl-num-row):not(.tl-access-card):not(.tl-mini-cell):not(.dash-action) {
    color: var(--so-blue);
}
body[data-app-theme="sonoma"] a:not(.btn):not(.nav-item):not(.dispatch-classified):not(.tl-num-row):not(.tl-access-card):not(.tl-mini-cell):not(.dash-action):hover {
    text-decoration: underline;
}

/* ─── TOAST — glass notification ─── */
body[data-app-theme="sonoma"] .toast {
    background: rgba(28,28,30,0.88) !important;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 12px !important;
    color: #fff !important;
    font-family: var(--so-sans) !important;
    font-weight: 500 !important;
    letter-spacing: -0.008em !important;
}

/* Sonoma LIGHT — force text colors to light-mode values regardless of any
   conflicting data-theme="dark" rules that might linger. Last word in cascade. */
body[data-app-theme="sonoma"] .section-title,
body[data-app-theme="sonoma"] .card-title,
body[data-app-theme="sonoma"] .nav-item,
body[data-app-theme="sonoma"] .nav-module-header {
    color: #1d1d1f !important;
}
body[data-app-theme="sonoma"] .section-subtitle,
body[data-app-theme="sonoma"] .bento-label,
body[data-app-theme="sonoma"] .stat-label {
    color: rgba(60,60,67,0.72) !important;
}

/* ─── CINEMATIC: staggered page reveal for cards ─── */
@keyframes soCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
body[data-app-theme="sonoma"] .card,
body[data-app-theme="sonoma"] .stat-card,
body[data-app-theme="sonoma"] .tl-col,
body[data-app-theme="sonoma"] .tl-access-card,
body[data-app-theme="sonoma"] .tl-mini-cell,
body[data-app-theme="sonoma"] .tl-hero {
    animation: soCardIn 0.6s cubic-bezier(0.32, 0.72, 0, 1) both;
}
body[data-app-theme="sonoma"] .tl-hero { animation-delay: 0.05s; }
body[data-app-theme="sonoma"] .tl-row:nth-of-type(1) .tl-col:nth-child(1) { animation-delay: 0.12s; }
body[data-app-theme="sonoma"] .tl-row:nth-of-type(1) .tl-col:nth-child(2) { animation-delay: 0.18s; }
body[data-app-theme="sonoma"] .tl-access-card:nth-child(1) { animation-delay: 0.24s; }
body[data-app-theme="sonoma"] .tl-access-card:nth-child(2) { animation-delay: 0.30s; }
body[data-app-theme="sonoma"] .tl-access-card:nth-child(3) { animation-delay: 0.36s; }
body[data-app-theme="sonoma"] .tl-access-card:nth-child(4) { animation-delay: 0.42s; }

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    body[data-app-theme="sonoma"] *,
    body[data-app-theme="sonoma"] *::before,
    body[data-app-theme="sonoma"] *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   FORCE-LIGHT — dark mode removed from the platform per product direction.
   Any rule under [data-theme="dark"] is neutralized here by re-applying
   the light palette with !important. initTheme() also sets html[data-theme]
   to "light" on every load. Kept as a safety net.
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] {
    /* Re-point the dark palette to light values so stale localStorage can't
       flash a dark screen before JS runs. */
    --ios-bg: #F5F5F7 !important;
    --ios-bg-2: #FBFBFD !important;
    --ios-paper: #FFFFFF !important;
    --ios-sidebar-bg: rgba(251, 251, 253, 0.72) !important;
    --ios-topbar-bg: rgba(245, 245, 247, 0.72) !important;
    --ios-label: #1D1D1F !important;
    --ios-label-2: #424245 !important;
    --ios-label-3: #6E6E73 !important;
    --ios-label-4: #86868B !important;
    --ios-divider: #D2D2D7 !important;
    --ios-divider-soft: rgba(60, 60, 67, 0.12) !important;
    --bg-app: #F5F5F7 !important;
    --bg-sidebar: rgba(251, 251, 253, 0.72) !important;
    --bg-topbar: rgba(245, 245, 247, 0.72) !important;
    --bg-card: #FFFFFF !important;
    --bg-elevated: #FFFFFF !important;
    --bg-input: #FFFFFF !important;
    --bg-hover: rgba(120, 120, 128, 0.08) !important;
    --bg-active: rgba(120, 120, 128, 0.12) !important;
    --text-primary: #1D1D1F !important;
    --text-secondary: #424245 !important;
    --text-muted: #6E6E73 !important;
    --text-dim: #86868B !important;
    --border: rgba(60, 60, 67, 0.12) !important;
    --border-strong: #D2D2D7 !important;
    --border-hairline: rgba(60, 60, 67, 0.12) !important;
}

/* Hide ONLY the theme-toggle button since dark mode is disabled.
   Other buttons share class .theme-toggle (e.g. logout), so target by the
   specific onclick handler instead. */
button[onclick*="toggleTheme"],
button[onclick*="switchTheme"] {
    display: none !important;
}

/* Apple Search Ads — Mod Agresiv badge pulse */
@keyframes appleAggressivePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
    50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}


/* ═══════════════════════════════════════════════════════════
   SIDEBAR ICON PILLS — iOS Settings style 2026
   gradient colored square + WHITE icon (clean, premium look)
   ═══════════════════════════════════════════════════════════ */

/* Base pill: 28x28 rounded gradient square, white icon centered */
.sidebar .nav-icon {
    width: 28px !important;
    height: 28px !important;
    padding: 5.5px !important;
    border-radius: 7px !important;
    color: #ffffff !important;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.15);
    /* default — fallback if a row doesn't match a specific selector */
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

/* Per-item gradients — premium iOS-style */
.sidebar .nav-item[data-nav="dashboard"] .nav-icon  { background: linear-gradient(135deg, #6366f1, #4338ca); }
.sidebar .nav-item[data-nav="agents"] .nav-icon     { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.sidebar .nav-module[data-module="email"] .nav-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.sidebar .nav-module[data-module="sms"] .nav-icon    { background: linear-gradient(135deg, #22c55e, #15803d); }
.sidebar .nav-module[data-module="content"] .nav-icon { background: linear-gradient(135deg, #ec4899, #be185d); }
.sidebar .nav-module[data-module="seo"] .nav-icon   { background: linear-gradient(135deg, #10b981, #047857); }
.sidebar .nav-module[data-module="bot"] .nav-icon   { background: linear-gradient(135deg, #f97316, #c2410c); }
.sidebar .nav-module[data-module="analytics"] .nav-icon { background: linear-gradient(135deg, #06b6d4, #0e7490); }
.sidebar .nav-item[data-nav="ads-google"] .nav-icon { background: linear-gradient(135deg, #4285F4, #1a73e8); }
.sidebar .nav-item[data-nav="ads-apple"] .nav-icon  { background: linear-gradient(135deg, #007AFF, #0040c1); }
.sidebar .nav-item[data-nav="contacts"] .nav-icon   { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.sidebar .nav-item[data-nav="sources"] .nav-icon    { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.sidebar .nav-item[data-nav="products"] .nav-icon   { background: linear-gradient(135deg, #f59e0b, #b45309); }
.sidebar .nav-item[data-nav="lab"] .nav-icon        { background: linear-gradient(135deg, #d946ef, #a21caf); }
.sidebar .nav-item[data-nav="wallet"] .nav-icon     { background: linear-gradient(135deg, #10b981, #047857); }
.sidebar .nav-item[data-nav="settings"] .nav-icon   { background: linear-gradient(135deg, #64748b, #334155); }
.sidebar .nav-item[data-nav="team"] .nav-icon       { background: linear-gradient(135deg, #6366f1, #4338ca); }
.sidebar .nav-item[data-nav="developer"] .nav-icon  { background: linear-gradient(135deg, #4b5563, #1f2937); }
.sidebar .nav-item[data-nav="admin"] .nav-icon      { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* Hover — subtle scale, no color change */
.sidebar .nav-item:hover .nav-icon,
.sidebar .nav-module-header:hover .nav-icon {
    transform: scale(1.06);
    box-shadow: 0 3px 8px rgba(0,0,0,0.14), inset 0 1px 0 rgba(255,255,255,0.18);
}

/* Active — keep gradient but with stronger shadow */
.sidebar .nav-item.active .nav-icon,
.sidebar .nav-module.has-active .nav-module-header .nav-icon {
    box-shadow: 0 2px 6px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.20);
}

/* Override any inline color attributes that might interfere */
.sidebar .nav-icon[style*="color"] {
    color: #ffffff !important;
}

/* Sub-items inside expanded modules — keep them text-only (no pills, no icons) */
.sidebar .nav-module-items .nav-icon,
.sidebar .nav-module-items .nav-item .nav-icon {
    display: none !important;
}

/* Chevron — subtle gray triangle, only visible on hover */
.sidebar .nav-module-chev {
    width: 14px !important;
    height: 14px !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: var(--text-muted) !important;
    opacity: 0.4;
    flex-shrink: 0;
    margin-left: auto;
    transition: opacity 0.18s ease, transform 0.25s ease;
}

.sidebar .nav-module-header:hover .nav-module-chev,
.sidebar .nav-module.expanded .nav-module-chev {
    opacity: 0.85;
}

.sidebar .nav-module.expanded .nav-module-chev {
    transform: rotate(90deg);
}

/* Wallet balance — clean text, no pill */
#navWalletBalance {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
}


/* Hide module chevrons completely — user prefers no arrows after text */
.sidebar .nav-module-chev { display: none !important; }


/* ═══════════════════════════════════════════════════════════════════════
   ▼▼▼ DASHBOARD 2026 PROTOTYPE — modern, clean, mobile-first ▼▼▼
   ═══════════════════════════════════════════════════════════════════════ */

/* MOBILE TOPBAR FIX — collapse non-essential icons into a dropdown menu */
@media (max-width: 768px) {
    /* Hide secondary topbar items on mobile */
    .topbar-bell,
    .topbar-copilot,
    #walletNav,
    .topbar-wallet,
    .topbar-greeting {
        display: none !important;
    }
    /* Compact a single icon button instead — opens a sheet with all options */
    .topbar-mobile-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: rgba(0,0,0,0.05);
        border: 1px solid rgba(0,0,0,0.08);
        color: var(--text-primary);
        cursor: pointer;
        margin-left: auto;
    }
    .topbar-mobile-menu:hover { background: var(--bg-hover); }

    /* Topbar tighter spacing */
    .topbar { padding: 0 14px !important; min-height: 56px; }
}
.topbar-mobile-menu { display: none; }

/* ─── Dashboard 2026 — global card upgrade ─── */
.dash26 {
    --card-radius: 16px;
    --card-padding: 22px;
    --card-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 2px 4px rgba(0,0,0,0.06), 0 12px 28px rgba(0,0,0,0.08);
}
/* Only show flex layout when section is active — otherwise inherit section visibility */
.section.dash26.active {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 1280px;
    margin: 0 auto;
}

/* Hero — clean greeting */
.dash26-hero {
    padding: 28px 26px 22px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 8%, var(--bg-card)),
        var(--bg-card) 60%);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
}
.dash26-hero-greeting {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    line-height: 1.1;
}
.dash26-hero-greeting .wave { display: inline-block; animation: wave 2.5s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(15deg); } 75% { transform: rotate(-10deg); } }
.dash26-hero-sub { font-size: 14.5px; color: var(--text-secondary); margin: 0 0 18px; line-height: 1.55; }
.dash26-hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.dash26-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.18s ease;
}
.dash26-btn:hover { transform: translateY(-1px); box-shadow: var(--card-shadow-hover); }
.dash26-btn-primary {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}
.dash26-btn-primary:hover { box-shadow: 0 6px 18px var(--accent-glow); }

/* KPI grid — clean, tabular, with delta */
.dash26-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.dash26-kpi {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: 18px 20px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash26-kpi:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.dash26-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 17px;
    margin-bottom: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.dash26-kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.dash26-kpi-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.1;
}
.dash26-kpi-trend {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.dash26-kpi-trend.up { color: #10b981; }
.dash26-kpi-trend.down { color: #ef4444; }

/* 2-col split row for activity + access */
.dash26-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
}
.dash26-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}
.dash26-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.dash26-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}
.dash26-card-link {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}
.dash26-card-link:hover { text-decoration: underline; }

/* Activity feed inside card */
.dash26-activity {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}
.dash26-activity::-webkit-scrollbar { width: 4px; }
.dash26-activity::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.dash26-activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-input);
    transition: background 0.15s;
}
.dash26-activity-item:hover { background: var(--bg-hover); }
.dash26-activity-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, black));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}
.dash26-activity-body { flex: 1; min-width: 0; }
.dash26-activity-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.45;
    margin: 0 0 2px;
}
.dash26-activity-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Quick access — colored gradient cards */
.dash26-quick {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.dash26-quick-card {
    position: relative;
    padding: 16px 14px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.18s ease;
    overflow: hidden;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: none;
    text-align: left;
}
.dash26-quick-card:hover { transform: translateY(-2px) scale(1.01); box-shadow: var(--card-shadow-hover); }
.dash26-quick-card-icon { font-size: 22px; }
.dash26-quick-card-title { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.dash26-quick-card-desc { font-size: 11px; opacity: 0.85; margin-top: 2px; }

.dash26-quick-card.bg-purple { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.dash26-quick-card.bg-pink   { background: linear-gradient(135deg, #ec4899, #be185d); }
.dash26-quick-card.bg-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.dash26-quick-card.bg-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.dash26-quick-card.bg-orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.dash26-quick-card.bg-cyan   { background: linear-gradient(135deg, #06b6d4, #0e7490); }

/* Chip lists for categories/locations */
.dash26-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.dash26-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}
.dash26-chip:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.dash26-chip-count {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .dash26-kpis { grid-template-columns: repeat(2, 1fr); }
    .dash26-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .dash26-hero { padding: 22px 18px 18px; }
    .dash26-hero-greeting { font-size: 22px; }
    .dash26-hero-sub { font-size: 13px; }
    .dash26-kpi { padding: 14px 16px; }
    .dash26-kpi-value { font-size: 22px; }
    .dash26-card { padding: 16px; }
    .dash26-quick { grid-template-columns: 1fr; }
}


/* Map legacy chip rendering inside dash26 to new chip style */
.dash26-chip-grid .category-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: 18px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    user-select: none;
}
.dash26-chip-grid .category-item:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.dash26-chip-grid .category-name { font-weight: 500; }
.dash26-chip-grid .category-count {
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 11px;
}


/* ═══════════════════════════════════════════════════════════════════════
   ▼▼▼ GLOBAL DESIGN TOKENS UNIFICATION 2026-04-28 ▼▼▼
   Upgrades existing .card, .section-header, .dash-kpi, .btn-* across ALL pages
   to match dash26 prototype. Targeted overrides — no HTML changes needed.
   ═══════════════════════════════════════════════════════════════════════ */

/* --- Section headers (page hero) --- */
.section .section-header {
    padding: 24px 26px 20px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 6%, var(--bg-card)),
        var(--bg-card) 70%);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04);
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.section .section-header.section-header-compact { padding: 18px 22px 16px; }

.section .section-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
    line-height: 1.15;
    color: var(--text-primary);
}
.section .section-subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

/* --- Cards globally upgraded --- */
.section .card {
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04);
    background: var(--bg-card);
    transition: box-shadow 0.18s ease;
}
.section .card:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 12px 28px rgba(0,0,0,0.08);
}

/* --- Dashboard KPI grid (used across many pages) --- */
.section .dash-kpi {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.section .dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.06), 0 12px 24px rgba(0,0,0,0.08);
}
.section .dash-kpi .kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.section .dash-kpi .kpi-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 0;
}

/* --- Buttons unified --- */
.section .btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.18s ease;
    letter-spacing: -0.005em;
}
.section .btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.section .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--accent-glow);
}
.section .btn-secondary,
.section .btn-ghost {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.section .btn-secondary:hover,
.section .btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

/* --- Toolbar/action rows: more breathing room --- */
.section .toolbar,
.section .action-bar,
.section [class*="-toolbar"] {
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Tables in cards: clean modern look --- */
.section .card table {
    font-size: 13px;
}
.section .card table thead {
    background: var(--bg-input);
}
.section .card table thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
}
.section .card table tbody td {
    padding: 10px 12px;
}
.section .card table tbody tr {
    transition: background 0.12s;
}
.section .card table tbody tr:hover {
    background: var(--bg-hover);
}

/* --- Empty states: friendlier --- */
.section [id$="EmptyState"] .card,
.section .empty-state {
    border-radius: 18px !important;
}

/* Mobile: section headers tighter */
@media (max-width: 768px) {
    .section .section-header { padding: 18px 18px 14px; }
    .section .section-title { font-size: 20px; }
    .section .section-subtitle { font-size: 12.5px; }
    .section .card { padding: 16px !important; }
    .section .dash-kpi { padding: 12px 14px; }
    .section .dash-kpi .kpi-value { font-size: 18px; }
}



/* ═══════════════════════════════════════════════════════════════════════
   ▼▼▼ MOBILE-FIRST GLOBAL FIXES 2026-04-28 — applies to ALL pages ▼▼▼
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* ─── Section headers on mobile: tighter, no overlap ─── */
    .section .section-header {
        padding: 16px 16px 12px !important;
        margin-bottom: 12px !important;
        border-radius: 14px !important;
    }
    .section .section-title {
        font-size: 19px !important;
        line-height: 1.2;
    }
    .section .section-subtitle {
        font-size: 12.5px !important;
        line-height: 1.45;
    }

    /* ─── Action rows: horizontal scroll instead of wrap stack ─── */
    .section [class*="-toolbar"],
    .section [class*="-actions"]:not(.modal-footer):not(.dash26-hero-cta),
    .section .toolbar,
    /* Generic action row pattern: horizontal flex with multiple buttons */
    .section [style*="display:flex"][style*="gap"][style*="flex-wrap"] {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scroll-snap-type: x proximity;
    }
    .section [class*="-toolbar"]::-webkit-scrollbar,
    .section .toolbar::-webkit-scrollbar { display: none; }

    .section [class*="-toolbar"] > *,
    .section .toolbar > * {
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    /* ─── Cards: tighter padding ─── */
    .section .card {
        padding: 14px !important;
        margin-bottom: 10px;
    }
    .section .card[style*="padding"] { padding: 14px !important; }

    /* ─── KPI grids: 2 per row on phone ─── */
    .section .dash-grid,
    .section .dash26-kpis,
    .section .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .section .dash-kpi,
    .section .dash26-kpi {
        padding: 10px 12px !important;
        min-height: auto;
    }
    .section .dash-kpi .kpi-value,
    .section .dash26-kpi-value { font-size: 16px !important; }
    .section .dash-kpi .kpi-label,
    .section .dash26-kpi-label { font-size: 10px !important; }

    /* ─── Charts shrink ─── */
    .section canvas { max-height: 180px !important; }
    .section [class*="-chart-"] canvas { max-height: 160px !important; }

    /* ─── Tables: enable horizontal scroll inside cards ─── */
    .section .card > table,
    .section table {
        font-size: 11.5px;
    }
    .section .card > div[style*="overflow"] table,
    .section [style*="overflow-x"] table {
        min-width: 600px; /* trigger scroll on phone */
    }
    .section table th,
    .section table td {
        padding: 7px 8px !important;
        white-space: nowrap;
    }
    /* First column: keep visible/sticky on horizontal scroll */
    .section table thead th:first-child,
    .section table tbody td:first-child {
        position: sticky;
        left: 0;
        background: var(--bg-card);
        z-index: 2;
    }
    .section table thead th:first-child { background: var(--bg-input); }

    /* ─── Modals: fullscreen sheet ─── */
    .modal-overlay {
        padding: 0 !important;
        align-items: stretch !important;
    }
    .modal {
        max-width: 100vw !important;
        max-height: 100vh !important;
        height: 100vh !important;
        width: 100vw !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column;
    }
    .modal-header {
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
        border-bottom: 1px solid var(--border);
        padding: 14px 18px !important;
    }
    .modal-header h3 { font-size: 16px !important; }
    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px !important;
    }
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        padding: 12px 18px !important;
        flex-wrap: wrap;
    }
    .modal-footer .btn { flex: 1; min-height: 42px; }

    /* ─── Forms inputs: prevent iOS zoom + bigger taps ─── */
    .section input[type="text"],
    .section input[type="email"],
    .section input[type="number"],
    .section input[type="search"],
    .section input[type="tel"],
    .section input[type="url"],
    .section input[type="password"],
    .section select,
    .section textarea,
    .modal input,
    .modal select,
    .modal textarea {
        font-size: 16px !important;
        min-height: 42px;
        padding: 10px 12px;
    }
    .section textarea { min-height: 80px; }

    /* ─── Buttons: bigger taps ─── */
    .section .btn,
    .section button {
        min-height: 40px;
    }
    .section .btn-sm { min-height: 34px; padding: 6px 10px; }

    /* ─── Account selectors / dropdowns: full width ─── */
    .section select[class*="Acct"],
    .section select[id*="Acct"],
    .section select[id*="Select"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* ─── Filter rows wrap to column ─── */
    .section .filter-bar,
    .section [class*="filter-row"] {
        flex-direction: column;
        align-items: stretch !important;
    }
    .section .filter-bar > *,
    .section [class*="filter-row"] > * {
        width: 100%;
    }

    /* ─── Multi-column grids → 1 column ─── */
    .section .grid-2,
    .section .grid-3,
    .section .grid-4,
    .section [style*="grid-template-columns:1fr 1fr"]:not(.dash26-kpis) {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* ─── Charts row: stack vertically ─── */
    .section [style*="grid-template-columns:1fr 1fr"][style*="gap:14px"] {
        grid-template-columns: 1fr !important;
    }

    /* ─── Page detail headers (e.g. campaign detail): wrap ─── */
    .section [style*="display:flex"][style*="align-items:center"][style*="margin-bottom:18px"] {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    /* ─── Notification toasts: stack at bottom, not top right ─── */
    .toast-stack,
    [class*="toast-container"] {
        bottom: 12px !important;
        right: 12px !important;
        left: 12px !important;
        max-width: none !important;
        top: auto !important;
    }

    /* ─── App content padding ─── */
    .content {
        padding: 12px !important;
    }
}

/* ─── Small phones (≤ 380px) ─── */
@media (max-width: 380px) {
    .section .dash-grid,
    .section .dash26-kpis,
    .section .kpi-grid {
        grid-template-columns: 1fr !important;
    }
    .section .section-title { font-size: 17px !important; }
    .section .dash26-hero-greeting { font-size: 20px !important; }
    .section .card { padding: 12px !important; }
    .modal-header h3 { font-size: 15px !important; }
}



/* ═══════════════════════════════════════════════════════════════════════
   ▼▼▼ AGGRESSIVE VISUAL UPGRADE 2026-04-28 ▼▼▼
   Forces dash26 visual style on ALL pages — overrides inline styles too
   ═══════════════════════════════════════════════════════════════════════ */

/* Apply dash26 layout to ALL sections (not just dashboard) */
.section.active {
    max-width: 1280px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Section header → hero style on every page */
.section .section-header {
    padding: 26px 28px 22px !important;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 7%, var(--bg-card)),
        var(--bg-card) 65%) !important;
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04) !important;
    margin-bottom: 18px !important;
}
.section .section-header > * { margin-top: 0; }

.section .section-title {
    font-size: 26px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    margin: 0 0 6px !important;
    line-height: 1.15 !important;
    color: var(--text-primary) !important;
}
.section .section-subtitle {
    font-size: 14px !important;
    color: var(--text-secondary) !important;
    margin: 0 !important;
    line-height: 1.55 !important;
    max-width: 720px;
}

/* All cards modernized */
.section .card {
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04) !important;
    background: var(--bg-card) !important;
    transition: box-shadow 0.18s ease, transform 0.18s ease !important;
}
/* Don't double-card hovers if section already has its own */
.section .card:not([class*="dash-kpi"]):hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 12px 28px rgba(0,0,0,0.08) !important;
}

/* KPI cards — modern look */
.section .dash-kpi {
    background: var(--bg-card) !important;
    border-radius: 14px !important;
    padding: 16px 18px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04) !important;
    transition: box-shadow 0.18s ease, transform 0.18s ease !important;
}
.section .dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.06), 0 12px 24px rgba(0,0,0,0.08) !important;
}
.section .dash-kpi .kpi-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    margin: 0 0 4px !important;
}
.section .dash-kpi .kpi-value {
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    font-variant-numeric: tabular-nums !important;
    color: var(--text-primary) !important;
    line-height: 1.1 !important;
    margin: 0 !important;
}

/* Buttons (all sizes) */
.section .btn {
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.18s ease !important;
}
.section .btn-primary {
    background: var(--accent-gradient) !important;
    color: white !important;
    border: none !important;
}
.section .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--accent-glow) !important;
}
.section .btn-secondary {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}
.section .btn-secondary:hover { background: var(--bg-hover) !important; }
.section .btn-ghost {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: 1px solid transparent !important;
}
.section .btn-ghost:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* Modal headers — modern */
.modal-header {
    padding: 16px 22px !important;
    border-bottom: 1px solid var(--border) !important;
}
.modal-header h3 {
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
}
.modal {
    border-radius: 18px !important;
    box-shadow: 0 24px 60px rgba(0,0,0,0.20) !important;
}

/* Tables polished */
.section table {
    border-collapse: separate !important;
    border-spacing: 0;
}
.section table thead th {
    background: var(--bg-input) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 11px 14px !important;
    border-bottom: 1px solid var(--border);
}
.section table tbody td {
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--border);
}
.section table tbody tr:last-child td { border-bottom: none; }
.section table tbody tr {
    transition: background 0.12s !important;
}
.section table tbody tr:hover {
    background: var(--bg-hover) !important;
}

/* Empty states — friendlier */
.section [id$="EmptyState"] .card,
.section .empty-state {
    border-radius: 20px !important;
    padding: 48px 32px !important;
}

/* CRM panels */
.section .crm-panel {
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04) !important;
}

/* Settings nav */
.section .settings-nav {
    border-radius: 14px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}
.section .settings-nav-item {
    border-radius: 8px !important;
}
.section .settings-main {
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04) !important;
}



/* ═══════════════════════════════════════════════════════════════════════
   SONOMA OVERRIDE 2026-04-28 — beat Sonoma theme specificity
   ═══════════════════════════════════════════════════════════════════════ */

body[data-app-theme="sonoma"] .section .section-header,
body[data-app-theme="sonoma"] .section-header {
    padding: 26px 28px 22px !important;
    background: linear-gradient(135deg,
        rgba(99,102,241,0.07),
        var(--bg-card, #fff) 65%) !important;
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04) !important;
    margin-bottom: 18px !important;
    padding-bottom: 22px !important;
}

body[data-app-theme="sonoma"] .section .section-title,
body[data-app-theme="sonoma"] .section-title {
    font-size: 26px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.15 !important;
    margin: 0 0 6px !important;
    color: var(--text-primary) !important;
}

body[data-app-theme="sonoma"] .section .section-subtitle,
body[data-app-theme="sonoma"] .section-subtitle {
    font-size: 14px !important;
    line-height: 1.55 !important;
    color: var(--text-secondary) !important;
    margin: 0 !important;
}

body[data-app-theme="sonoma"] .section .card,
body[data-app-theme="sonoma"] .card {
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.04) !important;
}

body[data-app-theme="sonoma"] .section .dash-kpi,
body[data-app-theme="sonoma"] .dash-kpi {
    border-radius: 14px !important;
    padding: 16px 18px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04) !important;
}

body[data-app-theme="sonoma"] .section .btn-primary,
body[data-app-theme="sonoma"] .btn-primary {
    background: var(--accent-gradient) !important;
    color: white !important;
    border: none !important;
    border-radius: 10px !important;
}

body[data-app-theme="sonoma"] .modal {
    border-radius: 18px !important;
}



/* ═══════════════════════════════════════════════════════════════════════
   ▼▼▼ MODERN 2026 THEME — replaces Sonoma — DRAMATICALLY visible ▼▼▼
   ═══════════════════════════════════════════════════════════════════════ */

body[data-app-theme="modern2026"] {
    background: var(--bg-app);
}

/* Section headers — gradient hero card on EVERY page */
body[data-app-theme="modern2026"] .section-header {
    padding: 28px 30px 24px !important;
    margin-bottom: 22px !important;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%) !important;
    background-size: 200% 200% !important;
    border: none !important;
    border-radius: 20px !important;
    box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.35), 0 4px 12px rgba(0,0,0,0.06) !important;
    position: relative;
    overflow: hidden;
    animation: heroShine 12s ease-in-out infinite;
}

@keyframes heroShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body[data-app-theme="modern2026"] .section-header::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 19px;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card) 100%);
    z-index: 0;
}

body[data-app-theme="modern2026"] .section-header > * {
    position: relative;
    z-index: 1;
}

body[data-app-theme="modern2026"] .section-title {
    font-size: 28px !important;
    font-weight: 800 !important;
    letter-spacing: -0.025em !important;
    line-height: 1.15 !important;
    margin: 0 0 8px !important;
    background: linear-gradient(135deg, #6366f1, #ec4899) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    display: inline-block;
}

body[data-app-theme="modern2026"] .section-subtitle {
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    color: var(--text-secondary) !important;
    margin: 0 !important;
    font-weight: 400;
}

/* Cards — modern soft */
body[data-app-theme="modern2026"] .card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 18px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 6px 18px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
}
body[data-app-theme="modern2026"] .card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 14px 32px rgba(0,0,0,0.08) !important;
    transform: translateY(-2px);
}

/* KPI cards — colorful + modern */
body[data-app-theme="modern2026"] .dash-kpi {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    padding: 18px 20px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04) !important;
    transition: all 0.2s ease !important;
    position: relative;
    overflow: hidden;
}
body[data-app-theme="modern2026"] .dash-kpi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    opacity: 0.7;
}
body[data-app-theme="modern2026"] .dash-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.10) !important;
}
body[data-app-theme="modern2026"] .dash-kpi .kpi-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    margin: 0 0 6px !important;
}
body[data-app-theme="modern2026"] .dash-kpi .kpi-value {
    font-size: 24px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    font-variant-numeric: tabular-nums !important;
    color: var(--text-primary) !important;
    line-height: 1.1 !important;
    margin: 0 !important;
}

/* Buttons — modern gradient primary */
body[data-app-theme="modern2026"] .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.30) !important;
    transition: all 0.18s ease !important;
}
body[data-app-theme="modern2026"] .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.40) !important;
}

body[data-app-theme="modern2026"] .btn-secondary {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
}
body[data-app-theme="modern2026"] .btn-secondary:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border-strong) !important;
    transform: translateY(-1px);
}

body[data-app-theme="modern2026"] .btn-ghost {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: none !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
}
body[data-app-theme="modern2026"] .btn-ghost:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* Modals — softer */
body[data-app-theme="modern2026"] .modal {
    border-radius: 20px !important;
    box-shadow: 0 24px 60px rgba(0,0,0,0.20), 0 0 0 1px var(--border) !important;
}

/* Tables polished */
body[data-app-theme="modern2026"] table thead th {
    background: linear-gradient(180deg, var(--bg-input) 0%, color-mix(in srgb, var(--bg-input) 70%, var(--bg-card)) 100%) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 11px 14px !important;
}
body[data-app-theme="modern2026"] table tbody tr:hover {
    background: var(--bg-hover) !important;
}

/* CRM panels & settings nav */
body[data-app-theme="modern2026"] .crm-panel,
body[data-app-theme="modern2026"] .settings-nav,
body[data-app-theme="modern2026"] .settings-main {
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05) !important;
}



/* ═══════════════════════════════════════════════════════════════════════
   ▼▼▼ MOBILE POLISH KIT 2026 — bottom nav, topbar fix, skeletons, etc.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── BOTTOM NAV — visible only on mobile ─── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0)) 4px;
    justify-content: space-around;
    align-items: stretch;
}
.bottom-nav-item {
    flex: 1;
    background: transparent;
    border: none;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.15s ease;
    font-size: 10px;
    font-weight: 600;
    min-height: 50px;
}
.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.18s ease;
}
.bottom-nav-item:hover { color: var(--text-secondary); }
.bottom-nav-item.active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.bottom-nav-item.active svg { transform: scale(1.1); }

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    /* Make sure content doesn't hide behind bottom nav */
    .content { padding-bottom: 90px !important; }
    /* Hide topbar hamburger since we have bottom-nav "More" button */
    body[data-app-theme="modern2026"] .topbar-hamburger { display: none !important; }

    /* Topbar mobile cleanup — minimal */
    body[data-app-theme="modern2026"] .topbar {
        padding: 0 14px !important;
        height: 56px;
    }
    body[data-app-theme="modern2026"] .topbar .topbar-bell,
    body[data-app-theme="modern2026"] .topbar .topbar-copilot,
    body[data-app-theme="modern2026"] .topbar #walletNav,
    body[data-app-theme="modern2026"] .topbar .topbar-wallet,
    body[data-app-theme="modern2026"] .topbar [class*="wallet"],
    body[data-app-theme="modern2026"] .topbar .topbar-greeting {
        display: none !important;
    }
    body[data-app-theme="modern2026"] .topbar .breadcrumb {
        font-size: 13px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body[data-app-theme="modern2026"] .topbar .breadcrumb span:not(.breadcrumb-current) { display: none; }
    body[data-app-theme="modern2026"] .topbar .breadcrumb-current { font-weight: 700; font-size: 15px; }
    body[data-app-theme="modern2026"] .topbar .topbar-search {
        width: 38px;
        min-width: 38px;
        max-width: 38px;
        padding: 0;
        justify-content: center;
        background: transparent;
        border: 1px solid var(--border);
        border-radius: 10px;
    }
    body[data-app-theme="modern2026"] .topbar .topbar-search input,
    body[data-app-theme="modern2026"] .topbar .topbar-search .topbar-kbd { display: none !important; }

    /* Section headers more compact on mobile */
    body[data-app-theme="modern2026"] .section-header {
        padding: 20px 18px 16px !important;
        margin-bottom: 14px !important;
        border-radius: 16px !important;
    }
    body[data-app-theme="modern2026"] .section-title { font-size: 22px !important; }
}

/* ─── SKELETON LOADERS ─── */
.skeleton {
    background: linear-gradient(90deg,
        rgba(127,127,127,0.08) 0%,
        rgba(127,127,127,0.16) 50%,
        rgba(127,127,127,0.08) 100%);
    background-size: 200% 100%;
    border-radius: 6px;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; width: 80%; margin: 6px 0; border-radius: 6px; }
.skeleton-title { height: 22px; width: 60%; margin: 8px 0; border-radius: 8px; }
.skeleton-card { height: 100px; border-radius: 14px; margin: 10px 0; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }

/* ─── EMPTY STATES (modern, illustrated) ─── */
.empty-state-modern {
    text-align: center;
    padding: 60px 24px;
    max-width: 480px;
    margin: 20px auto;
}
.empty-state-modern .empty-illustration {
    font-size: 64px;
    line-height: 1;
    margin: 0 0 18px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 4px 16px rgba(99,102,241,0.20));
    animation: emptyFloat 4s ease-in-out infinite;
}
@keyframes emptyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.empty-state-modern h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.empty-state-modern p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 22px;
}

/* ─── PAGE TRANSITIONS — fade between sections ─── */
.section {
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.section:not(.active) {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}
.section.active {
    opacity: 1;
    transform: translateY(0);
    animation: pageEnter 0.32s ease;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Disable transition for elements inside hero (avoid weird animations on title gradient) */
.section.active .section-header { animation: none; }

/* ─── MOBILE SIDEBAR DRAWER POLISH ─── */
@media (max-width: 768px) {
    .app-shell.sidebar-mobile-open .sidebar { transform: translateX(0); }

    /* Hide redundant hamburger from topbar on mobile (use bottom nav "More" instead) */
    .topbar-hamburger { display: none !important; }

    /* Drawer header tighter */
    .sidebar-mobile-open .sidebar-header {
        padding: 14px 16px;
    }

    /* Bottom nav is the primary nav on mobile, sidebar is secondary */
    .sidebar-backdrop {
        z-index: 95;
    }
    .sidebar {
        z-index: 96;
    }
}

/* ─── TOAST stack — bottom on mobile to not overlap topbar ─── */
@media (max-width: 768px) {
    .toast-stack,
    [class*="toast-container"] {
        bottom: 100px !important;
        right: 12px !important;
        left: 12px !important;
        max-width: none !important;
        top: auto !important;
    }
}



/* ═══════════════════════════════════════════════════════════════════════
   MOBILE FIX URGENT 2026-04-28 — topbar clean + drawer functional
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* ─── TOPBAR — strip to essentials. Only breadcrumb + search icon visible ─── */
    .topbar > *:not(.breadcrumb):not(.topbar-search) {
        display: none !important;
    }
    .topbar {
        padding: 0 14px !important;
        height: 56px !important;
        min-height: 56px !important;
        gap: 8px !important;
    }
    .topbar .breadcrumb {
        flex: 1;
        min-width: 0;
        font-size: 14px;
        font-weight: 600;
    }
    .topbar .breadcrumb span:not(.breadcrumb-current) { display: none !important; }
    .topbar .breadcrumb-current { font-size: 16px; font-weight: 700; }

    /* ─── SIDEBAR DRAWER — restore full text labels when open ─── */
    .app-shell.sidebar-mobile-open .sidebar { transform: translateX(0); }
    .app-shell.sidebar-mobile-open .sidebar-backdrop {
        display: block !important;
        opacity: 1 !important;
    }

    /* Force text labels visible in mobile drawer */
    .app-shell.sidebar-mobile-open .sidebar-brand,
    .app-shell.sidebar-mobile-open .nav-item > span,
    .app-shell.sidebar-mobile-open .nav-section-label,
    .app-shell.sidebar-mobile-open .nav-module-header > span,
    .app-shell.sidebar-mobile-open .nav-module-items,
    .app-shell.sidebar-mobile-open .sidebar-footer-text {
        display: revert !important;
    }

    /* Force proper alignment + padding inside drawer */
    .app-shell.sidebar-mobile-open .sidebar .nav-item,
    .app-shell.sidebar-mobile-open .sidebar .nav-module-header {
        justify-content: flex-start !important;
        padding: 11px 14px !important;
        min-height: 44px;
        width: 100% !important;
    }
    .app-shell.sidebar-mobile-open .sidebar-header {
        justify-content: flex-start !important;
        padding: 16px 16px !important;
    }

    /* Drawer must be ABOVE backdrop AND clickable */
    .app-shell .sidebar {
        z-index: 1100 !important;
        pointer-events: auto !important;
    }
    .app-shell .sidebar-backdrop {
        z-index: 1099 !important;
    }
    .app-shell.sidebar-mobile-open .sidebar * {
        pointer-events: auto !important;
    }

    /* Drawer items must respond to clicks */
    .sidebar .nav-item,
    .sidebar .nav-module-header {
        cursor: pointer;
        user-select: none;
    }

    /* Hide auto-expand modules properly when collapsed inside drawer */
    .app-shell.sidebar-mobile-open .nav-module:not(.expanded) .nav-module-items {
        display: none !important;
    }
    .app-shell.sidebar-mobile-open .nav-module.expanded .nav-module-items {
        display: flex !important;
        flex-direction: column;
    }
}


/* Hamburger removed completely — bottom nav "Mai mult" is the only mobile menu */
.topbar-hamburger,
body .topbar-hamburger,
body[data-app-theme] .topbar-hamburger,
.topbar > .topbar-hamburger {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
}
