:root {
    color-scheme: dark;
    --bg: #09090b;
    --panel: #111827;
    --panel-2: #0f172a;
    --panel-3: #151d2d;
    --line: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --muted: #9ca3af;
    --indigo: #6366f1;
    --violet: #8b5cf6;
    --cyan: #06b6d4;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 20% 8%, rgba(99, 102, 241, 0.16), transparent 26%),
        radial-gradient(circle at 80% 18%, rgba(6, 182, 212, 0.14), transparent 24%),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    color: inherit;
}

a {
    text-decoration: none;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 20;
    transform: translateY(-140%);
    border: 1px solid rgba(6, 182, 212, 0.6);
    border-radius: 8px;
    background: #05070c;
    color: #e0f2fe;
    padding: 10px 14px;
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid rgba(6, 182, 212, 0.78);
    outline-offset: 3px;
}

.view,
.screen {
    display: none;
}

.view.active,
.screen.active {
    display: block;
}

.landing {
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 48%, rgba(6, 182, 212, 0.18), transparent 28%),
        radial-gradient(circle at 50% 55%, rgba(139, 92, 246, 0.16), transparent 36%),
        linear-gradient(180deg, #09090b 0%, #0b1020 100%);
}

.landing-nav {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px clamp(18px, 4vw, 56px);
}

.brand,
.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-mark,
.sidebar-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
}

.brand strong,
.sidebar-brand strong {
    display: block;
    font-size: 17px;
    line-height: 1.1;
}

.brand small,
.sidebar-brand small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.hero {
    position: relative;
    min-height: calc(100vh - 72px);
    display: grid;
    place-items: center;
    padding: 44px 18px 76px;
    text-align: center;
}

.hero-core {
    position: absolute;
    width: min(520px, 80vw);
    opacity: 0.34;
    filter: saturate(1.25);
    pointer-events: none;
}

.hero .primary-action {
    position: relative;
    z-index: 1;
}

.hero-brand,
.section-label {
    position: relative;
    margin: 0 0 12px;
    color: var(--cyan);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero h1 {
    position: relative;
    width: min(900px, 100%);
    margin: 0 0 22px;
    font-size: clamp(44px, 8vw, 92px);
    line-height: 0.98;
}

.hero-line {
    position: relative;
    margin: 0 0 18px;
    color: #e5e7eb;
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 700;
    line-height: 1.12;
}

.hero-copy {
    position: relative;
    width: min(680px, 100%);
    margin: 0 auto 34px;
    color: #cbd5e1;
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.55;
}

.app-shell {
    min-height: 100vh;
}

.app-shell.active {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 22px;
    border-right: 1px solid var(--line);
    background: rgba(11, 13, 19, 0.88);
    backdrop-filter: blur(18px);
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    border-radius: 7px;
    padding: 0 12px;
    color: #d1d5db;
    font-size: 14px;
    font-weight: 700;
}

.side-nav a:hover,
.side-nav a.active,
.side-nav a[aria-current="page"] {
    background: rgba(99, 102, 241, 0.18);
    color: white;
}

.sidebar-footer {
    display: grid;
    gap: 6px;
    margin-top: auto;
    color: var(--muted);
    font-size: 12px;
}

.sidebar-footer strong {
    color: white;
}

.workspace {
    min-width: 0;
    padding: clamp(18px, 3vw, 36px);
}

.workspace:focus {
    outline: none;
}

.screen,
.panel,
.panel-title,
.table-list,
.table-row,
.table-row > div,
.row-actions {
    min-width: 0;
}

.workspace-topbar,
.panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.workspace-topbar {
    margin-bottom: 22px;
}

.workspace-topbar h2,
.panel-title h3 {
    margin: 0;
}

.workspace-topbar h2 {
    font-size: clamp(30px, 4vw, 48px);
}

.topbar-actions,
.row-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.language-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0 10px;
    background: rgba(17, 24, 39, 0.72);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.language-control select {
    width: auto;
    height: 30px;
    min-width: 112px;
    border: 0;
    padding: 0 8px;
    background: rgba(9, 9, 11, 0.75);
    color: white;
}

.status-pill {
    min-width: 132px;
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 999px;
    padding: 8px 12px;
    color: #a5f3fc;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
}

.primary-action,
.secondary-action,
.table-row button,
.row-actions a {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    color: white;
    font-weight: 800;
}

.primary-action {
    background: linear-gradient(135deg, var(--indigo), var(--cyan));
}

.secondary-action,
.table-row button,
.row-actions a {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
}

.compact {
    min-height: 38px;
    padding: 0 12px;
}

.full {
    width: 100%;
}

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

.metrics-grid.tight {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.82), rgba(15, 23, 42, 0.78));
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
}

.metric {
    min-height: 112px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.metric::after {
    content: "";
    position: absolute;
    inset: auto 14px 12px auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.78);
}

.metric span {
    display: block;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    font-size: 22px;
    overflow-wrap: anywhere;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
    gap: 16px;
    margin-top: 18px;
}

.media-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

.command-hero {
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(6, 182, 212, 0.1)),
        linear-gradient(180deg, rgba(17, 24, 39, 0.88), rgba(15, 23, 42, 0.82));
}

.panel {
    padding: 20px;
}

.form-panel {
    max-width: 940px;
}

