:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8faff;
    --surface-hover: #f2f6ff;
    --text: #172033;
    --muted: #667085;
    --line: #dfe6f2;
    --line-strong: #ccd7e8;
    --primary: #3f72f5;
    --primary-strong: #2f61df;
    --primary-soft: #edf3ff;
    --success: #07966a;
    --success-soft: #e9f9f3;
    --violet: #7657e8;
    --violet-soft: #f1edff;
    --amber: #b97808;
    --amber-soft: #fff6df;
    --shadow: 0 10px 30px rgba(39, 66, 119, .07);
    --sidebar-width: 248px;
}

html[data-theme="dark"] {
    --bg: #121621;
    --surface: #191e2b;
    --surface-soft: #202636;
    --surface-hover: #252d40;
    --text: #edf2ff;
    --muted: #9aa6bd;
    --line: #2c3446;
    --line-strong: #3a455b;
    --primary-soft: #213154;
    --success-soft: #17352d;
    --violet-soft: #2b2448;
    --amber-soft: #3b301b;
    --shadow: 0 12px 34px rgba(0, 0, 0, .18);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

a, button {
    font: inherit;
}

button {
    color: inherit;
}

svg {
    display: block;
}

.app-layout {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 16px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.brand {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    border-radius: 13px;
    color: #fff;
    font-size: 21px;
    font-weight: 850;
    background: linear-gradient(135deg, #3f72f5, #7657e8);
    box-shadow: 0 8px 20px rgba(63, 114, 245, .24);
}

.brand-copy strong,
.brand-copy small {
    display: block;
}

.brand-copy strong {
    font-size: 17px;
    letter-spacing: -.02em;
}

.brand-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.sidebar-nav {
    display: grid;
    gap: 5px;
    margin-top: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: .18s ease;
}

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

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

.nav-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 8px 4px;
}

.private-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--success);
    font-size: 11px;
    font-weight: 750;
}

.private-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px var(--success-soft);
}

.sidebar-version {
    margin-top: 9px;
    color: var(--muted);
    font-size: 10px;
}

.main-area {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 76px;
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 28px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.eyebrow,
.section-kicker {
    color: var(--primary);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.page-title {
    margin: 3px 0 0;
    font-size: 20px;
    letter-spacing: -.025em;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    cursor: pointer;
}

.icon-button:hover {
    background: var(--surface-hover);
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.lang-pill {
    min-width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0 9px;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 800;
}

.mobile-only {
    display: none;
}

.content {
    width: min(1500px, calc(100% - 44px));
    margin: 22px auto 40px;
    flex: 1;
}

.welcome-panel,
.panel,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.welcome-panel {
    min-height: 300px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr);
    gap: 28px;
    align-items: center;
    overflow: hidden;
    padding: 38px;
    border-radius: 24px;
    position: relative;
}

.welcome-panel::before {
    content: "";
    width: 520px;
    height: 520px;
    position: absolute;
    right: -240px;
    top: -250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(63,114,245,.14), rgba(118,87,232,.05) 44%, transparent 70%);
    pointer-events: none;
}

.welcome-copy {
    position: relative;
    z-index: 2;
}

.welcome-copy h2 {
    max-width: 740px;
    margin: 9px 0 12px;
    font-size: clamp(28px, 3.4vw, 44px);
    line-height: 1.08;
    letter-spacing: -.045em;
}

.welcome-copy p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 780;
    text-decoration: none;
    transition: .18s ease;
}

.button.primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px rgba(63,114,245,.18);
}

.button.primary:hover {
    background: var(--primary-strong);
    transform: translateY(-1px);
}

.button.secondary {
    color: var(--text);
    background: var(--surface-soft);
    border-color: var(--line);
}

.button.secondary:hover {
    background: var(--surface-hover);
}

.studio-preview {
    min-height: 220px;
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
}

.preview-window {
    width: min(100%, 420px);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background: var(--surface-soft);
    box-shadow: 0 24px 55px rgba(51,72,116,.12);
    transform: rotate(1.5deg);
}

