:root {
    --bg-deep: #06080f;
    --bg: #0a0e17;
    --surface: rgba(18, 22, 34, 0.72);
    --surface-solid: #121622;
    --surface-2: rgba(28, 34, 52, 0.85);
    --surface-hover: rgba(38, 46, 70, 0.9);
    --text: #f4f6fb;
    --text-soft: #c8d0e0;
    --muted: #8b96ad;
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-dark: #6d28d9;
    --accent: #f472b6;
    --accent-2: #22d3ee;
    --accent-3: #fbbf24;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 24px;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 60px rgba(139, 92, 246, 0.15);
    --font: "DM Sans", system-ui, sans-serif;
    --font-display: "Fraunces", Georgia, serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; scrollbar-color: rgba(139, 92, 246, 0.35) rgba(255, 255, 255, 0.04); scrollbar-width: thin; }

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); border-radius: 999px; }
*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.55), rgba(244, 114, 182, 0.45));
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgba(167, 139, 250, 0.75), rgba(244, 114, 182, 0.6)); }

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

a { color: inherit; }

/* Ambient background */
.ambient {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    animation: float 18s var(--ease) infinite alternate;
}

.orb-a {
    width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.45), transparent 70%);
    top: -120px; left: -80px;
}

.orb-b {
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.35), transparent 70%);
    top: 20%; right: -100px;
    animation-delay: -6s;
}

.orb-c {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.25), transparent 70%);
    bottom: -80px; left: 30%;
    animation-delay: -12s;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
}

@keyframes float {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(30px, 24px) scale(1.06); }
}

.container {
    width: min(1140px, 92vw);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    background: rgba(6, 8, 15, 0.72);
    backdrop-filter: blur(18px) saturate(160%);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
    font-size: 1.1rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text strong { font-size: 1rem; }
.brand-text small {
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s, transform 0.2s;
}

.nav a:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
}

.nav a.active {
    color: var(--text);
    background: rgba(139, 92, 246, 0.18);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.25);
}

.nav-cta {
    margin-left: 0.35rem;
    background: linear-gradient(135deg, var(--primary), #7c3aed) !important;
    color: white !important;
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.35);
}

.nav-cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.main {
    padding: 2rem 0 3rem;
    animation: fadeUp 0.6s var(--ease) both;
}

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

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0 2rem;
    position: relative;
    z-index: 1;
}

.footer-inner p {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

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

.glass-panel {
    background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}

/* Hero */
.hero {
    display: grid;
    grid-template-columns: 1.2fr auto;
    gap: 2rem;
    align-items: end;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at top right, rgba(139, 92, 246, 0.18), transparent 45%),
        radial-gradient(circle at bottom left, rgba(244, 114, 182, 0.12), transparent 40%),
        var(--surface);
    box-shadow: var(--shadow), var(--shadow-glow);
    overflow: hidden;
    position: relative;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -20% -60% auto;
    width: 280px;
    height: 280px;
    background: conic-gradient(from 180deg, var(--accent-2), var(--primary), var(--accent), var(--accent-2));
    opacity: 0.12;
    filter: blur(8px);
    border-radius: 50%;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--primary-light);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}

.hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3rem);
    max-width: 14ch;
}

.hero-lead {
    margin: 0;
    color: var(--text-soft);
    font-size: 1.05rem;
    max-width: 46ch;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 200px;
    position: relative;
    z-index: 1;
}

.hero-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.72rem 1.25rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    font-family: inherit;
    transition: transform 0.2s var(--ease), box-shadow 0.2s, filter 0.2s, background 0.2s;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    color: white;
    box-shadow: 0 12px 28px rgba(109, 40, 217, 0.35);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.08);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-link-danger {
    color: #fca5a5;
}

.btn-link-danger:hover {
    color: #fecaca;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: center;
}

.job-error {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    max-width: 28ch;
}

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    border-color: var(--border);
}

.btn-link {
    background: transparent;
    color: var(--primary-light);
    padding: 0;
    border: 0;
    box-shadow: none;
}

.btn-link:hover { transform: none; color: var(--accent-2); }

/* Posts grid */
.grid.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.25rem;
}

.post-card {
    overflow: hidden;
    padding: 0;
    border-radius: var(--radius);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow), 0 0 0 1px rgba(139, 92, 246, 0.2);
}

