/* ============================================================
   Hairebel Creative Board — Dark Mode
   ============================================================ */

/* Geist Sans + Geist Mono loaded via CDN in base.html */

:root {
    /* ── Backgrounds — 6-layer elevation, cool-tinted (Impeccable) ── */
    --bg:          #08090D;
    --bg-surface:  #0E0F14;
    --bg-card:     #131419;
    --bg-hover:    #1B1C23;
    --bg-input:    #131419;
    --bg-elevated: #191A21;
    --bg-active:   #22232B;

    /* ── Borders — near-invisible, Geist-style ── */
    --border:       rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.03);
    --border-focus: rgba(255, 255, 255, 0.12);
    --border-hover: rgba(255, 255, 255, 0.09);

    /* ── Text — higher contrast ── */
    --text:           #F0F0F3;
    --text-secondary: #8B8B96;
    --text-muted:     #4A4A55;
    --text-inverse:   #08090D;
    --white: #ffffff;
    --black: #000000;

    /* ── Accent — Monochrome (white in dark) ── */
    --accent:        #FFFFFF;
    --accent-hover:  #D4D4D8;
    --accent-light:  rgba(255, 255, 255, 0.06);
    --accent-border: rgba(255, 255, 255, 0.12);
    --accent-text:   #F0F0F3;

    /* ── Aliases usados por módulos ── */
    --bg-primary:    var(--bg);
    --text-primary:  var(--text);
    --font-mono:     'Geist Mono', 'SF Mono', 'Roboto Mono', monospace;

    /* ── Legacy aliases ── */
    --gold: var(--accent);
    --gold-light: var(--accent-light);
    --gold-border: var(--accent-border);
    --primary: var(--accent);
    --danger: var(--negative);

    /* ── Semantic — desaturados, estilo Linear ── */
    --positive:       #30A46C;
    --positive-light: rgba(48, 164, 108, 0.10);
    --negative:       #E5484D;
    --negative-light: rgba(229, 72, 77, 0.10);
    --warning:        #F5A623;
    --warning-light:  rgba(245, 166, 35, 0.10);
    --info:           #369EFF;
    --info-light:     rgba(54, 158, 255, 0.10);

    /* ── Legacy semantic aliases ── */
    --green: var(--positive);
    --green-light: var(--positive-light);
    --red: var(--negative);
    --red-light: var(--negative-light);
    --blue: var(--info);
    --blue-light: var(--info-light);
    --orange: var(--warning);
    --orange-light: var(--warning-light);
    --purple: var(--accent);
    --purple-light: var(--accent-light);

    /* ── Radius ── */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* ── Shadows — dark: subtle, borders do the work ── */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow:    0 2px 8px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.03);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --card-shadow: none;

    /* ── Spacing — grid 4px ── */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* ── Motion tokens (Impeccable) ── */
    --ease-out:     cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in:      cubic-bezier(0.5, 0, 0.75, 0);
    --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);

    --duration-instant: 80ms;
    --duration-fast:    150ms;
    --duration-normal:  250ms;
    --duration-slow:    400ms;

    /* ── Legacy transition alias ── */
    --transition: all 0.15s ease;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* Scrollbar global */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(180,190,220,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(180,190,220,0.14); }

body {
    font-family: 'Geist Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.65;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
}
html.light body { line-height: 1.6; }

/* Global font reset — browsers default form elements to Arial */
button, input, select, textarea { font-family: inherit; }

/* Geist Mono — números, KPIs, datos, código */
.mono, .geist-mono, code, .kpi-value, .dash-kpi__value, .header-be-roas strong,
.column-count, .numbers-value, .numbers-card-value, .stat-value, .email-stat-value {
    font-family: 'Geist Mono', 'SF Mono', 'Menlo', monospace;
}

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

::selection { background: rgba(180, 190, 220, 0.12); color: var(--text); }

/* ── Global micro-interactions (Impeccable motion tokens) ── */
@media (prefers-reduced-motion: no-preference) {
    .card, .dash-card, .dash-kpi, .email-stat-card, .stat-card,
    .inspo-brand-card, .my-campaign-card, .result-card {
        transition: border-color var(--duration-normal) var(--ease-out),
                    transform var(--duration-normal) var(--ease-out),
                    box-shadow var(--duration-normal) var(--ease-out);
    }
    .sidebar-link, .tab, .chat-channel-item {
        transition: color var(--duration-instant) var(--ease-out),
                    background var(--duration-instant) var(--ease-out);
    }
    input, textarea, select {
        transition: border-color var(--duration-fast) var(--ease-out),
                    box-shadow var(--duration-fast) var(--ease-out);
    }
}

/* ── Focus-visible — accessible keyboard navigation (Impeccable) ── */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Reduced motion — fade only, no spatial movement ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 54px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}
.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo { display: flex; align-items: center; }
.logo img { height: 15px; width: auto; }
/* Day/Night logo swap — dark mode default shows white logo, light mode shows black logo */
.logo .logo-dark { display: block; }
.logo .logo-light { display: none; }
html.light .logo .logo-dark { display: none; }
html.light .logo .logo-light { display: block; }
.header-divider { width: 1px; height: 20px; background: var(--border); }

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--duration-instant) var(--ease-out),
                color var(--duration-instant) var(--ease-out);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }

.user-badge {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.header-be-roas {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}
.header-be-roas strong {
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 54px;
    left: 0;
    bottom: 0;
    width: 200px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    z-index: 150;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar.collapsed { width: 54px; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 1px;
    height: 100%;
    min-height: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 450;
    white-space: nowrap;
    transition: all 0.12s ease;
    position: relative;
    text-decoration: none;
}
.sidebar-link:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
    text-decoration: none;
}
.sidebar-link.active {
    color: var(--white);
    background: rgba(255,255,255,0.06);
    font-weight: 500;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--gold);
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.5;
}

.sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s ease;
}

.sidebar.collapsed .sidebar-label { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 8px 0; border-radius: 0; gap: 0; }
.sidebar.collapsed .sidebar-nav { padding: 8px 0; }

/* Tooltip on collapsed */
.sidebar.collapsed .sidebar-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 300;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

/* Badges */
.sidebar-badge {
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 700;
    margin-left: auto;
    flex-shrink: 0;
    background: var(--negative);
    color: var(--white);
}
.sidebar-badge--warning { background: var(--warning); color: var(--text-inverse); }
.sidebar-badge--gold { background: var(--accent); color: #000000; }
.sidebar-badge--chat { background: var(--warning); color: var(--text-inverse); }

.sidebar.collapsed .sidebar-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 7px;
    height: 7px;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
}

/* Separators (legacy — kept for compat) */
.sidebar-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 10px;
}
.sidebar.collapsed .sidebar-sep { margin: 6px 4px; }

/* Section labels — replaces separators */
.sidebar-section-label {
    padding: 20px 10px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section-label span {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.sidebar-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.sidebar.collapsed .sidebar-section-label {
    padding: 0;
    height: auto;
    margin: 6px 12px;
    background: none;
}
.sidebar.collapsed .sidebar-section-label span {
    display: none;
}
.sidebar.collapsed .sidebar-section-label::after {
    height: 1px;
    background: var(--border);
}
html.sidebar-collapsed-early .sidebar .sidebar-section-label {
    padding: 0;
    height: auto;
    margin: 6px 12px;
    background: none;
}
html.sidebar-collapsed-early .sidebar .sidebar-section-label span {
    display: none;
}
html.sidebar-collapsed-early .sidebar .sidebar-section-label::after {
    height: 1px;
    background: var(--border);
}

/* Bottom section — push to bottom */
.sidebar-bottom-section {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* Grouped items — indent slightly */
.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sidebar-group .sidebar-link {
    padding-left: 14px;
}
.sidebar.collapsed .sidebar-group .sidebar-link {
    padding-left: 8px;
}

/* ============================================================
   APP MAIN — content area offset by sidebar
   ============================================================ */
.app-main {
    min-height: calc(100vh - 54px);
    transition: margin-left 0.2s ease;
}
/* When sidebar exists (logged in), offset content */
.sidebar ~ .app-main {
    margin-left: 200px;
    margin-top: 54px;
}
.sidebar.collapsed ~ .app-main { margin-left: 54px; }
/* Prevent flash on load when sidebar was collapsed */
html.sidebar-collapsed-early .sidebar { width: 54px; }
html.sidebar-collapsed-early .sidebar .sidebar-label { opacity: 0; width: 0; }
html.sidebar-collapsed-early .sidebar .sidebar-link { justify-content: center; padding: 8px 0; border-radius: 0; gap: 0; }
html.sidebar-collapsed-early .sidebar .sidebar-nav { padding: 8px 0; }
html.sidebar-collapsed-early .sidebar ~ .app-main { margin-left: 54px; }

/* Nav rows (legacy compat — no longer in header but keep for any inline usage) */
.nav { display: flex; gap: 4px; }
.nav a {
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: var(--transition);
    white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.nav a.active { color: var(--white); background: var(--bg-hover); }

/* ============================================================
   BUTTONS
   ============================================================ */
/* ── Buttons — 4 variantes + micro-interacciones ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    transition: background var(--duration-instant) var(--ease-out),
                border-color var(--duration-instant) var(--ease-out),
                color var(--duration-instant) var(--ease-out),
                transform var(--duration-instant) var(--ease-out),
                box-shadow var(--duration-instant) var(--ease-out);
    position: relative;
    user-select: none;
    white-space: nowrap;
}
.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-focus);
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.btn:disabled, .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary — white on black */
.btn-primary {
    background: var(--white);
    color: var(--black);
    border-color: var(--white);
    font-weight: 600;
}
.btn-primary:hover {
    background: #e4e4e7;
    border-color: #e4e4e7;
}
.btn-primary:active { background: #d4d4d8; }

/* Accent — Monochrome CTA */
.btn-gold, .btn-accent {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    font-weight: 600;
}
.btn-gold:hover, .btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-gold:active, .btn-accent:active { opacity: 0.85; }

/* Ghost — fully transparent */
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: rgba(180, 190, 220, 0.05);
    color: var(--text);
}
.btn-ghost:active { background: rgba(180, 190, 220, 0.08); }

/* Danger */
.btn-danger { color: var(--red); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--red-light); color: var(--red); }

/* Sizes */
.btn-small { padding: 5px 12px; font-size: 12px; }
.btn-tiny { padding: 2px 8px; font-size: 11px; border-radius: var(--radius-sm); }
.btn-large { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* Icon-only button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon:active { transform: scale(0.92); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="email"],
textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}
select option { background: var(--bg-card); color: var(--text); }
textarea { resize: vertical; line-height: 1.6; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
code { background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid;
}
.alert-error { background: var(--negative-light); color: var(--negative); border-color: rgba(229, 72, 77, 0.2); }
.alert-success { background: var(--positive-light); color: var(--positive); border-color: rgba(48, 164, 108, 0.2); }
.alert-info { background: var(--info-light); color: var(--info); border-color: rgba(54, 158, 255, 0.15); }
.alert-gold, .alert-accent { background: var(--accent-light); color: var(--accent-text); border-color: var(--accent-border); }

/* ============================================================
   LOGIN & REGISTER
   ============================================================ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-box .login-logo { margin-bottom: 16px; display: flex; justify-content: center; }
.login-box .login-logo img { height: 32px; width: auto; max-width: 240px; object-fit: contain; }
.login-logo .logo-dark { display: block; }
.login-logo .logo-light { display: none; }
html.light .login-logo .logo-dark { display: none; }
html.light .login-logo .logo-light { display: block; }
.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}
.login-box .form-group { text-align: left; }
.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}
.login-footer a { color: var(--gold); font-weight: 500; }

/* Password toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper input { padding-right: 40px; }
.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.password-toggle:hover { color: var(--text-secondary); }

/* Account type selector */
.type-btn {
    padding: 12px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.type-btn:hover { border-color: var(--text-muted); }
.type-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--text);
}

/* ============================================================
   BOARD — Kanban
   ============================================================ */
.board {
    display: flex;
    gap: 12px;
    padding: 20px 16px;
    overflow-x: auto;
    min-height: calc(100vh - 54px);
    align-items: flex-start;
    background: var(--bg);
}
.board-column {
    min-width: 230px;
    max-width: 230px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: grab;
}
.column-header:active { cursor: grabbing; }
.column-ghost {
    opacity: 0.3;
    border: 1px dashed var(--border-focus) !important;
}
.column-title {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.column-count {
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
.column-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: var(--negative);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}
.column-header:hover .column-delete-btn { opacity: 0.6; }
.column-delete-btn:hover { opacity: 1 !important; background: rgba(255,69,58,0.15); }
.column-cards {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
    flex-grow: 1;
}

/* Column top accents — removed, monochrome */

/* Task Card */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: auto 80px;
}
.task-card:hover {
    border-color: var(--border-focus);
    border-left-color: var(--border-focus);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: var(--bg-hover);
}
/* Priority left accent bar */
.task-card.prio-alta { border-left-color: var(--red); }
.task-card.prio-media { border-left-color: var(--orange); }
.task-card.prio-baja { border-left-color: var(--green); }
.task-card.prio-alta:hover { border-left-color: var(--red); }
.task-card.prio-media:hover { border-left-color: var(--orange); }
.task-card.prio-baja:hover { border-left-color: var(--green); }
.task-card.sortable-ghost {
    opacity: 0.35;
    border: 2px dashed var(--border-focus);
    border-radius: 10px;
    box-shadow: none;
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}
body.is-dragging .task-card:not(.sortable-fallback):not(.sortable-ghost) {
    transition: transform 0.2s cubic-bezier(0, 0, 0.2, 1);
}
.task-card.sortable-chosen {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transform: scale(1.02);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    z-index: 10;
}
.task-card.sortable-fallback {
    opacity: 1 !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 0 1px var(--border-focus) !important;
    border-radius: 10px;
    z-index: 99999 !important;
    cursor: grabbing !important;
    transform: rotate(1deg) scale(1.03);
    transition: none;
}
body.is-dragging .column-cards {
    min-height: 80px;
    padding-bottom: 40px;
    transition: background 0.25s cubic-bezier(0, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0, 0, 0.2, 1);
}
.column-cards.drag-over {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--border-focus);
    border-radius: 8px;
}
html.light .column-cards.drag-over {
    background: rgba(0, 0, 0, 0.03);
}
.card-drag-handle { display: none; }

/* ── Card top row: checkbox + title + correction + delete ── */
.card-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* Custom checkbox */
.card-check-wrap {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    position: relative;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.task-card:hover .card-check-wrap,
.task-card.task-selected .card-check-wrap { opacity: 1; }
.card-check-wrap .task-select-cb {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.card-check-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--border-focus);
    background: transparent;
    color: transparent;
    transition: all 0.15s ease;
}
.card-check-wrap:hover .card-check-icon {
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}
.task-select-cb:checked ~ .card-check-icon {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg-card);
}

.card-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    cursor: default;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s ease;
}
.card-title:hover { color: var(--accent-hover); cursor: text; }

.card-angle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 4px;
    padding-left: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-left: 24px;
}
.card-date {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.card-assignee {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border-focus);
}
.add-column-btn {
    min-width: 120px !important;
    max-width: 120px !important;
    background: transparent !important;
    border: 1px solid var(--border) !important;
    cursor: pointer;
}
.add-column-btn:hover { border-color: var(--border-focus) !important; background: var(--bg-surface) !important; }

/* Inline edit input */
.inline-edit-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-focus);
    border-radius: 5px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    width: 100%;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    flex: 1;
    min-width: 0;
}
.inline-edit-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
}
.inline-title-input {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: var(--bg-input);
    border: 1px solid var(--gold);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 10px;
    width: 100%;
    font-family: inherit;
}

/* ============================================================
   TASK DETAIL
   ============================================================ */
.task-nav-arrows {
    display: flex;
    gap: 4px;
}
.task-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}
.task-nav-btn:hover {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}
.task-nav-btn.disabled {
    opacity: 0.2;
    pointer-events: none;
    cursor: default;
}

.task-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0;
    min-height: calc(100vh - 54px);
    align-items: start;
}
.task-main { padding: 32px 40px; }
.task-sidebar {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    position: sticky;
    top: 54px;
    max-height: calc(100vh - 54px);
}

/* Status bar */
.task-status-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 32px; }
.status-pill {
    padding: 5px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
}
.status-pill:hover { border-color: var(--border-hover); color: var(--text); background: var(--bg-hover); }
.status-pill.active { background: var(--white); color: var(--black); border-color: var(--white); font-weight: 600; }

/* Sections */
.task-section { margin-bottom: 32px; }
.collapsible-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.collapsible-header:hover { color: var(--text); }
.collapse-icon {
    font-size: 9px;
    color: var(--text-muted);
    transition: transform 0.15s;
}
.task-section h3 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.section-header h3 { margin-bottom: 0; }
.section-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
}
.section-edit { margin-top: 10px; }
.section-edit .btn { margin-top: 10px; margin-right: 8px; }
.script-text { max-height: 400px; overflow-y: auto; }
.text-muted { color: var(--text-muted); font-style: italic; }

/* Brief */
.brief-rendered { line-height: 1.8; }
.brief-rendered strong, .brief-rendered b {
    color: var(--gold);
    font-weight: 700;
}

/* Video */
.video-container {
    background: var(--black);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}
.inspiration-video { width: 100%; max-height: 400px; display: block; }

/* Files */
.files-list { margin-bottom: 14px; }
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    transition: var(--transition);
}
.file-item:hover { border-color: var(--border-focus); }
.file-icon { font-size: 16px; }
.file-name { font-size: 13px; flex-grow: 1; color: var(--text); font-weight: 500; }
.file-name:hover { color: var(--gold); }
.file-date { font-size: 11px; color: var(--text-muted); }
.upload-form { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.upload-form input[type="file"] { font-size: 12px; color: var(--text-secondary); }

/* Comments */
.comments-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    max-height: 400px;
}
.comment {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.comment-header strong { font-size: 13px; color: var(--gold); }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-body { font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: var(--text-secondary); }
.comment-form textarea { margin-bottom: 8px; }
.comment-form .btn { width: 100%; }

/* Task info */
.task-info { border-top: 1px solid var(--border); padding-top: 20px; }
.task-info h4 { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.task-info p { font-size: 13px; margin-bottom: 6px; color: var(--text-secondary); }
.task-info strong { color: var(--text); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-close:hover { color: var(--text); }

/* ============================================================
   ADMIN / USERS
   ============================================================ */
.admin-container { max-width: 800px; margin: 0 auto; padding: 40px 24px; }
.admin-container h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.users-list { margin-bottom: 48px; }
.users-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.users-table th, .users-table td {
    padding: 13px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.users-table th { color: var(--text-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.users-table tr:hover td { background: var(--bg-hover); transition: background 80ms ease; }
.add-user-form {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

/* ============================================================
   CREATIVE WORKFLOW PAGES
   ============================================================ */
.page-container { max-width: 900px; margin: 0 auto; padding: 40px 24px; }
.page-container--wide { max-width: 100%; padding: 32px 32px 40px; }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 16px; font-weight: 600; }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 3px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}
.tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.02); }
.tab.active {
    background: var(--bg-active);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Results */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
}
.result-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.angle-badge {
    display: inline-block;
    background: var(--gold-light);
    color: var(--gold);
    border: 1px solid var(--gold-border);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}
.script-preview {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Progress */
.progress-bar { width: 100%; height: 4px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; margin: 16px 0; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.3s ease; }

/* AI Progress — indeterminate shimmer bar */
.ai-progress {
    width: 100%;
    height: 3px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.ai-progress-fill {
    position: absolute;
    top: 0; left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
    animation: ai-shimmer 1.5s ease-in-out infinite;
}
@keyframes ai-shimmer {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* AI Loading State (for panels) */
.ai-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}
.ai-loading-state .ai-progress { max-width: 280px; }
.ai-loading-label {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono, 'Geist Mono', monospace);
    letter-spacing: 0.02em;
}
/* Inline button loading (replaces btn text) */
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-loading .spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Analysis output */
.analysis-output {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    max-height: 600px;
    overflow-y: auto;
}

/* Recommended angles */
.angles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.angle-chip {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.angle-chip:hover, .angle-chip.selected {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-light);
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-card .stat-value { font-size: 30px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-card .stat-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* History table */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.history-table th { color: var(--text-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.history-table tr:hover td { background: var(--bg-hover); transition: background 80ms ease; }

/* Floating action button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 40px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    z-index: 50;
}

/* ============================================================
   BREAK EVEN ROAS BANNER
   ============================================================ */
.be-roas-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}
.be-roas-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.be-roas-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.be-roas-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--gold);
}
.be-roas-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Metrics chips */
.metrics-required {
    margin-bottom: 16px;
}
.metrics-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 8px;
}
.metrics-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.metric-chip {
    padding: 3px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   EDITABLE FIELDS (click to edit)
   ============================================================ */
.editable-field { cursor: pointer; transition: var(--transition); }
.editable-field:hover {
    border-color: var(--gold-border);
    background: var(--bg-hover);
}
.editable-title {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    cursor: pointer;
}
.editable-title:hover { color: var(--gold); }

/* Assignee selector */
.assignee-selector select {
    max-width: 250px;
}

/* ============================================================
   DRAG & DROP ZONE
   ============================================================ */
.drop-zone {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    transition: var(--transition);
    margin-bottom: 16px;
    cursor: pointer;
}
.drop-zone:hover, .drop-zone-active {
    border-color: var(--gold-border);
    background: var(--gold-light);
}
.drop-zone-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 13px;
}
.drop-icon {
    font-size: 24px;
    font-weight: 300;
    color: var(--text-muted);
}

/* ============================================================
   MEDIA VIEWER
   ============================================================ */
.media-viewer {
    background: var(--black);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-viewer video,
.media-viewer img,
.media-viewer audio {
    max-width: 100%;
}

/* ============================================================
   REVIEW PAGE
   ============================================================ */
.review-card { transition: var(--transition); }
.review-card:hover { border-color: var(--gold-border); }

.review-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-surface);
    transition: var(--transition);
}
.review-item:hover { border-color: var(--border-light); }
.review-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.review-checkbox {
    display: flex;
    align-items: center;
}
.review-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
    cursor: pointer;
}
.review-item-body {}
.script-display {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
}
.script-edit textarea {
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
}

/* ============================================================
   CHAT — WhatsApp-Inspired Dark Theme
   ============================================================ */
body:has(.chat-layout) {
    overflow: hidden;
    height: 100vh;
}
body:has(.chat-layout) .header {
    flex-shrink: 0;
}
body:has(.chat-layout) .app-main {
    height: calc(100vh - 54px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chat-layout {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- Left Sidebar (Slack-style channels) ---- */
.chat-left-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-left-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-left-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.chat-left-sidebar-body::-webkit-scrollbar { width: 4px; }
.chat-left-sidebar-body::-webkit-scrollbar-track { background: transparent; }
.chat-left-sidebar-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Channel items */
.chat-channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin: 0 6px;
    content-visibility: auto;
    contain-intrinsic-size: auto 36px;
}
.chat-channel-item:hover { background: var(--bg-hover); color: var(--text); }
.chat-channel-item.active {
    background: var(--bg-hover);
    color: var(--text);
    border-left: 2px solid var(--gold);
    padding-left: 10px;
}
.chat-channel-icon {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.chat-channel-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.chat-unread-badge {
    background: var(--gold);
    color: var(--black);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
}
.chat-sidebar-add-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 4px;
    transition: var(--transition);
    line-height: 1;
}
.chat-sidebar-add-btn:hover { background: var(--bg-hover); color: var(--gold); }

/* DM items in sidebar */
.dm-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.dm-sidebar-item:hover { background: var(--bg-hover); }
.dm-sidebar-item.active {
    background: var(--bg-hover);
    border-left: 2px solid var(--gold);
    padding-left: 14px;
}
.dm-sidebar-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dm-sidebar-delete {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}
.dm-sidebar-item:hover .dm-sidebar-delete { display: block; }
.dm-sidebar-delete:hover { color: var(--red); background: var(--red-light); }

/* Header action buttons */
.chat-header-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-header-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.chat-header-action-btn.active { color: var(--gold); background: var(--gold-light); }
.chat-header-channel-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 10px;
    flex-shrink: 0;
}
.chat-header-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* ---- Right sidebar (members/files) ---- */
.chat-right-sidebar {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: width 0.2s, padding 0.2s;
}
.chat-right-sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-left: none;
}
.chat-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}
.chat-file-item:hover { background: var(--bg-hover); }
.chat-file-meta {
    flex: 1;
    min-width: 0;
}
.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    position: relative;
}
.chat-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- Header bar ---- */
.chat-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
    gap: 12px;
}
.chat-header-left { display: flex; align-items: center; gap: 0; flex: 1; }
.chat-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Search */
.chat-search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-search-btn:hover { background: var(--bg-hover); color: var(--text); }
.chat-search-bar {
    display: none;
    padding: 8px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    animation: slideDown 0.2s ease;
}
.chat-search-bar.active { display: flex; gap: 8px; align-items: center; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-search-bar input {
    flex: 1;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.chat-search-bar input:focus { border-color: var(--gold-border); }
.chat-search-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}
.chat-search-close:hover { color: var(--text); background: var(--bg-hover); }
.chat-search-count {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---- Pinned banner ---- */
.chat-pinned-banner {
    display: none;
    padding: 8px 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border-bottom: 1px solid var(--gold-border);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s;
    align-items: center;
    gap: 10px;
}
.chat-pinned-banner.active { display: flex; }
.chat-pinned-banner:hover { background: rgba(255,255,255,0.12); }
.chat-pinned-icon {
    color: var(--gold);
    font-size: 14px;
    flex-shrink: 0;
}
.chat-pinned-text {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-pinned-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.chat-pinned-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}
.chat-pinned-close:hover { color: var(--text); background: var(--bg-hover); }

/* ---- Messages area ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    background: var(--bg);
    /* Subtle chat pattern */
    background-image: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.015) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(255,255,255,0.01) 0%, transparent 50%);
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: #444; }

