:root {
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #19302c;
  background: #f4f6f5;
  font-synthesis: none;
  --text: #19302c;
  --muted: #5d706a;
  --accent: #086b5b;
  --accent-hover: #07584c;
  --line: #dce6e1;
  --surface: #fff;
  --wash: #f2f7f5;
  --danger: #9e3534;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #0a806e; outline-offset: 3px; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  display: flex;
  flex-direction: column;
  padding: 30px 17px;
  background: #fbfcfb;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar > .brand, .sidebar > .navigation { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; width: fit-content; font-size: 17px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; }
.brand-icon { display: grid; grid-template-columns: repeat(2, 6px); grid-auto-rows: 6px; gap: 3px; align-content: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); }
.brand-icon i { background: #eaf8f2; border-radius: 1.5px; }
.brand-icon i:nth-child(2) { opacity: .55; }
.navigation { display: flex; flex-direction: column; gap: 5px; margin-top: 42px; }
.nav-link { min-height: 43px; display: flex; align-items: center; gap: 11px; padding: 9px 12px; color: var(--muted); border-radius: 8px; font-weight: 600; white-space: nowrap; }
.nav-settings { border: 0; background: transparent; text-align: left; }
.settings-status { margin-left: auto; padding: 2px 5px; color: #76551e; background: #f7efdf; border-radius: 4px; font-size: 11px; }
.nav-link:hover { background: #edf3f0; color: var(--text); }
.nav-link[aria-current="page"] { background: #e1f1eb; color: #085e51; }
.logout-error { margin: 8px 12px 0; }
.recent-section { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 34px; }
.recent-section h2 { padding-inline: 12px; color: var(--muted); font-size: 12px; font-weight: 650; }
.recent-history { min-height: 0; margin-top: 8px; overflow-y: auto; overscroll-behavior-y: contain; }
.recent-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: 3px; }
.recent-empty, .recent-link { min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 12px; color: var(--muted); border-radius: 7px; }
.recent-link:hover, .recent-link[aria-current="page"] { background: #edf3f0; color: var(--text); }
.recent-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-delete { min-height: 30px; padding: 3px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.recent-delete:enabled:hover, .recent-delete:focus-visible { color: var(--danger); background: #f9e9e8; }
.recent-delete:disabled { opacity: .45; }
.dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #96a59f; }
.dot[data-status="completed"] { background: #127962; }
.dot[data-status="planned"] { background: #96803b; }
.dot[data-status="running"], .dot[data-status="planning"] { background: #51829e; }
.dot[data-status="partial"] { background: #a67323; }
.dot[data-status="failed"], .dot[data-status="deleting"] { background: #b45751; }

.workspace { min-width: 0; width: 100%; max-width: 1450px; padding: 35px clamp(22px, 3.8vw, 54px) 55px; margin-inline: auto; }
.page-heading { margin: 0 0 25px; }
.page-heading h1 { font-size: clamp(29px, 3.05vw, 41px); line-height: 1.24; letter-spacing: -.045em; font-weight: 760; overflow-wrap: anywhere; }
.page-heading p { color: var(--muted); margin-top: 7px; font-size: 14px; }
.studio-grid { display: grid; grid-template-columns: minmax(282px, .82fr) minmax(0, 1.18fr); gap: 21px; align-items: start; }
.panel { min-width: 0; padding: 23px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel h2 { font-size: 18px; line-height: 1.35; font-weight: 700; letter-spacing: -.015em; }
.login-page { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.login-panel { width: min(100%, 400px); padding: clamp(24px, 6vw, 36px); }
.login-panel .brand { padding: 0; }
.login-panel h1 { margin-block: 22px 18px; font-size: 26px; line-height: 1.3; }
.login-form { display: grid; gap: 15px; }
.login-form .button { margin-top: 3px; }
.input-panel { display: grid; gap: 19px; }
.input-panel h2 { margin-bottom: 1px; }
.form-field { min-width: 0; display: grid; gap: 8px; }
.form-field label, .form-field h3 { font-size: 14px; font-weight: 650; }
.field-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.required { color: var(--accent); }
.optional { margin-left: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }
.dropzone {
  min-height: 136px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px;
  text-align: center;
  background: var(--wash);
  border: 1px dashed #8eafa3;
  border-radius: 10px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.dropzone:hover, .dropzone.is-dragover { background: #e8f5ef; border-color: var(--accent); }
.dropzone:focus-within { outline: 2px solid #0a806e; outline-offset: 3px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-mark { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 2px; color: var(--accent); background: #e3f0eb; border-radius: 9px; }
.dropzone strong { font-size: 13px; font-weight: 650; }
.dropzone strong span { color: var(--accent); }
.dropzone small { font-size: 12px; font-weight: 400; color: var(--muted); }
.reference-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.reference { position: relative; min-width: 0; }
.reference-preview { display: block; width: 100%; aspect-ratio: 1; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.reference-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.reference-remove { position: absolute; top: 4px; right: 4px; width: 24px !important; height: 24px !important; font-size: 16px !important; color: #fff; background: #233e35; }
.reference-remove:hover { background: #0d271f; }
.form-field input[type="text"], .form-field input[type="password"], .form-field textarea, select { width: 100%; border: 1px solid #cbdad4; border-radius: 8px; background: var(--surface); }
.form-field input[type="text"], .form-field input[type="password"], select { min-height: 43px; padding: 9px 11px; }
.form-field textarea { min-height: 91px; padding: 9px 11px; resize: vertical; }
.form-field input::placeholder, .form-field textarea::placeholder { color: #657770; }
.field-error { color: var(--danger); font-size: 13px; overflow-wrap: anywhere; }
.output-settings { padding-top: 15px; border-top: 1px solid var(--line); }
.output-settings h2 { margin-bottom: 12px; }
.extra-fields-list { display: grid; gap: 12px; }
.extra-value-control { display: grid; gap: 6px; }
.extra-value-control:has(select) { grid-template-columns: minmax(0, 1fr) 102px; }
.extra-value-control select { min-width: 0; padding-inline: 8px 4px; }
.extra-fields-list label { overflow-wrap: anywhere; }
.mode-options { min-width: 0; margin: 0 0 15px; padding: 0; border: 0; }
.mode-options legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.mode-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-choice { display: flex; align-items: flex-start; gap: 7px; min-width: 0; padding: 10px; border-radius: 8px; background: #f5f8f6; cursor: pointer; }
.mode-choice:hover, .mode-choice:has(input:checked) { background: #eaf5ef; }
.mode-choice input { flex: 0 0 auto; width: 14px; height: 14px; margin: 3px 0 0; accent-color: var(--accent); }
.mode-choice span { min-width: 0; }
.mode-choice strong, .mode-choice small { display: block; overflow-wrap: anywhere; }
.mode-choice strong { font-size: 13px; }
.mode-choice small { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.output-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.output-wide { grid-column: 1 / -1; }
.output-controls .form-field { gap: 5px; }
.output-controls label { font-size: 13px; }
.output-controls select { padding-right: 6px; }
.output-note { padding: 8px 10px; border-radius: 6px; background: var(--wash); color: var(--muted); font-size: 12px; }
.catalog-error { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.catalog-error .button { min-height: 34px; padding: 4px 9px; font-size: 12px; }

.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 13px; margin-bottom: 19px; }
.panel-heading p { color: var(--muted); margin-top: 5px; font-size: 13px; overflow-wrap: anywhere; }
.panel-meta { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.format-chip, .status-chip { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 3px 9px; border-radius: 6px; background: #edf3f0; color: #405f55; font-size: 12px; line-height: 1.35; white-space: nowrap; font-weight: 650; }
.status-chip[data-status="completed"] { color: #086454; background: #e5f5ed; }
.status-chip[data-status="planned"] { color: #76551e; background: #f7efdf; }
.status-chip[data-status="running"], .status-chip[data-status="planning"] { color: #34607a; background: #e7f2f7; }
.status-chip[data-status="partial"] { color: #845d22; background: #fbf1de; }
.status-chip[data-status="failed"], .status-chip[data-status="deleting"] { color: var(--danger); background: #f9e9e8; }
.slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 11px; align-items: start; }
.slot { position: relative; min-width: 0; }
@media (min-width: 951px) {
  #plan-grid .slot { width: min(100%, calc(144px * var(--output-aspect, 1))); justify-self: center; }
}
.slot-media {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  aspect-ratio: var(--output-aspect, 1);
  overflow: hidden;
  padding: 0;
  border: 1px solid #e7eeeb;
  border-radius: 10px;
  background: #eff4f2;
  color: #537a6c;
}
.slot:nth-child(1) .slot-media { background: #f6f8f7; }
.slot:nth-child(3n) .slot-media { background: #edf3ef; }
.slot:nth-child(n+6):nth-child(-n+8) .slot-media { color: #577a6f; background: #eaf2ef; }
.slot[data-state="failed"] .slot-media { background: #fbf1f0; color: var(--danger); border-color: #f4e2e1; }
button.slot-media:hover { border-color: var(--accent); }
.slot-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slot-preview-icon {
  width: clamp(23px, 3vw, 36px);
  height: clamp(20px, 2.45vw, 29px);
  position: relative;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  overflow: hidden;
}
.slot-preview-icon::before { content: ""; display: block; position: absolute; width: 24%; aspect-ratio: 1; border: 1.5px solid currentColor; border-radius: 50%; left: 15%; top: 17%; }
.slot-preview-icon::after { content: ""; position: absolute; width: 65%; aspect-ratio: 1; transform: rotate(45deg); border-top: 1.5px solid currentColor; border-left: 1.5px solid currentColor; border-radius: 3px; top: 57%; left: 39%; }
.slot-media:has(.slot-spinner) { border-color: #d3e4dd; background: #edf5f1; }
.slot-spinner {
  width: clamp(25px, 3.1vw, 42px);
  aspect-ratio: 1;
  border: 3px solid #c7dfd6;
  border-block-start-color: var(--accent);
  border-inline-end-color: var(--accent);
  border-radius: 50%;
  animation: slot-wait-spin .85s linear infinite;
}
@keyframes slot-wait-spin { to { transform: rotate(1turn); } }
.slot-title { display: block; margin-top: 6px; font-weight: 650; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.slot-caption { display: grid; gap: 4px; }
.slot-state { font-size: 12px; color: var(--muted); }
.slot-state[data-status="failed"] { color: var(--danger); }
.slot-note { overflow-wrap: anywhere; }
.slot-prompt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.slot-copy { display: grid; gap: 2px; margin-block: 3px; padding-inline-start: 7px; border-inline-start: 2px solid #94b6aa; }
.slot-copy-label { color: var(--muted); font-size: 11px; }
.slot-copy-value { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 12px; }
.slot-copy-caption { color: var(--muted); }
.slot-actions { display: flex; flex-wrap: wrap; column-gap: 12px; }
.slot-action { min-height: 30px; max-width: 100%; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 650; text-align: left; overflow-wrap: anywhere; }
.slot-action:enabled:hover { text-decoration: underline; }
.slot-action:disabled { color: var(--muted); }
.slot-regenerate {
  position: absolute;
  z-index: 1;
  inset: 6px 6px auto auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  background: #fffffff2;
  font-size: 20px;
  line-height: 1;
}
.slot-regenerate:enabled:hover { background: var(--wash); }
.slot-regenerate:disabled { color: var(--muted); }
.panel-actions { display: grid; gap: 10px; margin-top: 21px; }
.new-actions { margin: 0 0 20px; }
.submit-config { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.submit-config .slot-action { flex-shrink: 0; padding-inline: 4px; }
.result-actions { margin-bottom: 14px; }
.result-actions:has(#retry-all[hidden]) { display: none; }
.planned-actions, .task-action-error { margin-bottom: 14px; }
.action-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 42px; padding: 7px 15px; font-size: 14px; text-align: center; white-space: nowrap; font-weight: 700; border-radius: 8px; border: 1px solid transparent; transition: background .16s ease; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-hover); }
.button-primary:disabled { background: #3c8376; }
.button[aria-busy="true"] { cursor: wait; }
.button-secondary { color: var(--accent); border-color: #c5d9d1; background: #fff; }
.button-secondary:hover { background: #edf6f2; }
.button-danger { color: #fff; background: var(--danger); }
.button-danger:enabled:hover { background: #832c2b; }
.button-danger:disabled { opacity: .65; }
.generate { width: 100%; min-height: 47px; font-size: 15px; }
.generate:disabled:not([aria-busy="true"]) { color: #536961; background: #e4ebe8; transition: none; }
.sparkle { font-size: 19px; line-height: 1; }
.notice { padding: 10px 12px; margin-bottom: 13px; border-radius: 8px; background: #fbf1e8; color: #75491e; font-size: 13px; overflow-wrap: anywhere; }

.history-panel { padding: 9px 22px; }
.history-message { padding: 42px 14px; text-align: center; color: var(--muted); }
.history-message .button { margin-top: 13px; }
.history-row { min-height: 70px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 7px; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row:hover { background: var(--wash); border-radius: 7px; }
.history-thumb { display: grid; place-items: center; overflow: hidden; width: 44px; height: 44px; border-radius: 7px; background: var(--wash); color: #537a6c; }
.history-thumb img { width: 100%; height: 100%; object-fit: contain; }
.history-thumb .slot-preview-icon { width: 22px; height: 19px; }
.history-name { display: block; font-weight: 680; overflow-wrap: anywhere; }
.history-meta { display: block; color: var(--muted); font-size: 12px; }
.back-link { display: inline-block; margin-bottom: 7px; color: var(--accent); font-size: 13px; }
.back-link:hover { text-decoration: underline; }
.notice-panel { display: grid; justify-items: start; gap: 11px; color: var(--muted); }
.saved-description { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.saved-extra { display: grid; gap: 7px; }
.saved-extra div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.saved-extra dt { font-weight: 650; overflow-wrap: anywhere; }
.saved-extra dd { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.task-settings { display: grid; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.task-settings div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.task-settings dt { color: var(--muted); }
.task-settings dd { font-weight: 650; text-align: right; overflow-wrap: anywhere; }

.lightbox { width: fit-content; max-width: min(94vw, 840px); max-height: 92vh; padding: 12px; border: 0; border-radius: 13px; color: var(--text); background: #fff; }
.lightbox::backdrop { background: #102821bd; }
.lightbox-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 3px 8px 7px; }
.lightbox-header h2 { font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.lightbox-actions { display: flex; align-items: center; gap: 9px; }
.lightbox-download { min-height: 36px; padding: 6px 10px; white-space: nowrap; }
#lightbox-media { overflow: hidden; border-radius: 6px; }
.lightbox img { max-width: 100%; max-height: 76vh; display: block; object-fit: contain; border-radius: 6px; margin-inline: auto; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; padding: 0; border: 0; border-radius: 7px; font-size: 24px; line-height: 1; }
.close-lightbox { background: var(--wash); }
.close-lightbox:hover { background: #e5efea; }
.settings-dialog { width: min(92vw, 460px); max-height: 92vh; padding: 22px; border: 0; border-radius: 14px; color: var(--text); background: #fff; }
.settings-dialog::backdrop { background: #10282185; }
.delete-task-dialog .delete-task-name { margin-top: 10px; font-weight: 700; overflow-wrap: anywhere; }
.delete-task-dialog .action-row { margin-top: 16px; }
.delete-task-error { flex-basis: 100%; }
.settings-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 21px; }
.settings-header h2 { font-size: 22px; }
.settings-header p, .settings-note { margin-top: 4px; color: var(--muted); font-size: 13px; }
.provider-readiness { display: grid; gap: 10px; margin-bottom: 16px; }
.provider-readiness div { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.provider-readiness dt { font-weight: 650; }
.provider-key-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.reference-unavailable { display: grid; place-items: center; color: #537a6c; }
.settings-form { display: grid; gap: 16px; }
.settings-form .button { justify-self: end; }
.settings-success { color: var(--accent); font-size: 13px; }
.extra-config-dialog { width: min(94vw, 760px); }
.generation-settings-form { display: grid; gap: 7px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.generation-settings-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.generation-settings-controls .form-field { flex: 0 1 138px; }
.generation-settings-controls .button { min-height: 43px; }
.provider-config-form, .task-defaults-form, .storage-settings { display: grid; gap: 10px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.provider-config-form h3, .task-defaults-form h3, .storage-settings h3 { font-size: 16px; }
.storage-settings .provider-readiness { margin: 0; }
.task-defaults-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.extra-config-heading { margin-bottom: 12px; }
.extra-config-heading h3 { font-size: 16px; }
.extra-config-list { display: grid; gap: 13px; }
.extra-config-list:empty { display: none; }
.extra-config-row { display: grid; grid-template-columns: minmax(104px, .8fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: start; padding: 12px; border-radius: 9px; background: var(--wash); }
.extra-config-values { display: grid; gap: 9px; }
.extra-config-values textarea { min-height: 74px; }
.extra-config-values .settings-note { margin: 0; font-size: 12px; }
.extra-config-remove { border: 0; padding: 8px 2px; color: var(--danger); background: transparent; font-weight: 650; font-size: 13px; }
.extra-config-remove:enabled:hover { text-decoration: underline; }
.extra-config-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.extra-config-actions #extra-config-save { margin-left: auto; }
.prompt-dialog { width: min(92vw, 620px); }
.prompt-dialog #prompt-input { min-height: 150px; max-height: 46vh; }
.prompt-copy { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.prompt-copy legend { padding-inline: 5px; color: var(--text); font-weight: 700; }
.prompt-copy legend span { color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.prompt-copy textarea { min-height: 65px; max-height: 22vh; }
.prompt-copy #prompt-overlay-title { min-height: 43px; }
.workspace { position: relative; }
.page-heading { padding-inline-end: 89px; }
.task-heading { padding-inline-end: 0; }
.task-heading-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.task-heading .back-link { display: inline-flex; align-items: center; min-height: 36px; }
.task-heading .reproduce-error { color: var(--danger); }
.workspace-tools { position: absolute; inset-block-start: 36px; inset-inline-end: clamp(22px, 3.8vw, 54px); display: flex; gap: 8px; }
.workspace-tools .button { min-height: 36px; padding: 5px 10px; }
.task-heading-actions .workspace-tools { position: static; flex-wrap: wrap; justify-content: flex-end; margin-inline-start: auto; gap: 10px; }
.task-heading-actions .workspace-tools .button { flex: 0 0 auto; }
.debug-open { color: var(--text); }
.debug-terminal { color: var(--accent); font-family: ui-monospace, monospace; font-weight: 700; }
.debug-dialog { width: min(94vw, 810px); }
.debug-header { margin-bottom: 12px; }
.debug-header p { overflow-wrap: anywhere; }
.debug-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.debug-log { max-height: min(63vh, 640px); min-height: min(210px, 44vh); overflow: auto; overscroll-behavior: contain; background: var(--wash); border: 1px solid var(--line); border-radius: 9px; }
.debug-empty { color: var(--muted); padding: 18px; }
.debug-event + .debug-event { border-top: 1px solid var(--line); }
.debug-event summary { display: flex; gap: 9px; align-items: baseline; padding: 11px 12px; cursor: pointer; list-style: none; overflow-wrap: anywhere; }
.debug-event summary::-webkit-details-marker { display: none; }
.debug-event summary::after { content: ""; flex: 0 0 6px; width: 6px; height: 6px; margin: 0 3px 2px auto; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.debug-event[open] summary::after { transform: rotate(225deg); }
.debug-event time { flex: 0 0 auto; color: var(--muted); font: 12px ui-monospace, monospace; }
.debug-event-kind, .debug-event-slot { flex: 0 0 auto; border-radius: 4px; padding: 2px 5px; background: #e4eeea; color: #36584c; font-size: 11px; font-weight: 650; }
.debug-event[data-tone="error"] .debug-event-kind { color: var(--danger); background: #f9e9e8; }
.debug-event-title { min-width: 0; font-size: 13px; font-weight: 650; }
.debug-event-details { max-width: calc(100% - 24px); margin: 0 12px 12px; padding: 12px; color: #d7ede3; background: #152a24; border-radius: 6px; font: 12px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.icon { display: inline-block; position: relative; flex: 0 0 auto; width: 16px; height: 16px; }
.icon-plus::before, .icon-plus::after { content: ""; position: absolute; border-radius: 2px; background: currentColor; }
.icon-plus::before { width: 12px; height: 1.6px; left: 2px; top: 7px; }
.icon-plus::after { width: 1.6px; height: 12px; left: 7px; top: 2px; }
.icon-clock { border: 1.5px solid currentColor; border-radius: 50%; }
.icon-clock::after { content: ""; position: absolute; width: 4px; height: 5px; top: 2px; left: 6px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; }
.icon-sliders { display: grid; align-content: center; gap: 3px; }
.icon-sliders i { position: relative; width: 14px; height: 1px; border-radius: 2px; background: currentColor; }
.icon-sliders i::before { content: ""; position: absolute; top: -1px; left: 3px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.icon-sliders i:nth-child(2)::before { left: 9px; }
.icon-logout::before { content: ""; position: absolute; inset: 2px 7px 2px 1px; border: 1.5px solid currentColor; border-right: 0; border-radius: 2px 0 0 2px; }
.icon-logout::after { content: "→"; position: absolute; left: 4px; top: -3px; font-size: 16px; }
.icon-upload, .icon-download { border: solid currentColor; border-width: 0 1.5px 1.5px; border-radius: 0 0 3px 3px; height: 9px; margin-top: 6px; }
.icon-upload::before, .icon-download::before { content: ""; position: absolute; width: 1.5px; height: 10px; background: currentColor; top: -7px; left: calc(50% - .75px); }
.icon-upload::after, .icon-download::after { content: ""; position: absolute; width: 5px; height: 5px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(45deg); top: -7px; left: calc(50% - 3px); }
.icon-download::after { top: -3px; transform: rotate(225deg); }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 184px minmax(0, 1fr); }
  .workspace { padding-inline: 26px; }
  .panel { padding: 18px; }
  .studio-grid { gap: 15px; }
  .slot-grid { gap: 13px 7px; }
  .history-panel { padding: 7px 16px; }
  .workspace-tools { inset-inline-end: 26px; }
}

@media (max-width: 950px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .navigation { flex-direction: row; margin: 0; }
  .recent-section { display: none; }
  .settings-status { display: none; }
  .logout-error { position: fixed; z-index: 2; top: 56px; right: 12px; padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
}

@media (max-width: 730px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace { padding: 22px 16px 40px; }
  body:has(#new-view:not([hidden])) .workspace { padding-bottom: 106px; }
  body:has(#new-view:not([hidden]) :is(#submit-error, #submit-config-required):not([hidden])) .workspace { padding-bottom: 160px; }
  .new-actions { position: fixed; z-index: 1; bottom: 0; inset-inline: 0; margin: 0; padding: 10px max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: #fbfcfb; border-top: 1px solid var(--line); }
  .sidebar { padding-inline: 13px; gap: 6px; }
  .nav-link { min-height: 39px; padding: 7px 9px; gap: 6px; font-size: 13px; }
  .settings-text { display: none; }
  .page-heading { margin-bottom: 18px; }
  .panel { padding: 17px; }
  .history-panel { padding: 7px 10px; }
  .form-field input[type="text"], .form-field input[type="password"], .form-field textarea, select { font-size: 16px; }
  .slot-grid { gap: 14px 9px; }
  .workspace-tools { inset-block-start: 21px; inset-inline-end: 16px; gap: 6px; }
  .debug-dialog { padding: 16px; }
}

@media (max-width: 450px) {
  .nav-link:not(.nav-settings) .icon { display: none; }
  .workspace-tools #download-task { width: 36px; padding-inline: 0; }
  #download-label { display: none; }
  .extra-config-dialog { padding: 17px; }
  .task-defaults-controls .default-model-field { grid-column: 1 / -1; }
  .extra-config-row { grid-template-columns: minmax(0, 1fr) auto; }
  .extra-config-values { grid-column: 1 / -1; grid-row: 2; }
  .extra-config-remove { grid-column: 2; grid-row: 1; align-self: end; }
  .debug-event summary { column-gap: 6px; padding-inline: 9px; flex-wrap: wrap; }
}

@media (max-width: 365px) {
  .sidebar { padding-inline: 10px; gap: 5px; flex-wrap: wrap; }
  .brand { gap: 6px; font-size: 15px; padding-inline: 0; }
  .brand-icon { width: 27px; height: 27px; }
  .nav-link { padding-inline: 7px; font-size: 13px; }
  .mode-choice { gap: 5px; padding: 7px; }
}

@media (max-width: 325px) {
  .brand-icon { display: none; }
  .output-controls { grid-template-columns: minmax(0, 1fr); }
}

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