:root {
  color-scheme: light;
  --ink: #181816;
  --muted: #78766f;
  --line: #dcdad3;
  --paper: #fbfaf7;
  --workspace: #f0f0ec;
  --sidebar: #121210;
  --sidebar-line: #2b2a27;
  --coral: #f45a43;
  --coral-dark: #d94331;
  --green: #1d8a62;
  --blue: #3f6e9f;
  --warning: #ad6f14;
  --shadow: 0 12px 30px rgba(28, 28, 22, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--workspace);
  color: var(--ink);
}

button,
input,
select,
textarea { font: inherit; letter-spacing: 0; }

button,
select,
input[type="range"] { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(244, 90, 67, 0.24);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 288px minmax(560px, 1fr) 320px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 22px;
  overflow-y: auto;
  color: #f8f7f3;
  background: var(--sidebar);
  border-right: 1px solid #24231f;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #35332e;
  border-radius: 8px;
  background: #1b1a18;
}

.brand-mark img { width: 25px; height: 25px; }
.brand-copy { display: flex; flex-direction: column; }
.brand-copy small { color: #aaa79e; font-size: 10px; font-weight: 800; }
.brand-copy strong { font-size: 22px; line-height: 1.15; }

.access-panel { padding-top: 26px; }

.access-panel h2,
.settings-section h2,
.history-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  font-size: 15px;
}