/* ---- Date separator (WhatsApp style) ---- */
.chat-date-sep {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    width: 100%;
    max-width: 100%;
}
.chat-date-sep span {
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    letter-spacing: 0.3px;
}
/* Floating date indicator */
.chat-date-float {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

/* ---- Message row ---- */
.chat-msg {
    display: flex;
    gap: 8px;
    max-width: 72%;
    align-items: flex-end;
    position: relative;
    padding: 3px 0;
    transition: background 0.15s;
}
.chat-msg:hover { background: rgba(255,255,255,0.02); border-radius: var(--radius); }
.chat-msg.chat-msg-highlight {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    animation: msgHighlight 2s ease-out;
}
@keyframes msgHighlight {
    0% { background: rgba(255,255,255,0.25); }
    100% { background: transparent; }
}
.chat-msg-deleted .chat-msg-body {
    font-style: italic;
    color: var(--text-muted) !important;
    opacity: 0.7;
}

/* Avatar */
.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
}

/* Online indicator */
.online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--bg);
    display: none;
}
.online-dot.active { display: block; }

/* Message bubble */
.chat-msg-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
    padding: 6px 12px 6px 12px;
    min-width: 80px;
    max-width: 100%;
    position: relative;
}

/* Own messages */
.chat-msg-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-msg-own .chat-msg-content {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.18);
    border-radius: 16px 4px 16px 16px;
}
.chat-msg-own .chat-msg-avatar {
    background: var(--gold);
    color: var(--black);
}

/* Message header */
.chat-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1px;
    gap: 12px;
}
.chat-msg-header strong {
    font-size: 11px;
    color: var(--gold);
    font-weight: 600;
}
.chat-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}
.chat-msg-body {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}
.chat-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Reply quote inside bubble ---- */
.chat-msg-reply-quote {
    background: rgba(255,255,255,0.04);
    border-left: 3px solid var(--gold);
    border-radius: 4px;
    padding: 4px 10px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-msg-reply-quote:hover { background: rgba(255,255,255,0.07); }
.chat-msg-reply-author {
    font-size: 10px;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 1px;
}
.chat-msg-reply-text {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* ---- Reactions ---- */
.chat-msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}
.reaction-pill:hover {
    border-color: var(--gold-border);
    background: rgba(255,255,255,0.1);
}
.reaction-pill.reaction-own {
    border-color: var(--gold-border);
    background: rgba(255,255,255,0.08);
}
.reaction-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 8px;
    text-align: center;
}

/* ---- Hover action bar ---- */
.chat-msg-actions {
    position: absolute;
    top: -14px;
    right: 8px;
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    box-shadow: var(--shadow-md);
    z-index: 20;
    gap: 1px;
}
.chat-msg:hover .chat-msg-actions { display: flex; }
.chat-msg-own .chat-msg-actions { right: auto; left: 8px; }
.chat-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.chat-action-btn.action-delete:hover {
    background: var(--red-light);
    color: var(--red);
}

/* ---- Reaction picker (mini) ---- */
.reaction-picker {
    position: absolute;
    top: -44px;
    right: 8px;
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 4px 6px;
    box-shadow: var(--shadow-md);
    z-index: 25;
    gap: 2px;
    animation: popIn 0.15s ease;
}
.reaction-picker.active { display: flex; }
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
.reaction-picker-emoji {
    font-size: 20px;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 50%;
    line-height: 1;
    transition: transform 0.1s, background 0.1s;
}
.reaction-picker-emoji:hover {
    transform: scale(1.25);
    background: var(--bg-hover);
}

/* ---- Context menu ---- */
.chat-context-menu {
    position: fixed;
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 9000;
    animation: popIn 0.12s ease;
}
.chat-context-menu.active { display: block; }
.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    white-space: nowrap;
}
.ctx-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.ctx-menu-item.ctx-danger { color: var(--red); }
.ctx-menu-item.ctx-danger:hover { background: var(--red-light); }
.ctx-menu-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.ctx-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ---- Link preview ---- */
.chat-link-preview {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    max-width: 340px;
    text-decoration: none;
    color: inherit;
}
.chat-link-preview:hover {
    border-color: var(--gold-border);
    background: rgba(255,255,255,0.05);
    text-decoration: none;
    color: inherit;
}
.chat-link-preview-img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-hover);
}
.chat-link-preview-info { flex: 1; min-width: 0; overflow: hidden; }
.chat-link-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.chat-link-preview-desc {
    font-size: 11px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.chat-link-preview-domain {
    font-size: 10px;
    color: var(--gold);
    margin-top: 2px;
}

/* ---- Audio / voice messages ---- */
.chat-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 20px;
    min-width: 220px;
    margin-top: 2px;
}
.audio-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--black);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.audio-play-btn:hover { background: var(--accent); transform: scale(1.05); }
.audio-play-btn svg { width: 14px; height: 14px; }
.audio-waveform {
    flex: 1;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 2px;
}
.audio-waveform-bar {
    width: 3px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: height 0.1s, background 0.1s;
}
.audio-waveform-bar.played { background: var(--gold); }
.audio-duration {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 32px;
    text-align: right;
}

/* Voice recording indicator */
.voice-record-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.2);
    border-radius: 20px;
    flex: 1;
}
.voice-record-indicator.active { display: flex; }
.voice-record-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
    animation: recordPulse 1s ease-in-out infinite;
}
@keyframes recordPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}
.voice-record-timer {
    font-size: 14px;
    font-weight: 600;
    color: var(--red);
    font-variant-numeric: tabular-nums;
}
.voice-record-text {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
}
.voice-record-cancel,
.voice-record-send {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.voice-record-cancel { color: var(--text-muted); }
.voice-record-cancel:hover { color: var(--red); background: var(--red-light); }
.voice-record-send { color: var(--gold); }
.voice-record-send:hover { background: var(--gold-light); }

/* Mic button */
.chat-mic-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-mic-btn:hover { background: var(--bg-hover); color: var(--text); }
.chat-mic-btn.recording { color: var(--red); background: var(--red-light); }

/* ---- Mic permission banner ---- */
.mic-permission-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    margin: 0 0 8px 0;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    animation: micBannerIn 0.2s ease-out;
}
@keyframes micBannerIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.mic-permission-content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.mic-permission-content strong {
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}
.mic-permission-steps {
    color: var(--text-secondary);
    font-size: 12px;
}
.mic-permission-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
.mic-permission-close:hover { color: var(--text); }

/* ---- Reply preview above input ---- */
.chat-reply-preview {
    display: none;
    padding: 8px 14px;
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--gold);
    border-radius: 0 6px 6px 0;
    margin-bottom: 8px;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.15s ease;
}
.chat-reply-preview.active { display: flex; }
.chat-reply-preview-content { flex: 1; min-width: 0; }
.chat-reply-preview-author {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
}
.chat-reply-preview-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-reply-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    border-radius: 4px;
    transition: var(--transition);
    line-height: 1;
}
.chat-reply-close:hover { color: var(--text); background: var(--bg-hover); }

/* ---- Typing indicator ---- */
.chat-typing-indicator {
    display: none;
    padding: 4px 24px 4px 24px;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}
.chat-typing-indicator.active { display: flex; }
.typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}
.typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Input bar ---- */
.chat-input-bar {
    position: relative;
    padding: 10px 24px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}
.chat-input-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}
.chat-input-bar textarea {
    flex-grow: 1;
    resize: none;
    min-height: 38px;
    max-height: 120px;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}
.chat-input-bar textarea:focus {
    border-color: var(--gold-border);
}
.chat-send-btn {
    padding: 8px 14px !important;
    border-radius: 20px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    line-height: 1;
    border-radius: var(--radius);
    transition: var(--transition);
}
.emoji-btn:hover { background: var(--bg-hover); }
/* @Mention autocomplete dropdown */
.mention-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50px;
    right: 50px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    z-index: 110;
    padding: 4px 0;
}
.mention-dropdown.active { display: block; }
.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.mention-item:hover, .mention-item-active {
    background: var(--bg-hover);
}
.mention-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold-light);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.mention-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.mention-display {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.mention-username {
    font-size: 11px;
    color: var(--text-muted);
}

/* @mention highlight in messages */
.chat-mention {
    color: var(--gold);
    font-weight: 500;
    background: var(--gold-light);
    padding: 1px 4px;
    border-radius: 4px;
}

.emoji-picker-container {
    position: absolute;
    bottom: 100%;
    left: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    max-width: 360px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    z-index: 100;
}
.emoji-item {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    text-align: center;
    line-height: 1.2;
    transition: background 0.1s;
}
.emoji-item:hover { background: var(--bg-hover); }

/* ---- Sidebar ---- */
.chat-sidebar {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.chat-sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    margin-bottom: 2px;
    transition: var(--transition);
}
.chat-member:hover { background: var(--bg-hover); }
.chat-member-active { background: var(--bg-hover); border-left: 2px solid var(--gold); }
.chat-member-self { opacity: 0.6; cursor: default !important; }

/* Online status in sidebar avatar */
.chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.chat-avatar-wrap .online-dot {
    bottom: 0;
    right: 0;
}

/* DM contacts list */
.dm-contacts-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.dm-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
}
.dm-contact-item:hover { background: var(--bg-hover); }
.dm-contact-item.dm-contact-active { background: var(--bg-hover); border-left: 2px solid var(--gold); }
.dm-contact-info { flex: 1; min-width: 0; }
.dm-contact-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dm-contact-last-msg {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dm-contact-time {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* DM header */
.dm-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: var(--bg-surface);
}
.dm-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    position: relative;
}
.dm-header-status {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}
#dmConversation { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#dmMessages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    background: var(--bg);
    background-image: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.015) 0%, transparent 50%);
}
#dmMessages::-webkit-scrollbar { width: 6px; }
#dmMessages::-webkit-scrollbar-track { background: transparent; }
#dmMessages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---- Chat images ---- */
.chat-msg-image {
    margin-top: 4px;
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 280px;
}
.chat-msg-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    transition: opacity 0.2s;
}
.chat-msg-image:hover img { opacity: 0.85; }
.chat-image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}
.chat-image-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.chat-image-preview-remove {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.chat-upload-progress {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.chat-upload-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.15s;
}

/* ---- Lightbox ---- */
.chat-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.chat-lightbox.active { display: flex; }
.chat-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.chat-lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.chat-lightbox-actions {
    display: flex;
    gap: 12px;
}

/* ---- Drag & drop overlay ---- */
.chat-dragover {
    outline: 2px dashed var(--gold);
    outline-offset: -4px;
    background: var(--gold-light);
}

/* ---- No results overlay ---- */
.chat-no-results {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
}
.chat-no-results.active { display: block; }

/* ---- Search results panel ---- */
.chat-search-results {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    background: var(--bg);
}
.chat-search-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.chat-search-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}
.chat-search-item:last-child { border-bottom: none; }
.chat-search-item:hover { background: var(--bg-hover); }
.chat-search-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.chat-search-item-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.chat-search-item-name {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
}
.chat-search-item-channel {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: auto;
}
.chat-search-item-date {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.chat-search-item-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.chat-search-item-body mark {
    background: var(--warning, #f59e0b);
    color: var(--bg);
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================================
   VOICE GENERATION
   ============================================================ */
.voice-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.voice-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.voice-select {
    flex: 1;
    max-width: 300px;
}
.voice-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: var(--gold);
    font-size: 13px;
}
.voice-player {
    margin-top: 12px;
}
.voice-player audio {
    border-radius: var(--radius);
}
.voice-error {
    margin-top: 12px;
    color: var(--red);
    font-size: 13px;
}
.voice-tips {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.voice-tips p { margin-bottom: 6px; }
.voice-tips ul { padding-left: 18px; margin: 0; }
.voice-tips li { margin-bottom: 2px; }
.voice-tips strong { color: var(--gold); }

/* Hooks section in task detail */
.hooks-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.hooks-output {
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
    margin-bottom: 12px;
}

.voice-script-area {
    margin-bottom: 12px;
}
.voice-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.voice-label .hint {
    font-weight: 400;
}

/* ============================================================
   VOICE PANEL v3 PRO (ElevenLabs)
   ============================================================ */
.voice-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Tabs */
.vp-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 4px;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.vp-tabs::-webkit-scrollbar { display: none; }
.vp-tab {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    top: 1px;
}
.vp-tab:hover { color: var(--text-secondary); }
.vp-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* Tab content */
.vp-tab-content {
    display: none;
    padding: 16px;
}
.vp-tab-content.active { display: block; }

/* Audio Tags Toolbar */
.audio-tags-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.tag-group {
    position: relative;
}
.tag-group-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
}
.tag-group-btn:hover { border-color: var(--border-hover); }
.tag-group-btn.open { border-color: var(--border-focus); }
.tag-chevron { font-size: 8px; opacity: 0.5; }

/* Tag group colors */
.tag-group-btn.tag-emotion { color: #60a5fa; }
.tag-group-btn.tag-emotion:hover,
.tag-group-btn.tag-emotion.open { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.2); }
.tag-group-btn.tag-sfx { color: var(--positive); }
.tag-group-btn.tag-sfx:hover,
.tag-group-btn.tag-sfx.open { background: var(--positive-light); border-color: rgba(34,197,94,0.2); }
.tag-group-btn.tag-pacing { color: var(--warning); }
.tag-group-btn.tag-pacing:hover,
.tag-group-btn.tag-pacing.open { background: var(--warning-light); border-color: rgba(245,158,11,0.2); }
.tag-group-btn.tag-accent-grp { color: #a78bfa; }
.tag-group-btn.tag-accent-grp:hover,
.tag-group-btn.tag-accent-grp.open { background: rgba(167,139,250,0.08); border-color: rgba(167,139,250,0.2); }

/* Tag dropdown */
.tag-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    z-index: 20;
    min-width: 120px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.tag-dropdown.open { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-option {
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    background: transparent;
}
.tag-option:hover { background: var(--bg-card); }
.tag-option.tag-emotion { color: #60a5fa; }
.tag-option.tag-emotion:hover { background: rgba(59,130,246,0.1); }
.tag-option.tag-sfx { color: var(--positive); }
.tag-option.tag-sfx:hover { background: var(--positive-light); }
.tag-option.tag-pacing { color: var(--warning); }
.tag-option.tag-pacing:hover { background: var(--warning-light); }
.tag-option.tag-accent-grp { color: #a78bfa; }
.tag-option.tag-accent-grp:hover { background: rgba(167,139,250,0.1); }

/* v3 badge */
.tag-v3-badge {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--border);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    margin-left: auto;
    cursor: help;
}
.audio-tags-toolbar.disabled .tag-group-btn {
    opacity: 0.35;
    pointer-events: none;
}
.audio-tags-toolbar.disabled .tag-v3-badge {
    color: var(--warning);
    background: var(--warning-light);
}

/* Script editor with highlight overlay */
.script-editor-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.script-editor-wrap:focus-within {
    border-color: var(--border-focus);
}
.script-highlight {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 10px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    color: transparent;
}
.script-editor-wrap textarea {
    width: 100%;
    min-height: 160px;
    padding: 10px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.6;
    background: transparent;
    border: none;
    outline: none;
    resize: vertical;
    color: transparent;
    caret-color: var(--text);
    position: relative;
    z-index: 1;
}

/* Tag pills in overlay */
.tag-pill {
    border-radius: 3px;
    padding: 0 2px;
}
.tag-pill-emotion { background: rgba(59,130,246,0.15); color: #60a5fa; }
.tag-pill-sfx { background: rgba(34,197,94,0.15); color: var(--positive); }
.tag-pill-pacing { background: rgba(245,158,11,0.15); color: var(--warning); }
.tag-pill-accent { background: rgba(167,139,250,0.15); color: #a78bfa; }
.tag-pill-unknown { background: var(--accent-light); color: var(--text-secondary); }
/* Plain text in overlay must be visible */
.script-highlight { color: var(--text); }

/* Script editor footer */
.script-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 0;
}
.char-counter {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.char-counter.warning { color: var(--warning); }
.char-counter.danger { color: var(--red); }

/* Voice player pro (below tabs) */
.voice-player-pro {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.voice-player-pro audio {
    border-radius: var(--radius);
}

/* ============================================================
   WAVEFORM PLAYER (custom)
   ============================================================ */
.wfp-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 20px;
}
.wfp-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--black);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.wfp-play-btn:hover { transform: scale(1.05); }
.wfp-play-btn svg { width: 14px; height: 14px; }
.wfp-waveform {
    flex: 1;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}
.wfp-bar {
    width: 3px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background 0.1s;
    flex-shrink: 0;
}
.wfp-bar.played { background: var(--accent); }
.wfp-duration {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 36px;
    text-align: right;
}

/* ============================================================
   DIALOGUE MODE
   ============================================================ */
.dialogue-editor {
    margin-top: 10px;
}
.dialogue-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dialogue-line {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.dialogue-line-voice {
    width: 140px;
    flex-shrink: 0;
    font-size: 12px;
}
.dialogue-line-text {
    flex: 1;
    min-height: 36px;
    font-size: 13px;
    padding: 6px 10px;
    resize: vertical;
}
.dialogue-line-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    flex-shrink: 0;
    transition: var(--transition);
}
.dialogue-line-remove:hover { color: var(--red); }

/* ============================================================
   VERSION HISTORY (Tab 4)
   ============================================================ */
.vh-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
}
.vh-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}
.vh-item:hover { border-color: var(--border-hover); }
.vh-item.active { border-color: var(--accent); background: var(--accent-light); }
.vh-version {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text);
    min-width: 28px;
}
.vh-info {
    flex: 1;
    min-width: 0;
}
.vh-info-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.vh-date {
    font-size: 11px;
    color: var(--text-muted);
}
.vh-model-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: var(--border);
    color: var(--text-secondary);
}
.vh-voice {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vh-duration {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    flex-shrink: 0;
}
.vh-active-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--black);
    font-weight: 600;
}
.vh-restore-btn {
    font-size: 11px;
    padding: 3px 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.vh-restore-btn:hover { border-color: var(--accent); color: var(--text); }
.vh-warning {
    font-size: 11px;
    color: var(--warning);
    padding: 8px 0 0;
    text-align: center;
}

/* Voice actions row */
.voice-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 0 0;
}

/* Toolbar disabled state for non-v3 models */
.audio-tags-toolbar.disabled .tag-group-btn::after {
    content: 'v3 only';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
.audio-tags-toolbar.disabled .tag-group-btn:hover::after {
    opacity: 1;
}

/* ============================================================
   VOICE BROWSER (Tab 2)
   ============================================================ */
.vb-custom-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.vb-search-row {
    margin-bottom: 8px;
}
.vb-search-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: var(--transition);
}
.vb-search-input:focus {
    border-color: var(--border-focus);
    outline: none;
}
.vb-filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.vb-filter-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.vb-pill {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.vb-pill:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.vb-pill.active { background: var(--accent); color: var(--black); border-color: var(--accent); }

/* Voice card grid */
.vb-grid {
    max-height: 320px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.vb-grid::-webkit-scrollbar { width: 4px; }
.vb-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.vb-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.vb-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Voice card */
.vb-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.vb-card:hover { border-color: var(--border-hover); }
.vb-card.selected { border-color: var(--accent); background: var(--accent-light); }
.vb-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vb-card-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.vb-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: var(--border);
    color: var(--text-secondary);
}
.vb-badge-cat { text-transform: capitalize; }
.vb-card-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 10px;
    transition: var(--transition);
}
.vb-card-preview:hover { background: var(--accent); color: var(--black); }
.vb-card-check {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--black);
    font-size: 11px;
    align-items: center;
    justify-content: center;
}
.vb-card.selected .vb-card-check { display: flex; }

/* ============================================================
   MODEL SELECTOR
   ============================================================ */
.model-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.model-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.model-card:hover { border-color: var(--border-hover); }
.model-card.active { border-color: var(--accent); background: var(--accent-light); }
.model-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.model-card-badges {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.model-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: var(--border);
    color: var(--text-secondary);
}
.model-badge-fast { background: rgba(34,197,94,0.12); color: var(--positive); }
.model-badge-cost { color: var(--warning); }
.model-card-features {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: wrap;
}
.model-feature {
    font-size: 9px;
    color: var(--text-muted);
}