.preview-head {
    height: 34px;
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.preview-head span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--line-strong);
}

.preview-body {
    min-height: 135px;
    display: grid;
    grid-template-columns: 94px 1fr;
    gap: 18px;
    align-items: center;
    padding: 20px;
}

.preview-avatar {
    height: 110px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.avatar-head {
    width: 46px;
    height: 52px;
    position: absolute;
    z-index: 2;
    top: 6px;
    border-radius: 48% 48% 45% 45%;
    background: linear-gradient(145deg, #f0cbb4, #d6a98f);
    box-shadow: inset 0 8px 0 #46342f;
}

.avatar-body {
    width: 82px;
    height: 72px;
    position: absolute;
    bottom: 0;
    border-radius: 36px 36px 12px 12px;
    background: linear-gradient(145deg, #e4dacb, #c4b7a6);
}

.preview-lines {
    display: grid;
    gap: 11px;
}

.preview-lines .line {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: var(--line-strong);
}

.preview-lines .long { width: 92%; }
.preview-lines .medium { width: 72%; }
.preview-lines .short { width: 48%; }

.preview-timeline {
    height: 44px;
    display: grid;
    grid-template-columns: 1.2fr .7fr 1fr .6fr;
    gap: 5px;
    padding: 10px 12px;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.preview-timeline span {
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary-soft), var(--violet-soft));
    border: 1px solid var(--line);
}

.floating-chip {
    position: absolute;
    z-index: 3;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 11px;
    font-weight: 800;
}

.chip-one {
    right: 5%;
    top: 4%;
}

.chip-two {
    left: 4%;
    bottom: 5%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.stat-card {
    min-height: 112px;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 18px;
    border-radius: 17px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    border-radius: 12px;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.stat-icon.blue {
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-icon.violet {
    color: var(--violet);
    background: var(--violet-soft);
}

.stat-icon.green {
    color: var(--success);
    background: var(--success-soft);
}

.stat-icon.amber {
    color: var(--amber);
    background: var(--amber-soft);
}

.stat-copy span,
.stat-copy strong,
.stat-copy small {
    display: block;
}

.stat-copy span {
    color: var(--muted);
    font-size: 10px;
    margin-bottom: 3px;
}

.stat-copy strong {
    font-size: 20px;
    letter-spacing: -.025em;
}

.stat-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 14px;
}

.panel {
    border-radius: 20px;
    padding: 22px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--line);
}

.panel-head h3 {
    margin: 5px 0 0;
    font-size: 17px;
    letter-spacing: -.02em;
}

.status-badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
}

.status-badge.planned {
    color: var(--primary);
    background: var(--primary-soft);
}

.status-badge.active {
    color: var(--success);
    background: var(--success-soft);
}

.workflow-list {
    display: grid;
    gap: 9px;
    margin-top: 17px;
}

.workflow-step {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px;
    border-radius: 13px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.workflow-step.active {
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
    background: var(--primary-soft);
}

.step-number {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    border-radius: 9px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 10px;
    font-weight: 850;
}

.workflow-step strong,
.workflow-step small {
    display: block;
}

.workflow-step strong {
    font-size: 11px;
}

.workflow-step small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.config-list {
    margin-top: 10px;
}

.config-row {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px dashed var(--line);
}

.config-row:last-child {
    border-bottom: 0;
}

.config-row span {
    color: var(--muted);
    font-size: 10px;
}

.config-row strong {
    text-align: right;
    font-size: 10px;
}

.progress-panel {
    margin-top: 14px;
}

.project-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 17px;
}

.project-summary > div {
    min-height: 68px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.project-summary span,
.project-summary strong {
    display: block;
}

.project-summary span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 9px;
}

.project-summary strong {
    font-size: 10px;
    overflow-wrap: anywhere;
}

.placeholder-panel {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.placeholder-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
}

.placeholder-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.placeholder-panel h2 {
    margin: 8px 0 8px;
    font-size: 25px;
}

.placeholder-panel p {
    max-width: 520px;
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.footer {
    padding: 20px;
    color: var(--muted);
    text-align: center;
    font-size: 9px;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .welcome-panel {
        grid-template-columns: 1fr;
    }

    .studio-preview {
        min-height: 190px;
    }
}

@media (max-width: 860px) {
    :root {
        --sidebar-width: 230px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 14px 0 36px rgba(0,0,0,.10);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        pointer-events: none;
        opacity: 0;
        background: rgba(10,15,26,.42);
        transition: opacity .2s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .mobile-only {
        display: grid;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .project-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .topbar {
        padding: 10px 14px;
    }

    .content {
        width: calc(100% - 20px);
        margin-top: 10px;
    }

    .welcome-panel {
        min-height: 0;
        padding: 24px 20px;
        border-radius: 18px;
    }

    .welcome-copy h2 {
        font-size: 29px;
    }

    .studio-preview {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 9px 0;
    }

    .stat-card {
        min-height: 92px;
    }

    .panel {
        padding: 17px;
        border-radius: 16px;
    }

    .config-row {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 10px 0;
    }

    .config-row strong {
        text-align: left;
    }

    .page-title {
        font-size: 17px;
    }

    .eyebrow {
        display: none;
    }
}


/* ===== Card 2 adjustments: Multilanguage + cleaner sidebar + improved Hero ===== */

.sidebar-footer {
    display: none !important;
}

.topbar-actions {
    gap: 10px;
}

.setting-control {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.setting-label {
    padding: 0 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.setting-option {
    min-width: 40px;
    height: 30px;
    padding: 0 9px;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    font-weight: 760;
}

.setting-option:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.setting-option.active {
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 42%, transparent);
}

.hero-brand-art {
    min-height: 220px;
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.hero-brand-art::before {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 30%, rgba(63,114,245,.23), transparent 42%),
        radial-gradient(circle at 66% 68%, rgba(118,87,232,.22), transparent 45%);
    filter: blur(4px);
    z-index: -2;
}

.hero-orbit {
    position: absolute;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
    border-radius: 50%;
    z-index: -1;
}

.orbit-one {
    width: 300px;
    height: 150px;
    transform: rotate(-12deg);
}

.orbit-two {
    width: 245px;
    height: 245px;
    transform: rotate(16deg);
    border-color: color-mix(in srgb, var(--violet) 18%, transparent);
}

.hero-logo-card {
    width: min(100%, 330px);
    min-height: 186px;
    display: grid;
    grid-template-columns: 82px 1fr;
    grid-template-rows: auto auto auto;
    gap: 12px 16px;
    align-items: center;
    padding: 22px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 76%, transparent);
    border-radius: 26px;
    background:
        linear-gradient(145deg,
            color-mix(in srgb, var(--surface) 96%, transparent),
            color-mix(in srgb, var(--primary-soft) 65%, var(--surface))
        );
    box-shadow:
        0 28px 60px rgba(45, 68, 120, .16),
        inset 0 1px 0 rgba(255,255,255,.8);
    transform: perspective(900px) rotateY(-5deg) rotateX(2deg);
}

.hero-logo-mark {
    width: 82px;
    height: 82px;
    grid-row: 1 / 3;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(135deg, #3478ff 0%, #6356ec 52%, #8b57dc 100%);
    box-shadow: 0 16px 35px rgba(75, 89, 220, .28);
}

.hero-n {
    font-size: 39px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -.08em;
    transform: translateX(-3px);
}

.hero-play {
    width: 29px;
    height: 29px;
    position: absolute;
    right: -8px;
    bottom: -7px;
    display: grid;
    place-items: center;
    border: 3px solid var(--surface);
    border-radius: 10px;
    background: #0f1728;
    box-shadow: 0 7px 18px rgba(15,23,40,.18);
}

.hero-play svg {
    width: 15px;
    height: 15px;
    fill: #fff;
}

.hero-logo-copy strong,
.hero-logo-copy span {
    display: block;
}

.hero-logo-copy strong {
    font-size: 24px;
    line-height: 1;
    letter-spacing: -.045em;
}

.hero-logo-copy span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
}

.hero-wave {
    height: 34px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hero-wave i {
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary), var(--violet));
}

.hero-wave i:nth-child(1) { height: 10px; }
.hero-wave i:nth-child(2) { height: 18px; }
.hero-wave i:nth-child(3) { height: 27px; }
.hero-wave i:nth-child(4) { height: 15px; }
.hero-wave i:nth-child(5) { height: 31px; }
.hero-wave i:nth-child(6) { height: 22px; }
.hero-wave i:nth-child(7) { height: 12px; }
.hero-wave i:nth-child(8) { height: 25px; }
.hero-wave i:nth-child(9) { height: 16px; }

.hero-subtitle-line {
    grid-column: 1 / -1;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.hero-subtitle-line span {
    min-width: 26px;
    padding: 3px 6px;
    border-radius: 6px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 8px;
    font-weight: 850;
    text-align: center;
}

.hero-subtitle-line b {
    height: 6px;
    border-radius: 999px;
    background: var(--line-strong);
}

.hero-subtitle-line b:nth-of-type(1) { width: 43%; }
.hero-subtitle-line b:nth-of-type(2) { width: 22%; }
.hero-subtitle-line b:nth-of-type(3) { width: 14%; }

.hero-format-chip {
    position: absolute;
    top: 12%;
    right: 4%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 9px;
    font-weight: 850;
}

.hero-format-chip.duration {
    top: auto;
    right: auto;
    left: 3%;
    bottom: 12%;
    color: var(--violet);
}

@media (max-width: 860px) {
    .setting-label {
        display: none;
    }
}

@media (max-width: 620px) {
    .topbar {
        align-items: flex-start;
    }

    .topbar-actions {
        gap: 5px;
    }

    .setting-control {
        min-height: 34px;
    }

    .setting-option {
        min-width: 34px;
        height: 26px;
        padding: 0 6px;
        font-size: 9px;
    }

    .hero-brand-art {
        display: none;
    }
}


/* ===== Branding Studio Nextflow ===== */

.brand-image {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
    object-fit: contain;
}

.brand-studio strong,
.brand-studio small {
    display: block;
    line-height: 1.02;
}

.brand-studio strong {
    font-size: 15px;
    color: var(--text);
    letter-spacing: -.025em;
}

.brand-studio small {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
}

.hero-studio-copy strong {
    color: var(--text);
    font-size: 24px;
    line-height: 1;
}

.hero-studio-copy span {
    margin-top: 4px;
    color: var(--primary);
    font-size: 16px;
    font-weight: 850;
    letter-spacing: -.02em;
}


/* ===== Fase 1 · Formulario Nuevo Video ===== */

.form-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-hero h2 {
    margin: 7px 0 8px;
    font-size: 28px;
    letter-spacing: -.035em;
}

.form-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.format-badge {
    min-width: 136px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--primary-soft);
    text-align: right;
}

.format-badge span,
.format-badge strong {
    display: block;
}

.format-badge span {
    color: var(--primary);
    font-size: 20px;
    font-weight: 850;
}

.format-badge strong {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.video-form {
    display: grid;
    gap: 12px;
}

.form-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-section-head {
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
}

.form-section-head > div {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.step-chip {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    border-radius: 9px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 850;
}

.form-section-head h3 {
    margin: 0;
    font-size: 15px;
}

.form-section-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.field-grid {
    display: grid;
    gap: 12px;
}

.field-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field.full {
    grid-column: 1 / -1;
}

.field {
    display: grid;
    gap: 7px;
}

.field > span {
    color: var(--text);
    font-size: 10px;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    font-size: 11px;
}

.field input:focus,
.field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.choice-grid {
    display: grid;
    gap: 10px;
}

.choice-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-card,
.duration-card {
    position: relative;
    cursor: pointer;
}

.choice-card input,
.duration-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-body,
.duration-card > span {
    min-height: 92px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
    transition: .16s ease;
}

.choice-card input:checked + .choice-body,
.duration-card input:checked + span {
    border-color: color-mix(in srgb, var(--primary) 62%, var(--line));
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}

.choice-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    border-radius: 11px;
}

.choice-icon svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.choice-icon.commercial {
    color: var(--primary);
    background: var(--primary-soft);
}

.choice-icon.storytelling {
    color: var(--violet);
    background: var(--violet-soft);
}

.choice-body strong,
.choice-body small,
.duration-card strong,
.duration-card small {
    display: block;
}

.choice-body strong {
    font-size: 12px;
}

.choice-body small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.duration-card > span {
    min-height: 78px;
    display: block;
    text-align: center;
}

.duration-card strong {
    color: var(--primary);
    font-size: 20px;
}

.duration-card small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 4px 0 10px;
}

.form-actions button {
    cursor: pointer;
}

.notice {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
}

.notice.success {
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid color-mix(in srgb, var(--success) 24%, var(--line));
}

@media (max-width: 820px) {
    .choice-grid.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-grid.two,
    .choice-grid.two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .form-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .format-badge {
        width: 100%;
        text-align: left;
    }

    .choice-grid.four {
        grid-template-columns: 1fr 1fr;
    }

    .form-panel {
        padding: 16px;
    }
}


/* ===== Card 4 ajuste: Vertical / Horizontal ===== */

.orientation-card {
    position: relative;
    cursor: pointer;
}

.orientation-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.orientation-body {
    min-height: 112px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
    transition: .16s ease;
}

.orientation-card input:checked + .orientation-body {
    border-color: color-mix(in srgb, var(--primary) 62%, var(--line));
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}

.orientation-preview {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    flex: 0 0 74px;
    border-radius: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.orientation-preview i {
    display: block;
    border-radius: 6px;
    border: 2px solid var(--primary);
    background: linear-gradient(145deg, var(--primary-soft), var(--violet-soft));
}

.vertical-preview i {
    width: 30px;
    height: 54px;
}

.horizontal-preview i {
    width: 56px;
    height: 32px;
}

.orientation-body strong,
.orientation-body small,
.orientation-body em {
    display: block;
}

.orientation-body strong {
    font-size: 12px;
}

.orientation-body small {
    margin-top: 4px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 750;
}

.orientation-body em {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    font-style: normal;
}

@media (max-width: 620px) {
    .orientation-body {
        align-items: flex-start;
    }
}


/* ===== Fase 1 · Módulo de costos ===== */

.cost-header {
    margin-bottom: 14px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.cost-header h2 {
    margin: 7px 0 8px;
    font-size: 27px;
    letter-spacing: -.035em;
}

.cost-header p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.cost-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
    margin-bottom: 14px;
}

.cost-summary-card {
    min-height: 116px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.cost-summary-card.total {
    border-color: color-mix(in srgb, var(--primary) 36%, var(--line));
    background: var(--primary-soft);
}

.cost-summary-card span,
.cost-summary-card strong,
.cost-summary-card small {
    display: block;
}

.cost-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.cost-summary-card strong {
    margin-top: 9px;
    font-size: 24px;
    letter-spacing: -.035em;
}

.cost-summary-card small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
}

.cost-layout {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 14px;
}

.cost-form {
    margin-top: 17px;
}

.cost-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 13px;
}

.cost-form-actions button {
    cursor: pointer;
}

.cost-video-list {
    display: grid;
    gap: 8px;
    margin-top: 15px;
}

.cost-video-row {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.cost-video-row strong,
.cost-video-row small {
    display: block;
}

.cost-video-row > div:first-child strong {
    font-size: 10px;
}

.cost-video-row > div:first-child small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.video-cost-values {
    display: flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
}

.video-cost-values span {
    color: var(--muted);
    font-size: 9px;
}

.video-cost-values strong {
    color: var(--primary);
    font-size: 12px;
}

.cost-history-panel {
    margin-top: 14px;
}

.cost-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 14px;
}

.cost-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.cost-table th,
.cost-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 9px;
}

.cost-table th {
    color: var(--muted);
    font-weight: 750;
}

.amount-cell {
    font-weight: 800;
    color: var(--text);
}

.provider-pill {
    display: inline-flex;
    padding: 5px 7px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 850;
}

.provider-pill.openai {
    color: var(--success);
    background: var(--success-soft);
}

.provider-pill.gpu {
    color: var(--violet);
    background: var(--violet-soft);
}

.empty-state {
    margin-top: 15px;
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    color: var(--muted);
    background: var(--surface-soft);
    text-align: center;
    font-size: 10px;
}

@media (max-width: 1000px) {
    .cost-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cost-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .cost-summary-grid {
        grid-template-columns: 1fr;
    }

    .cost-video-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .video-cost-values {
        width: 100%;
        justify-content: space-between;
    }
}


/* ===== Ajustes 0.5.1: mensajes temporales + Biblioteca CRUD ===== */

.notice {
    position: relative;
    padding-right: 44px;
    transition:
        opacity .25s ease,
        transform .25s ease,
        max-height .25s ease,
        margin .25s ease,
        padding .25s ease;
}

.notice.notice-hiding {
    opacity: 0;
    transform: translateY(-6px);
}

.notice-close {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 50%;
    right: 9px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.notice-close:hover {
    background: rgba(0, 0, 0, .05);
}

.library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.library-header h2 {
    margin: 7px 0 8px;
    font-size: 27px;
    letter-spacing: -.035em;
}

.library-header p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.library-panel {
    min-height: 440px;
}

.library-count {
    display: inline-grid;
    min-width: 25px;
    height: 25px;
    margin-left: 6px;
    place-items: center;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 9px;
    vertical-align: middle;
}

.video-library-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.video-library-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-soft);
}

.video-thumb {
    min-height: 142px;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 78% 18%, rgba(118,87,232,.16), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(63,114,245,.18), transparent 30%),
        var(--primary-soft);
}

.video-thumb-frame {
    display: grid;
    place-items: center;
    border: 2px solid color-mix(in srgb, var(--primary) 55%, var(--line));
    border-radius: 10px;
    color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.video-thumb.vertical .video-thumb-frame {
    width: 54px;
    height: 96px;
}

.video-thumb.horizontal .video-thumb-frame {
    width: 112px;
    height: 63px;
}

.video-thumb-frame svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.video-format {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 7px;
    border-radius: 7px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 8px;
    font-weight: 850;
}

.video-library-body {
    padding: 13px;
}

.video-library-title {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.video-id {
    padding: 3px 5px;
    border-radius: 5px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 8px;
    font-weight: 850;
    flex: 0 0 auto;
}

.video-library-title h4 {
    margin: 1px 0 0;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.video-meta span {
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 8px;
}

.video-cost-mini {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
    padding: 8px;
    border-radius: 9px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.video-cost-mini span {
    color: var(--muted);
    font-size: 8px;
}

.video-cost-mini strong {
    color: var(--primary);
    font-size: 9px;
}

.video-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    margin-top: 11px;
}

.button.danger {
    color: #c13434;
    background: #fff2f2;
    border-color: #f0cccc;
}

html[data-theme="dark"] .button.danger {
    color: #ff8585;
    background: #3a2025;
    border-color: #5a3038;
}

.button.danger:hover {
    transform: translateY(-1px);
}

.button.compact {
    min-height: 32px;
    padding: 0 10px;
    font-size: 9px;
    cursor: pointer;
}

.button.compact svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.library-empty {
    min-height: 310px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.library-empty strong {
    color: var(--text);
    font-size: 13px;
}

.library-empty span {
    margin-bottom: 9px;
}

@media (max-width: 1120px) {
    .video-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .library-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .video-library-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== Fase 2 · Guion manual ===== */

.script-grid {
    display: grid;
    gap: 14px;
}

.script-field textarea {
    width: 100%;
    min-height: 138px;
    resize: vertical;
    padding: 12px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    font: inherit;
    font-size: 11px;
    line-height: 1.65;
}

.script-field textarea[name="final_script"] {
    min-height: 220px;
}

.script-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
}

.field-help b {
    color: var(--primary);
    white-space: nowrap;
    font-size: 9px;
}

.video-action-buttons {
    display: flex;
    align-items: center;
    gap: 7px;
}

@media (max-width: 620px) {
    .field-help {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .video-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .video-action-buttons {
        width: 100%;
    }

    .video-action-buttons .button,
    .video-action-buttons form {
        flex: 1;
    }

    .video-action-buttons form .button {
        width: 100%;
    }
}


/* ===== Fase 2 · Generación con OpenAI ===== */

.openai-generator {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.openai-toggle {
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
}

.openai-toggle > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.openai-toggle-ui {
    width: 38px;
    height: 22px;
    position: relative;
    flex: 0 0 38px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: .18s ease;
}

.openai-toggle-ui::after {
    content: "";
    width: 16px;
    height: 16px;
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .14);
    transition: .18s ease;
}

.openai-toggle input:checked + .openai-toggle-ui {
    background: var(--primary);
}

.openai-toggle input:checked + .openai-toggle-ui::after {
    transform: translateX(16px);
}

.openai-toggle strong,
.openai-toggle small {
    display: block;
}

.openai-toggle strong {
    font-size: 11px;
}

.openai-toggle small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.openai-generator-body {
    display: none;
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
}

.openai-generator.enabled .openai-generator-body {
    display: block;
}

.openai-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.openai-api-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 9px;
}

.openai-api-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--line-strong);
}

.openai-api-status.ready {
    color: var(--success);
}

.openai-api-status.ready i {
    background: var(--success);
}

.openai-api-status.error {
    color: #c13434;
}

.openai-api-status.error i {
    background: #c13434;
}

.openai-generate-button {
    cursor: pointer;
}

.openai-generate-button[disabled] {
    opacity: .55;
    cursor: wait;
}

.openai-generation-result {
    display: none;
    margin-top: 10px;
    padding: 10px 11px;
    border-radius: 9px;
    font-size: 9px;
    line-height: 1.5;
}

.openai-generation-result.show {
    display: block;
}

.openai-generation-result.success {
    color: var(--success);
    background: var(--success-soft);
}

.openai-generation-result.error {
    color: #c13434;
    background: #fff2f2;
}

html[data-theme="dark"] .openai-generation-result.error {
    color: #ff8585;
    background: #3a2025;
}

@media (max-width: 620px) {
    .openai-status-row {
        align-items: stretch;
        flex-direction: column;
    }

    .openai-generate-button {
        width: 100%;
    }
}


/* ===== Patrón estándar de tablas NextFlow ===== */

.nextflow-table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    margin-bottom: 8px;
}

.nextflow-table-search {
    flex: 1;
    max-width: 320px;
}

.nextflow-table-search input,
.nextflow-table-filters select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    font-size: 9px;
}

.nextflow-table-search input:focus,
.nextflow-table-filters select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.nextflow-table-filters {
    display: flex;
    align-items: center;
    gap: 7px;
}

.nextflow-table-filters select:first-child {
    min-width: 160px;
}

.nextflow-table-filters select:last-child {
    width: 72px;
}

.nextflow-data-table th button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    text-align: left;
}

