:root {
    color-scheme: dark;
    --bg: #14151a;
    --bg-elevated: #1c1e26;
    --border: #2c2f3a;
    --text: #e8e9ed;
    --text-muted: #9a9db0;
    --accent: #6d8dfa;
    --accent-strong: #4d6ff2;
    --success: #3ecf8e;
    --warning: #e8b339;
    --danger: #e8546a;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 22px;
    margin: 0;
}

/* Shell */

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

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 24px;
    color: var(--text);
}

.brand-name {
    font-weight: 600;
    font-size: 15px;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-link {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text-muted);
}

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

.nav-link.active {
    background: rgba(109, 141, 250, 0.15);
    color: var(--accent);
}

.sidebar-footer {
    margin-top: auto;
}

.content {
    flex: 1;
    padding: 28px 32px;
    max-width: 1100px;
}

/* Login */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    margin-bottom: 4px;
}

.login-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Page header */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

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

.page-loading {
    color: var(--text-muted);
    padding: 24px 0;
}

/* Tabs */

.tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0 0 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}

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

.tab.active {
    color: var(--text);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

/* Forms */

.form-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}

.section-title {
    font-weight: 600;
    margin-bottom: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    flex: 1;
}

.field-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.field-label {
    font-size: 12px;
    color: var(--text-muted);
}

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.field-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
}

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

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 6px;
    border: 1px solid transparent;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: var(--text);
}

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

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

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

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards */

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

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

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

.card-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-row {
    display: flex;
    gap: 20px;
    margin-top: 4px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-weight: 600;
    font-size: 16px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

.stack {
    display: flex;
    flex-direction: column;
}

/* Table */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Pills / badges */

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.pill-success {
    background: rgba(62, 207, 142, 0.15);
    color: var(--success);
}

.pill-warning {
    background: rgba(232, 179, 57, 0.15);
    color: var(--warning);
}

.pill-danger {
    background: rgba(232, 84, 106, 0.15);
    color: var(--danger);
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.dot-on {
    background: var(--success);
}

.dot-off {
    background: var(--text-muted);
}

/* Banners */

.banner {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px 14px;
    margin-bottom: 14px;
}

.banner-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.banner-info {
    border-color: var(--accent);
    background: rgba(109, 141, 250, 0.1);
}

.banner-warning {
    border-color: var(--warning);
    background: rgba(232, 179, 57, 0.1);
}

.banner-error {
    border-color: var(--danger);
    background: rgba(232, 84, 106, 0.1);
}

.banner-success {
    border-color: var(--success);
    background: rgba(62, 207, 142, 0.1);
}

/* Empty state */

.empty-state {
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}

.empty-state-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.empty-state-description {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 420px;
    margin: 0 auto 14px;
}

/* Media */

.video-preview {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    background: black;
}

.scene-thumb {
    width: 100%;
    max-width: 280px;
    border-radius: 6px;
}

.portrait-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 6px;
    border: 2px solid transparent;
}

.portrait img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 6px;
}

.portrait-selected {
    border-color: var(--accent);
}

/* Misc */

.row-tight {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.small {
    font-size: 12px;
}

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

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