/* ============================================================
   VOICE SETTINGS (Tab 3)
   ============================================================ */
.vs-section {
    margin-bottom: 14px;
}
.vs-section:last-child { margin-bottom: 0; }
.vs-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.vs-val {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 4px;
}
.vs-row {
    display: flex;
    gap: 12px;
}

/* Presets */
.vs-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.vs-preset {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.vs-preset:hover { border-color: var(--border-hover); color: var(--text); }
.vs-preset.active { background: var(--accent); color: var(--black); border-color: var(--accent); }

/* Range sliders */
.vs-slider-row { margin-bottom: 12px; }
.vs-slider-row:last-child { margin-bottom: 0; }
.vs-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.vs-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.1s;
}
.vs-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.vs-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    cursor: pointer;
}
.vs-slider-marks {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 2px;
    padding: 0 2px;
}

/* Toggle */
.vs-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}
.vs-toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}
.vs-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    cursor: help;
}

/* ============================================================
   VOICE MODALS (Design + Clone)
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    transition: var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 16px 20px;
}
.modal-body .form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.modal-body textarea,
.modal-body input[type="text"],
.modal-body select {
    width: 100%;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}
.modal-status {
    padding: 10px 20px;
    font-size: 13px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-error {
    padding: 10px 20px;
    font-size: 13px;
    color: var(--red);
}

/* Clone dropzone */
.clone-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.clone-dropzone:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.clone-dropzone.has-file { border-color: var(--positive); color: var(--positive); border-style: solid; }

/* Design voice preview list */
.dv-preview-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dv-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}
.dv-preview-item:hover { border-color: var(--border-hover); }
.dv-preview-item.selected { border-color: var(--accent); background: var(--accent-light); }
.dv-preview-item audio { flex: 1; height: 32px; }
.dv-preview-item .btn { flex-shrink: 0; }

/* ============================================================
   RICH TEXT EDITOR (Brief)
   ============================================================ */
.rich-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    align-items: center;
}
.toolbar-btn {
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}
.toolbar-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text);
}
.toolbar-highlight {
    background: var(--warning-light);
    color: var(--black);
    font-weight: 700;
    border-radius: 4px;
}
.toolbar-highlight:hover {
    background: var(--warning);
    color: var(--black);
}
.toolbar-size {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    width: auto;
    min-width: 80px;
}
.rich-editor {
    min-height: 120px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
    outline: none;
    white-space: pre-wrap;
}
.rich-editor:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-light);
}

/* ============================================================
   ELEVENLABS STATUS
   ============================================================ */
.elevenlabs-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot-green { background: var(--green); }
.status-dot-red { background: var(--red); }

/* ============================================================
   CREATE PAGE SPACING FIX
   ============================================================ */
.angle-mode-content {
    margin-bottom: 24px;
}

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */
.lang-switch { display: flex; gap: 2px; background: var(--bg-input); border-radius: 6px; padding: 2px; }
.lang-btn {
    display: inline-block; padding: 4px 10px; border-radius: 4px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
    text-decoration: none; color: var(--text-muted); transition: all 0.15s ease;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.lang-active { background: var(--accent); color: var(--text-inverse); }

/* ============================================================
   DELETE TASK BUTTONS
   ============================================================ */
/* Board card — delete button in flow */
.task-card { position: relative; }
.card-delete-btn {
    flex-shrink: 0;
    width: 20px; height: 20px; border-radius: 5px;
    background: transparent; border: none;
    color: var(--text-muted); font-size: 10px; line-height: 1;
    cursor: pointer; opacity: 0; transition: all 0.15s ease;
    display: flex; align-items: center; justify-content: center;
    margin-left: auto;
}
.task-card:hover .card-delete-btn { opacity: 0.4; }
.card-delete-btn:hover { opacity: 1 !important; background: rgba(229, 72, 77, 0.15); color: var(--red); }

/* Task detail — subtle, red on hover */
.task-delete-btn { font-size: 14px !important; }
.task-delete-btn:hover { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }

/* ============================================================
   EMAIL MARKETING
   ============================================================ */
/* Sections */
.email-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}
.email-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.email-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.email-section-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}
.email-section-body {
    padding: 20px;
    max-height: 380px;
    overflow-y: auto;
}
.email-section-body thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-surface);
}
.email-section-body .email-pre {
    margin: 0;
}
.email-section .email-table-wrap {
    border: none;
    border-radius: 0;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
/* btn-secondary — alias for base .btn style with slight bg */
.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s var(--ease);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-focus); }
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.email-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.email-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    content-visibility: auto;
    contain-intrinsic-size: auto 120px;
}
.email-stat-card:hover { border-color: var(--border-hover); }
.email-stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.email-stat-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.email-table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.email-table {
    width: 100%;
    border-collapse: collapse;
}
.email-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    background: transparent;
}
.email-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
.email-table tr:last-child td { border-bottom: none; }
.email-table tr:hover td { background: rgba(255,255,255,0.02); }
.email-table .campaign-name { font-weight: 500; }
.email-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 16px !important;
}
.email-th-sort { cursor: pointer; user-select: none; }
.email-th-sort:hover { color: var(--text); }
.sort-arrow { font-size: 10px; opacity: 0.7; }

.email-status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.status-sent { background: var(--green-light); color: var(--green); }
.status-draft { background: var(--bg-hover); color: var(--text-muted); }
.status-scheduled { background: var(--orange-light); color: var(--orange); }

.email-output-section {
    margin-top: 0;
}
.email-output {
    padding: 0;
}
.email-pre {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    font-family: inherit;
    margin: 0;
}
/* Rendered markdown in email analysis */
.email-analysis-rendered {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    padding: 20px;
}
.email-analysis-rendered h1,
.email-analysis-rendered h2,
.email-analysis-rendered h3 {
    color: var(--text);
    margin: 20px 0 8px;
    font-weight: 600;
}
.email-analysis-rendered h1 { font-size: 18px; }
.email-analysis-rendered h2 { font-size: 15px; }
.email-analysis-rendered h3 { font-size: 14px; }
.email-analysis-rendered h1:first-child,
.email-analysis-rendered h2:first-child,
.email-analysis-rendered h3:first-child { margin-top: 0; }
.email-analysis-rendered p { margin: 8px 0; }
.email-analysis-rendered ul, .email-analysis-rendered ol {
    margin: 8px 0;
    padding-left: 24px;
}
.email-analysis-rendered li { margin: 4px 0; }
.email-analysis-rendered strong { color: var(--text); font-weight: 600; }
.email-analysis-rendered em { color: var(--text-secondary); }
.email-analysis-rendered code {
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.email-analysis-rendered blockquote {
    border-left: 2px solid var(--gold);
    padding-left: 12px;
    margin: 12px 0;
    color: var(--text-secondary);
}
.email-analysis-rendered hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}
.email-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 14px;
}

/* Content dot indicator */
.email-content-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 6px;
    vertical-align: middle;
}

/* ============================================================
   Email Calendar
   ============================================================ */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.cal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cal-nav-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}
.cal-nav-btn:hover { border-color: var(--border-hover); color: var(--text); }
.cal-month-label {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 160px;
    text-align: center;
}
.cal-actions {
    display: flex;
    gap: 8px;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--border-light);
}
.cal-day-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
    font-family: var(--font-mono);
}
.cal-day {
    min-height: 110px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 6px;
    position: relative;
    transition: background 0.15s;
    overflow: hidden;
    min-width: 0;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.cal-day-other { opacity: 0.3; }
.cal-day.cal-day-today { background: rgba(255,255,255,0.03); }
.cal-day.cal-day-today .cal-day-num { color: var(--accent); font-weight: 700; }
.cal-day-num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 4px;
    display: inline-block;
}
.cal-day.drag-over { background: rgba(255,255,255,0.06); }

/* Calendar campaign cards */
.cal-entry {
    padding: 4px 6px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
    cursor: grab;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}
.cal-entry:active { cursor: grabbing; }
.cal-entry:hover { filter: brightness(1.15); }
.cal-entry:hover .cal-entry-delete { opacity: 1; }
.cal-entry-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0 2px;
}
.cal-entry-delete:hover { color: var(--negative); }

/* Audience colors */
.cal-entry.aud-engaged {
    background: rgba(99, 102, 241, 0.15);
    border-left-color: #6366f1;
    color: #a5b4fc;
}
.cal-entry.aud-shoppers {
    background: rgba(16, 185, 129, 0.15);
    border-left-color: #10b981;
    color: #6ee7b7;
}
.cal-entry.aud-both {
    background: rgba(245, 158, 11, 0.15);
    border-left-color: #f59e0b;
    color: #fcd34d;
}
html.light .cal-entry.aud-engaged { background: rgba(99, 102, 241, 0.1); color: #4338ca; }
html.light .cal-entry.aud-shoppers { background: rgba(16, 185, 129, 0.1); color: #047857; }
html.light .cal-entry.aud-both { background: rgba(245, 158, 11, 0.1); color: #92400e; }

/* Status indicators */
.cal-entry .cal-status-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}
.cal-status-proposal { background: var(--text-muted); }
.cal-status-planned { background: #6366f1; }
.cal-status-brief_approved { background: #8b5cf6; }
.cal-status-copy_ready { background: #f59e0b; }
.cal-status-sent { background: #10b981; }

.cal-entry-title {
    display: block;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-entry-audience {
    font-size: 10px;
    opacity: 0.8;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cal-entry-revenue {
    font-size: 10px;
    font-family: var(--font-mono);
}
.cal-entry-revenue.positive { color: var(--positive); }
.cal-entry-revenue.negative { color: var(--negative); }

/* Calendar legend */
.cal-legend {
    display: flex;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 11px;
    color: var(--text-muted);
}
.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.cal-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}
.cal-legend-dot.engaged { background: #6366f1; }
.cal-legend-dot.shoppers { background: #10b981; }
.cal-legend-dot.both { background: #f59e0b; }

/* Planner modal */
.cal-planner-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.cal-planner-overlay.active { display: flex; }
.cal-planner-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
}
.cal-planner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-light);
}
.cal-planner-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.cal-planner-body {
    padding: 20px 24px;
}
.cal-planner-field {
    margin-bottom: 16px;
}
.cal-planner-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cal-planner-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* Brief panel (full overlay) */
.brief-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 40px 20px;
}
.brief-overlay.active { display: flex; }
.brief-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}
.brief-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    border-radius: 12px 12px 0 0;
    z-index: 2;
}
.brief-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
.brief-panel-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
}
.brief-panel-body {
    padding: 24px;
}

/* Brief field block */
.brief-field {
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
.brief-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-light);
}
.brief-field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}
.brief-field-actions {
    display: flex;
    gap: 6px;
}
.brief-regen-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.brief-regen-btn:hover { border-color: var(--border-hover); color: var(--text); }
.brief-regen-btn:disabled { opacity: 0.4; cursor: default; }
.brief-field-value {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    min-height: 20px;
    cursor: text;
    outline: none;
    transition: background 0.15s;
}
.brief-field-value:focus {
    background: rgba(255,255,255,0.03);
}
.brief-field-value:empty::before {
    content: 'Click para editar...';
    color: var(--text-muted);
}

/* Regen instructions inline input */
.brief-regen-input {
    display: none;
    padding: 8px 14px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-elevated);
}
.brief-regen-input.active { display: flex; gap: 8px; }
.brief-regen-input input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    outline: none;
}
.brief-regen-input input:focus { border-color: var(--border-hover); }
.brief-regen-input button {
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

/* Subject options group */
.brief-subjects-group {
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
.brief-subjects-group .brief-field-header {
    border-bottom: 1px solid var(--border-light);
}
.brief-subject-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}
.brief-subject-option:last-child { border-bottom: none; }
.brief-subject-option:hover { background: rgba(255,255,255,0.02); }
.brief-subject-option.selected {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid #6366f1;
}
html.light .brief-subject-option.selected {
    background: rgba(99, 102, 241, 0.06);
}
.brief-subject-radio {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    transition: all 0.15s;
}
.brief-subject-option.selected .brief-subject-radio {
    border-color: #6366f1;
}
.brief-subject-option.selected .brief-subject-radio::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #6366f1;
}
.brief-subject-content { flex: 1; }
.brief-subject-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-family: var(--font-mono);
}
.brief-subject-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    outline: none;
}
.brief-subject-preheader {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    outline: none;
}
.brief-subject-regen {
    flex-shrink: 0;
}

/* Brief generate / empty state */
.brief-empty-state {
    text-align: center;
    padding: 60px 20px;
}
.brief-empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Brief footer */
.brief-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}
.brief-panel-footer .ai-disclaimer {
    padding: 0;
    font-size: 11px;
}

/* ═══ Calendar Entry Metrics ═══ */
.cal-entry-metrics {
    display: flex;
    gap: 6px;
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 2px;
}
.cal-entry-metrics span {
    background: var(--bg-hover);
    padding: 1px 3px;
    border-radius: 2px;
}

/* ═══ Post-Send Section ═══ */
.brief-post-send {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}
.brief-post-send-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-mono);
}
.post-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.post-metric {
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}
.post-metric-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 4px;
}
.post-metric-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono);
}
.post-analysis-wrap {
    margin-top: 16px;
}
.post-analysis-field {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
}
.post-analysis-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 6px;
}
.post-analysis-value {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}
.post-note-wrap {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.post-note-textarea {
    width: 100%;
    min-height: 60px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    margin-top: 6px;
}
.post-note-textarea::placeholder { color: var(--text-muted); }

/* ═══ Copy Panel ═══ */
.copy-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10001;
    padding: 40px;
    overflow-y: auto;
}
.copy-overlay.active { display: flex; justify-content: center; align-items: flex-start; }
.copy-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.copy-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
}
.copy-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.copy-panel-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: var(--font-mono);
}
.copy-panel-body {
    padding: 20px 24px 24px;
}
.copy-empty-state {
    text-align: center;
    padding: 48px 24px;
}
.copy-section {
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 14px 16px;
    transition: border-color 0.15s;
}
.copy-section:hover {
    border-color: var(--border);
}
.copy-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.copy-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.copy-section-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.copy-section:hover .copy-section-actions { opacity: 1; }
.copy-regen-btn, .copy-edit-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    transition: color 0.15s, border-color 0.15s;
}
.copy-regen-btn:hover, .copy-edit-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
}
.copy-section-value {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}
.copy-production-note {
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}
.copy-regen-wrap {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}
.copy-regen-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text);
}
.copy-regen-input::placeholder { color: var(--text-muted); }
.copy-edit-wrap { margin-top: 8px; }
.copy-edit-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
}

/* ============================================================
   Flows — Champion-Challenger
   ============================================================ */
.flow-alerts-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}
.flow-alerts-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}
.flow-alerts-icon { font-size: 16px; }
.flow-alerts-title { font-size: 14px; color: var(--text-primary); }
.flow-alerts-count {
    background: var(--negative);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
}
.flow-alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.flow-alert-item:hover { background: var(--bg-hover); }
.flow-alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.flow-alert-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.flow-alert-flow { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.flow-alert-email { font-size: 12px; color: var(--text-muted); }
.flow-alert-status { font-size: 12px; font-weight: 500; white-space: nowrap; }

.flow-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.flow-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.flow-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.flow-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.flow-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.flow-card-badge {
    background: var(--negative);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
}
.flow-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.flow-card-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.flow-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.flow-stat-val {
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Flow Detail Overlay */
.flow-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 5000;
    overflow-y: auto;
    padding: 40px 20px;
}
.flow-detail-overlay.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.flow-detail-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 860px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.flow-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.flow-detail-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}
.flow-detail-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}
.flow-detail-emails {
    padding: 20px 28px 28px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Flow Email Rows */
.flow-email-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-surface);
}
.flow-email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.flow-email-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.flow-email-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.flow-email-front,
.flow-email-metric {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}
.flow-email-days {
    color: var(--text-muted);
}
.flow-email-status {
    font-weight: 600;
}

/* Variant Comparison */
.flow-variants-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}
.flow-variant-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}
.flow-variant-card.champion {
    border-color: var(--positive);
    border-left: 3px solid var(--positive);
}
.flow-variant-card.challenger {
    border-color: var(--warning);
    border-left: 3px solid var(--warning);
}
.flow-variant-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.flow-variant-card.champion .flow-variant-label { color: var(--positive); }
.flow-variant-card.challenger .flow-variant-label { color: var(--warning); }
.flow-variant-subject {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-style: italic;
}
.flow-variant-metrics {
    display: flex;
    gap: 12px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* Stats Bar */
.flow-stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.flow-stats-winner {
    color: var(--positive);
    font-weight: 600;
}

.flow-single-variant {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
    font-style: italic;
}

/* Email Actions */
.flow-email-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.flow-metric-select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 3px 8px;
    cursor: pointer;
}

/* Battle History */
.flow-battle-list {
    margin-top: 8px;
}
.flow-battle-item {
    padding: 10px 12px;
    border-left: 2px solid var(--border);
    margin-bottom: 8px;
}
.flow-battle-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.flow-battle-num {
    font-weight: 600;
    color: var(--text-primary);
}
.flow-battle-learning {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Flow Config Modal */
.flow-config-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 6000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.flow-config-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.flow-config-modal h4 {
    margin: 0 0 20px;
    font-size: 16px;
    font-weight: 600;
}
.flow-config-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}
.flow-config-fields label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.flow-config-fields input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
}
.flow-config-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .cal-day { min-height: 70px; }
    .cal-entry { font-size: 10px; padding: 3px 4px; }
    .cal-month-label { font-size: 13px; min-width: 120px; }
    .brief-panel { max-width: 100%; }
    .brief-overlay { padding: 20px 10px; }
    .copy-panel { max-width: 100%; }
    .copy-overlay { padding: 20px 10px; }
    .flow-detail-panel { max-width: 100%; }
    .flow-detail-overlay { padding: 20px 10px; }
    .flow-variants-compare { grid-template-columns: 1fr; }
    .flow-cards { grid-template-columns: 1fr; }
    .flow-decision-panel { max-width: 100%; margin: 10px; }
}

/* Flow Decision Overlay (Step 6) */
.flow-decision-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10001;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}
.flow-decision-overlay.active {
    display: flex;
}
.flow-decision-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 640px;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.flow-decision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 1;
}
.flow-decision-header h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}
.decision-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.decision-section:last-of-type {
    border-bottom: none;
}
.decision-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}
.decision-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.5;
}
.decision-field-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.decision-learning {
    background: var(--bg-hover);
    padding: 10px 12px;
    border-radius: var(--radius);
    border-left: 3px solid var(--positive);
}
.decision-app-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: fit-content;
}
.decision-challenger-text {
    margin-bottom: 12px;
}
.decision-challenger-text label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.decision-challenger-text textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
}
.decision-challenger-text textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.decision-challenger-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.decision-meta-item {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 6px 10px;
    background: var(--bg-hover);
    border-radius: var(--radius);
}
.decision-meta-item strong {
    color: var(--text);
}
.decision-actions {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
}

/* Flow Tabs */
.flow-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 2px;
}
.flow-tab {
    padding: 4px 12px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.flow-tab:hover { color: var(--text); }
.flow-tab.active {
    background: var(--bg-surface);
    color: var(--text);
    font-weight: 500;
}

/* Battle History — enriched (Step 7) */
.battle-variants-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}
.battle-variant-mini {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    background: var(--bg-hover);
    border-radius: var(--radius);
    font-size: 12px;
}
.battle-variant-tag {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.battle-variant-tag.champ { color: var(--positive); }
.battle-variant-tag.chall { color: #a78bfa; }
.battle-variant-text {
    color: var(--text);
    line-height: 1.4;
}
.battle-variant-metric {
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
}
.battle-stats-row {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 6px;
    padding: 4px 0;
}
.battle-pattern {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--bg-hover);
    border-radius: var(--radius);
    border-left: 2px solid #60a5fa;
}

/* Knowledge Base */
.kb-filters {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.kb-filters select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 8px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    min-width: 140px;
}
.kb-filters select:focus { outline: none; border-color: var(--accent); }
.kb-entries {
    padding: 14px 20px;
    max-height: 600px;
    overflow-y: auto;
}
.kb-entry {
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: var(--bg-primary);
}
.kb-entry:hover { border-color: var(--border); }
.kb-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.kb-entry-source {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.kb-entry-flow {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.kb-entry-email {
    font-size: 12px;
    color: var(--text-muted);
}
.kb-entry-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.kb-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    white-space: nowrap;
}
.kb-tag-app {
    background: var(--bg-surface);
    border-color: var(--accent);
    color: var(--text);
}
.kb-entry-learning {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    padding: 10px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius);
    border-left: 3px solid var(--positive);
    margin-bottom: 8px;
}
.kb-entry-details {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.kb-entry-details strong {
    color: var(--text-muted);
}

/* Email Preview Modal */
.email-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.email-preview-overlay.active {
    display: flex;
}
.email-preview-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.email-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.email-preview-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 40px);
}
.email-preview-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.email-preview-close:hover { color: var(--text); }
.email-preview-meta {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text);
}
.email-preview-field {
    margin-bottom: 4px;
}
.email-preview-field:last-child { margin-bottom: 0; }
.email-preview-loading {
    color: var(--text-muted);
    font-style: italic;
}
.email-preview-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    padding: 0 20px;
}
.email-preview-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
.email-preview-tab:hover { color: var(--text); }
.email-preview-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.email-preview-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 400px;
}
.email-preview-pane {
    display: none;
    position: absolute;
    inset: 0;
    overflow-y: auto;
}
.email-preview-pane.active { display: block; }
.email-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}
.email-preview-copytext {
    padding: 20px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}
.email-preview-ctas {
    padding: 12px 20px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.email-preview-ctas strong {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 4px;
}
.email-cta-pill {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================================
   EMAIL INSPIRATION LIBRARY
   ============================================================ */
.inspo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.inspo-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px;
    transition: var(--transition);
}
.inspo-card:hover {
    border-color: var(--border);
}
.inspo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.inspo-brand {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}
.inspo-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0;
    transition: var(--transition);
}
.inspo-card:hover .inspo-delete { opacity: 1; }
.inspo-delete:hover { color: var(--negative); }
.inspo-subject {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.4;
}
.inspo-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}
.inspo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.inspo-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
}
.inspo-notes {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}
.inspo-source {
    margin-top: 6px;
}
.inspo-source a {
    font-size: 11px;
    color: var(--primary);
    text-decoration: none;
}
.inspo-source a:hover { text-decoration: underline; }

/* ============================================================
   CONCEPT CARDS + CAMPAIGN PIPELINE (Fase 2)
   ============================================================ */
.loading-spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.concept-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    padding: 16px 20px;
}
.concept-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}
.concept-card:hover {
    border-color: var(--primary);
}
.concept-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
}
.concept-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.concept-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.concept-tag-emotion {
    background: var(--negative-light);
    color: var(--negative);
    border-color: rgba(229, 72, 77, 0.2);
}
.concept-tag-format {
    background: var(--info-light);
    color: var(--info);
    border-color: rgba(54, 158, 255, 0.2);
}
.concept-card-hook {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
    font-style: italic;
}
.concept-card-subjects {
    margin-bottom: 12px;
}
.concept-subject-line {
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 0;
}
.concept-create-btn {
    width: 100%;
    margin-top: 4px;
}