.post-thumb {
    position: relative;
    aspect-ratio: 9/16;
    background: linear-gradient(160deg, #1a2030, #0d111a);
    overflow: hidden;
}

.post-thumb img,
.post-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--ease);
}

.post-card:hover .post-thumb img,
.post-card:hover .post-thumb video {
    transform: scale(1.04);
}

.post-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6,8,15,0.85) 0%, transparent 45%);
    pointer-events: none;
}

.post-thumb .placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 3rem;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(244,114,182,0.15));
}

.post-body { padding: 1.1rem 1.15rem 1.25rem; }

.post-body h3 {
    margin: 0 0 0.35rem;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 600;
}

.meta, .muted, .excerpt { color: var(--muted); }

.field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    line-height: 1.45;
}
.excerpt { font-size: 0.92rem; margin: 0.5rem 0 0.75rem; }
.small { font-size: 0.82rem; }

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3.5rem 2rem;
    background:
        radial-gradient(circle at center, rgba(139, 92, 246, 0.12), transparent 60%),
        var(--surface);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 8px 20px rgba(139, 92, 246, 0.35));
}

.empty-state h2 { margin: 0 0 0.5rem; font-size: 1.75rem; }
.empty-state p { max-width: 42ch; margin: 0 auto 1.25rem; color: var(--text-soft); }

.feature-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.feature-chip {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-soft);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.badge-completed, .badge-success {
    background: rgba(52, 211, 153, 0.18);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-processing, .badge-in_progress, .badge-pending {
    background: rgba(251, 191, 36, 0.18);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-failed, .badge-error {
    background: rgba(251, 113, 133, 0.18);
    color: var(--danger);
    border: 1px solid rgba(251, 113, 133, 0.25);
}

.badge-draft {
    background: rgba(139, 150, 173, 0.15);
    color: var(--muted);
}

.post-thumb .badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
}

/* Forms */
.form, .form-grid { display: grid; gap: 1.1rem; }

.form-grid label,
.form label {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-soft);
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(8, 10, 18, 0.65);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.78rem 0.95rem;
    font: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
    background: rgba(8, 10, 18, 0.85);
}

input::placeholder, textarea::placeholder { color: #5f6b82; }

input[type="file"] {
    padding: 0.55rem;
    font-size: 0.85rem;
}

.checkbox {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500 !important;
}

.checkbox input { width: auto; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
}

/* Tabs / mode selector */
.mode-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mode-tabs .tab {
    position: relative;
    overflow: hidden;
    background: rgba(18, 22, 34, 0.55);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition:
        border-color 0.25s var(--ease),
        background 0.25s var(--ease),
        box-shadow 0.25s var(--ease),
        transform 0.25s var(--ease),
        color 0.25s var(--ease);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.5rem;
}

.mode-tabs .tab::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: transparent;
    transition: background 0.25s var(--ease);
}

.mode-tabs .tab-icon {
    width: 2.65rem;
    height: 2.65rem;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-size: 1.25rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.mode-tabs .tab-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.mode-tabs .tab-title {
    font-weight: 650;
    font-size: 0.86rem;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -0.01em;
}

.mode-tabs .tab-desc {
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--muted);
    font-weight: 500;
}

.mode-tabs .tab[data-mode="text_to_image"] .tab-icon {
    background: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.22);
}

.mode-tabs .tab[data-mode="image_to_image"] .tab-icon {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.22);
}

.mode-tabs .tab[data-mode="text_to_audio"] .tab-icon {
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.22);
}

.mode-tabs .tab[data-mode="image_to_video"] .tab-icon {
    background: rgba(244, 114, 182, 0.12);
    border-color: rgba(244, 114, 182, 0.22);
}

.mode-tabs .tab[data-mode="text_to_video"] .tab-icon {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.22);
}

.mode-tabs .tab[data-mode="references_to_video"] .tab-icon {
    background: rgba(236, 72, 153, 0.12);
    border-color: rgba(236, 72, 153, 0.22);
}

.mode-tabs .tab[data-mode="video_to_video"] .tab-icon {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.22);
}

.mode-tabs .tab[data-mode="presenter"] .tab-icon {
    background: rgba(20, 184, 166, 0.12);
    border-color: rgba(20, 184, 166, 0.22);
}

