@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f6f8fc;
  --bg-soft: #fbfcff;
  --panel: rgba(255, 255, 255, 0.82);
  --card: rgba(255, 255, 255, 0.94);
  --card-strong: #ffffff;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #0f172a;
  --muted: #66758a;
  --muted-2: #94a3b8;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.1);
  --ok: #16a34a;
  --ok-strong: #15803d;
  --ok-soft: rgba(22, 163, 74, 0.11);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.11);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.11);
  --used-bg: #dff5e8;
  --used-bg-strong: #cfeeda;
  --shadow-panel: 0 14px 36px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 6px 18px rgba(15, 23, 42, 0.04);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', 'Microsoft YaHei UI', sans-serif;
  background:
    radial-gradient(920px 420px at 0% 0%, rgba(59, 130, 246, 0.08), transparent 60%),
    radial-gradient(760px 360px at 100% 0%, rgba(16, 185, 129, 0.06), transparent 60%),
    linear-gradient(180deg, #fafdff 0%, var(--bg) 100%);
}

.app-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image: radial-gradient(rgba(148, 163, 184, 0.08) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
}

button, input, select, textarea { font: inherit; }
button { outline: none; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-columns: 342px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  font-size: 13px;
}

.sidebar,
.main {
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-panel);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 4px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: 0.06em;
  color: var(--primary-strong);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 55%, #ecfeff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 10px 20px rgba(37, 99, 235, 0.11);
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.card {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 12px;
}

.form-card { flex: 0 0 auto; }

.list-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-head,
.title-row,
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.94);
  color: var(--text);
  font-size: 0.78rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 102px;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder { color: var(--muted-2); }

input:hover,
select:hover,
textarea:hover { border-color: rgba(96, 165, 250, 0.34); }

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.42);
  background: #fff;
}

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

.model-row select {
  margin-bottom: 0;
  font-size: 0.79rem;
  padding-right: 28px;
}

.form-actions {
  margin-top: 14px;
}

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

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.075);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.btn.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
}

.btn.ghost { background: rgba(248, 250, 252, 0.9); }

.btn.success {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.18);
}

.btn.sm {
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 12px;
  font-size: 0.7rem;
}

.hint {
  color: var(--muted);
  font-size: 0.71rem;
  line-height: 1.5;
}

.list-header {
  align-items: flex-start;
  margin-bottom: 8px;
}

.list-tools {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
}

.list-tools input,
.list-tools select {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.78rem;
}

.session-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.session-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.session-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.session-item.active {
  position: relative;
  border-color: rgba(37, 99, 235, 0.34);
  background: linear-gradient(180deg, rgba(231, 241, 255, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

.session-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #60a5fa);
}

.session-item.used {
  border-color: rgba(22, 163, 74, 0.24);
  background: linear-gradient(180deg, rgba(212, 245, 224, 0.98), rgba(193, 231, 207, 0.98));
}

.session-item img {
  width: 52px;
  aspect-ratio: 9 / 16;
  height: auto;
  min-height: 92px;
  border-radius: 14px;
  object-fit: cover;
  background: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.session-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: flex-start;
}

.session-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.session-title {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.session-summary {
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.analysis-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: rgba(241, 245, 249, 0.95);
  color: var(--muted);
}

.analysis-badge.running {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: rgba(37, 99, 235, 0.18);
}

.analysis-badge.done {
  background: var(--ok-soft);
  color: var(--ok-strong);
  border-color: rgba(22, 163, 74, 0.18);
}

.session-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.session-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.67rem;
  font-weight: 700;
  line-height: 1.2;
}

.session-status-pill.status-idle,
.session-status-pill.status-unknown {
  color: var(--muted);
  background: rgba(241, 245, 249, 0.95);
}

.session-status-pill.status-running-generate,
.session-status-pill.status-running-upscale,
.session-status-pill.status-running-interpolate,
.session-status-pill.status-downloading {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: rgba(37, 99, 235, 0.18);
}

.session-status-pill.status-done-generate,
.session-status-pill.status-done-upscale,
.session-status-pill.status-done-interpolate {
  color: var(--ok-strong);
  background: var(--ok-soft);
  border-color: rgba(22, 163, 74, 0.18);
}

.session-status-pill.status-used {
  color: var(--ok-strong);
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.22);
}

.session-status-pill.status-failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.18);
}

.list-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.detail-header {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.96));
}

.thumb {
  width: 52px;
  aspect-ratio: 9 / 16;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  background: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.meta-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 0;
  justify-content: center;
}

.title-row {
  align-items: flex-start;
  min-height: 0;
}

.title {
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.detail-meta-row,
.detail-status-row,
#jimengStatus {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
  white-space: normal;
}

.detail-meta-row {
  padding-top: 1px;
}

.detail-status-row {
  padding-top: 1px;
}

.detail-link-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
}

.detail-link-btn {
  width: auto;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: linear-gradient(180deg, rgba(239,246,255,0.88), rgba(248,250,252,0.96));
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.detail-link-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.09);
}

.detail-link-label {
  flex: 0 0 auto;
  color: var(--primary-strong);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.detail-link-text {
  min-width: 0;
  color: #1e293b;
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-chip {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.96);
  line-height: 1.2;
}

.meta-chip-label {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 700;
  white-space: nowrap;
}

.meta-chip-value {
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  font-size: 0.66rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-chip.ok {
  background: var(--ok-soft);
  border-color: rgba(22, 163, 74, 0.18);
}

.meta-chip.info {
  background: var(--primary-soft);
  border-color: rgba(37, 99, 235, 0.18);
}

.meta-chip.danger {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.18);
}

.meta-chip.link {
  max-width: min(100%, 520px);
}

#detailMeta .meta-chip.link,
#jimengStatus .meta-chip.link {
  flex: 1 1 280px;
}