/* --- My Campaigns Section --- */
.my-campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    padding: 16px 20px;
}
.my-campaign-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}
.my-campaign-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.my-campaign-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.my-campaign-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.my-campaign-subject {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.my-campaign-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Status pills for campaigns */
.status-draft { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.status-ready { background: var(--positive-light); color: var(--positive); }
.status-sent { background: var(--info-light); color: var(--info); }

/* ============================================================
   CAMPAIGN DETAIL PAGE
   ============================================================ */
.campaign-detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}
@media (max-width: 900px) {
    .campaign-detail-layout { grid-template-columns: 1fr; }
}
.campaign-detail-main {
    min-width: 0;
}
.campaign-detail-sidebar {
    min-width: 0;
}
.campaign-status-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}
.campaign-section {
    margin-bottom: 24px;
}
.campaign-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.campaign-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.campaign-field-value {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 0;
    flex: 1;
}
.campaign-field-value:hover {
    color: var(--primary);
}

/* Subject variants */
.subject-variants-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.subject-variant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
}
.subject-variant-item input[type="radio"] {
    accent-color: var(--primary);
}
.subject-variant-item:hover { color: var(--text-primary); }

/* Copy sections */
.copy-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}
.copy-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-light);
}
.copy-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.copy-section-regen {
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s;
}
.copy-section:hover .copy-section-regen { opacity: 1; }
.copy-section-text {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    cursor: pointer;
    min-height: 40px;
}
.copy-section-text:hover {
    background: rgba(255,255,255,0.02);
}

/* Format selector */
.campaign-html-controls {
    margin-top: 10px;
}
.format-selector {
    display: flex;
    gap: 6px;
}
.format-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}
.format-option.active {
    border-color: var(--primary);
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}
.format-option input[type="radio"] {
    accent-color: var(--primary);
}

/* Template gallery */
.template-gallery {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--surface);
}
.template-cat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 12px 0 6px;
}
.template-cat-label:first-child {
    margin-top: 0;
}
.template-cat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.template-card {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    width: 140px;
    flex-shrink: 0;
}
.template-card:hover {
    border-color: var(--text-secondary);
}
.template-card-active {
    border-color: var(--primary);
    background: rgba(255,255,255,0.05);
}
.template-card-thumb {
    width: 100%;
    height: 100px;
    overflow: hidden;
    border-radius: calc(var(--radius) - 2px);
    background: var(--bg);
    margin-bottom: 6px;
    position: relative;
}
.template-card-thumb-loading {
    width: 100%;
    height: 100%;
    background: linear-gradient(110deg, var(--bg) 30%, var(--surface) 50%, var(--bg) 70%);
    background-size: 200% 100%;
    animation: thumb-shimmer 1.5s ease-in-out infinite;
}
@keyframes thumb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.template-thumb-iframe {
    width: 600px;
    height: 800px;
    border: none;
    transform: scale(0.233);
    transform-origin: top left;
    pointer-events: none;
}
.template-thumb-fallback {
    width: 100%;
    height: 100%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
}
.template-card-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.template-card-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.template-card-tags {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.template-card-stats {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 1px;
}

/* HTML preview iframe */
.campaign-preview-iframe {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
}

/* Sidebar */
.campaign-sidebar-section {
    margin-bottom: 20px;
}
.campaign-sidebar-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.campaign-meta-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.campaign-meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.campaign-meta-label {
    font-size: 12px;
    color: var(--text-muted);
}
.concept-original-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 8px;
}
.concept-original-body p { margin: 0 0 8px; }
.concept-original-body ul { margin: 4px 0 8px 16px; padding: 0; }
.concept-original-body li { margin-bottom: 4px; }
.concept-voc-quote {
    font-style: italic;
    color: var(--text-muted);
    border-left: 2px solid var(--border);
    padding-left: 10px;
}
.campaign-history {
    font-size: 12px;
    color: var(--text-muted);
}
.campaign-history-item { margin-bottom: 4px; }

/* ============================================================
   INSPIRATION ENGINE — Brands + Emails Page
   ============================================================ */
.inspo-brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.inspo-brand-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
}
.inspo-brand-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.inspo-brand-inactive {
    opacity: 0.5;
}
.inspo-brand-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.inspo-brand-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.inspo-brand-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}
.inspo-brand-card:hover .inspo-brand-card-actions {
    opacity: 1;
}
.inspo-brand-action {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.inspo-brand-action:hover {
    background: var(--bg);
    color: var(--text);
}
.inspo-brand-action-danger:hover {
    color: var(--negative);
}
.inspo-brand-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.inspo-brand-card-domain {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
}
/* Email list inside expanded brand */
.inspo-email-list {
    display: flex;
    flex-direction: column;
}
.inspo-email-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.inspo-email-row:last-child {
    border-bottom: none;
}
.inspo-email-row:hover {
    background: var(--bg);
}
.inspo-email-info {
    flex: 1;
    min-width: 0;
}
.inspo-email-subject {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.inspo-email-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
    margin-bottom: 4px;
}
.inspo-email-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================
   VIDEOS PAGE — Unified Workflow Steps
   ============================================================ */
.video-step {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
}
/* Stripe-style connector line between steps */
.video-step + .video-step {
    margin-top: 0;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.video-step + .video-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 39px;
    width: 1px;
    height: 0;
    background: var(--border);
}
.video-step:first-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.video-step:not(:first-child):not(:last-child) {
    border-radius: 0;
}
.video-step:last-of-type {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    margin-bottom: 20px;
}
.video-step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}
.video-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--border-focus);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.video-step-num.active,
.video-step:first-child .video-step-num {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--black);
    font-weight: 700;
}
.video-step-num.completed {
    background: var(--green);
    border-color: var(--green);
    color: var(--black);
}
.video-step-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}
.video-step-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}
.video-step-body {
    padding: 24px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .board { padding: 12px 8px; }
    .board-column { min-width: 200px; max-width: 200px; }
    .task-layout { grid-template-columns: 1fr; }
    .task-sidebar { border-left: none; border-top: 1px solid var(--border); }
    .chat-layout { grid-template-columns: 1fr; }
    .chat-left-sidebar { display: none; }
    .chat-right-sidebar { display: none; }
    .header { padding: 0 12px; }
    .sidebar { width: 54px; }
    .sidebar .sidebar-label { opacity: 0; width: 0; }
    .sidebar .sidebar-link { justify-content: center; padding: 8px 0; border-radius: 0; gap: 0; }
    .sidebar .sidebar-nav { padding: 8px 0; }
    .sidebar .sidebar-group .sidebar-link { padding-left: 0; }
    .sidebar .sidebar-section-label { padding: 0; height: auto; margin: 6px 8px; background: none; }
    .sidebar .sidebar-section-label span { display: none; }
    .sidebar .sidebar-badge {
        position: absolute; top: 4px; right: 6px;
        min-width: 7px; height: 7px; padding: 0; font-size: 0; border-radius: 50%;
    }
    .app-main { margin-left: 54px; }
    .page-container { padding: 24px 16px; }
    .email-summary { grid-template-columns: repeat(2, 1fr); }
    .email-table { font-size: 12px; }
    .email-table th, .email-table td { padding: 8px 10px; }
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dash {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

/* --- Header (greeting + actions) --- */
.dash-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}
.dash-greeting__time {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}
.dash-greeting__name {
    font-size: 26px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.dash-greeting__name::after {
    content: '';
    display: block;
    width: 32px;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
    margin-top: 6px;
}
/* dash-action-btn removed — redundant with sidebar nav */

/* --- KPI Row --- */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.dash-kpi {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    opacity: 0;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.dash-kpi:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}
.dash-kpi::before { display: none; }
.dash-kpi__icon { display: none; }
.dash-kpi__body { display: flex; flex-direction: column; gap: 10px; }
.dash-kpi__value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.dash-kpi__label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    order: -1;
}
.dash-kpi__trend {
    font-size: 11px;
    line-height: 1;
    min-height: 14px;
}

/* --- Stale Alert --- */
.dash-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}
.dash-alert--urgent {
    background: rgba(229, 72, 77, 0.08);
    border: 1px solid rgba(229, 72, 77, 0.2);
    color: var(--negative);
}
.dash-alert__link {
    margin-left: auto;
    font-size: 12px;
    color: var(--negative);
    opacity: 0.8;
    text-decoration: none;
    white-space: nowrap;
}
.dash-alert__link:hover { opacity: 1; }

/* --- Quick Actions --- */
.dash-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.dash-quick-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.dash-quick-action:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--bg-hover);
}
.dash-quick-action svg { opacity: 0.6; }
.dash-quick-action:hover svg { opacity: 1; }

/* --- Main Grid --- */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    align-items: start;
}
.dash-col-main { display: flex; flex-direction: column; gap: 20px; }
.dash-col-side { display: flex; flex-direction: column; gap: 20px; }
.dash-card-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* --- Cards --- */
.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dash-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03) 50%, transparent);
}
.dash-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.dash-card__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}
.dash-card__title svg { opacity: 0.5; }
.dash-card__link {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.dash-card__link:hover { color: var(--gold); }

/* --- Pipeline --- */
.dash-pipeline__bars { display: flex; flex-direction: column; gap: 8px; }
.dash-pipeline__row {
    display: grid;
    grid-template-columns: 140px 1fr 32px;
    align-items: center;
    gap: 12px;
}
.dash-pipeline__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-pipeline__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-pipeline__bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
    overflow: hidden;
}
.dash-pipeline__bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.8;
}
.dash-pipeline__count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.dash-pipeline__skeleton { display: flex; flex-direction: column; gap: 8px; }

/* --- My Tasks --- */
.dash-task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.15s ease;
    text-decoration: none;
    color: var(--text);
}
.dash-task-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.dash-task-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-task-item__title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-task-item__status {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 2px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 999px;
    white-space: nowrap;
}

/* --- Stat Rows (Support / Email) --- */
.dash-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dash-stat-row:last-child { border-bottom: none; }
.dash-stat-row__label {
    font-size: 13px;
    color: var(--text-secondary);
}
.dash-stat-row__value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.dash-stat-row__value--alert {
    color: var(--red);
}

/* --- Badges --- */
.dash-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.dash-badge--success {
    color: var(--green);
    background: var(--green-light);
}
.dash-badge--neutral {
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
}

/* --- Team --- */
.dash-team__list { display: flex; flex-direction: column; gap: 4px; }
.dash-team__member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.dash-team__member:hover { background: var(--bg-hover); }
.dash-team__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.dash-team__name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.dash-team__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-team__dot--online {
    background: var(--green);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}
.dash-team__footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* --- Activity Feed --- */
.dash-activity { display: flex; flex-direction: column; }
.dash-activity__item {
    display: flex;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
    text-decoration: none;
    color: var(--text);
    position: relative;
}
.dash-activity__item:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.dash-activity__item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 36px;
    bottom: -2px;
    width: 1px;
    background: rgba(255,255,255,0.06);
}
.dash-activity__icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    z-index: 1;
}
.dash-activity__content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-top: 2px;
}
.dash-activity__title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-activity__meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* --- Empty State --- */
.dash-empty {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
}

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 800px 100%;
    animation: dash-shimmer 1.5s infinite linear;
    border-radius: 6px;
}
.skeleton-text {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 800px 100%;
    animation: dash-shimmer 1.5s infinite linear;
}
.skeleton-value {
    height: 28px;
    width: 60px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 800px 100%;
    animation: dash-shimmer 1.5s infinite linear;
    display: inline-block;
}
.skeleton-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.skeleton-row:last-child { border-bottom: none; }
.skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 800px 100%;
    animation: dash-shimmer 1.5s infinite linear;
    flex-shrink: 0;
}
.skeleton-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* Hide skeletons once data loads */
.dash-loaded .skeleton-placeholder { display: none; }
@keyframes dash-shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

/* --- Fade-in Animation --- */
@keyframes dash-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dash-fade-in {
    animation: dash-fade-up 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* --- Dashboard Responsive --- */
@media (max-width: 1100px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
    .dash-col-side {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}
@media (max-width: 768px) {
    .dash { padding: 20px 16px 48px; }
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .dash-kpis {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .dash-kpi { padding: 16px 20px; }
    .dash-kpi__value { font-size: 22px; }
    .dash-col-side {
        grid-template-columns: 1fr;
    }
    .dash-actions {
        flex-wrap: wrap;
    }
    .dash-pipeline__row {
        grid-template-columns: 100px 1fr 28px;
    }
    .dash-card-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   PRIORITY
   ============================================================ */
/* Priority dots — legacy, now using left border accent on .task-card.prio-* */
.card-priority { display: none; }

.priority-selector {
    display: flex;
    gap: 4px;
}
.priority-pill {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.priority-pill:hover { background: var(--bg-hover); color: var(--text); }
.priority-pill.active.priority-alta { border-color: var(--negative); background: var(--negative-light); color: var(--negative); }
.priority-pill.active.priority-media { border-color: var(--warning); background: var(--warning-light); color: var(--warning); }
.priority-pill.active.priority-baja { border-color: var(--positive); background: var(--positive-light); color: var(--positive); }

/* Correction tags */
.correction-selector {
    display: flex;
    gap: 4px;
    margin-left: 4px;
}
.correction-pill {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.correction-pill:hover { background: var(--bg-hover); color: var(--text); }
.correction-pill.active.correction-pending { border-color: var(--warning); background: var(--warning-light); color: var(--warning); }
.correction-pill.active.correction-done { border-color: var(--positive); background: var(--positive-light); color: var(--positive); }

/* Correction indicator on kanban cards (legacy compat) */
.card-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.card-correction {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}
.card-correction.correccion { background: var(--warning); box-shadow: 0 0 6px rgba(245, 166, 35, 0.4); }
.card-correction.corregido { background: var(--positive); box-shadow: 0 0 6px rgba(48, 164, 108, 0.4); }

/* File delete button — visible on hover only */
.file-delete-btn {
    opacity: 0;
    color: var(--red) !important;
    font-size: 16px !important;
    padding: 0 4px !important;
    transition: opacity 0.15s;
}
.file-item:hover .file-delete-btn { opacity: 1; }

/* ============================================================
   FILE UPLOAD PROGRESS
   ============================================================ */
.file-uploading, .file-upload-done, .file-upload-error {
    flex-wrap: wrap;
    gap: 6px 10px;
}
.file-uploading .file-name, .file-upload-done .file-name, .file-upload-error .file-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.upload-progress-wrap {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    order: 10;
}
.upload-progress-bar {
    height: 100%;
    width: 0;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.2s;
}
.upload-progress-bar.done { background: var(--positive); }
.upload-progress-bar.error { background: var(--red); }
.upload-pct {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}
.upload-status {
    font-size: 11px;
    color: var(--text-muted);
}
.upload-status.success { color: var(--positive); font-weight: 600; }
.upload-status.error { color: var(--red); }

/* ============================================================
   DRAG & DROP IMPROVEMENTS (ClickUp-style)
   ============================================================ */
body.is-dragging {
    cursor: grabbing !important;
    user-select: none;
}
body.is-dragging .task-card { cursor: grabbing; }

/* ============================================================
   @MENTIONS DROPDOWN (task comments)
   ============================================================ */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 4px;
}
.mention-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}
.mention-item:hover, .mention-item.selected {
    background: var(--gold-light);
}
.comment-hint {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

/* ============================================================
   Brand Switcher
   ============================================================ */

.brand-switcher {
    position: relative;
}

.brand-switcher-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 4px 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    border-radius: 8px;
}

.brand-switcher-trigger:hover {
    background: var(--bg-hover);
}

/* Avatar — round, works as img or initial span */
.brand-avatar,
img.brand-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #a68b3d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-inverse);
    flex-shrink: 0;
    object-fit: cover;
}

.brand-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-chevron {
    opacity: 0.4;
    transition: opacity 0.15s;
}
.brand-switcher-trigger:hover .brand-chevron { opacity: 0.8; }

.brand-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    z-index: 1000;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}

.brand-dropdown.open {
    display: block;
    animation: fadeIn 0.12s ease;
}

/* Logo section at top of dropdown */
.brand-dropdown-logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 10px;
}
.brand-logo-upload-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}
.brand-logo-preview,
.brand-logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}
.brand-logo-placeholder {
    background: linear-gradient(135deg, var(--gold), #a68b3d);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-inverse);
}
.brand-logo-edit {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    color: var(--text-secondary);
}
.brand-logo-upload-wrap:hover .brand-logo-edit { opacity: 1; }
.brand-logo-info { overflow: hidden; }
.brand-logo-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-logo-url {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.brand-dropdown-header {
    padding: 6px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 14px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: background 0.1s;
}

.brand-option:hover {
    background: var(--bg-hover);
}

.brand-option.active {
    background: var(--gold-light);
    color: var(--gold);
}

/* Avatar in dropdown list — round */
.brand-avatar-sm,
img.brand-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #a68b3d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-inverse);
    flex-shrink: 0;
    object-fit: cover;
}

.brand-role-badge {
    font-size: 10px;
    background: var(--gold-light);
    color: var(--gold);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 600;
}

.brand-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 2px 0;
}

.brand-create-btn {
    color: var(--text-muted) !important;
    padding-bottom: 10px !important;
}

.brand-create-btn:hover {
    color: var(--text) !important;
}

/* ============================================================
   User Profile Dropdown
   ============================================================ */

.user-profile-dropdown {
    position: relative;
}

.user-profile-dropdown .user-badge {
    cursor: pointer;
    border: none;
    background: none;
    padding: 2px;
    border-radius: 50%;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: 2px solid transparent;
}

.user-profile-dropdown .user-badge:hover {
    outline-color: rgba(255, 255, 255, 0.5);
}

.user-badge-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.user-badge-initial {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #a68b3d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-inverse);
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 260px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-focus);
    border-radius: 10px;
    padding: 0;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    overflow: hidden;
}

.profile-dropdown.open {
    display: block;
    animation: fadeIn 0.12s ease;
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #a68b3d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-inverse);
    flex-shrink: 0;
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.profile-avatar-edit {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-inverse);
    opacity: 0;
    transition: opacity 0.15s;
}

.profile-avatar-wrap:hover .profile-avatar-edit {
    opacity: 1;
}

.user-badge-photo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 4px;
}

.profile-phone-row {
    display: flex;
    gap: 6px;
}

.profile-phone-select {
    width: 90px !important;
    flex-shrink: 0;
    font-size: 0.8rem !important;
    padding: 7px 4px !important;
}

.profile-phone-number {
    flex: 1;
    min-width: 0;
}

/* Profile photos in chat, permissions, dashboard */
.chat-avatar-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.chat-msg-avatar .chat-avatar-photo {
    width: 32px;
    height: 32px;
}

.perm-avatar-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dash-team__avatar-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mention-avatar-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.profile-username {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
}

.profile-edit-section {
    padding: 12px 16px;
}

.profile-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.profile-input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.profile-input:focus {
    border-color: var(--gold);
}

.profile-save-btn {
    width: 100%;
    margin-top: 10px;
    padding: 7px;
    background: var(--gold);
    color: var(--text-inverse);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
}

.profile-save-btn:hover {
    filter: brightness(1.1);
}

.profile-msg {
    font-size: 0.75rem;
    min-height: 16px;
    text-align: center;
}

.profile-logout-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.1s;
}

.profile-logout-btn:hover {
    background: rgba(255,255,255,0.04);
    color: var(--negative);
}

/* ============================================================
   Permissions Page
   ============================================================ */

.permissions-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px;
}

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

.permissions-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.permissions-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.permissions-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.permissions-add-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-gold {
    background: var(--gold);
    color: var(--text-inverse);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
}

.btn-gold:hover {
    filter: brightness(1.1);
}

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

.permissions-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

.permissions-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.perm-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.perm-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #a68b3d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-inverse);
    flex-shrink: 0;
}

.perm-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.perm-uname {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.role-owner {
    background: var(--accent-light);
    color: var(--accent-text);
}

.role-admin {
    background: var(--info-light);
    color: var(--info);
}

.role-member {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
}

.perm-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    color: var(--positive);
}

/* Toggle switch */
.perm-toggle {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.perm-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.perm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 9px;
    transition: 0.2s;
}

.perm-slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.perm-toggle input:checked + .perm-slider {
    background: var(--gold);
}

.perm-toggle input:checked + .perm-slider:before {
    transform: translateX(14px);
}

.perm-remove-btn {
    font-size: 1.1rem;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.perm-remove-btn:hover {
    opacity: 1;
    color: var(--negative);
}

/* ============================================================
   Modal Overlay (for brand create)
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-focus);
    border-radius: 14px;
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}

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

/* ============================================================
   Media Library
   ============================================================ */

.media-page { padding: 24px 32px; max-width: 1400px; margin: 0 auto; }
.media-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-title { font-size: 1.5rem; font-weight: 600; }
.page-subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }

.media-section { margin-bottom: 20px; }

/* Upload zone */
.media-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}
.media-upload-zone:hover, .media-upload-zone.drag-active {
    border-color: var(--text);
    background: var(--bg-hover);
    color: var(--text);
}
.upload-icon { margin-bottom: 12px; color: var(--text-muted); }
.media-upload-zone.drag-active .upload-icon { color: var(--text); }
.upload-link { color: var(--text); cursor: pointer; text-decoration: underline; font-weight: 500; }

.upload-progress-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.upload-progress-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 12px;
    font-size: 0.8rem;
}
.upload-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.upload-bar { flex: 0 0 120px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-bar-fill { height: 100%; background: var(--text); width: 0; transition: width 0.2s; border-radius: 2px; }
.upload-status { flex: 0 0 36px; text-align: right; font-size: 0.75rem; color: var(--text-secondary); }
.upload-retry-btn { flex: 0 0 auto; font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); cursor: pointer; transition: background 0.15s; }
.upload-retry-btn:hover { background: var(--bg-hover); }

/* Lasso multi-select */
.media-lasso { position:fixed; border:1px solid var(--accent-border); background:var(--accent-light); border-radius:2px; z-index:50; pointer-events:none; }
.media-grid.lasso-active { cursor:crosshair; }
body.lasso-dragging { user-select:none; -webkit-user-select:none; }