.mode-tabs .tab:hover {
    border-color: var(--border-strong);
    background: rgba(28, 34, 52, 0.72);
    transform: translateY(-1px);
}

.mode-tabs .tab:hover .tab-icon {
    transform: scale(1.05);
}

.mode-tabs .tab.active {
    color: white;
    border-color: rgba(139, 92, 246, 0.55);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(244, 114, 182, 0.07));
    box-shadow:
        0 10px 28px rgba(109, 40, 217, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mode-tabs .tab.active::before {
    background: linear-gradient(180deg, var(--primary-light), var(--accent));
}

.mode-tabs .tab.active .tab-title {
    color: #fff;
}

.mode-tabs .tab.active .tab-desc {
    color: rgba(255, 255, 255, 0.62);
}

.mode-tabs .tab.active .tab-icon {
    background: rgba(139, 92, 246, 0.28);
    border-color: rgba(167, 139, 250, 0.45);
    box-shadow: 0 6px 16px rgba(109, 40, 217, 0.25);
}

.mode-tabs .tab:focus-visible {
    outline: 2px solid rgba(167, 139, 250, 0.75);
    outline-offset: 2px;
}

/* Legacy tabs (other pages) */
.tabs:not(.mode-tabs) {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.tabs:not(.mode-tabs) .tab {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    text-align: center;
    transition: all 0.25s var(--ease);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.tabs:not(.mode-tabs) .tab-icon { font-size: 1.35rem; }

.tabs:not(.mode-tabs) .tab:hover {
    border-color: var(--border-strong);
    color: var(--text);
    transform: translateY(-2px);
}

.tabs:not(.mode-tabs) .tab.active {
    color: white;
    border-color: rgba(139, 92, 246, 0.45);
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.22), rgba(244, 114, 182, 0.08));
    box-shadow: 0 12px 30px rgba(109, 40, 217, 0.2);
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
}

.page-header p {
    margin: 0;
    color: var(--text-soft);
    max-width: 52ch;
}

.section-title {
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

/* Alerts */
.hidden { display: none !important; }

[hidden] { display: none !important; }

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    animation: fadeUp 0.4s var(--ease) both;
}

.alert-error {
    background: rgba(251, 113, 133, 0.12);
    color: #fecdd3;
    border-color: rgba(251, 113, 133, 0.25);
}

.alert-success {
    background: rgba(52, 211, 153, 0.12);
    color: #a7f3d0;
    border-color: rgba(52, 211, 153, 0.25);
}

/* Auth */
.page-auth .main {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

.auth-shell {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.auth-visual {
    padding: 2.5rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.25), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(244, 114, 182, 0.3), transparent 55%),
        linear-gradient(160deg, #1e1145, #0f172a);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 420px;
}

.auth-visual h2 {
    margin: 0 0 0.75rem;
    font-size: 2rem;
    color: white;
}

.auth-visual p {
    margin: 0;
    color: rgba(255,255,255,0.78);
    font-size: 1rem;
}

.auth-card {
    padding: 2.25rem;
    background: var(--surface-solid);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.85rem;
}

/* Detail / media */
.detail-grid { display: grid; gap: 1.25rem; }

.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.media-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.media-item img,
.media-item video,
.media-item audio {
    width: 100%;
    border-radius: 10px;
}

.media-item figcaption {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table th, .table td {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0.5rem;
    text-align: left;
}

.hashtags { color: var(--accent-2); }

.preview-hashtags {
    color: var(--accent-2);
    font-size: 0.68rem;
    line-height: 1.4;
}

body.page-studio .preview-hashtags {
    background: linear-gradient(90deg, var(--accent-2), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 500;
}

/* Agent */
.agent-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.25rem;
    min-height: 68vh;
}

.conversations h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-family: var(--font);
}

.conversations ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.25rem;
}

.conversations a {
    display: block;
    padding: 0.65rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversations a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text);
}

.conversations a.active {
    color: var(--text);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.25);
}

.chat-panel {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 60vh;
    padding: 0;
    overflow: hidden;
}

.chat-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.chat-header-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
}

.chat-messages {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.25rem;
    min-height: 320px;
}

.chat-welcome {
    margin: auto;
    text-align: center;
    max-width: 420px;
    color: var(--muted);
}

