:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #19253a;
  background: #f7f8fc;
  font-synthesis: none;
  --ink: #19253a;
  --muted: #59677c;
  --subtle: #66758a;
  --line: #e4e9f2;
  --panel: #fff;
  --canvas: #f7f8fc;
  --aside: #111a2e;
  --blue: #5146e5;
  --blue-dark: #4034cd;
  --blue-soft: #efedff;
  --green: #10775e;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 14px; }
::selection { background: #dedaff; color: #221d55; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { color: inherit; caret-color: var(--blue); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7468f1; outline-offset: 3px; }
svg { vertical-align: middle; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }

.shell { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 24px 15px 15px; color: #aebad0; background: var(--aside); z-index: 3; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 5px; width: fit-content; max-width: 100%; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; flex-shrink: 0; border: 1px solid #8074ff; border-radius: 11px; background: #5a4dee; color: #fff; }
.brand strong { display: block; color: #f6f7fe; font-size: 15px; line-height: 1.35; }
.nav { display: grid; gap: 4px; margin-top: 41px; }
.nav-label { color: #95a3bc; font-size: 11px; letter-spacing: .1em; margin: 0 10px 8px; }
.nav-label:not(:first-child) { margin-top: 26px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 43px; border-radius: 8px; padding: 0 11px; border: 1px solid transparent; color: #b8c3d8; outline-offset: 2px; }
.nav-item:hover { color: #fff; background: #1a2540; }
.nav-item[aria-current="page"] { color: #f2efff; background: #27274b; border-color: #3b3564; font-weight: 650; }
.nav-item[aria-current="page"] svg { color: #b4a8ff; }
.sidebar-bottom { margin-top: auto; }
.gateway-link { display: flex; width: 100%; align-items: center; gap: 9px; background: #17223a; border: 1px solid #2b3852; color: #dce4f5; border-radius: 9px; padding: 11px 9px; text-align: left; }
.gateway-link:hover { background: #202c47; }
.gateway-link .text { flex: 1; }
.gateway-link strong, .gateway-link small { display: block; }
.gateway-link strong { font-size: 11px; font-weight: 650; }
.gateway-link small { color: #aab6cb; font-size: 10px; line-height: 1.5; margin-top: 3px; }
.gateway-dot { width: 7px; height: 7px; border-radius: 50%; background: #9c91fb; margin-left: 1px; }
.gateway-dot.live { background: #57cca5; }
.profile-caption { border-top: 1px solid #2b3852; display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 14px 4px 3px; color: #b8c3d8; font-size: 12px; }
.profile-caption .text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-caption button { color: inherit; background: none; border: 0; padding: 5px; }
.avatar { background: #eae6ff; color: #4338c2; width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.sidebar .avatar { background: #302657; color: #d8ceff; }
.topbar { min-height: 65px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 31px; }
.breadcrumb, .top-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.breadcrumb { color: var(--muted); font-size: 13px; white-space: nowrap; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.top-actions { gap: 15px; }
.top-actions .doc-link { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.top-actions .doc-link:hover { color: var(--blue-dark); }
.profile-button { display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 2px 0; }
.mode-label { display: inline-flex; align-items: center; gap: 6px; color: #5045b7; background: #f1eeff; border: 1px solid #e8e1ff; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.mode-label.live { color: #1c6e58; background: #eaf8f2; border-color: #d1efe3; }
.mode-label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.topbar .mobile-nav { display: none; }

.content { max-width: 1520px; padding: 30px 31px 44px; margin-inline: auto; }
.page-heading { min-width: 0; display: flex; justify-content: space-between; align-items: end; gap: 15px; margin-bottom: 24px; }
.page-heading h1 { font-size: clamp(27px, 2.6vw, 38px); line-height: 1.2; font-weight: 750; letter-spacing: -.035em; }
.page-heading p { color: var(--muted); margin-top: 9px; line-height: 1.65; font-size: 13px; }
.page-actions, .row-actions, .form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn, .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; background: #fff; border: 1px solid #dce3ee; min-height: 38px; padding: 7px 12px; color: #29364e; font-weight: 650; font-size: 13px; white-space: nowrap; }
.btn:hover, .icon-btn:hover { background: #f2f4fb; border-color: #cdd6e8; }
.btn.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.large { min-height: 42px; padding-inline: 15px; }
.btn.destructive { color: #a33247; }
.btn:disabled, .icon-btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 36px; min-height: 36px; padding: 0; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; color: #473bc7; border: 0; background: none; font-size: 13px; font-weight: 650; white-space: nowrap; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button.destructive { color: #a33247; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.section { margin-top: 25px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.section-heading h2 { font-weight: 720; font-size: 19px; letter-spacing: -.02em; line-height: 1.35; }
.section-heading p { color: var(--muted); margin-top: 4px; line-height: 1.55; font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; }
.stat { min-width: 0; min-height: 103px; padding: 19px 16px; display: flex; align-items: center; gap: 13px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: #5849d5; background: #efecff; flex: none; }
.stat-icon.queue { color: #276faf; background: #e8f3ff; }
.stat-icon.asset { color: #157b69; background: #e7f6f0; }
.stat-icon.members { color: #935727; background: #fbf0e4; }
.stat-name { display: block; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.stat-value { display: block; color: #131e34; font-size: 27px; letter-spacing: -.025em; font-weight: 720; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.13; }
.stat-value small { font-size: 11px; font-weight: 550; color: var(--subtle); letter-spacing: 0; margin-left: 5px; }

.video-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.video-card { overflow: hidden; display: block; text-align: left; width: 100%; padding: 0; }
.video-card:hover { border-color: #b9b3f3; }
.media-cover { position: relative; aspect-ratio: 2.03; background: #e9edf8; overflow: hidden; display: grid; place-items: center; }
.media-cover img, .media-cover video { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.media-cover.empty-cover { background: #20284c; color: #c7c5ed; }
.media-cover .play { position: relative; z-index: 1; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid #ffffffb5; background: #15203d69; color: #fff; transition: background 160ms; }
.video-card:hover .play { background: #493edb; }
.play svg { margin-left: 2px; }
.media-cover .duration { position: absolute; z-index: 1; right: 9px; bottom: 9px; color: white; background: #141a30bb; border-radius: 5px; padding: 3px 6px; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.video-info { padding: 11px 12px 12px; }
.video-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #19253a; font-size: 14px; }
.video-meta { display: flex; align-items: center; gap: 7px; color: var(--subtle); font-size: 11px; margin-top: 6px; overflow: hidden; white-space: nowrap; }
.video-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #8c97aa; flex: none; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { background: #fafbfe; font-weight: 650; color: #56657d; font-size: 12px; padding: 11px 13px; }
td { height: 54px; padding: 8px 13px; border-top: 1px solid #e9edf5; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { padding-left: 17px; }
th:last-child, td:last-child { padding-right: 17px; }
td .title { color: #24334c; font-weight: 650; }
td .subtitle { display: block; margin-top: 3px; font-size: 10px; }
tbody tr:hover { background: #fbfcff; }
.table-thumb { width: 32px; height: 30px; border-radius: 6px; background: #efedff; color: #6352c7; display: grid; place-items: center; flex: none; overflow: hidden; }
.table-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cell-title { display: flex; align-items: center; gap: 9px; }
.status { display: inline-flex; align-items: center; gap: 5px; color: #51617a; background: #eff2f7; border-radius: 5px; padding: 4px 7px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.succeeded, .status.Active, .status.Available { color: #087458; background: #e6f6ef; }
.status.running, .status.Processing, .status.submitting { color: #245fa9; background: #eaf2ff; }
.status.queued, .status.unknown { color: #875414; background: #fff2dc; }
.status.failed, .status.rejected, .status.Failed { color: #a43549; background: #fcecf0; }
.empty { min-height: 145px; padding: 22px; display: grid; place-content: center; justify-items: center; gap: 9px; text-align: center; color: var(--muted); line-height: 1.6; }
.empty svg { color: #7468c2; }
.empty h3 { color: var(--ink); font-size: 15px; }
.load-message { padding: 23px; color: var(--muted); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-height: 36px; }
.toolbar input { flex: 1 1 175px; max-width: 310px; }
.toolbar .push { margin-left: auto; }
.pagination { display: flex; align-items: center; justify-content: end; gap: 9px; padding: 13px 0 0; color: var(--muted); font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 15px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 3px 12px; color: var(--muted); font-weight: 650; }
.tab[aria-selected="true"] { color: var(--blue-dark); border-color: var(--blue); }

.creator { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(250px, 1fr); gap: 16px; align-items: start; }
.form-panel, .side-panel { padding: 19px; }
.form-panel h2, .side-panel h2 { font-size: 17px; margin-bottom: 15px; }
.side-panel p { color: var(--muted); line-height: 1.75; }
.side-panel dl { margin: 12px 0 0; }
.side-panel dt { color: var(--muted); font-size: 12px; margin-top: 13px; }
.side-panel dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.creator-side { display: grid; gap: 14px; }
.creator-side .stat-value { margin-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field, .media-list { display: grid; min-width: 0; gap: 6px; }
.field > span, .field-label { font-weight: 650; color: #25334d; font-size: 13px; }
.field small, .help { color: var(--muted); font-size: 12px; line-height: 1.55; }
.full { grid-column: 1 / -1; }
input:not([type="checkbox"]), textarea, select { border: 1px solid #dbe2ef; border-radius: 8px; background: #fff; padding: 8px 10px; min-width: 0; min-height: 39px; }
.field textarea { resize: vertical; min-height: 90px; }
.field textarea.prompt { min-height: 120px; }
input::placeholder, textarea::placeholder { color: #64738a; opacity: 1; }
.form-actions { margin-top: 17px; justify-content: end; }
.form-error { color: #9f2a42; background: #fff0f3; padding: 9px 11px; border-radius: 7px; font-size: 12px; line-height: 1.5; margin-top: 10px; }
.asset-dropzone { position: relative; display: grid; gap: 5px; place-items: center; padding: 17px 12px; background: #f8f7ff; border: 1px dashed #a7a1cb; border-radius: 9px; text-align: center; min-width: 0; transition: background-color .18s, border-color .18s; }
.asset-dropzone label { display: grid; gap: 7px; justify-items: center; color: #403892; line-height: 1.45; }
.asset-dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.asset-dropzone:focus-within { outline: 2px solid #695af3; outline-offset: 2px; }
.asset-dropzone:hover, .asset-dropzone.drag-over { background: #efecff; border-color: #695af3; }
.asset-upload-queue { display: grid; gap: 5px; list-style: none; margin: 8px 0 0; padding: 0; max-height: 258px; overflow-y: auto; }
.asset-upload-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.asset-upload-thumb { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; width: 52px; height: 46px; border-radius: 5px; overflow: hidden; background: #f0edff; color: #6754b9; }
.asset-upload-thumb > * { grid-area: 1 / 1; }
.asset-upload-thumb img { width: 100%; height: 100%; object-fit: cover; background: #f0edff; }
.asset-upload-file { display: grid; gap: 2px; min-width: 0; font-size: 12px; }
.asset-upload-file strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.asset-upload-file small { color: var(--muted); }
.asset-upload-item .icon-btn { width: 30px; min-height: 30px; }
.asset-upload-item .status { white-space: nowrap; }
.asset-upload-error { color: #9f2a42; overflow-wrap: anywhere; }
.asset-upload-summary { margin: 6px 0 0; }
.check { display: flex; align-items: start; gap: 7px; color: var(--muted); line-height: 1.5; }
.check input { accent-color: var(--blue); }
.advanced { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.advanced summary { color: #4338bd; font-weight: 650; cursor: pointer; margin-bottom: 12px; }
.model-quota-editor { min-width: 0; margin-top: 3px; }
.model-quota-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(115px, .8fr) minmax(85px, .65fr); gap: 8px; align-items: center; padding: 10px 0; }
.model-quota-row + .model-quota-row { border-top: 1px solid var(--line); }
.model-quota-row strong, .model-quota-row small { display: block; overflow-wrap: anywhere; }
.model-quota-row small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.media-input { display: grid; grid-template-columns: minmax(98px, .65fr) minmax(120px, 2fr) minmax(110px, .8fr) auto; gap: 6px; }
.hint { border: 1px solid #e7e3fa; border-radius: 9px; padding: 10px 12px; color: #524582; background: #f7f5ff; line-height: 1.6; font-size: 12px; }
.request-warning { background: #fff7e7; border-color: #f1dfb6; color: #76511a; }

.asset-grid, .model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.asset-card, .model-card { overflow: hidden; }
.asset-body, .model-card { padding: 13px; }
.asset-body h3, .model-card h3 { font-size: 15px; margin-bottom: 7px; overflow-wrap: anywhere; }
.asset-body p, .model-card p { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; line-height: 1.5; }
.asset-body .row-actions, .model-card .row-actions { margin-top: 9px; }
.asset-body .btn, .model-card .btn { padding-inline: 9px; min-height: 32px; font-size: 12px; }
.model-top { display: flex; justify-content: space-between; gap: 7px; align-items: start; }
.model-card details { margin-top: 11px; color: var(--muted); }
.model-card summary { cursor: pointer; font-size: 12px; color: var(--blue-dark); }
.model-card ul { padding: 0 0 0 16px; font-size: 12px; }
.model-card li { margin: 5px 0; overflow-wrap: anywhere; }
.quota-meter { display: inline-block; vertical-align: middle; width: 73px; height: 5px; background: #e8e9f5; border-radius: 8px; margin-left: 8px; }
.quota-meter i { height: 100%; display: block; border-radius: inherit; background: #695af3; }

.dialog { width: min(100% - 28px, 640px); max-height: min(88dvh, 760px); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff; box-shadow: 0 16px 50px #17163e2b; }
.dialog::backdrop { background: #141b35a6; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 13px 17px; }
.dialog-head h2 { font-size: 18px; overflow-wrap: anywhere; }
.dialog-body { padding: 17px; }
.dialog-body .hint { margin-bottom: 12px; }
.dialog-body .details { display: grid; gap: 10px; }
.dialog-body .details p { color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.dialog-body video, .dialog-body .detail-image { width: 100%; max-height: 350px; border-radius: 10px; object-fit: contain; background: #141b35; }
.payload { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f6fb; padding: 9px; border-radius: 7px; color: #33415e; font: 12px/1.5 Consolas, monospace; }
.notice { position: fixed; bottom: 18px; right: 18px; z-index: 5; max-width: min(400px, calc(100vw - 36px)); background: #1c2850; color: #fff; box-shadow: 0 8px 28px #1b26463d; border-radius: 9px; padding: 11px 14px; line-height: 1.5; }
.startup { padding: 30px; color: var(--muted); grid-column: 1 / -1; }

@media (max-width: 1030px) {
  .shell { grid-template-columns: 187px minmax(0, 1fr); }
  .content, .topbar { padding-inline: 22px; }
  .stat { gap: 8px; padding-inline: 12px; }
  .stat-icon { width: 34px; height: 34px; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; width: min(242px, 85vw); left: 0; top: 0; transform: translateX(-105%); transition: transform 160ms ease-out; }
  .sidebar.open { transform: translateX(0); box-shadow: 7px 0 40px #17214655; }
  .sidebar:not(.open) { visibility: hidden; }
  .topbar .mobile-nav { display: inline-flex; }
  .topbar { min-height: 58px; }
  .content { padding-top: 23px; }
}
@media (max-width: 580px) {
  .content, .topbar { padding-inline: 14px; }
  .top-actions { gap: 7px; }
  .top-actions .doc-link span, .breadcrumb > span, .breadcrumb > svg { display: none; }
  .top-actions .profile-button > svg { display: none; }
  .page-heading { align-items: start; gap: 8px; margin-bottom: 17px; }
  .page-heading h1 { font-size: 27px; }
  .page-heading p { font-size: 12px; }
  .page-heading .btn { min-height: 36px; padding-inline: 8px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-height: 75px; padding: 11px; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stat-value { font-size: 22px; }
  .section { margin-top: 20px; }
  .video-grid { grid-template-columns: 1fr; gap: 10px; }
  .media-cover { aspect-ratio: 2.45; }
  .asset-grid, .model-grid { grid-template-columns: 1fr; }
  .creator { grid-template-columns: 1fr; }
  .model-quota-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .model-quota-row > div { grid-column: 1 / -1; }
  .toolbar .push { margin-left: 0; }
  .media-input { grid-template-columns: minmax(0, 1fr) auto; }
  .media-input input { grid-column: 1 / -1; grid-row: 2; }
  .media-input .role { grid-column: 1; grid-row: 3; }
  .media-input button { grid-column: 2; grid-row: 1; }
  .tabs { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