/* Bulk selection */
.media-bulk-bar { display:flex; align-items:center; gap:12px; padding:8px 16px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); margin-bottom:12px; }
.media-bulk-bar .bulk-count { font-size:0.85rem; color:var(--text); font-weight:500; }
.media-card.selected { outline:2px solid var(--text); outline-offset:-2px; }
.media-card .media-select-check { position:absolute; top:6px; left:6px; z-index:2; width:18px; height:18px; border-radius:4px; border:1.5px solid rgba(255,255,255,0.7); background:rgba(0,0,0,0.3); cursor:pointer; display:none; align-items:center; justify-content:center; color:#fff; font-size:12px; }
.media-card:hover .media-select-check, .media-card.selected .media-select-check { display:flex; }
.media-card.selected .media-select-check { background:var(--text); border-color:var(--text); }

/* AdFactory toggle in detail modal */
.adf-toggle-wrap { margin-bottom:10px; }
.adf-toggle { display:inline-flex; align-items:center; gap:6px; padding:5px 14px; border-radius:20px; font-size:0.75rem; font-weight:600; font-family:inherit; cursor:pointer; transition:all 0.2s ease; border:1.5px solid var(--border); background:transparent; color:var(--text-muted); }
.adf-toggle:hover { border-color:var(--gold-border); color:var(--gold); }
.adf-toggle.adf-active { background:rgba(234,179,8,0.15); border-color:var(--gold); color:var(--gold); }
.adf-toggle.adf-active svg { fill:var(--gold); stroke:var(--gold); }
.adf-toggle:disabled { opacity:0.5; cursor:wait; }

/* AdFactory info banner */
.adf-info-banner { display:flex; align-items:center; justify-content:space-between; padding:10px 16px; margin-bottom:12px; border-radius:var(--radius); border-left:3px solid var(--gold); background:rgba(234,179,8,0.06); }
.adf-info-content { display:flex; align-items:center; gap:10px; font-size:0.8rem; color:var(--text-secondary); line-height:1.4; }
.adf-info-content svg { flex-shrink:0; stroke:var(--gold); }
.adf-info-content strong { color:var(--text); font-weight:600; }
.adf-info-close { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:18px; padding:0 4px; line-height:1; opacity:0.6; }
.adf-info-close:hover { opacity:1; color:var(--text); }

/* AdFactory bulk button */
.adf-bulk-btn { color:var(--gold) !important; }
.adf-bulk-btn svg { stroke:var(--gold); }

/* Toolbar */
.media-toolbar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.media-search-wrap {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 6px 12px; flex: 1; min-width: 200px;
}
.media-search-wrap svg { flex-shrink: 0; color: var(--text-muted); }
.media-search {
    background: none; border: none; color: var(--text); font-size: 0.85rem;
    outline: none; width: 100%; font-family: inherit;
}
.media-search-mode {
    flex-shrink: 0;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.media-search-mode:hover { border-color: var(--border-hover); color: var(--text); }
.media-filters { display: flex; align-items: center; gap: 6px; }
.filter-btn {
    padding: 6px 14px; font-size: 0.8rem; font-weight: 500;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-secondary);
    cursor: pointer; transition: var(--transition); font-family: inherit;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: var(--bg-hover); border-color: var(--text); color: var(--text); font-weight: 600; }
.media-select {
    padding: 6px 10px; font-size: 0.8rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-secondary);
    cursor: pointer; font-family: inherit; outline: none;
}

/* Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.media-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: var(--transition); cursor: pointer;
}
.media-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.media-thumb {
    position: relative; width: 100%; padding-top: 100%;
    background: var(--bg); overflow: hidden;
}
.media-thumb img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
}
.media-thumb-placeholder {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.media-audio-placeholder { background: rgba(16,185,129,0.06); }
.ml-audio-placeholder { background: rgba(16,185,129,0.08); border-radius: 4px; }
.media-play-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px; background: rgba(0,0,0,0.6);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    z-index: 2;
}
.media-audio-badge { background: rgba(16,185,129,0.7); width: 36px; height: 36px; }
.media-audio-badge svg { width: 16px; height: 16px; }
.media-duration {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.75); color: white; font-size: 0.7rem;
    padding: 2px 6px; border-radius: 4px; font-weight: 500; z-index: 2;
}
.media-card-info { padding: 10px 12px; }
.media-card-name {
    font-size: 0.8rem; font-weight: 500; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-card-meta {
    display: flex; gap: 8px; margin-top: 4px;
    font-size: 0.7rem; color: var(--text-muted);
}
.media-empty {
    grid-column: 1 / -1; text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.media-empty p { margin-top: 12px; }

/* Processing overlay */
.media-processing-overlay {
    position: absolute; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.7); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.media-processing-overlay span {
    font-size: 0.7rem; color: white; padding: 4px 10px;
    background: rgba(0,0,0,0.5); border-radius: 12px;
    animation: mediaPulse 1.5s ease-in-out infinite;
}
@keyframes mediaPulse { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

/* Detail Modal */
.media-detail-modal { max-width: 900px; width: 95%; max-height: 90vh; overflow: hidden; }
.media-detail-layout { display: flex; gap: 24px; padding: 20px; max-height: calc(90vh - 40px); }
.media-detail-preview { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-detail-sidebar { flex: 0 0 260px; overflow-y: auto; max-height: calc(90vh - 80px); padding-right: 4px; scrollbar-width: thin; }
.media-detail-sidebar::-webkit-scrollbar { width: 4px; }
.media-detail-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.media-detail-sidebar h3 {
    font-size: 0.95rem; font-weight: 600; margin-bottom: 16px;
    word-break: break-word;
}
.media-detail-meta { margin-bottom: 16px; }
.meta-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 0.8rem; }
.meta-label { color: var(--text-muted); }

.media-detail-tags-section { margin-bottom: 16px; }
.media-detail-tags-section h4 { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 8px; }
.media-tags-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.media-tag {
    display: inline-block; padding: 3px 10px;
    background: var(--gold-light); border: 1px solid var(--gold-border);
    border-radius: 20px; font-size: 0.7rem; color: var(--gold); font-weight: 500;
}
.media-no-tags { font-size: 0.75rem; color: var(--text-muted); }
.media-tag-ai {
    background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.25);
    color: rgba(99,102,241,0.85);
}
.media-tag-mandatory {
    background: rgba(234,179,8,0.1); border-color: rgba(234,179,8,0.3);
    color: rgba(234,179,8,0.9);
}

/* Folders bar */
.media-folders-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 16px; padding: 8px 0;
}
.media-folder-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px; font-size: 0.78rem;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
    font-family: inherit; white-space: nowrap;
}
.media-folder-chip:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text); }
.media-folder-chip.active { background: var(--bg-hover); border-color: var(--text); color: var(--text); font-weight: 600; }
.media-folder-count {
    font-size: 0.65rem; background: var(--bg-hover); border-radius: 8px;
    padding: 1px 6px; color: var(--text-muted);
}
.media-folder-wrap {
    display: inline-flex; align-items: center; position: relative;
}
.media-folder-wrap .media-folder-chip {
    border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none;
    padding-right: 8px;
}
.media-folder-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 100%; padding: 6px 0; border: 1px solid var(--border);
    border-left: none; border-radius: 0 20px 20px 0;
    background: var(--bg-card); color: var(--text-muted); cursor: pointer;
    font-size: 0.72rem; font-family: inherit; transition: all 0.15s;
    letter-spacing: -1px;
}
.media-folder-menu-btn:hover { background: var(--bg-hover); color: var(--text); }
.media-folder-wrap .media-folder-chip.active + .media-folder-menu-btn {
    background: var(--bg-hover); border-color: var(--text); color: var(--text);
}
.media-folder-add {
    width: 30px; height: 30px; padding: 0; justify-content: center;
    font-size: 1rem; font-weight: 300; color: var(--text-muted);
}
.media-folder-add:hover { color: var(--text); }

/* Folder context menu */
.folder-ctx-menu {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 0; min-width: 140px; width: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.folder-ctx-menu button {
    display: block; width: 100%; padding: 6px 12px; border: none; background: none;
    color: var(--text-secondary); font-size: 0.76rem; cursor: pointer;
    font-family: inherit; text-align: left; white-space: nowrap;
}
.folder-ctx-menu button:hover { background: var(--bg-hover); color: var(--text); }
.folder-ctx-menu button:last-child:hover { color: var(--red, #e74c3c); }

/* View toggle */
.media-view-toggle {
    display: inline-flex; gap: 2px; margin-left: 8px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 2px;
}
.media-view-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 26px; border: none; border-radius: 6px;
    background: none; color: var(--text-muted); cursor: pointer;
    transition: all 0.15s;
}
.media-view-btn:hover { color: var(--text); background: var(--bg-hover); }
.media-view-btn.active { color: var(--text); background: var(--bg-hover); }

/* List view */
.media-view-list { display: block !important; }
.media-list-table { width: 100%; }
.media-list-header {
    display: flex; align-items: center; gap: 0;
    padding: 0 8px; height: 32px;
    border-bottom: 1px solid var(--border);
    font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.media-list-row {
    display: flex !important; align-items: center; gap: 0;
    padding: 0 8px; height: 48px;
    border-bottom: 1px solid var(--border-light, rgba(255,255,255,0.04));
    cursor: pointer; transition: background 0.1s;
    border-radius: 0 !important; border: none !important;
    transform: none !important; box-shadow: none !important;
    background: none !important; position: relative;
}
.media-list-row:hover { background: var(--bg-hover) !important; }
.media-list-row.selected { background: var(--accent-light, rgba(99,102,241,0.08)) !important; }

/* List columns */
.ml-col { flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-col-check { width: 32px; display: flex; align-items: center; justify-content: center; }
.ml-col-check .media-select-check {
    position: static; width: 20px; height: 20px; font-size: 11px;
    opacity: 0.4; transform: none;
}
.media-list-row:hover .ml-col-check .media-select-check,
.media-list-row.selected .ml-col-check .media-select-check { opacity: 1; }
.ml-col-thumb { width: 48px; display: flex; align-items: center; justify-content: center; }
.ml-thumb {
    width: 40px; height: 40px; border-radius: 6px; overflow: hidden;
    background: var(--bg-card); flex-shrink: 0;
}
.ml-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ml-thumb-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
}
.ml-col-name {
    flex: 1; min-width: 120px; padding: 0 12px;
    font-size: 0.8rem; color: var(--text); font-weight: 500;
    cursor: pointer;
}
.media-list-row .ml-col-name:hover { text-decoration: underline; }
.ml-sortable { cursor: pointer; user-select: none; }
.ml-sortable:hover { color: var(--text); }
.ml-col-type { width: 70px; font-size: 0.72rem; }
.ml-type-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 0.68rem; font-weight: 500;
}
.ml-type-video { background: rgba(99,102,241,0.12); color: rgba(99,102,241,0.9); }
.ml-type-image { background: rgba(234,179,8,0.12); color: rgba(234,179,8,0.9); }
.ml-type-audio { background: rgba(16,185,129,0.12); color: rgba(16,185,129,0.9); }
.ml-col-size { width: 70px; font-size: 0.74rem; color: var(--text-secondary); }
.ml-col-ratio { width: 55px; font-size: 0.74rem; color: var(--text-secondary); }
.ml-col-dur { width: 50px; font-size: 0.74rem; color: var(--text-secondary); }
.ml-col-date { width: 75px; font-size: 0.7rem; color: var(--text-muted); }
.ml-col-ai { width: 32px; font-size: 0.8rem; text-align: center; }
.ml-ai-done { color: var(--green, #22c55e); }
.ml-ai-progress { color: var(--text-secondary); }
.ml-ai-pending { color: var(--text-muted); }
.ml-col-actions { width: 36px; display: flex; align-items: center; justify-content: center; position: relative; }
.ml-actions-btn {
    width: 28px; height: 28px; border: none; background: none;
    color: var(--text-muted); cursor: pointer; border-radius: 6px;
    font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.15s;
}
.media-list-row:hover .ml-actions-btn { opacity: 1; }
.ml-actions-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Move to folder popup */
.media-move-folder-popup {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 0; min-width: 200px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.media-move-folder-title {
    font-size: 0.72rem; color: var(--text-muted); padding: 4px 14px 8px;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
}
.media-move-folder-option {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 14px; border: none; background: none;
    color: var(--text-secondary); font-size: 0.82rem; cursor: pointer;
    font-family: inherit; text-align: left;
}
.media-move-folder-option:hover { background: var(--bg-hover); color: var(--text); }
.media-tag-editable { padding-right: 6px; cursor: default; }
.media-tag-remove {
    display: inline-block; margin-left: 4px; cursor: pointer;
    font-size: 0.85rem; line-height: 1; color: var(--gold); opacity: 0.7;
    font-weight: 700; vertical-align: middle;
}
.media-tag-remove:hover { opacity: 1; color: var(--red, #e74c3c); }
.media-tag-input-wrap { display: flex; gap: 6px; margin-bottom: 8px; }
.media-tag-input {
    flex: 1; padding: 4px 8px; font-size: 0.75rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); outline: none; font-family: inherit;
}

.media-detail-actions { display: flex; gap: 8px; margin-top: 16px; }
.media-delete-btn { color: var(--red) !important; border-color: var(--red) !important; }
.media-delete-btn:hover { background: var(--red-light) !important; }

/* Navigation arrows */
.media-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
}
.media-nav-arrow:hover { background: rgba(0,0,0,0.85); border-color: var(--border-hover); color: var(--text); }
.media-nav-prev { left: 16px; }
.media-nav-next { right: 16px; }

/* Quick actions menu on cards */
.media-card { position: relative; }
.media-card-actions-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    padding: 0;
    line-height: 1;
}
.media-card:hover .media-card-actions-btn { opacity: 1; }
.media-card-actions-btn:hover { background: rgba(0,0,0,0.85); }

.media-card-actions-menu {
    display: none;
    position: absolute;
    top: 40px;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 10;
    overflow: hidden;
    min-width: 140px;
}
.media-card-actions-menu.open { display: block; }
.media-card-actions-menu button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.media-card-actions-menu button:hover { background: var(--bg-hover); }
.media-card-actions-menu button.menu-delete { color: var(--red); }
.media-card-actions-menu button.menu-delete:hover { background: var(--red-light); }
.media-rename-input {
    width: 100%; padding: 2px 4px; font-size: 0.78rem; font-family: inherit;
    background: var(--bg); border: 1px solid var(--gold); border-radius: 4px;
    color: var(--text); outline: none; box-sizing: border-box;
}

/* Toast */
.media-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    color: var(--text);
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.media-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 768px) {
    .media-page { padding: 16px; }
    .media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .media-toolbar { flex-direction: column; }
    .media-detail-layout { flex-direction: column; }
    .media-detail-sidebar { flex: 1; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .media-nav-prev { left: 8px; }
    .media-nav-next { right: 8px; }
    .media-card-actions-btn { opacity: 1; }
}

/* ============================================================
   BOARDS LIST PAGE
   ============================================================ */
.boards-page {
    padding: 32px 40px;
    max-width: 900px;
}
.boards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.boards-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
}
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.board-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text);
}
.board-card:hover {
    border-color: var(--gold-border);
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}
.board-card-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}
.board-card-info {
    flex: 1;
    min-width: 0;
}
.board-card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.board-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}
.board-card-type-badge {
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-hover);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.board-card-count {
    color: var(--text-muted);
}
.board-card-arrow {
    color: var(--text-muted);
    font-size: 16px;
    transition: var(--transition);
}
.board-card:hover .board-card-arrow {
    color: var(--gold);
    transform: translateX(3px);
}
.board-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--negative);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    z-index: 2;
}
.board-card:hover .board-delete-btn { opacity: 0.5; }
.board-delete-btn:hover { opacity: 1 !important; background: rgba(255,69,58,0.15); }

/* Board Rename Button */
.board-rename-btn {
    position: absolute;
    top: 8px;
    right: 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    z-index: 2;
}
.board-card:hover .board-rename-btn { opacity: 0.5; }
.board-rename-btn:hover { opacity: 1 !important; background: var(--bg-hover); color: var(--text); }

/* Board subheader rename cursor hint */
.board-subheader-name[data-board-id] { cursor: text; }
.board-subheader-name[data-board-id]:hover { color: var(--accent); }

/* Multi-select checkbox — now handled by .card-check-wrap custom checkbox */
.task-select-cb {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Selected task card highlight */
.task-card.task-selected {
    border-color: rgba(255, 255, 255, 0.15) !important;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Batch move toolbar */
.batch-toolbar {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: batchSlideUp 0.2s ease-out;
}
@keyframes batchSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.batch-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}
.batch-select {
    font-size: 13px;
    padding: 5px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    min-width: 140px;
}
.batch-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; border-radius: var(--radius); transition: var(--transition); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.board-card-create {
    border-style: dashed;
    justify-content: center;
}
.board-card-create:hover {
    border-color: var(--gold);
}

/* Board Subheader (inside kanban view) */
.board-subheader {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.board-back-link {
    font-size: 13px;
    color: var(--text-muted);
    transition: var(--transition);
}
.board-back-link:hover {
    color: var(--gold);
}
.board-subheader-icon {
    font-size: 18px;
}
.board-subheader-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.board-subheader-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Board Type Selector (create modal) */
.board-type-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.board-type-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}
.board-type-option:hover {
    border-color: var(--gold-border);
    background: var(--bg-hover);
}
.board-type-option.selected {
    border-color: var(--gold);
    background: var(--gold-light);
}
.board-type-option input[type="radio"] {
    display: none;
}
.board-type-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.board-type-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.board-type-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

@media (max-width: 768px) {
    .boards-page { padding: 16px; }
    .boards-grid { grid-template-columns: 1fr; }
    .board-subheader { padding: 10px 16px; }
}

/* ============================================================
   IMAGE STUDIO — Image Generation
   ============================================================ */

/* Fix: prevent ANY scrolling — only chat-messages scrolls */
html:has(.image-studio-page),
body:has(.image-studio-page) {
    overflow: hidden;
    height: 100vh;
}
body:has(.image-studio-page) .app-main {
    height: calc(100vh - 54px);
    max-height: calc(100vh - 54px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.image-studio-page {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Sidebar */
.image-studio-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease, opacity 0.15s ease;
}

.image-studio-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

.image-studio-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px 6px;
    gap: 8px;
}

.image-studio-sidebar-header h2 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.image-studio-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.image-studio-stats {
    padding: 0 12px 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.image-studio-stats-sep { margin: 0 4px; }

.image-studio-sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 6px 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.image-studio-sessions-list::-webkit-scrollbar { width: 6px; }
.image-studio-sessions-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.image-studio-sessions-list::-webkit-scrollbar-track { background: transparent; }

.image-studio-session-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    transition: all 0.12s ease;
    margin-bottom: 1px;
    border: 1px solid transparent;
}

.image-studio-session-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.image-studio-session-item.active {
    background: var(--accent-light);
    border-color: transparent;
    border-left: 2px solid var(--accent);
}

.image-studio-session-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px;
}

.image-studio-session-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.image-studio-session-delete {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: all 0.12s ease;
    line-height: 1;
}

.image-studio-session-item:hover .image-studio-session-delete {
    opacity: 1;
}

.image-studio-session-delete:hover {
    color: var(--red);
    background: var(--red-light);
}

.image-studio-empty-sessions {
    padding: 32px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}
/* Dim sessions with 0 images */
.image-studio-session-item[data-empty="true"] {
    opacity: 0.45;
}
.image-studio-session-item[data-empty="true"] .image-studio-session-title::after {
    content: ' (vacía)';
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Sidebar toggle (visible when sidebar collapsed) */
.image-studio-sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 11;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    line-height: 0;
    transition: all 0.15s ease;
}
.image-studio-sidebar-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text);
}
/* Shift chat header when toggle button is visible to avoid overlap */
.image-studio-page:has(.image-studio-sidebar.collapsed) .image-studio-chat-header {
    padding-left: 48px;
}
.image-studio-sidebar-collapse {
    color: var(--text-muted);
    transition: color 0.12s ease;
}
.image-studio-sidebar-collapse:hover { color: var(--text); }

/* Main area */
.image-studio-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    position: relative;
}

/* No API key state */
.image-studio-no-key {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.image-studio-no-key-icon { margin-bottom: 16px; line-height: 0; }
.image-studio-no-key h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 8px; color: var(--text); letter-spacing: -0.01em; }
.image-studio-no-key p { color: var(--text-muted); margin: 0; font-size: 0.85rem; }
.image-studio-no-key code {
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent-text);
}

/* Empty state */
.image-studio-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.image-studio-empty-state h2 { font-size: 1.25rem; font-weight: 600; margin: 0; color: var(--text); letter-spacing: -0.01em; }

.image-studio-new-session-btn {
    margin-top: 20px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.image-studio-new-session-btn:hover { opacity: 0.85; }

/* Chat header — sticky */
.image-studio-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
    gap: 12px;
}

.image-studio-chat-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid transparent;
    transition: all 0.15s ease;
    cursor: text;
}

.image-studio-chat-title:hover {
    border-bottom-color: var(--border-hover);
}

.image-studio-chat-title:focus {
    background: var(--bg-input);
    border-bottom-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.image-studio-chat-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.image-studio-select {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.12s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234A4A55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 22px;
}

.image-studio-select:hover { border-color: var(--border-hover); }
.image-studio-select:focus {
    border-color: var(--accent-border);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-light);
}

.image-studio-brand-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.15s ease;
    user-select: none;
}
.image-studio-brand-toggle:hover { border-color: var(--border-hover); }
.image-studio-brand-toggle input { display: none; }
.image-studio-brand-toggle:has(input:checked) {
    border-color: var(--accent-border);
    background: var(--accent-light);
    color: var(--accent-text);
}
.image-studio-brand-toggle-label { font-weight: 500; white-space: nowrap; }

/* Chat messages area */
.image-studio-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.image-studio-chat-messages::-webkit-scrollbar { width: 6px; }
.image-studio-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.image-studio-chat-messages::-webkit-scrollbar-track { background: transparent; }

.image-studio-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.image-studio-msg { display: flex; }
.image-studio-msg-user { justify-content: flex-end; }
.image-studio-msg-model { justify-content: flex-start; }

.image-studio-msg-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.image-studio-msg-user-bubble {
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.image-studio-msg-model-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.image-studio-msg-refs {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.image-studio-msg-text {
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.image-studio-msg-image {
    position: relative;
    margin-top: 8px;
}

.image-studio-msg-image img {
    max-width: 600px;
    max-height: 500px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
}

.image-studio-msg-image img:hover { opacity: 0.9; }

.image-studio-msg-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.image-studio-msg-error {
    color: var(--red);
    font-size: 0.85rem;
}

/* Skeleton loading */
.image-studio-skeleton {
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

/* Input area */
.image-studio-input-area {
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 12px 20px;
}

.image-studio-refs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.image-studio-refs-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.image-studio-refs-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.image-studio-ref-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 8px 3px 3px;
    font-size: 0.75rem;
}

.image-studio-ref-chip img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}

.image-studio-ref-chip button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 0.9rem;
}

.image-studio-ref-chip button:hover { color: var(--red); }

.image-studio-refs-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.image-studio-refs-clear:hover { color: var(--red); }

/* Analyze button on ref chips */
.image-studio-ref-analyze {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
}
.image-studio-ref-analyze:hover { color: var(--accent-text); border-color: var(--accent-text); }

/* Analysis panel */
.image-studio-analysis-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0 16px 12px;
    overflow: hidden;
}
.image-studio-analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.image-studio-analysis-title {
    font-size: 0.8rem;
    font-weight: 600;
}
.image-studio-analysis-close {
    background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
}
.image-studio-analysis-body {
    padding: 10px 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    max-height: 280px;
    overflow-y: auto;
}
.image-studio-analysis-body .analysis-field {
    margin-bottom: 6px;
}
.image-studio-analysis-body .analysis-label {
    font-weight: 600;
    color: var(--text-muted);
    display: inline;
    margin-right: 4px;
}
.image-studio-analysis-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    align-items: center;
}
.image-studio-adapt-input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.78rem;
    padding: 5px 8px;
}