.chat-welcome-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.chat-bubble {
    max-width: 85%;
    border-radius: 16px;
    padding: 0.85rem 1rem;
    animation: fadeUp 0.35s var(--ease) both;
}

.chat-bubble strong {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
    opacity: 0.7;
}

.chat-user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(109, 40, 217, 0.25));
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.chat-assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
}

.chat-tool {
    align-self: center;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.2);
    font-size: 0.9rem;
}

.chat-form {
    display: grid;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.file-inline {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.85rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.85rem !important;
}

.status-box {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.22);
    color: var(--text-soft);
}

.help-box ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-soft);
}

.help-box li { margin-bottom: 0.5rem; }

.help-box strong { color: var(--text); }

.models-preview {
    max-height: none;
    overflow: visible;
    font-size: 0.88rem;
    color: var(--text-soft);
    display: grid;
    gap: 1.25rem;
}

.models-table-wrap {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.models-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.models-table th,
.models-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.models-table th {
    position: sticky;
    top: 0;
    background: var(--surface-solid);
    color: var(--text-soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.models-table tr.row-rec {
    background: rgba(52, 211, 153, 0.06);
}

.price-tag {
    display: inline-block;
    font-weight: 600;
    color: var(--accent-2);
}

.price-breakdown,
.price-line {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.model-price-detail {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.35rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.18);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-soft);
}

.model-price-detail-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-2);
}

.model-price-lines {
    margin: 0;
    padding-left: 1rem;
}

.model-price-lines.compact {
    width: 100%;
    font-size: 0.78rem;
}

.model-price-lines li {
    margin: 0.15rem 0;
}

.models-preview-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-family: var(--font);
}

.models-preview-rec {
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-size: 0.85rem;
}

.models-preview div {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.model-rec {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    margin-top: 0.35rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.22);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-soft);
}

.model-rec-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.model-picker {
    position: relative;
}

.model-picker-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.model-picker-trigger,
.model-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(8, 10, 18, 0.65);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.78rem 0.95rem;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.model-picker-trigger:hover,
.model-picker.open .model-picker-trigger {
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(8, 10, 18, 0.85);
}

.model-picker.open .model-picker-trigger {
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.model-picker-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.model-picker-item {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.model-picker-item:last-child {
    border-bottom: none;
}

.model-picker-item:hover,
.model-picker-item.active {
    background: var(--surface-hover);
}

.model-picker-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-picker-price {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--accent-2);
    white-space: nowrap;
    text-align: right;
}

.model-picker-star {
    color: var(--success);
    margin-right: 0.25rem;
}

.model-rec strong {
    color: var(--text);
    font-weight: 600;
}

.badge-rec {
    background: rgba(52, 211, 153, 0.18);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.35);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-2);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-link:hover { color: var(--primary-light); }

select option[data-recommended="1"] {
    font-weight: 600;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
    color: var(--accent-2);
}

.install-wrap { max-width: 760px; }

.check-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.check-list li {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.check-ok { color: var(--success); }
.check-bad { color: var(--danger); }

.steps { color: var(--text-soft); }

/* Stats page */
.page-stats .page-header { margin-bottom: 1.5rem; }

.stats-summary {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-breakdown {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem 1.35rem;
}

.stat-card-primary {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(244, 114, 182, 0.08));
    border-color: rgba(139, 92, 246, 0.35);
}

.stat-label {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.stat-value-sm { font-size: 1.35rem; }

.stat-danger { color: var(--danger); }

.stat-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.stats-charts {
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card h2 {
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

.chart-wrap {
    position: relative;
    height: 260px;
}

.chart-wrap-donut { height: 280px; }

.chart-card-wide { grid-column: span 1; }

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.stats-table-card { margin-bottom: 2rem; }

.stats-table-header {
    margin-bottom: 1rem;
}

.stats-table-header h2 { margin: 0 0 0.25rem; }

.table-scroll {
    overflow-x: auto;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

.stats-table .cost-cell {
    font-weight: 600;
    color: var(--accent-3);
    white-space: nowrap;
}

.type-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.model-code {
    font-size: 0.78rem;
    word-break: break-all;
}

.post-cost-total {
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
}

.post-cost-total strong { color: var(--accent-3); }

.edit-hint {
    margin: -0.25rem 0 1rem;
    font-size: 0.9rem;
}

/* ── Empresas ── */
.hero-compact { padding: 2rem 0 1.5rem; }

.companies-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.company-card-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.company-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-light);
}

.company-logo-lg {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
}

.company-header-main {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.company-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.company-tabs { margin-bottom: 1.5rem; }

/* ── Studio IA — diseño vivo ── */
body.page-studio .container.main {
    width: min(1380px, 96vw);
}

body.page-studio .company-header {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.14), transparent 50%),
        radial-gradient(circle at bottom right, rgba(34, 211, 238, 0.08), transparent 45%),
        var(--surface);
    margin-bottom: 1.25rem;
}

body.page-studio .company-tabs .tab.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(244, 114, 182, 0.12));
    box-shadow: 0 8px 28px rgba(109, 40, 217, 0.22), inset 0 1px 0 rgba(255,255,255,0.08);
}