.production-form {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

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

.wizard-steps,
.media-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.wizard-steps button,
.media-tabs button {
    min-height: 34px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #c7d2fe;
    padding: 8px 11px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.wizard-steps button.active {
    border-color: rgba(6, 182, 212, 0.82);
    background: rgba(6, 182, 212, 0.18);
    color: #a5f3fc;
}

.wizard-steps button.complete {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

.wizard-steps button.error {
    border-color: rgba(248, 113, 113, 0.7);
    background: rgba(248, 113, 113, 0.13);
    color: #fecaca;
}

.wizard-steps button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.wizard-panel {
    display: none;
    gap: 12px;
}

.wizard-panel.active {
    display: grid;
}

.wizard-panel label span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.wizard-panel [aria-invalid="true"] {
    border-color: rgba(248, 113, 113, 0.85);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.22);
}

.wizard-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.wizard-actions button[hidden] {
    display: none;
}

.wizard-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.54;
}

.wizard-status {
    min-height: 42px;
    border: 1px solid rgba(6, 182, 212, 0.26);
    border-radius: 8px;
    background: rgba(6, 182, 212, 0.08);
    color: #a5f3fc;
    padding: 12px;
    font-size: 13px;
    font-weight: 800;
}

.wizard-status.error {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.1);
    color: #fecaca;
}

.wizard-status.success {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.1);
    color: #bbf7d0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.breadcrumb a {
    color: #a5f3fc;
    text-decoration: none;
}

.wizard-summary {
    max-height: 360px;
}

.wizard-review {
    display: grid;
    gap: 12px;
}

.compact-list {
    display: grid;
    gap: 8px;
}

.media-tabs button {
    cursor: pointer;
}

.media-tabs button.active {
    border-color: rgba(6, 182, 212, 0.72);
    background: rgba(6, 182, 212, 0.18);
    color: #a5f3fc;
}

label {
    display: grid;
    gap: 8px;
    color: #d1d5db;
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: #0c1220;
    color: white;
    padding: 12px 14px;
}

input,
select {
    height: 48px;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--cyan);
    outline: 2px solid rgba(6, 182, 212, 0.18);
}

.timeline {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.timeline li {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--panel-3);
    padding: 0 12px;
}

.timeline li span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.timeline li.done {
    border-color: rgba(34, 197, 94, 0.42);
}

.timeline li.done span {
    color: #86efac;
}

.timeline li.running {
    border-color: rgba(245, 158, 11, 0.45);
}

.timeline li.running span {
    color: #fcd34d;
}

.progress-block {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.progress-bar,
.mini-progress {
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.progress-bar span,
.mini-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--indigo), var(--cyan));
    transition: width 240ms ease;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.mini-progress {
    width: 84px;
    height: 8px;
}

.table-list,
.detail-list,
.media-list,
.signal-grid,
.settings-grid {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.table-row,
.detail-row,
.empty-state,
.signal {
    min-height: 58px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--panel-3);
    padding: 12px;
}

.table-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.table-row strong,
.detail-row strong {
    display: block;
    overflow-wrap: anywhere;
}

.table-row span,
.detail-row span,
.empty-state {
    color: var(--muted);
    font-size: 13px;
}

.detail-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.signal {
    display: grid;
    gap: 6px;
}

.signal span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.signal strong {
    color: #e5e7eb;
    overflow-wrap: anywhere;
}

.agent-panel {
    margin-top: 16px;
}

.review-layout {
    margin-top: 16px;
}

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

.settings-card {
    min-height: 220px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--panel-3);
    padding: 14px;
}

.settings-card h4 {
    margin: 0;
    color: #f8fafc;
}

.settings-card .detail-list {
    margin-top: 12px;
}

.settings-card .detail-row {
    min-height: 44px;
    background: rgba(5, 7, 12, 0.42);
}

.video-frame {
    overflow: hidden;
    margin-top: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: #05070c;
    aspect-ratio: 16 / 9;
}

.video-frame.hidden {
    display: none;
}

.project-detail-pane {
    margin-top: 16px;
}

.video-frame video {
    width: 100%;
    height: 100%;
    display: block;
}

.media-project-meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.media-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.media-summary-grid .signal {
    min-height: 74px;
}

.media-list .table-row {
    border-color: rgba(99, 102, 241, 0.16);
}

.media-list .row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.analytics-pane {
    display: none;
}

.analytics-pane.active {
    display: block;
}

.analytics-context {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.analytics-context .signal-grid {
    align-content: start;
}

.compact-tabs {
    margin: 0 0 12px;
}

.compact-tabs button {
    padding: 9px 12px;
    font-size: 12px;
}

.json-preview {
    max-width: 100%;
    max-height: 620px;
    overflow: auto;
    margin: 18px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: #05070c;
    color: #c7d2fe;
    padding: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 1120px) {
    .app-shell.active {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .side-nav,
    .metrics-grid,
    .metrics-grid.tight,
    .two-column,
    .three-column,
    .form-grid,
    .settings-grid,
    .media-summary-grid,
    .analytics-context {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .brand small,
    .sidebar-brand small {
        display: none;
    }

    .workspace-topbar,
    .panel-title,
    .table-row,
    .detail-row {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .side-nav,
    .metrics-grid,
    .metrics-grid.tight,
    .two-column,
    .three-column,
    .form-grid,
    .settings-grid,
    .analytics-context {
        grid-template-columns: 1fr;
    }

    .topbar-actions,
    .row-actions {
        align-items: stretch;
        width: 100%;
    }

    .row-actions a,
    .table-row button,
    .compact {
        width: 100%;
    }

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

    .media-list .row-actions {
        justify-content: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