.access-panel h2 img { width: 20px; filter: invert(1); }
.access-panel label { display: block; margin: 0 0 8px; color: #aaa79e; font-size: 12px; }
.model-label-row { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.model-label-row label { margin: 0; }
.model-info-trigger {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  color: #f4f2eb;
  border: 1px solid #45433e;
  border-radius: 8px;
  background: #1c1b18;
}
.model-info-trigger svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.model-info-trigger:hover { color: #fff; border-color: #77736a; background: #292824; }
.access-panel select { margin-bottom: 14px; }
#model,
#modelEdition { font-size: 12px; }

.model-notice {
  margin: -5px 0 14px;
  padding: 8px 9px;
  color: #f3c47c;
  border: 1px solid #5a4527;
  border-radius: 6px;
  background: #2b2318;
  font-size: 10px;
  line-height: 1.5;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

input,
select { height: 44px; padding: 0 12px; }
textarea { resize: vertical; }

.sidebar input,
.sidebar select {
  color: #f5f4ef;
  border-color: #373631;
  background: #1e1d1a;
}

.password-field { position: relative; margin-bottom: 14px; }
.password-field input { padding-right: 46px; }
.password-field .icon-button { position: absolute; right: 4px; top: 4px; color: #aaa79e; }

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: inherit;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.icon-button:hover { background: rgba(128, 128, 128, 0.12); }
.icon-button.bordered { border: 1px solid var(--line); background: #fff; }

.button-row { display: flex; gap: 8px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
}

.button:hover { border-color: #b9b6ad; }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button img { width: 17px; height: 17px; }
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button.light { flex: 1; }
.button.dark-outline { color: #eee; border-color: #3b3934; background: transparent; }
.button.dark-outline img { filter: invert(1); }
.button.primary { color: #fff; border-color: var(--coral); background: var(--coral); }
.button.primary:hover { background: var(--coral-dark); }
.button.compact { min-height: 34px; padding: 0 11px; font-size: 12px; }
.button.coral-outline { color: var(--coral-dark); border-color: #f2b5aa; background: #fff7f4; }

.key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 17px 0 0;
  color: #8e8b82;
  font-size: 12px;
}

.key-status.is-saved { color: #7fd0ae; }

.status-dot {
  display: inline-block;
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8f8c83;
}

.is-saved .status-dot,
.task-badge.is-completed .status-dot { background: var(--green); }
.task-badge.is-running .status-dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(173, 111, 20, 0.12); }
.task-badge.is-failed .status-dot { background: #c83e3e; }

.purchase-link {
  margin: 28px 0 20px;
  padding-top: 20px;
  color: #85827a;
  border-top: 1px solid var(--sidebar-line);
  font-size: 12px;
  line-height: 1.65;
}

.purchase-link a { color: #aaa79e; text-decoration: none; }
.purchase-link a:hover { color: #fff; }

.generate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  margin-top: auto;
  color: #fff;
  border: 0;
  border-radius: 7px;
  background: var(--coral);
  box-shadow: 0 9px 20px rgba(244, 90, 67, 0.18);
  font-weight: 800;
}

.generate-button:hover { background: var(--coral-dark); }
.generate-button:disabled { cursor: not-allowed; opacity: 0.68; }
.generate-button img { width: 21px; filter: brightness(0) invert(1); }
.generate-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.generate-button.is-busy svg { animation: spin 1s linear infinite; }

.workspace {
  display: flex;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
}

.section-heading,
.reference-header,
.result-toolbar,
.video-meta,
.history-heading,
.range-control > div,
.range-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading { margin-bottom: 10px; font-size: 13px; font-weight: 800; }
.section-heading span { color: var(--muted); font-weight: 500; }
.prompt-meta { display: flex; align-items: center; gap: 5px; }
.prompt-meta .icon-button { width: 26px; height: 26px; color: var(--muted); font-size: 17px; }

.prompt-section textarea {
  min-height: 158px;
  padding: 17px;
  line-height: 1.65;
  border: 0;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px transparent;
}

.prompt-section textarea:focus { box-shadow: inset 0 0 0 1px var(--coral); }

.reference-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}

.reference-header { gap: 14px; }
.reference-header h2 { margin: 0 0 3px; font-size: 14px; }
.reference-header p { margin: 0; color: var(--muted); font-size: 12px; }
.reference-actions { display: flex; align-items: center; gap: 8px; }

.segmented {
  display: flex;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ecebe6;
}

.segmented button {
  min-width: 66px;
  padding: 0 10px;
  color: #77746c;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.segmented button.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08); }

.drop-zone {
  position: relative;
  min-height: 92px;
  margin-top: 13px;
  padding: 10px;
  border: 1px dashed #cbc7bd;
  border-radius: 6px;
  background: #fff;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone.is-dragging { border-color: var(--coral); background: #fff5f1; }
.drop-empty { display: flex; min-height: 70px; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.drop-empty strong { color: var(--ink); font-size: 13px; }
.drop-empty > span:last-child { font-size: 12px; }
.drop-icon { display: grid; width: 32px; height: 32px; place-items: center; color: var(--coral); border-radius: 6px; background: #fff0ec; font-size: 22px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.asset-grid:empty { display: none; }

.asset-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 5px;
  border: 1px solid #e4e1da;
  border-radius: 6px;
  background: #f9f8f5;
}

.asset-thumb {
  display: grid;
  width: 48px;
  height: 48px;
  overflow: hidden;
  place-items: center;
  color: var(--blue);
  border-radius: 5px;
  background: #e7eef4;
  font-size: 11px;
  font-weight: 800;
}

.asset-thumb img,
.asset-thumb video { width: 100%; height: 100%; object-fit: cover; }
.asset-copy { min-width: 0; }
.asset-copy strong,
.asset-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-copy strong { font-size: 11px; }
.asset-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.asset-copy span.is-active { color: var(--green); }
.asset-copy span.is-failed { color: #c83e3e; }
.asset-remove { color: #7f7b72; font-size: 18px; }

.inline-error {
  margin-top: 10px;
  padding: 9px 11px;
  color: #9a2929;
  border-left: 3px solid #c83e3e;
  background: #fff0f0;
  font-size: 12px;
}

.result-panel {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid #d4d1c9;
  border-radius: 7px;
  background: #faf9f6;
}

.result-grid-lines {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image: linear-gradient(#e8e6df 1px, transparent 1px), linear-gradient(90deg, #e8e6df 1px, transparent 1px);
  background-size: 32px 32px;
}

.result-toolbar { position: relative; z-index: 1; padding: 12px; }
.task-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; background: rgba(255, 255, 255, 0.9); font-size: 11px; }

.result-empty {
  position: absolute;
  inset: 50% auto auto 50%;
  display: flex;
  width: min(280px, 80%);
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  color: var(--muted);
  text-align: center;
}

.result-empty img { width: 36px; height: 36px; margin-bottom: 12px; }
.result-empty strong { color: var(--ink); font-size: 15px; }
.result-empty span { margin-top: 6px; font-size: 12px; }

.result-panel.is-generating .result-empty::before {
  content: "";
  width: min(320px, 78vw);
  aspect-ratio: 16 / 9;
  margin-bottom: 20px;
  border: 1px solid #ddd8ce;
  border-radius: 7px;
  background: linear-gradient(90deg, #ededeb 0%, #f2f1ee 44%, #fff1ec 68%, #e7e5df 100%);
  background-size: 240% 100%;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.08);
  animation: shimmer 1.1s linear infinite;
}

.result-panel.is-generating .result-empty img { display: none; }
.result-panel.is-generating .task-badge .status-dot { animation: status-pulse 1.2s ease-in-out infinite; }

.video-result { position: relative; z-index: 1; width: min(900px, calc(100% - 50px)); margin: 14px auto 28px; border: 1px solid #cbc8bf; border-radius: 7px; background: #111; box-shadow: var(--shadow); }
.video-result video { display: block; width: 100%; max-height: 62vh; background: #000; }
.video-result > img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #111; }
.video-meta { gap: 18px; padding: 12px; color: #fff; background: #171715; }
.video-meta > div:first-child { display: flex; min-width: 0; flex-direction: column; }
.video-meta strong { font-size: 13px; }
.video-meta span { margin-top: 4px; color: #9d9a92; font-size: 10px; }
.result-actions { display: flex; gap: 7px; }
.video-meta .button:not(.primary) { color: #eee; border-color: #3d3c38; background: #24231f; }
.video-meta a { text-decoration: none; }

.right-panel {
  min-width: 0;
  min-height: 100vh;
  padding: 28px 24px;
  background: #faf9f6;
  border-left: 1px solid var(--line);
}

.settings-section h2,
.history-section h2 { margin-bottom: 16px; }

.select-control,
.number-control,
.range-control,
.switch-control {
  display: block;
  padding: 17px 0;
  border-top: 1px solid var(--line);
}

.select-control > span,
.number-control > span,
.range-control label,
.switch-control > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.select-control select { height: 34px; padding: 0 30px 0 0; border: 0; background: transparent; font-size: 12px; font-weight: 600; }
.number-control input { height: 36px; }

.range-control output { color: var(--coral-dark); font-size: 12px; font-weight: 800; }
.range-control input { height: 18px; padding: 0; accent-color: var(--coral); border: 0; }
.range-labels { color: var(--muted); font-size: 9px; }

.switch-control { position: relative; display: flex; align-items: center; justify-content: space-between; }
.switch-control > span { margin: 0; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control i { position: relative; width: 40px; height: 22px; border-radius: 22px; background: #b9b6ad; transition: background 160ms ease; }
.switch-control i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 160ms ease; }
.switch-control input:checked + i { background: var(--ink); }
.switch-control input:checked + i::after { transform: translateX(18px); }
.switch-control input:focus-visible + i { outline: 3px solid rgba(244, 90, 67, 0.24); outline-offset: 2px; }

.history-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.history-heading h2 { margin: 0; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-empty { color: var(--muted); font-size: 12px; }

.history-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  padding: 6px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.history-item:hover { border-color: var(--coral); }
.history-preview { display: grid; width: 52px; height: 42px; place-items: center; color: #fff; border-radius: 4px; background: #252523; font-size: 16px; }
.history-copy { min-width: 0; }
.history-copy strong,
.history-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-copy strong { font-size: 11px; }
.history-copy span { margin-top: 5px; color: var(--muted); font-size: 9px; }

dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

dialog::backdrop { background: rgba(20, 20, 18, 0.56); }
dialog form { padding: 20px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; font-size: 17px; }
dialog label { display: block; margin: 13px 0 7px; font-size: 12px; font-weight: 800; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.model-info-dialog {
  width: min(760px, calc(100% - 32px));
  max-width: none;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.model-info-card { max-height: min(86vh, 780px); overflow-y: auto; background: #fff; }
.model-info-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 34px;
  border-bottom: 1px solid #ecebe7;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.model-info-heading { display: flex; min-width: 0; align-items: center; gap: 18px; }
.model-info-logo {
  display: grid;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid #ecebe7;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(24, 24, 22, 0.08);
}
.model-info-logo img { width: 35px; height: 35px; }
.model-info-family { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.model-info-title-row { display: flex; min-width: 0; align-items: center; gap: 9px; }
.model-info-title-row h2 { margin: 0; overflow-wrap: anywhere; font-size: clamp(22px, 3vw, 30px); line-height: 1.15; }
.model-copy-button {
  display: inline-grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: #2587ec;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 16px;
  font-style: normal;
}
.model-copy-button:hover { background: #eef6ff; }
.model-copy-button:disabled { cursor: default; color: #aaa; background: transparent; }
.model-info-close {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #66645e;
  border: 0;
  border-radius: 50%;
  background: #f2f2ef;
  font-size: 26px;
  line-height: 1;
}
.model-info-close:hover { color: #111; background: #e9e8e4; }

.model-info-section { padding: 24px 34px; border-bottom: 1px solid #ecebe7; }
.model-info-section.is-last { border-bottom: 0; }
.model-info-section-title { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.model-info-section-title h3 { margin: 0 0 2px; font-size: 17px; }
.model-info-section-title p { margin: 0; color: var(--muted); font-size: 12px; }
.model-info-section-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
  font-style: normal;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}
.model-info-section-icon.is-blue { background: #49a6f8; }
.model-info-section-icon.is-purple { background: #cd50dd; }
.model-info-section-icon.is-amber { background: #ffb84d; }
.model-info-description { margin: 0; color: #2b2a27; font-size: 14px; line-height: 1.75; }
.model-info-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.model-info-tags span { padding: 5px 10px; color: #5e5b55; border: 1px solid #e3e1dc; border-radius: 999px; background: #faf9f6; font-size: 11px; }
.model-info-tags span:last-child { color: #18734f; border-color: #c8eadb; background: #eefaf5; }

.model-endpoint-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 8px 10px 8px 14px;
  border: 1px solid #e7e5df;
  border-radius: 10px;
  background: #faf9f7;
}
.endpoint-dot { width: 8px; height: 8px; border-radius: 50%; background: #28b969; }
.model-endpoint-row code { overflow: hidden; color: #274a78; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.model-price-table { overflow: hidden; border: 1px solid #ece9e3; border-radius: 11px; }
.model-price-head,
.model-price-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(130px, 0.9fr) minmax(150px, 1fr); align-items: center; gap: 14px; }
.model-price-head { padding: 11px 16px; color: #77736c; background: #f7f6f3; font-size: 11px; font-weight: 800; }
.model-price-row { min-height: 64px; padding: 13px 16px; background: #fff; }
.model-price-row > span:first-child { overflow-wrap: anywhere; font-size: 12px; }
.model-price-row em { display: inline-block; padding: 5px 9px; color: #178e84; border-radius: 999px; background: #e7faf7; font-size: 11px; font-style: normal; }
.model-price-row strong { color: #1b1a18; font-size: 15px; line-height: 1.45; }
.model-price-note { margin: 11px 0 0; color: #96928a; font-size: 10px; text-align: right; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 28px;
  max-width: min(440px, calc(100% - 32px));
  padding: 11px 15px;
  transform: translateX(-50%);
  color: #fff;
  border-radius: 6px;
  background: #24231f;
  box-shadow: var(--shadow);
  font-size: 12px;
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes status-pulse {
  50% { opacity: 0.45; transform: scale(0.82); }
}

@media (prefers-reduced-motion: reduce) {
  .generate-button.is-busy svg,
  .result-panel.is-generating .result-empty::before,
  .result-panel.is-generating .task-badge .status-dot { animation: none; }
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 242px minmax(500px, 1fr) 274px; }
  .sidebar { padding-inline: 17px; }
  .workspace { padding: 22px; }
  .right-panel { padding-inline: 18px; }
  .reference-header { align-items: flex-start; flex-direction: column; }
  .reference-actions { width: 100%; }
  .reference-actions .coral-outline { margin-left: auto; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 16px 20px; }
  .brand { padding-bottom: 16px; }
  .access-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; padding-top: 16px; }
  .access-panel h2 { grid-column: 1 / -1; margin: 0; }
  .access-panel label { align-self: end; margin: 0; }
  .password-field,
  .access-panel select { margin: 0; }
  .button-row { grid-column: 1 / -1; }
  .key-status { grid-column: 1 / -1; margin: 0; }
  .purchase-link { display: none; }
  .generate-button { margin-top: 16px; }
  .workspace { min-height: 0; }
  .right-panel { min-height: 0; border-top: 1px solid var(--line); border-left: 0; }
  .settings-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .settings-section h2 { grid-column: 1 / -1; }
  .history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 560px) {
  .sidebar,
  .workspace,
  .right-panel { padding-inline: 14px; }
  .access-panel { grid-template-columns: 1fr; }
  .access-panel h2,
  .button-row,
  .key-status { grid-column: auto; }
  .workspace { padding-block: 18px; }
  .prompt-section textarea { min-height: 140px; }
  .reference-actions { flex-wrap: wrap; }
  .segmented { order: 1; width: 100%; }
  .segmented button { flex: 1; }
  .reference-actions .coral-outline { margin-left: 0; }
  .drop-empty { flex-wrap: wrap; padding: 12px; }
  .drop-empty > span:last-child { width: 100%; text-align: center; }
  .asset-grid { grid-template-columns: 1fr; }
  .result-panel { min-height: 360px; }
  .video-result { width: calc(100% - 20px); }
  .video-meta { align-items: flex-start; flex-direction: column; }
  .settings-section { grid-template-columns: 1fr; }
  .model-info-header,
  .model-info-section { padding-inline: 20px; }
  .model-info-logo { flex-basis: 50px; width: 50px; height: 50px; }
  .model-info-logo img { width: 28px; height: 28px; }
  .model-price-head { display: none; }
  .model-price-row { grid-template-columns: 1fr; gap: 9px; }
}