.label-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 10px currentColor;
}

.label-dot-purple { background: var(--primary-light); color: var(--primary-light); }
.label-dot-cyan { background: var(--accent-2); color: var(--accent-2); }
.label-dot-pink { background: var(--accent); color: var(--accent); }
.label-dot-amber { background: var(--accent-3); color: var(--accent-3); }

.studio-layout {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr) 290px;
    gap: 1rem;
    align-items: stretch;
    min-height: calc(100vh - 280px);
}

.studio-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.studio-panel {
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    backdrop-filter: blur(12px);
}

.studio-panel-platform {
    background:
        linear-gradient(160deg, rgba(139, 92, 246, 0.1), rgba(255,255,255,0.02)),
        var(--surface);
}

.studio-panel-conversations {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(160deg, rgba(34, 211, 238, 0.06), rgba(255,255,255,0.02)),
        var(--surface);
}

.studio-panel-prompts {
    background:
        linear-gradient(160deg, rgba(244, 114, 182, 0.08), rgba(255,255,255,0.02)),
        var(--surface);
}

.studio-panel-label,
.studio-panel-head .studio-panel-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    font-family: var(--font);
}

.studio-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.studio-panel-head .studio-panel-label { margin-bottom: 0; }

.btn-ghost {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.btn-ghost:hover {
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--primary-light);
    background: rgba(139, 92, 246, 0.1);
}

.btn-xs { padding: 0.3rem 0.6rem; font-size: 0.72rem; }

.conversation-scroll {
    flex: 1;
    min-height: 0;
    max-height: 160px;
    overflow-y: auto;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

.conversation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
}

.conversation-empty {
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.5rem 0.65rem;
    font-style: italic;
}

.conversation-list a {
    display: block;
    padding: 0.55rem 0.7rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid transparent;
    transition: all 0.2s var(--ease);
}

.conversation-list a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-color: var(--border);
}

.conversation-list a.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(139, 92, 246, 0.1));
    border-color: rgba(34, 211, 238, 0.25);
    box-shadow: 0 4px 16px rgba(34, 211, 238, 0.08);
}

.platform-picker-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.platform-picker-compact .platform-card {
    padding: 0.55rem 0.35rem;
    min-height: 58px;
}

.platform-picker-compact .platform-name {
    font-size: 0.68rem;
    line-height: 1.2;
}

.platform-picker-compact .platform-format { display: none; }

.platform-picker-compact .platform-icon { font-size: 1.15rem; }

.platform-option[data-platform="instagram_reels"] .platform-card:hover,
.platform-option[data-platform="instagram_reels"] input:checked + .platform-card {
    border-color: rgba(225, 48, 108, 0.55);
    background: linear-gradient(145deg, rgba(225, 48, 108, 0.15), rgba(131, 58, 180, 0.08));
    box-shadow: 0 0 20px rgba(225, 48, 108, 0.12);
}

.platform-option[data-platform="instagram_feed"] input:checked + .platform-card {
    border-color: rgba(225, 48, 108, 0.45);
    background: rgba(225, 48, 108, 0.1);
}

.platform-option[data-platform="tiktok"] input:checked + .platform-card {
    border-color: rgba(254, 44, 85, 0.55);
    background: rgba(254, 44, 85, 0.1);
    box-shadow: 0 0 20px rgba(254, 44, 85, 0.1);
}

.platform-option[data-platform="facebook"] input:checked + .platform-card {
    border-color: rgba(24, 119, 242, 0.55);
    background: rgba(24, 119, 242, 0.1);
}