/* Context bar */
.image-studio-context-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}
.image-studio-context-bar svg { opacity: 0.6; }
.image-studio-context-clear {
    background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; margin-left: auto;
}
.image-studio-context-clear:hover { color: var(--red); }

/* Adaptation sets */
.image-studio-adapt-sets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.image-studio-adapt-set-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
}
.image-studio-adapt-notes {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 4px 0;
}

.image-studio-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-studio-ref-upload-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.12s ease;
}
.image-studio-ref-upload-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

.image-studio-drop-zone {
    flex: 1;
    position: relative;
    border: 2px dashed transparent;
    border-radius: var(--radius);
    transition: border-color 0.2s, background 0.2s;
}

.image-studio-drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
}

.image-studio-drop-zone.drag-over::after {
    content: 'Suelta aquí';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent-text);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius);
    z-index: 2;
    pointer-events: none;
}

.image-studio-prompt-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    line-height: 1.5;
    min-height: 42px;
    max-height: 120px;
}

.image-studio-prompt-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.image-studio-prompt-input::placeholder { color: var(--text-muted); }

.image-studio-send-btn {
    background: var(--accent);
    border: none;
    color: var(--text-inverse);
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.image-studio-send-btn:hover { opacity: 0.85; }
.image-studio-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Optimize button */
.image-studio-optimize-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.image-studio-optimize-btn:hover { border-color: var(--border-hover); color: var(--accent-text); }
.image-studio-optimize-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.image-studio-optimize-btn.loading { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Optimizer panel */
.image-studio-optimizer-panel {
    background: var(--card-bg);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    max-height: 340px;
    overflow-y: auto;
}
.image-studio-optimizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.image-studio-optimizer-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold);
}
.image-studio-optimizer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
}
.image-studio-optimizer-close:hover { color: var(--text-primary); }

.builder-category {
    margin-bottom: 8px;
}
.builder-category:last-child { margin-bottom: 0; }
.builder-cat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    font-weight: 600;
}
.builder-cat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.builder-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 11px;
    border-radius: 14px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}
.builder-chip:hover {
    border-color: var(--border-hover);
    color: var(--text);
}
.builder-chip.selected {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    font-weight: 600;
}

.image-studio-optimizer-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.builder-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.image-studio-optimizer-generate {
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.image-studio-optimizer-generate:hover { opacity: 0.85; }
.image-studio-optimizer-generate:disabled { opacity: 0.4; cursor: not-allowed; }

/* Optimized prompt preview */
.image-studio-optimized-preview {
    background: var(--bg-card);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
}
.image-studio-optimized-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.image-studio-optimized-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
}
.image-studio-optimized-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
}
.image-studio-optimized-close:hover { color: var(--text-primary); }
.image-studio-optimized-text {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
}
.image-studio-optimized-summary {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* Inline reference badge in chat bubbles */
.image-studio-ref-label-inline {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(var(--accent-rgb, 212,175,55), 0.15);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb, 212,175,55), 0.3);
    margin-right: 6px;
    vertical-align: middle;
}
/* Inline optimized label in chat bubbles */
.image-studio-optimized-label-inline {
    font-size: 0.85rem;
}
.image-studio-show-optimized {
    display: block;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 0 0 0;
    text-decoration: underline;
}
.image-studio-show-optimized:hover { opacity: 0.8; }
.image-studio-optimized-full {
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Grid for multiple generated images (4 variants) */
.image-studio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.image-studio-grid-cell {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
}
.image-studio-grid-cell img {
    width: 100%;
    display: block;
    border-radius: var(--radius-lg);
    transition: transform 0.2s;
}
.image-studio-grid-cell:hover img {
    transform: scale(1.02);
}
.image-studio-grid-actions {
    position: absolute;
    bottom: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.image-studio-grid-cell:hover .image-studio-grid-actions {
    opacity: 1;
}
.image-studio-grid-actions button {
    background: rgba(0,0,0,0.7);
    border: none;
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.image-studio-grid-actions button:hover {
    background: rgba(255,255,255,0.85);
    color: var(--text-inverse);
}

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    border-color: var(--gold-border);
    color: var(--gold);
}

/* Image Modal (fullscreen) */
.image-studio-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.image-studio-modal-overlay.open {
    display: flex;
}

.image-studio-modal-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    object-fit: contain;
}

.image-studio-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: var(--radius);
}

.image-studio-modal-close:hover { background: rgba(255,255,255,0.2); }

/* Media Picker */
.media-picker-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.media-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-picker-item:hover { border-color: var(--border-hover); }
.media-picker-item.selected { border-color: var(--text); }

.media-picker-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--gold);
    font-weight: 700;
}

.media-picker-item.selected .media-picker-check {
    background: var(--gold);
    color: var(--text-inverse);
}

/* Edit label in user bubble */
.image-studio-edit-label {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Edit Modal */
.image-studio-edit-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.image-studio-edit-overlay.open {
    display: flex;
}

.image-studio-edit-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90vw;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.image-studio-edit-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.image-studio-edit-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.image-studio-edit-close:hover { color: var(--text); }

.image-studio-edit-preview {
    padding: 16px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.image-studio-edit-preview img {
    max-width: 100%;
    max-height: 50vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.image-studio-edit-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
}

.image-studio-edit-prompt {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    line-height: 1.5;
    min-height: 42px;
    max-height: 80px;
}

.image-studio-edit-prompt:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.image-studio-edit-prompt::placeholder { color: var(--text-muted); }

/* Inpaint Modal */
.image-studio-inpaint-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90vw;
    max-width: 660px;
    max-height: 90vh;
    overflow-y: auto;
}
.image-studio-inpaint-toolbar {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 16px; border-bottom: 1px solid var(--border);
    font-size: 0.78rem; color: var(--text-secondary);
}
.image-studio-inpaint-toolbar label { display: flex; align-items: center; gap: 6px; }
.image-studio-inpaint-toolbar input[type="range"] {
    width: 100px; accent-color: var(--accent);
}
.image-studio-inpaint-canvas-wrap {
    display: flex; justify-content: center; padding: 12px;
    background: var(--bg); border-bottom: 1px solid var(--border);
}
#inpaintCanvas {
    cursor: crosshair; border-radius: 8px; max-width: 100%;
    border: 1px solid var(--border);
}

/* Image action buttons (edit, download, save) */
.image-studio-msg-image-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-studio-msg-image:hover .image-studio-msg-image-actions {
    opacity: 1;
}

.image-studio-msg-image-actions button {
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
    transition: background 0.15s;
}

.image-studio-msg-image-actions button:hover {
    background: rgba(255,255,255,0.85);
    color: var(--text-inverse);
}

@media (max-width: 768px) {
    .image-studio-page { flex-direction: column; }
    .image-studio-sidebar { width: 100%; min-width: 100%; height: auto; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
    .image-studio-sidebar.collapsed { height: 0; max-height: 0; }
    .image-studio-msg-bubble { max-width: 90%; }
    .image-studio-edit-panel { width: 95vw; }
    .image-studio-msg-image-actions { opacity: 1; }
}

/* ============================================================
   AI Disclaimer Badge
   ============================================================ */
.ai-disclaimer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    margin-top: 10px;
    opacity: 0.7;
}
.ai-disclaimer svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.6;
}
.ai-disclaimer--light {
    color: #7B7B7B;
    opacity: 0.65;
}

/* ============================================================
   NUMBERS (P&L)
   ============================================================ */
.numbers-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

.numbers-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}

.numbers-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text);
}

.numbers-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.numbers-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Month Navigator */
.numbers-month-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
}

.numbers-month-arrow {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.numbers-month-arrow:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.numbers-month-current {
    background: none;
    border: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 6px 16px;
    cursor: default;
    letter-spacing: -0.01em;
    min-width: 100px;
    text-align: center;
}

.btn-numbers-new {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--gold);
    color: var(--text-inverse);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-numbers-new:hover {
    filter: brightness(1.1);
}

/* Operational Expenses Bar */
.numbers-opex-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 22px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.numbers-opex-bar:hover {
    border-color: var(--border-hover);
}

.numbers-opex-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.numbers-opex-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--orange-light);
    border-radius: var(--radius);
    color: var(--orange);
    flex-shrink: 0;
}

.numbers-opex-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.numbers-opex-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.numbers-opex-values {
    text-align: right;
}

.numbers-opex-total {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    padding: 4px 10px;
    letter-spacing: -0.02em;
}

.numbers-opex-daily {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    padding-right: 10px;
}

/* Summary Cards */
.numbers-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.numbers-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.numbers-card:hover {
    border-color: var(--border-hover);
}

.numbers-card-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.numbers-card-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.numbers-card--revenue,
.numbers-card--expenses,
.numbers-card--profit {
    border-left: none;
}

.numbers-card--negative .numbers-card-value {
    color: var(--red);
}

/* Lock Bar */
.numbers-lock-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: var(--orange);
}

.numbers-lock-toggle {
    margin-left: auto;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--orange);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.numbers-lock-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

.numbers-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.numbers-empty p {
    font-size: 0.88rem;
}

/* Tabs */
.numbers-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    padding: 0 0 0 4px;
    margin-bottom: 0;
}

.numbers-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    margin-bottom: -1px;
}

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

.numbers-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.numbers-tab svg {
    opacity: 0.6;
}

.numbers-tab.active svg {
    opacity: 1;
}

.numbers-tabs-spacer {
    flex: 1;
}

.numbers-lock-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.numbers-lock-btn:hover {
    border-color: var(--orange);
    color: var(--orange);
}

.numbers-save-indicator {
    font-size: 0.75rem;
    color: var(--green);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    margin-left: 8px;
    margin-right: 8px;
    white-space: nowrap;
}

.numbers-save-indicator.visible {
    opacity: 1;
}

/* Panels */
.numbers-panel {
    display: none;
}

.numbers-panel.active {
    display: block;
}

.numbers-panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.numbers-panel-total {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.numbers-panel-total strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.numbers-panel-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.btn-numbers-add {
    margin-left: auto;
    background: none;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-numbers-add:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* Table */
.numbers-table-wrap {
    overflow-x: auto;
}

.numbers-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.numbers-table thead th {
    background: transparent;
    padding: 10px 14px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.numbers-table thead th.col-day,
.numbers-table thead th.col-name {
    text-align: left;
}

.numbers-table tbody td {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
    cursor: default;
}

.numbers-table tbody tr:hover td {
    background: rgba(255,255,255,0.02);
}

.numbers-table tbody td.col-day {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    width: 50px;
    cursor: default;
}

.numbers-table tbody td.col-money,
.numbers-table tbody td.col-num {
    cursor: pointer;
}

.numbers-table tbody td.col-money:hover:not(.col-formula),
.numbers-table tbody td.col-num:hover {
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
}

.numbers-table tbody td.col-formula {
    color: var(--text-secondary);
    cursor: default;
    font-style: italic;
}

.numbers-table tbody td.col-profit {
    font-weight: 600;
    color: var(--green);
}

.numbers-table tbody td.col-profit.negative {
    color: var(--red);
}

.numbers-table tbody td.col-name {
    text-align: left;
    cursor: pointer;
}

.numbers-table tbody td.col-name:hover {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.numbers-table tbody td.col-amount {
    text-align: right;
    cursor: pointer;
    min-width: 120px;
}

.numbers-table tbody td.col-amount:hover:not(.col-formula) {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.numbers-table tbody td.col-actions {
    width: 36px;
    padding: 4px 8px;
    text-align: center;
}

.numbers-table--simple {
    max-width: 600px;
}

.numbers-table--simple thead th.col-name {
    width: 65%;
}

/* Total Row */
.numbers-total-row td {
    font-weight: 700;
    font-size: 0.88rem;
    padding: 12px 14px;
    border-top: 2px solid var(--border);
    border-bottom: none;
    background: var(--bg-surface);
}

.numbers-total-row td.col-profit {
    color: var(--green);
}

.numbers-total-row td.col-profit.negative {
    color: var(--red);
}

/* Formula rows in expenses */
.formula-row td {
    color: var(--text-secondary);
    font-style: italic;
}

/* Inline editing input */
.numbers-cell-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--gold);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.84rem;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    outline: none;
    text-align: right;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.numbers-cell-input[type="text"] {
    text-align: left;
}

/* Delete button for rows */
.numbers-row-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition);
    line-height: 1;
}

.numbers-table tbody tr:hover .numbers-row-delete {
    opacity: 0.5;
}

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

/* Opex Collapsible Categories */
.opex-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.opex-category:hover {
    border-color: rgba(255,255,255,0.08);
}

.opex-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.opex-category-header:hover {
    background: var(--bg-hover);
}

.opex-category-arrow {
    font-size: 0.88rem;
    color: var(--text-muted);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.opex-category.collapsed .opex-category-arrow {
    transform: rotate(-90deg);
}

.opex-category-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.opex-category-total {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.opex-category-body {
    padding: 0 18px 16px;
    border-top: 1px solid var(--border-light);
}

.opex-category.collapsed .opex-category-body {
    display: none;
}

.opex-category-body .numbers-table--simple {
    max-width: 100%;
    margin-top: 8px;
}

.opex-add-btn {
    margin: 12px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Budget Bar */
.numbers-budget-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 22px;
    margin-bottom: 16px;
}

.numbers-budget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.numbers-budget-fields {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.numbers-budget-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.numbers-budget-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.numbers-budget-input {
    width: 110px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s;
}

.numbers-budget-input:focus {
    border-color: var(--accent);
    outline: none;
}

/* Budget Progress in Cards */
.numbers-card-budget {
    margin-top: 4px;
}

.budget-progress {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.budget-progress__bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

.budget-progress__label {
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Category Select */
.numbers-cat-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.numbers-cat-select:focus {
    border-color: var(--accent);
    outline: none;
}

.col-category {
    width: 110px;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .numbers-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    .numbers-budget-bar {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .numbers-page {
        padding: 20px 16px 48px;
    }
    .numbers-header {
        flex-direction: column;
        gap: 14px;
    }
    .numbers-summary {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .numbers-card {
        padding: 14px 16px;
    }
    .numbers-card-value {
        font-size: 22px;
    }
    .numbers-table--simple {
        max-width: 100%;
    }
    .numbers-budget-fields {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   THEME TOGGLE
   ============================================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* Show sun in dark mode (click to go light), moon in light mode (click to go dark) */
.theme-icon-moon { display: none; }
.theme-icon-sun { display: block; }
html.light .theme-icon-moon { display: block; }
html.light .theme-icon-sun { display: none; }

/* ============================================================
   LIGHT MODE — Day View
   ============================================================ */
html.light {
    /* ── Backgrounds — warm-tinted neutrals (Impeccable) ── */
    --bg:          #F6F6F8;
    --bg-surface:  #FEFEFF;
    --bg-card:     #FEFEFF;
    --bg-hover:    #EFEFF2;
    --bg-input:    #FEFEFF;
    --bg-elevated: #FEFEFF;
    --bg-active:   #E7E7EC;

    /* ── Borders — subtle, shadows do the heavy lifting ── */
    --border:       rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);
    --border-focus: rgba(0, 0, 0, 0.20);
    --border-hover: rgba(0, 0, 0, 0.12);

    /* ── Text — max contrast like Vercel ── */
    --text:           #0A0A0B;
    --text-secondary: #5C5C66;
    --text-muted:     #9C9CA6;
    --text-inverse:   #FFFFFF;
    --white: #ffffff;
    --black: #000000;

    /* ── Accent — Monochrome (black in light) ── */
    --accent:        #0A0A0B;
    --accent-hover:  #262630;
    --accent-light:  rgba(0, 0, 0, 0.04);
    --accent-border: rgba(0, 0, 0, 0.12);
    --accent-text:   #0A0A0B;

    /* ── Semantic — darker for light bg ── */
    --positive:       #18794E;
    --positive-light: rgba(24, 121, 78, 0.07);
    --negative:       #CD2B31;
    --negative-light: rgba(205, 43, 49, 0.07);
    --warning:        #AD5700;
    --warning-light:  rgba(173, 87, 0, 0.07);
    --info:           #0A6DC9;
    --info-light:     rgba(10, 109, 201, 0.07);

    /* ── Aliases light mode ── */
    --bg-primary:    var(--bg);
    --text-primary:  var(--text);
    --font-mono:     'Geist Mono', 'SF Mono', 'Roboto Mono', monospace;

    /* ── Shadows — light mode: shadows create depth (Stripe/Vercel) ── */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow:    0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.03);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.03);
    --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.06);
}

/* ── Light mode scrollbar ── */
html.light ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
html.light ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }

/* ── Light mode selection ── */
html.light ::selection { background: rgba(0, 0, 0, 0.10); color: var(--text); }

/* ── Light mode buttons ── */
html.light .btn-primary {
    background: #0A0A0B;
    color: #FFFFFF;
    border-color: #0A0A0B;
}
html.light .btn-primary:hover {
    background: #262630;
    border-color: #262630;
}
html.light .btn-primary:active { background: #363640; }

html.light .btn-gold, html.light .btn-accent {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

html.light .btn-ghost:hover {
    background: rgba(0,0,0,0.04);
}
html.light .btn-ghost:active { background: rgba(0,0,0,0.07); }

/* ── Light mode status pill ── */
html.light .status-pill.active {
    background: #0A0A0B;
    color: #FFFFFF;
    border-color: #0A0A0B;
}

/* ── Light mode sidebar ── */
html.light .sidebar {
    background: var(--bg-surface);
    border-right-color: var(--border);
}
html.light .sidebar-link.active {
    color: #0A0A0B;
    background: var(--bg-hover);
    font-weight: 600;
}
html.light .sidebar-link.active::before {
    background: #0A0A0B;
}

/* ── Light mode cards — shadows create depth (Vercel/Stripe) ── */
html.light .card,
html.light .dash-card,
html.light .dash-kpi,
html.light .stat-card,
html.light .email-stat-card,
html.light .numbers-card,
html.light .inspo-card,
html.light .inspo-brand-card,
html.light .my-campaign-card,
html.light .result-card,
html.light .campaign-section,
html.light .campaign-detail-sidebar {
    box-shadow: var(--card-shadow);
    border-color: rgba(0,0,0,0.06);
}
html.light .card:hover,
html.light .dash-card:hover,
html.light .inspo-card:hover,
html.light .inspo-brand-card:hover,
html.light .my-campaign-card:hover {
    box-shadow: var(--shadow);
    border-color: rgba(0,0,0,0.08);
}
html.light .task-card {
    box-shadow: var(--card-shadow);
    border-color: rgba(0,0,0,0.06);
    border-left-width: 3px;
}
html.light .task-card:hover {
    box-shadow: var(--shadow-md);
    background: var(--bg-hover);
}
html.light .card-assignee {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    border-color: rgba(0, 0, 0, 0.1);
}
html.light .card-check-icon {
    border-color: rgba(0, 0, 0, 0.15);
}
html.light .card-check-wrap:hover .card-check-icon {
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.03);
}
html.light .task-select-cb:checked ~ .card-check-icon {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}
html.light .task-card.task-selected {
    border-color: rgba(0, 0, 0, 0.15) !important;
    background: rgba(0, 0, 0, 0.02);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
html.light .card-delete-btn:hover {
    background: rgba(229, 72, 77, 0.1);
}
html.light .inline-edit-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
}
html.light .inline-edit-input:focus {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.04);
}

/* ── Light mode task nav ── */
html.light .task-nav-btn:hover {
    background: var(--accent);
    color: #FFFFFF;
    border-color: var(--accent);
}

/* ── Light mode sidebar badges ── */
html.light .sidebar-badge { color: #FFFFFF; }
html.light .sidebar-badge--warning { color: #FFFFFF; }
html.light .sidebar-badge--gold { color: #FFFFFF; }
html.light .sidebar-badge--chat { color: #FFFFFF; }

/* ── Light mode inputs ── */
html.light input[type="text"], html.light input[type="password"],
html.light input[type="email"], html.light textarea, html.light select {
    border-color: rgba(0, 0, 0, 0.12);
    background: var(--bg-card);
}
html.light input:focus, html.light textarea:focus, html.light select:focus {
    border-color: rgba(0, 0, 0, 0.30);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}
html.light .script-editor-wrap textarea {
    background: transparent;
}

/* ── Light mode tables ── */
html.light .users-table tr:hover td,
html.light .numbers-table tr:hover td,
html.light .history-table tr:hover td,
html.light .email-table tr:hover td {
    background: rgba(0,0,0,0.025);
}

/* ── Light mode login ── */
html.light .login-box {
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.08);
}
html.light .login-page {
    background: var(--bg);
}

/* ── Light mode modal ── */
html.light .modal-overlay {
    background: rgba(0,0,0,0.40);
}
html.light .modal {
    box-shadow: var(--shadow-lg);
    border-color: rgba(0,0,0,0.08);
}

/* ── Light mode header — white bg, bottom shadow instead of border ── */
html.light .header {
    background: var(--bg-surface);
    border-bottom-color: rgba(0,0,0,0.06);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* ── Light mode brief rendered ── */
html.light .brief-rendered strong, html.light .brief-rendered b {
    color: var(--text);
    font-weight: 700;
}

/* ── Light mode comment header ── */
html.light .comment-header strong { color: var(--text); }

/* ── Light mode header BE ROAS ── */
html.light .header-be-roas strong { color: var(--text); }

/* ── Light mode chat ── */
html.light .chat-left-sidebar,
html.light .chat-sidebar {
    background: var(--bg-surface);
    border-color: var(--border);
}
html.light .chat-msg {
    border-color: transparent;
}
html.light .chat-msg:hover {
    background: rgba(0,0,0,0.02);
}

/* ── Light mode Numbers — gastos operativos card ── */
html.light .numbers-opex-card {
    box-shadow: var(--card-shadow);
}

/* ── Light mode incidencias/orders tables ── */
html.light .inc-table tr:hover td,
html.light .ord-table tr:hover td {
    background: rgba(0,0,0,0.025);
}

/* ── Smooth theme transition (only active during toggle) ── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}
html.theme-transitioning .sortable-drag,
html.theme-transitioning .sortable-ghost,
html.theme-transitioning video, html.theme-transitioning audio,
html.theme-transitioning img, html.theme-transitioning canvas {
    transition: none !important;
}

/* ── prefers-color-scheme fallback ── */
@media (prefers-color-scheme: light) {
    html:not(.light):not(.dark) {
        --bg:          #F4F4F6;
        --bg-surface:  #EAEAEF;
        --bg-card:     #FFFFFF;
        --bg-hover:    #E3E3EA;
        --bg-input:    #FFFFFF;
        --bg-elevated: #FFFFFF;
        --border:       rgba(0, 0, 0, 0.14);
        --border-light: rgba(0, 0, 0, 0.08);
        --border-focus: rgba(0, 0, 0, 0.25);
        --text:           #111118;
        --text-secondary: #44444F;
        --text-muted:     #70707E;
        --text-inverse:   #FFFFFF;
        --accent:        #111118;
        --accent-hover:  #2A2A35;
        --accent-light:  rgba(0, 0, 0, 0.05);
        --accent-border: rgba(0, 0, 0, 0.15);
        --accent-text:   #111118;
        --positive:       #18794E;
        --positive-light: rgba(24, 121, 78, 0.08);
        --negative:       #CD2B31;
        --negative-light: rgba(205, 43, 49, 0.08);
        --warning:        #AD5700;
        --warning-light:  rgba(173, 87, 0, 0.08);
        --info:           #0A6DC9;
        --info-light:     rgba(10, 109, 201, 0.08);
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
        --shadow:    0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.06);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.06);
        --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
    }
}

/* ============================================================
   Integrations Settings Page
   ============================================================ */

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

.integration-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: border-color 0.15s;
}
.integration-card:hover {
    border-color: var(--border-hover, var(--border));
}

.integration-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.integration-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.integration-info {
    flex: 1;
    min-width: 0;
}
.integration-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.integration-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin: 2px 0 0;
}

.integration-status {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
}
.integration-status--connected {
    color: var(--positive);
    background: var(--positive-light, rgba(52, 211, 153, 0.1));
}
.integration-status--disconnected {
    color: var(--text-tertiary);
    background: var(--bg-hover);
}
.integration-status--error {
    color: var(--negative);
    background: var(--negative-light, rgba(239, 68, 68, 0.1));
}

.integration-detail {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 8px;
    padding-left: 52px;
}

.integration-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-left: 52px;
}

.btn-danger-text {
    color: var(--negative) !important;
}
.btn-danger-text:hover {
    background: var(--negative-light, rgba(239, 68, 68, 0.1)) !important;
}

.integration-form {
    margin-top: 14px;
    padding: 14px;
    background: var(--bg-hover);
    border-radius: 8px;
}
.integration-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 10px;
}
.integration-label:first-child {
    margin-top: 0;
}
.integration-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.82rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Geist Mono', monospace;
}
.integration-input:focus {
    outline: none;
    border-color: var(--accent);
}
.integration-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: 'Geist Mono', monospace;
    font-size: 0.75rem;
}
.integration-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.integration-msg {
    font-size: 0.75rem;
    margin-top: 8px;
}

/* Integration banner (for module pages) */
.integration-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
}
.integration-banner--warning {
    border-color: var(--warning, #f59e0b);
    background: var(--warning-light, rgba(245, 158, 11, 0.06));
    color: var(--warning, #f59e0b);
}
.integration-banner a {
    color: var(--accent);
    text-decoration: underline;
}

/* ── Plans & Billing ──────────────────────────────────────── */
.plan-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    margin-bottom: 32px;
}
.plan-current-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.plan-current-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.plan-current-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    margin-top: 6px;
}
.plan-status--trial {
    background: var(--warning-light, rgba(245, 158, 11, 0.1));
    color: var(--warning, #f59e0b);
}
.plan-status--active {
    background: var(--positive-light, rgba(52, 211, 153, 0.1));
    color: var(--positive);
}
.plan-status--past_due {
    background: var(--negative-light, rgba(239, 68, 68, 0.1));
    color: var(--negative);
}
.plan-status--cancelled {
    background: var(--bg-hover);
    color: var(--text-muted);
}
.plan-current-price {
    text-align: right;
}
.plan-price-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.plan-price-period {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.plans-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 48px;
}
@media (max-width: 1100px) { .plans-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .plans-grid { grid-template-columns: 1fr; } }
.plan-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.plan-card:hover { border-color: var(--border-focus); }
.plan-card--active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.plan-popular {
    position: absolute;
    top: -1px;
    right: 24px;
    background: var(--accent);
    color: var(--text-inverse);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 12px;
    border-radius: 0 0 var(--radius) var(--radius);
}
.plan-card-header { margin-bottom: 20px; }
.plan-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}
.plan-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}
.plan-card-price {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.plan-price-big {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.plan-price-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 2px;
}
.plan-yearly-note {
    font-size: 0.7rem;
    color: var(--positive);
    margin-top: 4px;
}
.plan-card-features {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.plan-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.plan-feature svg { color: var(--positive); flex-shrink: 0; }
.plan-card-action { margin-top: auto; }
.plan-card-action .btn { width: 100%; }

/* Modules comparison table */
.plan-modules-section { margin-top: 16px; }
.plan-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}
.plan-modules-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.plan-modules-header,
.plan-modules-row {
    display: grid;
    grid-template-columns: 200px repeat(4, 1fr);
    align-items: center;
}
.plan-modules-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.plan-modules-header > div,
.plan-modules-row > div {
    padding: 10px 16px;
}
.plan-modules-row {
    border-bottom: 1px solid var(--border-light, rgba(128,128,128,0.08));
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.plan-modules-row:last-child { border-bottom: none; }
.plan-module-name { font-weight: 500; }
.plan-module-tier,
.plan-module-check {
    text-align: center;
}

/* ============================================================
   CONTROL PLANE — Admin Styles
   ============================================================ */

.admin-layout {
    display: flex;
    min-height: calc(100vh - 52px);
    gap: 0;
}

.admin-sidebar {
    width: 220px;
    min-width: 220px;
    padding: 20px 12px;
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-sidebar-header {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}

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

.admin-content {
    flex: 1;
    padding: 32px 40px;
    max-width: 1200px;
    overflow-x: auto;
}

.admin-page-header {
    margin-bottom: 28px;
}
.admin-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}
.admin-page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

/* Stats Grid */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.admin-stats-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.admin-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}
.admin-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.admin-stat-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.admin-stat-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Section */
.admin-section {
    margin-bottom: 32px;
}
.admin-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px;
}