.nextflow-data-table th button i {
    width: 8px;
    height: 12px;
    position: relative;
    flex: 0 0 8px;
}

.nextflow-data-table th button i::before,
.nextflow-data-table th button i::after {
    content: "";
    position: absolute;
    left: 1px;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    opacity: .25;
}

.nextflow-data-table th button i::before {
    top: 0;
    border-bottom: 4px solid currentColor;
}

.nextflow-data-table th button i::after {
    bottom: 0;
    border-top: 4px solid currentColor;
}

.nextflow-data-table th button.sort-asc i::before,
.nextflow-data-table th button.sort-desc i::after {
    opacity: 1;
    color: var(--primary);
}

.nextflow-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 9px;
}

.nextflow-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nextflow-pagination button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
}

.nextflow-pagination button:disabled {
    opacity: .4;
    cursor: default;
}

.nextflow-pagination span {
    min-width: 52px;
    text-align: center;
    font-weight: 750;
}

@media (max-width: 700px) {
    .nextflow-table-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .nextflow-table-search {
        max-width: none;
    }

    .nextflow-table-filters {
        width: 100%;
    }

    .nextflow-table-filters select:first-child {
        flex: 1;
        min-width: 0;
    }
}


/* ===== Fase 2 · Modos de contenido ===== */