.platform-option[data-platform="linkedin"] input:checked + .platform-card {
    border-color: rgba(10, 102, 194, 0.55);
    background: rgba(10, 102, 194, 0.1);
}

.platform-option[data-platform="youtube_shorts"] input:checked + .platform-card {
    border-color: rgba(255, 0, 0, 0.55);
    background: rgba(255, 0, 0, 0.1);
}

.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.quick-prompt {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 0.7rem;
    color: var(--text);
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.22s var(--ease);
}

.qp-icon { font-size: 1rem; flex-shrink: 0; }
.qp-text { line-height: 1.3; }

.quick-prompt-video:hover { border-color: rgba(244, 114, 182, 0.45); background: rgba(244, 114, 182, 0.08); transform: translateX(3px); }
.quick-prompt-carousel:hover { border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.08); transform: translateX(3px); }
.quick-prompt-image:hover { border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.08); transform: translateX(3px); }

/* Chat central */
.studio-chat-wrap {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.studio-chat-card {
    flex: 1;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: calc(100vh - 280px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(139, 92, 246, 0.2);
    background:
        radial-gradient(circle at top, rgba(139, 92, 246, 0.08), transparent 55%),
        linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    box-shadow: var(--shadow), 0 0 80px rgba(139, 92, 246, 0.06);
    overflow: hidden;
}

.studio-chat-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(0,0,0,0.12);
}

.chat-header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

.chat-header-brand strong {
    display: block;
    font-size: 0.95rem;
}

.chat-subtitle {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 400;
    margin-top: 0.1rem;
}

.chat-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    color: var(--success);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.studio-messages {
    min-height: 280px;
    max-height: none;
    padding: 1.25rem;
}

.studio-welcome {
    position: relative;
    margin: auto;
    max-width: 440px;
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(139, 92, 246, 0.2);
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.12), rgba(244, 114, 182, 0.06));
    overflow: hidden;
}

.studio-welcome-glow {
    position: absolute;
    inset: -40% auto auto 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
    pointer-events: none;
}

.studio-welcome h3 {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
    position: relative;
}

.studio-welcome p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.92rem;
    line-height: 1.55;
    position: relative;
}

.welcome-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.1rem;
    position: relative;
}

.welcome-tags span {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--primary-light);
}

.studio-form {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.18);
    gap: 0.85rem;
}

.attach-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.attach-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    flex-shrink: 0;
}

.attach-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex: 1;
}

.attach-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    font-size: 0.78rem;
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    overflow: hidden;
}

.attach-chip input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.attach-chip:hover {
    transform: translateY(-1px);
    color: var(--text);
}

.attach-chip-photo:hover { border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.1); }
.attach-chip-refs:hover { border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.1); }
.attach-chip-video:hover { border-color: rgba(244, 114, 182, 0.45); background: rgba(244, 114, 182, 0.1); }

.attach-chip.has-file {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
}

.studio-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    align-items: end;
}

.studio-input-row textarea {
    resize: none;
    min-height: 52px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: rgba(0,0,0,0.2);
    padding: 0.85rem 1rem;
    color: var(--text);
    font: inherit;
    line-height: 1.45;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.studio-input-row textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.btn-studio-send {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.85rem 1.15rem;
    border-radius: 14px;
    min-height: 52px;
    background: linear-gradient(135deg, var(--primary), #7c3aed 55%, var(--accent));
    box-shadow: 0 8px 28px rgba(109, 40, 217, 0.35);
    border: none;
    white-space: nowrap;
}

.btn-studio-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(109, 40, 217, 0.45);
}

.btn-send-icon { font-size: 0.9rem; }

/* Preview derecha */
.studio-preview-wrap {
    min-height: 0;
}

.studio-preview-card {
    position: sticky;
    top: 5rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(251, 191, 36, 0.15);
    background:
        radial-gradient(circle at top right, rgba(251, 191, 36, 0.08), transparent 50%),
        linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    box-shadow: var(--shadow);
}

.studio-preview-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.studio-preview-head h3 {
    margin: 0;
    font-size: 0.85rem;
    font-family: var(--font);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
}

.phone-frame-glow {
    box-shadow:
        var(--shadow),
        inset 0 0 0 2px rgba(255,255,255,0.08),
        0 0 40px rgba(139, 92, 246, 0.12);
}

.preview-spark {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

.preview-placeholder {
    background:
        linear-gradient(145deg, rgba(139, 92, 246, 0.12), rgba(34, 211, 238, 0.06)),
        var(--surface-solid);
}

.preview-platform-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
}

.preview-label-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-light);
    box-shadow: 0 0 8px var(--primary-light);
}

