:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #fff8f2;
  --text: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --accent-soft: #ffedd5;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(17, 24, 39, .08);
  --radius: 14px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #141b2d;
  --surface-soft: #201d29;
  --text: #f3f4f6;
  --muted: #a7b0c0;
  --line: #283248;
  --accent: #ff8a3d;
  --accent-strong: #ff9d5d;
  --accent-soft: #422818;
  --shadow: 0 18px 45px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); padding: 22px 16px; display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(249,115,22,.25); font-size: 19px; }
.brand strong { display: block; font-size: 15px; letter-spacing: .03em; }
.brand small { color: var(--muted); font-size: 11px; }
.nav { display: grid; gap: 7px; }
.nav button { border: 0; background: transparent; color: var(--muted); text-align: left; padding: 11px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; transition: .18s ease; }
.nav button:hover, .nav button.active { color: var(--text); background: var(--accent-soft); }
.nav button.active { font-weight: 700; }
.sidebar-footer { margin-top: auto; color: var(--muted); font-size: 12px; padding: 10px 8px; }
.main { min-width: 0; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 34px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 4; }
.crumb { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .avatar { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: grid; place-items: center; }
.avatar { border: 0; background: var(--accent); color: #fff; font-weight: 700; }
.content { padding: 38px 34px 52px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { margin: 0 0 7px; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.03em; }
.page-head p { margin: 0; color: var(--muted); }
.btn { border: 1px solid transparent; border-radius: 10px; padding: 11px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 24px rgba(249,115,22,.18); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); padding-inline: 10px; }
.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat { padding: 20px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; width: 100px; height: 100px; right: -34px; top: -34px; border-radius: 50%; background: var(--accent-soft); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 9px; font-size: 27px; font-weight: 800; letter-spacing: -.03em; }
.stat-note { color: var(--muted); font-size: 12px; margin-top: 5px; }
.dashboard-grid { margin-top: 18px; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); align-items: stretch; }
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head a { color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 20px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.task-row:first-of-type { border-top: 0; }
.task-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 5px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.status-running { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.status-failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.status-queued { color: #2563eb; background: color-mix(in srgb, #2563eb 12%, transparent); }
.quick-card { padding: 24px; background: linear-gradient(145deg, var(--surface-soft), var(--surface)); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.quick-icon { font-size: 30px; margin-bottom: 15px; }
.quick-card h2 { margin: 0 0 7px; font-size: 20px; }
.quick-card p { color: var(--muted); margin: 0 0 21px; }
.tip-list { display: grid; gap: 13px; margin-top: 6px; }
.tip { display: flex; gap: 11px; align-items: flex-start; color: var(--muted); font-size: 13px; }
.tip b { color: var(--accent-strong); }

.form-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(310px, .7fr); gap: 18px; align-items: start; }
.form-card { padding: 25px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: 13px; }
.field label span { color: var(--danger); }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); padding: 11px 12px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
textarea { min-height: 145px; resize: vertical; }
.helper { color: var(--muted); font-size: 12px; }
.upload { border: 1px dashed color-mix(in srgb, var(--accent) 58%, var(--line)); border-radius: 12px; padding: 19px; background: var(--surface-soft); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.upload strong { display: block; margin-bottom: 3px; }
.upload span { color: var(--muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.estimate { padding: 22px; position: sticky; top: 95px; }
.estimate h2 { margin: 0 0 18px; font-size: 17px; }
.estimate-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 20px; border-bottom: 1px solid var(--line); }
.estimate-total span { color: var(--muted); }
.estimate-total strong { font-size: 28px; }
.estimate-list { display: grid; gap: 13px; padding: 19px 0; }
.estimate-item { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.estimate-item b { color: var(--text); font-weight: 600; }
.notice { background: var(--accent-soft); color: var(--accent-strong); border-radius: 10px; padding: 11px 12px; font-size: 12px; }
.fire-stage { text-align: center; padding: 26px 15px 20px; }
.fire { font-size: 58px; filter: drop-shadow(0 10px 16px rgba(249,115,22,.22)); animation: fire-breathe 1.8s ease-in-out infinite; }
@keyframes fire-breathe { 50% { transform: scale(1.08) rotate(-2deg); } }
.progress { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.progress > i { display: block; height: 100%; width: 1%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.filters select, .filters input { width: auto; min-width: 150px; }
.history-table { overflow: hidden; }
.history-head, .history-item { display: grid; grid-template-columns: minmax(200px, 1.3fr) .8fr .8fr .7fr auto; gap: 16px; align-items: center; padding: 15px 20px; }
.history-head { background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 700; }
.history-item { border-top: 1px solid var(--line); }
.history-item:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.history-page-head { align-items: center; }
.history-head-actions { display: flex; align-items: center; gap: 10px; }
.history-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.history-summary-card { position: relative; min-height: 132px; padding: 19px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.history-summary-card::after { content: ""; position: absolute; width: 88px; height: 88px; right: -30px; top: -30px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.history-summary-card span, .history-summary-card small { display: block; color: var(--muted); }
.history-summary-card strong { display: block; margin: 11px 0 5px; color: var(--text); font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.history-summary-card small { font-size: 12px; }
.history-summary-card.is-running strong { color: #2563eb; }.history-summary-card.is-success strong { color: var(--success); }.history-summary-card.is-failed strong { color: var(--danger); }.history-summary-card.is-cost strong { color: var(--accent-strong); }
.history-summary-card > i, .history-status-line > i { display: block; height: 5px; margin-top: 13px; overflow: hidden; border-radius: 99px; background: var(--line); }
.history-summary-card > i b, .history-status-line > i b { display: block; height: 100%; border-radius: inherit; background: var(--success); }.history-summary-card.is-failed > i b { background: var(--danger); }
.history-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.history-insight { padding: 20px; }.history-insight-title { margin-bottom: 18px; color: var(--muted); font-size: 13px; font-weight: 700; }
.history-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }.history-metrics div { display: grid; gap: 7px; }.history-metrics span, .history-status-line span { color: var(--muted); font-size: 12px; }.history-metrics strong { font-size: 20px; }
.history-status-line { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; align-items: center; margin-top: 12px; }.history-status-line:first-of-type { margin-top: 0; }.history-status-line > i { grid-column: 1 / -1; margin-top: 0; }.history-status-line > i b { background: var(--accent); }.history-status-line > i b.is-muted { background: #8ba0b8; }
.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }.history-tabs { display: flex; align-items: center; gap: 4px; }.history-tab { border: 1px solid transparent; border-radius: 9px; padding: 9px 13px; background: transparent; color: var(--muted); cursor: pointer; }.history-tab:hover { color: var(--text); background: var(--surface); }.history-tab.active { border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.history-filters { display: flex; gap: 8px; }.history-filters input { width: 250px; }.history-filters select { width: 108px; }
.eyebrow { margin-bottom: 9px; color: #0f766e; font-size: 11px; letter-spacing: .22em; font-weight: 700; }
.model-config-head { align-items: center; }.model-config-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }.provider-panel { min-height: 700px; padding: 24px 16px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 82%, var(--bg)); }.provider-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 18px; }.provider-panel-head h2 { margin: 0; font-size: 17px; }.provider-search { margin: 0 8px 20px; width: calc(100% - 16px); background: var(--surface); }.provider-label { margin: 18px 8px 9px; color: var(--muted); font-size: 12px; }.provider-empty { padding: 0 8px 15px; color: var(--muted); font-size: 13px; }.provider-list { display: grid; gap: 7px; }.provider-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }.provider-item:hover { background: var(--surface); }.provider-item.active { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); background: color-mix(in srgb, var(--success) 13%, var(--surface)); color: #0f766e; }.provider-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #263238; color: #fff; font-size: 13px; }.model-config-main { padding: 30px 34px; }.model-config-main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }.model-config-main-head h2 { margin: 0 0 5px; font-size: 27px; }.model-config-main-head p { margin: 0; color: var(--muted); }.model-config-note { margin: 28px 0 34px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--success) 25%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--success) 8%, var(--surface)); color: #176b61; line-height: 1.7; }.connection-section, .configured-models { border-top: 1px solid var(--line); padding-top: 25px; }.connection-section h3, .configured-models h3 { margin: 0 0 17px; font-size: 18px; }.connection-grid { display: grid; gap: 13px; }.connection-grid > div { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 18px; }.connection-grid span { color: var(--muted); }.connection-grid strong { padding: 12px 15px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--surface-soft) 45%, var(--surface)); font-weight: 500; }.configured-models { margin-top: 34px; }.configured-models-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }.configured-models-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }.configured-model { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }.configured-model + .configured-model { margin-top: 12px; }.configured-model-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }.configured-model-main > div:last-child { display: grid; gap: 3px; min-width: 0; }.configured-model-main strong { font-size: 16px; }.configured-model-main code { color: var(--muted); font-size: 12px; }.configured-model-main span, .configured-model-main small { color: var(--muted); font-size: 12px; }.model-mark { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; background: #263238; color: #fff; font-weight: 700; }.configured-model-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }.model-editor { margin-top: 22px; padding: 20px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 14px; background: var(--surface-soft); }.model-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }.model-editor-head div { display: grid; gap: 4px; }.model-editor-head span { color: var(--muted); font-size: 12px; }.model-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }.model-editor-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }.model-editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-card { padding: 22px; }
.admin-card h2 { margin: 0 0 16px; font-size: 17px; }
.model-row, .member-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); padding: 13px 0; }
.model-row:first-of-type, .member-row:first-of-type { border-top: 0; }
.model-name strong, .member-name strong { display: block; }
.model-name span, .member-name span { color: var(--muted); font-size: 12px; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 20% 10%, rgba(249,115,22,.12), transparent 38%), var(--bg); }
.login-card { width: min(100%, 430px); padding: 35px; }
.login-card .brand { padding: 0; margin-bottom: 36px; }
.login-card h1 { margin: 0 0 8px; font-size: 28px; }
.login-card p { color: var(--muted); margin: 0 0 26px; }
.login-form { display: grid; gap: 16px; }
.login-form .btn { width: 100%; margin-top: 4px; }
.login-foot { color: var(--muted); text-align: center; font-size: 12px; margin-top: 22px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .52); backdrop-filter: blur(5px); }
.modal { width: min(100%, 560px); padding: 26px; position: relative; }
.modal-close { position: absolute; right: 18px; top: 18px; }
.modal-kicker { color: var(--accent-strong); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.modal h2 { margin: 8px 38px 4px 0; font-size: 22px; }
.modal-status { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.video-preview { height: 220px; margin: 22px 0; border-radius: 12px; display: grid; place-items: center; gap: 9px; align-content: center; color: var(--muted); background: radial-gradient(circle at 50% 35%, rgba(249,115,22,.45), transparent 30%), #151a28; }
.preview-glow { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.15); color: #fff; font-size: 17px; }
.modal > .btn { width: 100%; }
.task-detail-panel { display: grid; gap: 14px; margin-top: 20px; max-height: 330px; overflow-y: auto; }
.task-detail-block { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface-soft) 42%, var(--surface)); }
.task-detail-block h3 { margin: 0 0 9px; font-size: 13px; }
.task-prompt, .task-materials { margin: 0; color: var(--muted); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.task-parameter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.task-parameter-grid div { display: grid; gap: 3px; min-width: 0; }.task-parameter-grid span { color: var(--muted); font-size: 11px; }.task-parameter-grid strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; background: var(--text); color: var(--surface); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); animation: toast-in .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.empty { padding: 42px 15px; text-align: center; color: var(--muted); }
.video-only-page { min-height: 100vh; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
.video-layout { min-height: 100vh; display: grid; grid-template-columns: 350px minmax(0, 1fr); }
.video-sidebar { border-right: 1px solid var(--line); background: var(--surface); padding: 26px 18px; }
.sidebar-brand { display: flex; align-items: baseline; gap: 8px; padding: 2px 14px 34px; font-size: 16px; }
.sidebar-brand small { color: var(--muted); font-size: 10px; letter-spacing: .2em; }
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px 14px 14px; }
.recent-title { color: var(--muted); font-size: 15px; }
.recent-new { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--surface); color: var(--accent-strong); font-size: 12px; }
.recent-new:hover { border-color: var(--accent); background: var(--accent-soft); }
.recent-list { display: grid; gap: 8px; }
.recent-item { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; border: 1px solid transparent; border-radius: 12px; padding: 11px 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.recent-item:hover, .recent-item.active { background: color-mix(in srgb, var(--line) 65%, var(--surface)); }
.recent-item.active { border-color: color-mix(in srgb, #a7bfd8 45%, transparent); }
.recent-play { width: 28px; height: 28px; border: 1px solid #a7bfd8; border-radius: 8px; display: grid; place-items: center; color: #188b9f; }
.recent-name { font-size: 15px; }
.recent-action { border: 0; border-radius: 6px; padding: 4px 5px; background: transparent; color: #a8b4c2; font-size: 14px; line-height: 1; }
.recent-action:hover { background: var(--surface); color: var(--text); }
.recent-delete:hover { color: #dc2626; }
.recent-rename-input { min-width: 0; width: 100%; border: 1px solid var(--accent); border-radius: 6px; padding: 5px 7px; background: var(--surface); color: var(--text); outline: 0; }
.video-main { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.video-only-top { height: 64px; padding: 0 26px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.video-brand { display: flex; align-items: baseline; gap: 9px; font-weight: 800; letter-spacing: .08em; }
.video-brand small { color: var(--muted); font-size: 10px; letter-spacing: .22em; }
.video-only-actions { display: flex; align-items: center; gap: 10px; }
.video-exit { border: 0; background: transparent; color: var(--muted); padding: 8px 10px; }
.video-stage { flex: 1; min-height: 440px; display: grid; place-items: center; align-content: center; text-align: center; padding: 20px; }
.stage-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 50%; color: var(--accent); opacity: .8; }
.video-stage h1 { margin: 16px 0 7px; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.05em; font-weight: 500; }
.video-stage p { margin: 0; color: var(--muted); }
.video-composer { width: min(100% - 48px, 1240px); margin: 0 auto 22px; padding: 14px 22px 12px; border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line)); border-radius: 20px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 20px 55px rgba(17, 24, 39, .11); }
.composer-mode { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.composer-mode label { padding: 8px 12px; color: var(--muted); border-right: 1px solid var(--line); }
.composer-mode select { width: auto; border: 0; border-radius: 0; padding: 8px 34px 8px 12px; background: transparent; }
.composer-quota { margin: 8px 0 10px; color: var(--muted); font-size: 12px; }
.material-row { display: flex; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.material-slot { position: relative; min-width: 146px; height: auto; min-height: 100px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; display: flex; flex-direction: column; align-items: stretch; gap: 5px; transition: .18s ease; }
.material-slot:hover { border-color: var(--accent); transform: translateY(-2px); }
.material-empty { min-height: 78px; display: grid; place-items: center; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.material-slot-head { display: flex; justify-content: space-between; align-items: center; }
.material-slot-head span { font-weight: 700; }
.material-slot i { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; }
.material-add, .material-library { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.material-add { flex: 1; text-align: center; font-weight: 500; }
.material-add:hover, .material-library:hover { color: var(--accent-strong); }
.material-library { font-size: 11px; text-align: right; }
.avatar-modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .38); }
.avatar-modal { width: min(640px, 100%); padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 80px rgba(15, 23, 42, .24); }
.avatar-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.avatar-modal-head div { display: grid; gap: 4px; }
.avatar-modal-head span, .avatar-info span { color: var(--muted); font-size: 12px; }
.avatar-modal-close { border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.avatar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.avatar-card { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; }
.avatar-photo { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; color: rgba(17, 24, 39, .48); font-size: 42px; font-weight: 800; }
.avatar-info { display: grid; gap: 2px; }
.avatar-use { border: 0; border-radius: 8px; padding: 8px; background: var(--accent-soft); color: var(--accent-strong); cursor: pointer; }
.avatar-use:hover { background: var(--accent); color: white; }
.video-prompt-wrap { position: relative; padding-top: 9px; }
.video-prompt-wrap textarea { border: 0; background: transparent; padding: 10px 0 34px; min-height: 180px; max-height: 55vh; resize: vertical; font-size: 16px; line-height: 1.7; }
.prompt-hint { position: absolute; left: 0; bottom: 8px; color: var(--muted); font-size: 11px; }
.composer-controls { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.composer-controls select { width: auto; min-width: 92px; padding: 9px 28px 9px 10px; background: var(--surface); }
.balance { margin-left: auto; color: var(--muted); font-size: 12px; }
.draft-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.balance:first-letter { color: var(--success); }
.send-button { width: 46px; height: 46px; border: 0; border-radius: 14px; background: var(--accent-soft); color: var(--accent-strong); font-size: 25px; font-weight: 800; }
.send-button:hover { background: var(--accent); color: white; transform: translateY(-2px); }
.composer-notice { margin-top: 8px; padding: 7px 10px; border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line)); border-radius: 8px; color: var(--danger); font-size: 12px; background: color-mix(in srgb, var(--danger) 6%, transparent); }

@media (max-width: 1020px) {
  .shell { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child, .nav button span, .sidebar-footer { display: none; }
  .nav button { justify-content: center; font-size: 19px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .form-layout { grid-template-columns: 1fr; }
  .estimate { position: static; }
}
@media (max-width: 680px) {
  .shell { display: block; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; height: 66px; padding: 6px 10px; border-right: 0; border-top: 1px solid var(--line); flex-direction: row; justify-content: center; }
  .brand, .sidebar-footer { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav button { display: grid; justify-items: center; gap: 0; padding: 8px 14px; font-size: 18px; }
  .nav button span { display: block; font-size: 10px; }
  .topbar { padding: 0 16px; }
  .content { padding: 27px 16px 92px; }
  .page-head { display: block; }
  .page-head .btn { margin-top: 16px; width: 100%; }
  .stats { gap: 10px; }
  .stat { padding: 15px; }
  .stat-value { font-size: 21px; }
  .task-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .task-row > :last-child { grid-column: 2; grid-row: 1 / span 2; }
  .field-grid, .admin-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .form-card, .estimate, .panel, .admin-card { padding: 18px; }
  .history-table { overflow-x: auto; }
  .history-head, .history-item { min-width: 720px; }
  .login-card { padding: 25px 20px; }
  .video-only-top { padding-inline: 16px; }
  .video-layout { grid-template-columns: 1fr; }
  .video-sidebar { display: none; }
  .video-stage { min-height: 300px; }
  .video-composer { width: calc(100% - 20px); margin-bottom: 10px; padding: 12px; border-radius: 16px; }
  .material-row { overflow-x: auto; }
  .material-slot { min-width: 132px; }
  .composer-controls { flex-wrap: wrap; }
  .composer-controls select { flex: 1 1 28%; min-width: 0; }
  .balance { order: 5; margin-left: 0; flex: 1 1 60%; }
  .send-button { order: 6; }
}
@media (max-width: 1020px) {
  .history-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-summary-card.is-cost { grid-column: span 2; }
  .history-toolbar { align-items: stretch; flex-direction: column; }
  .history-filters { justify-content: space-between; }
  .model-config-layout { grid-template-columns: 1fr; }
  .provider-panel { min-height: 0; }
  .provider-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .provider-item { justify-content: center; }
  .provider-item span:last-child { display: none; }
}
@media (max-width: 680px) {
  .history-page-head { display: block; }
  .history-head-actions { margin-top: 16px; }
  .history-head-actions .btn { flex: 1; }
  .history-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-summary-card.is-cost { grid-column: auto; }
  .history-insights { grid-template-columns: 1fr; }
  .history-filters { width: 100%; }
  .history-filters input { flex: 1; min-width: 0; width: auto; }
  .history-tabs { overflow-x: auto; width: 100%; }
  .history-tab { flex: 0 0 auto; }
  .model-config-head { display: block; }
  .model-config-head > .btn { width: auto; margin-top: 14px; }
  .model-config-main { padding: 20px 16px; }
  .model-config-main-head, .configured-models-head { display: block; }
  .model-config-main-head > .btn, .configured-models-head > .btn { margin-top: 14px; }
  .connection-grid > div { grid-template-columns: 1fr; gap: 5px; }
  .configured-model { display: block; }
  .configured-model-actions { margin-top: 15px; flex-wrap: wrap; }
  .model-editor-grid { grid-template-columns: 1fr; }
  .provider-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.connection-editor { padding: 20px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 14px; background: var(--surface-soft); }
.connection-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.connection-editor-head div { display: grid; gap: 4px; }
.connection-editor-head span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.connection-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.connection-editor-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.connection-editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.model-editor-section-title { margin: 20px 0 12px; color: var(--text); font-size: 13px; font-weight: 700; }
.model-editor-section-title:first-of-type { margin-top: 0; }
.pricing-editor-grid input { font-variant-numeric: tabular-nums; }
.model-editor-hint { margin-top: 13px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.model-price-summary { color: var(--accent-strong) !important; font-variant-numeric: tabular-nums; }
@media (max-width: 680px) {
  .connection-editor-grid { grid-template-columns: 1fr; }
}