.content-profile-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 12px;
}

.content-profile {
    display: none;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.content-profile.active {
    display: block;
}

.content-profile strong,
.content-profile span {
    display: block;
}

.content-profile strong {
    color: var(--primary);
    font-size: 10px;
}

.content-profile span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
}

.cta-option {
    grid-column: 1 / -1;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.cta-text-wrap {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.cta-option.enabled .cta-text-wrap {
    display: block;
}

@media (max-width: 620px) {
    .content-profile-wrap {
        grid-template-columns: 1fr;
    }
}


/* ===== Fase 3 · Avatar Master + Cards visuales anti-saturación ===== */

.nextflow-card-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 12px;
}

.nextflow-card-tools input,
.nextflow-card-tools select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    font-size: 9px;
}

.nextflow-card-tools input {
    flex: 1;
    min-width: 180px;
}

.nextflow-card-tools select {
    min-width: 125px;
}

.nextflow-card-tools input:focus,
.nextflow-card-tools select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.nextflow-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 9px;
}

.compact-tools input {
    min-width: 120px;
}

.avatar-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.avatar-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-soft);
}

.avatar-card-image {
    height: 205px;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--primary-soft);
    border-bottom: 1px solid var(--line);
}

.avatar-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-card-image .status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

.avatar-placeholder {
    width: 86px;
    height: 86px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 30px;
    font-weight: 850;
}