.section-block { margin-bottom: 2.5rem; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.section-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.companies-grid-compact .company-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Laboratorio creativo ── */
body.page-lab .container.main {
    width: min(1200px, 96vw);
}

.lab-hero {
    background:
        radial-gradient(circle at top left, rgba(34, 211, 238, 0.12), transparent 50%),
        radial-gradient(circle at bottom right, rgba(251, 191, 36, 0.08), transparent 45%),
        var(--surface);
    border: 1px solid rgba(34, 211, 238, 0.15);
}

.lab-eyebrow {
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.25);
    color: var(--accent-2);
}

.lab-tabs { margin-bottom: 1.25rem; }

.lab-tabs .tab.active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(251, 191, 36, 0.08));
    border-color: rgba(34, 211, 238, 0.35);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.12);
}

.page-lab .mode-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lab-form {
    margin-top: 0.5rem;
}

.lab-agent-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1rem;
    min-height: 65vh;
}

.lab-agent-sidebar {
    padding: 1rem;
    align-self: start;
    position: sticky;
    top: 5rem;
}

.lab-agent-sidebar h3 {
    margin: 0;
    font-size: 0.85rem;
    font-family: var(--font);
}

.lab-chat-panel {
    min-height: 65vh;
}

.lab-avatar {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.3);
}

.lab-welcome {
    border-color: rgba(34, 211, 238, 0.25);
    background: linear-gradient(160deg, rgba(34, 211, 238, 0.1), rgba(251, 191, 36, 0.06));
}

.tab-panel.hidden { display: none; }

.brand-colors-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin: 0;
}

.brand-colors-fieldset legend {
    padding: 0 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.doc-list { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }

.doc-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.doc-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-lg { padding: 0.9rem 1.5rem; font-size: 1.05rem; }

.generate-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

.platform-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.platform-option input { position: absolute; opacity: 0; pointer-events: none; }

.platform-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    text-align: center;
}

.platform-option input:checked + .platform-card {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.12);
    box-shadow: 0 0 0 1px var(--primary);
}

.platform-icon { font-size: 1.4rem; }
.platform-name { font-size: 0.78rem; font-weight: 600; }
.platform-format { font-size: 0.68rem; color: var(--muted); }

.platform-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    font-size: 1.1rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.post-thumb { position: relative; }

/* ── Platform Preview (phone mockup) ── */
.platform-preview-card { grid-column: 1 / -1; }

.platform-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.phone-frame {
    width: 280px;
    background: #111;
    border-radius: 32px;
    padding: 12px;
    box-shadow: var(--shadow), inset 0 0 0 2px rgba(255,255,255,0.08);
    position: relative;
}

.phone-notch {
    width: 80px;
    height: 22px;
    background: #111;
    border-radius: 0 0 14px 14px;
    margin: -4px auto 6px;
    position: relative;
    z-index: 2;
}

.preview-screen {
    border-radius: 22px;
    overflow: hidden;
    background: #000;
    position: relative;
    aspect-ratio: 9 / 16;
}

.preview-instagram-feed .preview-screen,
.preview-linkedin .preview-screen {
    aspect-ratio: 1 / 1;
}

.preview-facebook .preview-screen {
    aspect-ratio: 16 / 9;
}

.preview-media {
    position: absolute;
    inset: 0;
}

.preview-media img,
.preview-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--surface-2), var(--surface-solid));
    color: var(--muted);
    gap: 0.5rem;
}

.preview-placeholder span { font-size: 2.5rem; opacity: 0.5; }

.preview-overlay {
    position: absolute;
    top: 20%;
    left: 0; right: 0;
    text-align: center;
    padding: 0 1rem;
    pointer-events: none;
}

.preview-hook {
    display: inline-block;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.preview-ui-bottom {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    padding: 2.5rem 0.75rem 0.75rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    color: #fff;
    font-size: 0.72rem;
}

.preview-caption strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.78rem;
}