.content-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 324px;
  gap: 12px;
}

.left-stack,
.right-preview {
  min-height: 0;
  display: grid;
  gap: 12px;
}

.left-stack {
  grid-template-rows: minmax(0, 1fr) 232px;
}

.right-preview {
  grid-template-rows: minmax(0, 1fr) 278px;
}

.result-card,
.cost-card,
.preview-card,
.timeline-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.result-box,
.raw-box {
  margin: 8px 0 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.65;
}

.result-editor { width: 100%; resize: none; }

.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
}

th, td {
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  padding: 8px 8px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child { text-align: left; }

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.97);
  color: var(--muted);
  font-weight: 800;
}

.total-cost {
  margin-top: 8px;
  text-align: right;
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.preview-actions {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.preview-head {
  justify-content: stretch;
  margin-bottom: 8px;
}

.preview-actions-top {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.preview-actions-top .btn,
.preview-actions .btn.success {
  width: 100%;
}

.preview-actions-top .btn {
  min-height: 34px;
  border: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.preview-actions-top .btn:last-child {
  border-right: 0;
}

.preview-actions-top .btn:hover:not(:disabled) {
  transform: none;
  background: rgba(255,255,255,0.72);
  box-shadow: none;
}

.video-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  padding: 10px;
  overflow: hidden;
}

.preview-done-btn {
  margin-top: 8px;
  min-height: 34px;
  border-radius: 14px;
}

.video-shell video {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: 16px;
  background: #dbeafe;
}

.timeline-list {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
}

.timeline-item {
  position: relative;
  min-height: 0;
  padding: 9px 11px 9px 15px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.94), rgba(255, 255, 255, 0.98));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 3px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.34);
}

.timeline-item .line1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-left: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.3;
  align-items: center;
}

.timeline-item .line1 span:last-child {
  white-space: nowrap;
}

.timeline-meta-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 6px;
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.24;
  min-width: 0;
}

.timeline-meta-label {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.timeline-meta-value {
  min-width: 0;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-error {
  padding-left: 10px;
  color: var(--danger);
  font-size: 0.63rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-item.running {
  border-color: rgba(37, 99, 235, 0.2);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.timeline-item.running::before { background: var(--primary); }
.timeline-item.running .line1 { color: var(--primary-strong); }

.timeline-item.done {
  border-color: rgba(22, 163, 74, 0.22);
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.96), rgba(255, 255, 255, 0.98));
}

.timeline-item.done::before { background: var(--ok); }
.timeline-item.done .line1 { color: var(--ok-strong); }

.timeline-item.failed {
  border-color: rgba(220, 38, 38, 0.22);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.96), rgba(255, 255, 255, 0.98));
}

.timeline-item.failed::before { background: var(--danger); }
.timeline-item.failed .line1 { color: var(--danger); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal.hidden { display: none; }

.modal-card {
  width: min(660px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

.dialog-card { width: min(410px, 92vw); }

.video-preview-card {
  width: min(420px, 92vw);
  padding: 14px;
  overflow: hidden;
}

.video-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.video-preview-shell {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #dbeafe;
}

.video-preview-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.dialog-title {
  font-size: 0.98rem;
  font-weight: 800;
}

.dialog-message {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.check input {
  width: auto;
  margin: 0;
}

.toast-viewport {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
  pointer-events: auto;
}

.toast-title {
  font-size: 0.84rem;
  font-weight: 800;
}

.toast-message {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
  word-break: break-word;
}

.toast.success { border-color: rgba(22, 163, 74, 0.18); }
.toast.success .toast-title { color: var(--ok); }
.toast.error { border-color: rgba(220, 38, 38, 0.18); }
.toast.error .toast-title { color: var(--danger); }
.toast.info { border-color: rgba(37, 99, 235, 0.18); }
.toast.info .toast-title { color: var(--primary-strong); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.28); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1500px) {
  .content-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .right-preview { grid-template-rows: minmax(0, 1fr) 260px; }
  .preview-actions-top { grid-template-columns: 1fr; }
}

@media (max-width: 1280px) {
  .app {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .content-grid { grid-template-columns: minmax(0, 1fr) 286px; }
  .left-stack { grid-template-rows: minmax(0, 1fr) 216px; }
  .right-preview { grid-template-rows: minmax(0, 1fr) 246px; }
}

@media (max-width: 1120px) {
  body { overflow: auto; }
  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    overflow: visible;
  }
  .sidebar,
  .main { overflow: visible; }
  .content-grid { grid-template-columns: 1fr; }
  .right-preview,
  .left-stack { grid-template-rows: auto; }
  .video-shell { min-height: 320px; }
  .timeline-list { grid-template-rows: repeat(3, minmax(92px, auto)); }
}

@media (max-width: 720px) {
  .app { padding: 10px; gap: 10px; }
  .sidebar, .main { padding: 12px; border-radius: 20px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 14px; }
  .brand-title { font-size: 0.94rem; }
  .detail-header { grid-template-columns: 56px minmax(0, 1fr); }
  .thumb { width: 56px; border-radius: 12px; }
  .list-header,
  .card-head,
  .title-row { align-items: flex-start; }
  .list-tools,
  .grid2,
  .row,
  .model-row,
  .preview-actions-top {
    grid-template-columns: 1fr;
  }
  .modal { padding: 12px; }
  .toast-viewport { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