/* Table */
.admin-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.admin-table thead th {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 10px 16px;
    text-align: left;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light, rgba(128,128,128,0.08));
    color: var(--text-secondary);
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table .mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Brand cell in table */
.admin-brand-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-brand-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}
.admin-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.admin-brand-name {
    font-weight: 500;
    color: var(--text);
    font-size: 0.82rem;
}
.admin-brand-slug {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Badges */
.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-surface);
    color: var(--text-muted);
    white-space: nowrap;
}
.admin-badge--active {
    background: rgba(52, 211, 153, 0.12);
    color: var(--positive);
}
.admin-badge--trial {
    background: rgba(96, 165, 250, 0.12);
    color: #60a5fa;
}
.admin-badge--suspended {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}
.admin-badge--cancelled {
    background: rgba(239, 68, 68, 0.12);
    color: var(--negative);
}

/* Chips */
.admin-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    margin: 1px 2px;
}
.admin-chip small {
    color: var(--text-muted);
}

/* Action buttons */
.admin-actions {
    display: flex;
    gap: 6px;
}
.admin-action-btn {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.admin-action-btn:hover { background: var(--bg-hover); }
.admin-action-btn--warn { color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.admin-action-btn--warn:hover { background: rgba(251,191,36,0.1); }
.admin-action-btn--ok { color: var(--positive); border-color: rgba(52,211,153,0.3); }
.admin-action-btn--ok:hover { background: rgba(52,211,153,0.1); }
.admin-action-btn--danger { color: var(--negative); border-color: rgba(239,68,68,0.3); }
.admin-action-btn--danger:hover { background: rgba(239,68,68,0.1); }

/* Toggle button */
.admin-toggle-btn {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.admin-toggle-btn--on {
    background: rgba(52, 211, 153, 0.12);
    color: var(--positive);
    border-color: rgba(52, 211, 153, 0.3);
}

/* Toolbar */
.admin-toolbar {
    margin-bottom: 16px;
}
.admin-search-form {
    display: flex;
    gap: 10px;
}
.admin-search-input {
    flex: 1;
    max-width: 300px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.82rem;
    outline: none;
}
.admin-search-input:focus { border-color: var(--accent); }
.admin-filter-select {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

/* Pagination */
.admin-pagination {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}
.admin-page-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.admin-page-btn:hover { background: var(--bg-hover); }
.admin-page-btn.active {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

/* View all link */
.admin-view-all {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
}
.admin-view-all:hover { color: var(--text); }

/* ============================================================
   SKELETON SCREENS — Loading placeholders
   ============================================================ */
@keyframes skeleton-pulse {
    0% { opacity: 0.06; }
    50% { opacity: 0.12; }
    100% { opacity: 0.06; }
}
.skeleton {
    background: var(--text);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.8s ease-in-out infinite;
}
.skeleton-card {
    background: var(--text);
    border-radius: var(--radius);
    animation: skeleton-pulse 1.8s ease-in-out infinite;
    height: 140px;
}
.skeleton-text {
    background: var(--text);
    border-radius: 4px;
    animation: skeleton-pulse 1.8s ease-in-out infinite;
    height: 14px;
    width: 100%;
}
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-avatar {
    background: var(--text);
    border-radius: 50%;
    animation: skeleton-pulse 1.8s ease-in-out infinite;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* ============================================================
   Live Editor — Email Campaign
   ============================================================ */
#liveEditorOverlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    animation: leSlideIn 0.2s ease-out;
}
@keyframes leSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.le-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    min-height: 48px;
}
.le-toolbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.le-device-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.le-device-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
}
.le-device-btn:hover { color: var(--text-primary); }
.le-device-btn.le-device-active {
    background: var(--surface);
    color: var(--text-primary);
}
.le-save-indicator {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}
.le-panels {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.le-panel-left {
    width: 380px;
    min-width: 320px;
    max-width: 440px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
}
.le-panel-right {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-secondary);
}
.le-preview-frame {
    width: 600px;
    max-width: 100%;
    transition: width 0.3s ease;
}
.le-preview-frame.le-mobile {
    width: 375px;
}
.le-iframe {
    width: 100%;
    height: calc(100vh - 120px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.le-section {
    margin-bottom: 16px;
}
.le-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.le-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.le-copy-textarea {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.15s;
}
.le-copy-textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
}
.le-copy-textarea.le-headline {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}
@media (max-width: 900px) {
    .le-panels { flex-direction: column; }
    .le-panel-left {
        width: 100%;
        min-width: unset;
        max-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 40vh;
    }
    .le-preview-frame { width: 100%; }
    .le-iframe { height: 50vh; }
    .le-toolbar-title { max-width: 120px; }
}

/* ============================================================
   EMAIL 3.0 BLOCK EDITOR
   ============================================================ */

/* Overlay */
#ebOverlay {
    display: none;
    position: fixed; inset: 0;
    z-index: 1100;
    background: var(--bg);
    flex-direction: column;
}
#ebOverlay.eb-open { display: flex; }

/* Toolbar */
.eb-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; height: 48px; min-height: 48px;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.eb-toolbar-title {
    font-size: 14px; font-weight: 500; color: var(--text-primary);
    max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.eb-save-indicator {
    font-size: 11px; color: var(--text-muted);
    opacity: 0; transition: opacity 0.2s;
    margin-right: 4px;
}

/* Main layout: palette | canvas | preview */
.eb-main {
    display: flex; flex: 1; overflow: hidden;
}

/* Palette */
.eb-palette {
    width: 180px; min-width: 180px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 12px 10px;
    overflow-y: auto;
}
.eb-palette-title {
    font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-muted);
    margin-bottom: 10px; padding: 0 4px;
}
.eb-palette-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: var(--radius);
    cursor: grab; user-select: none;
    color: var(--text-secondary);
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast);
    margin-bottom: 2px;
}
.eb-palette-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.eb-palette-icon {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; flex-shrink: 0;
}
.eb-palette-label {
    font-size: 13px; font-weight: 450;
}

/* Canvas */
.eb-canvas-wrap {
    flex: 1; overflow-y: auto;
    background: var(--bg);
    padding: 24px;
    display: flex; justify-content: center;
}
.eb-canvas {
    width: 100%; max-width: 640px;
    min-height: 200px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 8px;
    transition: border-color var(--duration-fast);
}
.eb-canvas:empty + .eb-empty-state,
.eb-canvas + .eb-empty-state[style*="display: none"] + .x { display: none; }

/* Empty state */
.eb-empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--text-muted); font-size: 14px;
    pointer-events: none;
}
.eb-empty-state svg {
    margin-bottom: 12px; opacity: 0.4;
}

/* Block wrapper */
.eb-block {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast);
    cursor: default;
}
.eb-block:hover {
    border-color: var(--border-hover);
}
.eb-block-selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent);
}

/* Drag handle */
.eb-block-handle {
    position: absolute; top: 6px; left: 6px;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    cursor: grab; opacity: 0;
    transition: opacity var(--duration-fast);
    border-radius: 4px; z-index: 2;
}
.eb-block:hover .eb-block-handle { opacity: 0.6; }
.eb-block-handle:hover { opacity: 1 !important; background: var(--bg-hover); }

/* Delete button */
.eb-block-delete {
    position: absolute; top: 6px; right: 6px;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    color: var(--text-muted); font-size: 16px;
    cursor: pointer; opacity: 0; border-radius: 4px;
    transition: opacity var(--duration-fast), background var(--duration-fast), color var(--duration-fast);
    z-index: 2;
}
.eb-block:hover .eb-block-delete { opacity: 0.6; }
.eb-block-delete:hover { opacity: 1 !important; background: rgba(255,59,48,0.1); color: var(--negative); }

/* Block badge */
.eb-block-badge {
    position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    font-size: 9px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--text-muted);
    background: var(--bg); padding: 2px 8px; border-radius: 10px;
    opacity: 0; transition: opacity var(--duration-fast);
    pointer-events: none; z-index: 2;
}
.eb-block:hover .eb-block-badge { opacity: 0.7; }

/* Block content */
.eb-block-content {
    padding: 16px 20px;
    min-height: 32px;
}

/* Header preview */
.eb-header-logo {
    display: block; max-height: 48px; margin: 0 auto;
}

/* Headline preview */
.eb-headline-preview {
    color: var(--text-primary);
}

/* Text preview */
.eb-text-preview {
    color: var(--text-secondary);
}

/* Button preview */
.eb-button-preview {
    display: inline-block;
    background: var(--accent);
    color: var(--bg);
    padding: 10px 28px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    text-align: center;
}

/* Image preview */
.eb-img-preview {
    width: 100%; max-height: 300px;
    object-fit: cover; border-radius: 6px;
}

/* Placeholder */
.eb-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: var(--bg);
}
.eb-placeholder-img {
    min-height: 80px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

/* Footer preview */
.eb-footer-preview {
    text-align: center;
    padding: 8px 0;
}

/* Two-column */
.eb-two-col {
    display: flex; gap: 0; min-height: 60px;
}
.eb-col {
    flex: 1; min-height: 48px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 6px;
    transition: border-color var(--duration-fast);
}
.eb-col-divider {
    width: 8px; flex-shrink: 0;
}
.eb-col-empty {
    text-align: center; padding: 16px 8px;
    color: var(--text-muted); font-size: 11px;
    pointer-events: none;
}
.eb-col-block {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 4px;
    padding: 8px;
    font-size: 13px;
    cursor: default;
}
.eb-col-block:hover { border-color: var(--border-hover); }
.eb-col-block-text {
    color: var(--text-secondary); line-height: 1.4;
}
.eb-col-block-img {
    width: 100%; border-radius: 4px; display: block;
}
.eb-col-block-delete {
    position: absolute; top: 2px; right: 2px;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    color: var(--text-muted); font-size: 14px;
    cursor: pointer; opacity: 0; border-radius: 3px;
    transition: opacity var(--duration-fast), color var(--duration-fast);
}
.eb-col-block:hover .eb-col-block-delete { opacity: 0.7; }
.eb-col-block-delete:hover { color: var(--negative); opacity: 1 !important; }

/* SortableJS drag states */
.eb-ghost {
    opacity: 0.85;
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px var(--accent);
    border-radius: var(--radius);
}
.eb-chosen {
    cursor: grabbing !important;
}
.eb-drag {
    opacity: 0;
}

/* Preview panel */
.eb-preview-wrap {
    width: 480px; min-width: 400px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.eb-preview-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.eb-preview-label {
    font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-muted);
}
.eb-preview-frame {
    flex: 1; overflow: auto;
    display: flex; justify-content: center;
    padding: 16px;
    background: #f5f5f5;
}
.eb-preview-frame.eb-mobile { background: var(--bg); }
.eb-preview-frame.eb-mobile .eb-preview-iframe {
    width: 375px; max-width: 375px;
    border-radius: 20px;
    box-shadow: 0 0 0 8px #333, 0 0 0 10px #555;
    margin: 12px auto;
}
.eb-preview-iframe {
    width: 100%; max-width: 600px; height: 100%;
    border: none; background: #fff;
    transition: all 0.25s ease;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Device toggle (reuse le- pattern) */
.eb-device-toggle {
    display: flex; gap: 2px;
    background: var(--bg); border-radius: 6px; padding: 2px;
}
.eb-device-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 24px;
    background: transparent; border: none;
    color: var(--text-muted); cursor: pointer;
    border-radius: 4px; transition: all var(--duration-fast);
}
.eb-device-btn:hover { color: var(--text-primary); }
.eb-device-btn.eb-device-active {
    background: var(--bg-hover); color: var(--text-primary);
}

/* ── Inline editing: toolbar ── */
.eb-inline-toolbar {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -12px -12px 8px -12px;
}
.eb-toolbar-select {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 12px;
    padding: 3px 6px; border-radius: 4px; cursor: pointer;
}
.eb-toolbar-size {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 12px;
    padding: 3px 4px; border-radius: 4px; width: 48px;
    text-align: center;
}
.eb-toolbar-label {
    font-size: 11px; color: var(--text-muted);
}
.eb-toolbar-btn {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 11px;
    padding: 3px 8px; border-radius: 4px; cursor: pointer;
    transition: all var(--duration-fast);
    margin-left: auto;
}
.eb-toolbar-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.eb-toolbar-btn-active {
    background: var(--accent); color: var(--bg);
    border-color: var(--accent);
}
.eb-toolbar-btn-active:hover {
    background: var(--text-secondary); border-color: var(--text-secondary);
}

/* ── Contenteditable ── */
.eb-contenteditable {
    outline: none; min-height: 1.2em;
    cursor: text; padding: 4px 2px;
    border-radius: 4px;
    transition: background var(--duration-fast);
}
.eb-contenteditable:focus {
    background: rgba(255,255,255,0.03);
}
.eb-contenteditable:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted); pointer-events: none;
}
.eb-button-edit {
    display: inline-block;
    background: var(--accent); color: var(--bg);
    padding: 10px 24px; border-radius: 6px;
    font-weight: 600; font-size: 15px;
    text-align: center; cursor: text;
}
.eb-btn-url-input {
    margin-top: 6px;
}

/* CTA block styles */
.eb-cta-styles {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border);
}
.eb-cta-style-group {
    display: flex; flex-direction: column; gap: 2px;
}
.eb-cta-style-group .eb-toolbar-size { width: 52px; }
.eb-color-input {
    width: 28px; height: 28px; padding: 0; border: 1px solid var(--border);
    border-radius: 4px; cursor: pointer; background: none;
}
.eb-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.eb-color-input::-webkit-color-swatch { border: none; border-radius: 2px; }
.eb-color-hex {
    width: 70px; background: var(--bg); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 11px; font-family: var(--font-mono, monospace);
    padding: 3px 4px; border-radius: 4px;
}

/* Text block link styling */
.eb-text-preview a {
    color: #111111; text-decoration: underline; cursor: pointer;
}
.eb-text-preview a:hover { opacity: 0.7; }

/* ── Form inputs (header/footer) ── */
.eb-input {
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 12px;
    padding: 6px 8px; border-radius: 4px; width: 100%;
    transition: border-color var(--duration-fast);
    box-sizing: border-box;
}
.eb-input:focus {
    outline: none; border-color: var(--text-muted);
}
.eb-input::placeholder { color: var(--text-muted); }
.eb-form-row {
    margin-bottom: 8px;
}
.eb-form-label {
    display: block; font-size: 11px; color: var(--text-muted);
    margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px;
}
.eb-header-form {
    margin-top: 8px;
}
.eb-logo-actions {
    display: flex; gap: 6px; margin-top: 8px;
    justify-content: center;
}
.eb-header-logo {
    max-height: 60px;
    display: block; margin: 0 auto 4px;
    border-radius: 4px;
}

/* ── Logo size slider ── */
.eb-logo-size-row {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px; padding: 0 4px;
}
.eb-logo-size-row .eb-form-label {
    margin-bottom: 0; flex-shrink: 0; min-width: 64px;
}
.eb-logo-slider {
    flex: 1; height: 4px;
    -webkit-appearance: none; appearance: none;
    background: var(--border); border-radius: 2px; outline: none;
    cursor: pointer;
}
.eb-logo-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px;
    background: var(--text-primary); border-radius: 50%;
    cursor: pointer;
}

/* ── Block style row (bg color etc) ── */
.eb-block-style-row {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ── Footer form ── */
.eb-footer-form {
    display: flex; flex-direction: column; gap: 2px;
}
.eb-footer-links {
    display: flex; flex-direction: column; gap: 4px;
}
.eb-footer-link-row {
    display: flex; gap: 4px; align-items: center;
}
.eb-link-name { flex: 0 0 120px; }
.eb-link-url { flex: 1; }
.eb-link-remove {
    background: transparent; border: none;
    color: var(--text-muted); font-size: 16px;
    cursor: pointer; padding: 2px 6px; border-radius: 3px;
    transition: color var(--duration-fast);
}
.eb-link-remove:hover { color: var(--negative); }
.eb-add-link-btn {
    background: transparent; border: 1px dashed var(--border);
    color: var(--text-muted); font-size: 11px;
    padding: 4px 8px; border-radius: 4px; cursor: pointer;
    margin-top: 4px; text-align: center;
    transition: all var(--duration-fast);
}
.eb-add-link-btn:hover {
    border-color: var(--text-muted); color: var(--text-secondary);
}

/* ── Image blocks ── */
.eb-img-wrap {
    position: relative;
}
.eb-img-change-btn {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.7); color: #fff;
    border: none; padding: 4px 10px; border-radius: 4px;
    font-size: 11px; cursor: pointer; opacity: 0;
    transition: opacity var(--duration-fast);
}
.eb-img-wrap:hover .eb-img-change-btn { opacity: 1; }
.eb-img-link-input { margin-top: 6px; }
.eb-placeholder-clickable {
    cursor: pointer;
    transition: all var(--duration-fast);
}
.eb-placeholder-clickable:hover {
    border-color: var(--text-muted);
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
}