.preview-hashtags {
    color: #a8c7fa;
    margin-top: 0.25rem;
    font-size: 0.68rem;
}

.platform-preview .preview-platform-label {
    text-align: center;
    margin: 0 auto;
}

.preview-cta { margin-top: 0.75rem; }

.copy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Carousel preview */
.carousel-preview {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.carousel-slide.active { opacity: 1; }

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-slide-label {
    position: absolute;
    bottom: 15%;
    left: 0; right: 0;
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    padding: 0 0.5rem;
}

.carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 4px;
    z-index: 2;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
}

.carousel-dot.active { background: #fff; }

/* Calendar */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.calendar-nav h2 { margin: 0; font-size: 1.2rem; }

.calendar-grid { padding: 1rem; }

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-cell {
    min-height: 90px;
    background: var(--surface-2);
    border-radius: 8px;
    padding: 0.35rem;
    border: 1px solid var(--border);
}

.calendar-cell.empty { background: transparent; border: none; }

.day-num {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}

.calendar-event {
    display: block;
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    margin-top: 0.2rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event.scheduled { background: rgba(251, 191, 36, 0.2); color: var(--warning); }
.calendar-event.published { background: rgba(52, 211, 153, 0.2); color: var(--success); }
.calendar-event.draft { background: rgba(139, 92, 246, 0.2); color: var(--primary-light); }

.calendar-legend .legend-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.85rem;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.35rem;
}

.legend-scheduled { background: var(--warning); }
.legend-published { background: var(--success); }
.legend-draft { background: var(--primary); }

/* Social accounts */
.social-connect-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.social-accounts-list { display: flex; flex-direction: column; gap: 0.5rem; }

.social-account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.publish-panel .form-actions { margin-top: 0.5rem; }

.status-box.status-error { border-color: var(--danger); color: var(--danger); }

/* Platform-specific accents */
.preview-tiktok .preview-hook {
    background: rgba(254, 44, 85, 0.85);
    font-family: system-ui, sans-serif;
}

.preview-instagram-reels .preview-ui-bottom {
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
}

.preview-linkedin .preview-hook {
    background: rgba(10, 102, 194, 0.9);
    text-transform: none;
    font-weight: 700;
    font-size: 0.95rem;
}

.preview-facebook .preview-hook {
    background: rgba(24, 119, 242, 0.9);
}

.preview-youtube .preview-hook {
    background: rgba(255, 0, 0, 0.85);
}

/* Responsive */
@media (max-width: 1100px) {
    .mode-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: row; flex-wrap: wrap; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { min-height: 220px; padding: 1.75rem; }
    .tabs:not(.mode-tabs) { grid-template-columns: repeat(2, 1fr); }
    .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-summary { grid-template-columns: repeat(2, 1fr); }
    .stats-charts { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
    .studio-layout {
        grid-template-columns: 230px minmax(0, 1fr);
    }
    .studio-preview-wrap {
        grid-column: 1 / -1;
    }
    .studio-preview-card {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 1.5rem;
        align-items: center;
    }
    .studio-preview-head { margin-bottom: 0; writing-mode: vertical-lr; transform: rotate(180deg); }
}

@media (max-width: 760px) {
    .two-col,
    .three-col,
    .agent-layout,
    .studio-layout {
        grid-template-columns: 1fr;
    }

    .studio-chat-card { min-height: 60vh; }
    .studio-input-row { grid-template-columns: 1fr; }
    .btn-studio-send { width: 100%; justify-content: center; }
    .studio-preview-card { grid-template-columns: 1fr; }
    .studio-preview-head { writing-mode: horizontal-tb; transform: none; margin-bottom: 1rem; }
    .lab-agent-layout {
        grid-template-columns: 1fr;
    }

    .lab-agent-sidebar {
        position: static;
    }

    .page-lab .mode-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mode-tabs {
        grid-template-columns: 1fr;
    }

    .mode-tabs .tab {
        min-height: 0;
    }

    .stats-summary,
    .stats-breakdown {
        grid-template-columns: 1fr;
    }

    .topbar-inner { flex-wrap: wrap; }
    .nav { width: 100%; }
    .nav-cta { margin-left: 0; }
    .page-header { flex-direction: column; }
    .generate-layout { grid-template-columns: 1fr; }
    .platform-picker { grid-template-columns: repeat(2, 1fr); }
    .company-header-main { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