.avatar-card-body {
    padding: 14px;
}

.avatar-card-body h4 {
    margin: 0;
    font-size: 13px;
}

.avatar-card-body p {
    min-height: 36px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
}

.avatar-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 11px;
    color: var(--muted);
    font-size: 9px;
}

.avatar-master-layout {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 14px;
}

.master-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.master-image-slot {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.master-image-slot img,
.master-image-empty {
    width: 100%;
    aspect-ratio: 2 / 3;
    display: grid;
    place-items: center;
    object-fit: cover;
    background: var(--primary-soft);
}

.master-image-empty {
    color: var(--primary);
    font-size: 28px;
}

.master-image-slot strong,
.master-image-slot small {
    display: block;
    padding: 0 9px;
}

.master-image-slot strong {
    margin-top: 9px;
    font-size: 9px;
}

.master-image-slot small {
    margin: 3px 0 9px;
    color: var(--muted);
    font-size: 8px;
}

.avatar-generate-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.avatar-generate-form button {
    cursor: pointer;
}

.avatar-generation-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 8px;
    text-align: right;
}

@media (max-width: 1000px) {
    .avatar-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .avatar-master-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .nextflow-card-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .nextflow-card-tools input,
    .nextflow-card-tools select {
        width: 100%;
        min-width: 0;
    }

    .avatar-card-grid {
        grid-template-columns: 1fr;
    }

    .master-image-grid {
        grid-template-columns: 1fr;
    }
}


.avatar-generate-placeholder {
    margin-top: 14px;
    padding: 12px 13px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
}