/* ── Media Picker Modal ── */
.eb-media-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10001; /* Above ebOverlay */
    align-items: center; justify-content: center;
}
.eb-media-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 20px;
    max-width: 720px; width: 92%;
    max-height: 80vh; overflow-y: auto;
    box-shadow: 0 16px 64px rgba(0,0,0,0.4);
}
.eb-media-modal-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 12px;
}
.eb-media-tabs {
    display: flex; gap: 2px;
    background: var(--bg); border-radius: 6px;
    padding: 2px; margin-bottom: 12px;
}
.eb-media-tab {
    flex: 1; padding: 6px 12px;
    background: transparent; border: none;
    color: var(--text-muted); font-size: 12px;
    cursor: pointer; border-radius: 4px;
    transition: all var(--duration-fast);
}
.eb-media-tab:hover { color: var(--text-secondary); }
.eb-media-tab-active {
    background: var(--bg-card); color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.eb-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}
.eb-media-item {
    aspect-ratio: 1; overflow: hidden;
    border-radius: 6px; cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--duration-fast);
}
.eb-media-item:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}
.eb-media-item img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}

/* Upload zone */
.eb-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px; padding: 32px;
    text-align: center; color: var(--text-muted);
    font-size: 13px;
    transition: all var(--duration-fast);
}
.eb-upload-zone.eb-upload-hover {
    border-color: var(--accent);
    background: rgba(255,255,255,0.02);
}
.eb-upload-label {
    color: var(--accent); cursor: pointer;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1100px) {
    .eb-preview-wrap { width: 380px; min-width: 320px; }
}
@media (max-width: 900px) {
    .eb-main { flex-direction: column; }
    .eb-palette {
        width: 100%; min-width: unset;
        flex-direction: row; display: flex; flex-wrap: wrap;
        border-right: none; border-bottom: 1px solid var(--border);
        max-height: 80px; padding: 6px;
    }
    .eb-palette-item { flex: 0 0 auto; margin-bottom: 0; }
    .eb-preview-wrap {
        width: 100%; min-width: unset;
        border-left: none; border-top: 1px solid var(--border);
        max-height: 40vh;
    }
}

/* ============================================================
   Brand Docs Module
   ============================================================ */
.brand-docs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 768px) {
    .brand-docs-grid { grid-template-columns: 1fr; }
}
.brand-doc-card { padding: 28px; }
.brand-doc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.brand-doc-card-header h3 { font-size: 15px; margin: 0; }
.brand-doc-status {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); flex-shrink: 0;
}
.brand-doc-status.filled { background: #22c55e; }
.brand-doc-dropzone {
    border: 1px dashed var(--border-hover);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted);
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
}
.brand-doc-dropzone.dragover {
    border-color: var(--text-secondary);
    background: var(--bg-hover);
}
.brand-doc-preview {
    font-family: var(--font-mono, 'Geist Mono', monospace);
    font-size: 12px; line-height: 1.5;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--text-secondary);
}
.brand-doc-meta {
    display: flex; gap: 12px; align-items: center;
    font-size: 12px; color: var(--text-muted);
    margin-top: 8px;
}
.brand-doc-textarea {
    width: 100%;
    font-family: var(--font-mono, 'Geist Mono', monospace);
    font-size: 12px; line-height: 1.5;
    min-height: 200px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    color: var(--text);
    resize: vertical;
}
.brand-doc-textarea:focus { outline: none; border-color: var(--border-focus); }
.brand-doc-actions {
    display: flex; gap: 8px; margin-top: 12px;
    justify-content: flex-end;
}
.brand-docs-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.brand-docs-module-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.progress-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ============================================================
   Email Customization Panel — Obsidian Pro V2
   ============================================================ */
.cust-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}
.cust-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.cust-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.cust-card-header .cust-label { margin-bottom: 0; }
.cust-counter {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Sections list --- */
.cust-sections-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cust-section-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background var(--duration-instant, 80ms) ease, border-color var(--duration-instant, 80ms) ease;
    cursor: grab;
}
.cust-section-row:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}
.cust-section-row.sortable-chosen {
    background: var(--bg-elevated);
    border-color: var(--border-focus);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform var(--duration-normal, 250ms) cubic-bezier(0.25,1,0.5,1), box-shadow var(--duration-normal, 250ms) ease;
}
.cust-section-row.cust-section-disabled {
    opacity: 0.45;
}
.cust-drag-handle {
    color: var(--text-muted);
    font-size: 14px;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}
.cust-section-check {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-focus);
    border-radius: 4px;
    background: var(--bg-input);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: background var(--duration-fast, 150ms) ease, border-color var(--duration-fast, 150ms) ease;
}
.cust-section-check:checked {
    background: var(--accent, #fff);
    border-color: var(--accent, #fff);
}
.cust-section-check:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid var(--bg, #08090D);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.cust-section-check:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.cust-section-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cust-section-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}
.cust-badge-layout { background: rgba(54,158,255,0.1); color: #369EFF; }
.cust-badge-content { background: rgba(48,164,108,0.1); color: #30A46C; }
.cust-badge-cta { background: rgba(245,166,35,0.1); color: #F5A623; }
.cust-badge-social { background: rgba(168,85,247,0.1); color: #A855F7; }
.cust-badge-footer { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* --- Image grid --- */
.cust-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.cust-image-slot {
    border: 1.5px dashed var(--border-focus);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--duration-fast, 150ms) ease, background var(--duration-fast, 150ms) ease;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.cust-image-slot:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.cust-image-slot.cust-slot-filled {
    border-style: solid;
    border-color: var(--border);
    padding: 4px;
}
.cust-image-slot.cust-slot-filled:hover {
    border-color: var(--accent);
}
.cust-image-slot img {
    width: 100%;
    border-radius: 4px;
    object-fit: cover;
}
.cust-slot-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.cust-slot-ratio {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}
.cust-slot-btn {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background var(--duration-instant, 80ms) ease;
}
.cust-slot-btn:hover { background: var(--bg-hover); }
.cust-slot-change {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 11px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--duration-fast, 150ms) ease;
}
.cust-image-slot:hover .cust-slot-change { opacity: 1; }

/* --- Style controls --- */
.cust-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 600px) {
    .cust-style-grid { grid-template-columns: 1fr; }
}
.cust-color-field { display: flex; flex-direction: column; gap: 4px; }
.cust-color-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.cust-color-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cust-color-swatch {
    appearance: none;
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: var(--bg-input);
    flex-shrink: 0;
}
.cust-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.cust-color-swatch::-webkit-color-swatch { border: none; border-radius: 4px; }
.cust-color-swatch::-moz-color-swatch { border: none; border-radius: 4px; }
.cust-color-swatch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.cust-color-hex {
    width: 80px;
    font-size: 13px;
    font-family: var(--font-mono, 'Geist Mono', monospace);
    padding: 6px 8px;
    text-transform: uppercase;
}
.cust-slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.cust-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.cust-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent, #fff);
    cursor: pointer;
    border: 2px solid var(--bg, #08090D);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.cust-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent, #fff);
    cursor: pointer;
    border: 2px solid var(--bg, #08090D);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.cust-slider:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* --- Light mode overrides --- */
html.light .cust-section-check:checked { background: var(--accent, #000); border-color: var(--accent, #000); }
html.light .cust-section-check:checked::after { border-color: #fff; }
html.light .cust-slider::-webkit-slider-thumb { background: var(--accent, #000); border-color: #fff; }
html.light .cust-slider::-moz-range-thumb { background: var(--accent, #000); border-color: #fff; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .cust-section-row,
    .cust-image-slot,
    .cust-section-check,
    .cust-slider {
        transition: none !important;
    }
    .cust-section-row.sortable-chosen {
        transform: none;
    }
}

/* ============================================================
   Knowledge Bot — Chat Panel
   ============================================================ */

/* Header button */
.kb-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}
.kb-header-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-hover);
}

/* Overlay */
.kb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-normal) var(--ease-out), visibility var(--duration-normal);
}
.kb-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Panel */
.kb-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 9991;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-lg);
}
.kb-panel.open {
    transform: translateX(0);
}

/* Panel header */
.kb-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    min-height: 48px;
    flex-shrink: 0;
}
.kb-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.kb-panel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.kb-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-instant) var(--ease-out);
}
.kb-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.kb-action-btn.active {
    background: var(--bg-active);
    color: var(--text);
}

/* History sidebar */
.kb-history {
    display: none;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-card);
}
.kb-history.open {
    display: flex;
}
.kb-history-list {
    padding: 4px;
}
.kb-history-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
.kb-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration-instant) var(--ease-out);
    position: relative;
}
.kb-history-item:hover {
    background: var(--bg-hover);
}
.kb-history-item.active {
    background: var(--bg-active);
}
.kb-history-item-title {
    flex: 1;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kb-history-item-date {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}
.kb-history-delete {
    display: none;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    align-items: center;
    justify-content: center;
}
.kb-history-item:hover .kb-history-delete {
    display: flex;
}
.kb-history-delete:hover {
    color: var(--negative);
    background: var(--negative-light);
}

/* Messages area */
.kb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome screen */
.kb-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    text-align: center;
    padding: 40px 20px;
}
.kb-welcome-icon {
    opacity: 0.3;
}
.kb-welcome p {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 280px;
    line-height: 1.5;
}

/* Message bubbles */
.kb-msg {
    display: flex;
    max-width: 100%;
}
.kb-msg--user {
    justify-content: flex-end;
}
.kb-msg--assistant {
    justify-content: flex-start;
}
.kb-msg-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}
.kb-msg--user .kb-msg-bubble {
    background: var(--accent);
    color: var(--text-inverse);
    border-bottom-right-radius: 4px;
}
.kb-msg--assistant .kb-msg-bubble {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* Markdown in messages */
.kb-msg-bubble h2, .kb-msg-bubble h3, .kb-msg-bubble h4 {
    margin: 8px 0 4px;
    font-size: 13px;
    font-weight: 600;
}
.kb-msg-bubble h2 { font-size: 14px; }
.kb-msg-bubble ul {
    padding-left: 16px;
    margin: 4px 0;
}
.kb-msg-bubble li {
    margin: 2px 0;
}
.kb-msg-bubble pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    overflow-x: auto;
    margin: 6px 0;
    font-family: var(--font-mono);
    font-size: 12px;
}
.kb-msg-bubble code.kb-inline-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}
.kb-msg-bubble strong {
    font-weight: 600;
}

/* Typing indicator */
.kb-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px !important;
}
.kb-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: kbTypingDot 1.2s infinite;
}
.kb-typing span:nth-child(2) { animation-delay: 0.2s; }
.kb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes kbTypingDot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* Input area */
.kb-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}
.kb-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out);
}
.kb-input:focus {
    border-color: var(--border-focus);
}
.kb-input::placeholder {
    color: var(--text-muted);
}
.kb-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--text-inverse);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}
.kb-send-btn:hover {
    background: var(--accent-hover);
}
.kb-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Light theme adjustments */
html.light .kb-msg--user .kb-msg-bubble {
    background: var(--bg-active);
    color: var(--text);
}
html.light .kb-msg-bubble pre {
    background: var(--bg-hover);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .kb-panel {
        width: 100vw;
    }
}


/* ============================================================
   Launch Planner
   ============================================================ */

.lp-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 24px 32px;
}

.lp-plan-card {
    position: relative;
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lp-plan-card:hover {
    border-color: var(--border-focus);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.lp-plan-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.lp-plan-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.lp-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.lp-badge-basic {
    background: rgba(202, 169, 98, 0.15);
    color: #c9a962;
}
.lp-badge-advanced {
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.15);
    color: var(--accent, #6366f1);
}

.lp-plan-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.lp-plan-touchpoints { color: var(--text-muted); }

.lp-plan-status { font-size: 12px; font-weight: 500; }
.lp-status-draft { color: var(--text-muted); }
.lp-status-complete { color: var(--positive, #34d399); }

.delete-plan-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.lp-plan-card:hover .delete-plan-btn { opacity: 1; }
.delete-plan-btn:hover { color: var(--negative, #ef4444); background: rgba(239,68,68,0.1); }

.lp-empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}
.lp-empty-state h3 {
    margin: 16px 0 8px;
    font-size: 18px;
    color: var(--text-secondary);
}
.lp-empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Modal — larger variant */
.modal-content.modal-lg {
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Form layout */
.lp-form { padding: 16px 20px; }
.lp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.lp-form-full { grid-column: 1 / -1; }

.lp-form .form-group { display: flex; flex-direction: column; }
.lp-form .form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.lp-form .form-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.lp-form .form-input:focus {
    outline: none;
    border-color: var(--border-focus);
}
.lp-form textarea.form-input { resize: vertical; min-height: 60px; }
.lp-form select.form-input { cursor: pointer; }

.lp-channels {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.lp-channel-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
}
.lp-channel-check input[type="checkbox"] {
    accent-color: var(--accent, #6366f1);
}

.lp-help-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    padding: 12px;
    background: rgba(202, 169, 98, 0.08);
    border: 1px solid rgba(202, 169, 98, 0.2);
    border-radius: var(--radius);
}
.lp-help-check input[type="checkbox"] {
    accent-color: #c9a962;
}

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

/* Detail page */
.lp-plan-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 12px 0 0;
}
.lp-plan-date-detail {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 8px;
}

.lp-plan-deck { padding: 24px 32px; max-width: 900px; }
.lp-loading-deck {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Content header (reusable) */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
}
.content-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.content-header-left h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}
.content-header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}
.content-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Light theme adjustments */
html.light .lp-plan-card {
    background: var(--bg-elevated);
}
html.light .lp-help-check {
    background: rgba(202, 169, 98, 0.06);
}

@media (max-width: 640px) {
    .lp-form-grid { grid-template-columns: 1fr; }
    .lp-plans-grid { grid-template-columns: 1fr; padding: 16px; }
    .content-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ── Plan Detail — Strategy Deck ──────────────────────── */

.lp-plan-deck {
    padding: 24px 32px;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Section card */
.lp-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.15s ease-out;
}
.lp-section:hover { border-color: var(--border-focus); }

.lp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.lp-section-header:hover { background: var(--bg-hover); }

.lp-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lp-section-title svg { color: var(--text-secondary); flex-shrink: 0; }
.lp-section-title h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    letter-spacing: 0.01em;
}

.lp-section-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: transform 0.25s ease-out;
}
.lp-section.collapsed .lp-section-toggle { transform: rotate(-90deg); }

.lp-section-body {
    padding: 0 20px 20px;
    transition: max-height 0.25s ease-out, opacity 0.15s ease-out;
}
.lp-section.collapsed .lp-section-body {
    display: none;
}

/* Stats grid */
.lp-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.lp-stat-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lp-stat-value {
    font-family: 'Geist Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.lp-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.lp-phases-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Offer card */
.lp-offer-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
}
.lp-offer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.lp-offer-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.lp-offer-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 12px;
    line-height: 1.5;
}
.lp-offer-urgency {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 10px 12px;
    background: rgba(229, 72, 77, 0.06);
    border-radius: var(--radius);
    border-left: 3px solid var(--negative, #E5484D);
}
.lp-value-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lp-value-stack-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.lp-value-item {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: rgba(48, 164, 108, 0.06);
    border-radius: var(--radius);
    border-left: 2px solid var(--positive, #30A46C);
}

/* Badge variants */
.lp-badge-info {
    background: rgba(54, 158, 255, 0.10);
    color: var(--info, #369EFF);
}
.lp-badge-positive {
    background: rgba(48, 164, 108, 0.10);
    color: var(--positive, #30A46C);
}
.lp-badge-negative {
    background: rgba(229, 72, 77, 0.10);
    color: var(--negative, #E5484D);
}
.lp-badge-warning {
    background: rgba(245, 166, 35, 0.10);
    color: var(--warning, #F5A623);
}
.lp-badge-neutral {
    background: rgba(255,255,255, 0.06);
    color: var(--text-secondary);
}

/* Timeline */
.lp-timeline-track {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 8px 0 16px;
    scrollbar-width: thin;
}
.lp-timeline-node {
    flex: 0 0 auto;
    min-width: 90px;
    max-width: 140px;
    padding: 10px 8px;
    text-align: center;
    border-radius: var(--radius);
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border-light);
    transition: transform 0.15s;
}
.lp-timeline-node:hover { transform: translateY(-1px); }

.lp-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 auto 6px;
}
.lp-phase-positive .lp-timeline-dot { background: var(--positive, #30A46C); }
.lp-phase-warning .lp-timeline-dot { background: var(--warning, #F5A623); }
.lp-phase-info .lp-timeline-dot { background: var(--info, #369EFF); }
.lp-phase-negative .lp-timeline-dot { background: var(--negative, #E5484D); }
.lp-phase-neutral .lp-timeline-dot { background: var(--text-muted); }

.lp-timeline-label {
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}
.lp-timeline-phase {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.lp-timeline-focus {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.lp-timeline-channels {
    margin-top: 6px;
    display: flex;
    gap: 3px;
    justify-content: center;
}
.lp-tp-icon {
    font-size: 12px;
    opacity: 0.7;
}

/* Email table */
.lp-table-wrap { overflow-x: auto; }
.lp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.lp-table thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
    white-space: nowrap;
}
.lp-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: top;
}
.lp-table tbody tr:hover { background: var(--bg-hover); }
.lp-table tbody tr:last-child td { border-bottom: none; }

.lp-td-day {
    font-family: 'Geist Mono', monospace;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    color: var(--text-secondary);
}
.lp-td-phase { white-space: nowrap; }
.lp-phase-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
}
.lp-email-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 3px;
}
.lp-email-subject {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}
.lp-td-purpose {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 220px;
}
.lp-td-emotion { white-space: nowrap; }
.lp-emotion-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(202, 169, 98, 0.12);
    color: #c9a962;
}
.lp-td-segment {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* SMS list */
.lp-sms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.lp-sms-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lp-sms-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}
.lp-sms-day {
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.lp-sms-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.lp-sms-time {
    font-size: 11px;
    color: var(--text-muted);
}
.lp-sms-bubble {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: 12px 12px 12px 4px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
    max-width: 500px;
}

/* Paid social — budget bar */
.lp-budget-bar { margin-bottom: 20px; }
.lp-budget-track {
    display: flex;
    height: 28px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
}
.lp-budget-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    min-width: 30px;
    transition: flex 0.25s;
}
.lp-seg-info { background: var(--info, #369EFF); }
.lp-seg-positive { background: var(--positive, #30A46C); }
.lp-seg-warning { background: var(--warning, #F5A623); color: #1a1a1a; }
.lp-seg-negative { background: var(--negative, #E5484D); }

.lp-budget-labels {
    display: flex;
    justify-content: space-around;
    margin-top: 6px;
}
.lp-budget-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Campaign cards */
.lp-campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.lp-campaign-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color 0.15s;
}
.lp-campaign-card:hover { border-color: var(--border-focus); }
.lp-campaign-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.lp-campaign-name {
    font-size: 13px;
    font-weight: 600;
}
.lp-campaign-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.lp-campaign-meta strong { color: var(--text-muted); }
.lp-campaign-brief {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Organic social */
.lp-organic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lp-organic-item {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.lp-organic-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.lp-organic-day {
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.lp-organic-platform {
    font-size: 11px;
    color: var(--text-muted);
}
.lp-organic-concept {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}
.lp-organic-angle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
}

/* Checklists */
.lp-checklist-group { margin-bottom: 16px; }
.lp-checklist-group:last-child { margin-bottom: 0; }
.lp-checklist-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 8px;
}
.lp-text-info { color: var(--info, #369EFF); }
.lp-text-positive { color: var(--positive, #30A46C); }
.lp-text-warning { color: var(--warning, #F5A623); }

.lp-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lp-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.lp-checklist-item:hover { background: var(--bg-hover); }
.lp-check {
    accent-color: var(--positive, #30A46C);
    margin-top: 2px;
    flex-shrink: 0;
}

/* Anti-patterns */
.lp-antipatterns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lp-antipattern-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(229, 72, 77, 0.04);
    border-radius: var(--radius);
    border-left: 3px solid var(--negative, #E5484D);
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}
.lp-antipattern-num {
    font-family: 'Geist Mono', monospace;
    font-weight: 700;
    font-size: 13px;
    color: var(--negative, #E5484D);
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

/* Revenue projections */
.lp-revenue-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
}
.lp-revenue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.lp-revenue-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lp-revenue-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.lp-revenue-value {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}
.lp-revenue-total .lp-revenue-value {
    font-family: 'Geist Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--positive, #30A46C);
}
.lp-revenue-assumptions {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}
.lp-revenue-assumptions-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}
.lp-revenue-assumptions ul {
    margin: 0;
    padding-left: 16px;
}
.lp-revenue-assumptions li {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Light theme adjustments for detail */
html.light .lp-section { box-shadow: var(--card-shadow); border-color: transparent; }
html.light .lp-section:hover { border-color: var(--border); }
html.light .lp-stat-card { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
html.light .lp-offer-card { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
html.light .lp-sms-bubble { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
html.light .lp-campaign-card { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
html.light .lp-badge-neutral { background: rgba(0,0,0, 0.06); }

/* Section header actions + regen */
.lp-section-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.lp-regen-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.lp-section:hover .lp-regen-btn { opacity: 1; }
.lp-regen-btn:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--bg-hover);
}
.lp-regen-spinning svg {
    animation: lp-spin 0.8s linear infinite;
}
@keyframes lp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Section highlight after regen */
.lp-section-highlight {
    animation: lp-highlight-pulse 2s ease-out;
}
@keyframes lp-highlight-pulse {
    0% { box-shadow: 0 0 0 2px rgba(48, 164, 108, 0.4); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Offer proposals */
.lp-proposals-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}
.lp-proposals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.lp-proposal-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    cursor: default;
}
.lp-proposal-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-1px);
}
.lp-proposal-recommended {
    border-color: rgba(202, 169, 98, 0.4);
    background: linear-gradient(135deg, var(--bg), rgba(202, 169, 98, 0.04));
}
.lp-proposal-selected {
    border-color: var(--positive, #30A46C) !important;
    box-shadow: 0 0 0 1px var(--positive, #30A46C);
}
.lp-proposal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.lp-proposal-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.lp-proposal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
}
.lp-proposal-why {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 8px 10px;
    background: rgba(54, 158, 255, 0.04);
    border-radius: var(--radius);
}
.lp-proposal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.lp-proposal-best {
    font-size: 11px;
    color: var(--text-muted);
}
.lp-select-offer-btn {
    margin-top: auto;
    align-self: stretch;
}

/* Light theme proposals */
html.light .lp-proposal-card { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
html.light .lp-proposal-recommended {
    box-shadow: 0 2px 8px rgba(202, 169, 98, 0.12);
}

/* Responsive detail */
@media (max-width: 640px) {
    .lp-plan-deck { padding: 16px; }
    .lp-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .lp-campaigns-grid { grid-template-columns: 1fr; }
    .lp-proposals-grid { grid-template-columns: 1fr; }
    .lp-timeline-node { min-width: 75px; }
    .lp-stat-value { font-size: 22px; }
    .lp-table { font-size: 12px; }
    .lp-table thead th { padding: 8px 10px; }
    .lp-table tbody td { padding: 8px 10px; }
    .lp-regen-btn { opacity: 1; }
}

/* LP Toast */
.lp-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 22px;
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}
.lp-toast-error { border-color: var(--negative); color: var(--negative); }
.lp-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
