:root {
  color-scheme: light;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-bg: #f5f7f5;
  --surface: #ffffff;
  --surface-subtle: #f9faf9;
  --surface-strong: #eef2ef;
  --text: #17201c;
  --text-secondary: #56615b;
  --text-muted: #657069;
  --border: #dfe5e1;
  --border-strong: #cbd4ce;
  --accent: #167458;
  --accent-hover: #0f634a;
  --accent-soft: #e8f4ef;
  --accent-border: #b8dacd;
  --warning: #946018;
  --warning-soft: #fff5df;
  --danger: #b5403b;
  --danger-hover: #96342f;
  --danger-soft: #fff0ee;
  --info: #27678c;
  --info-soft: #eaf4fa;
  --shadow-sm: 0 1px 2px rgba(18, 31, 24, 0.05);
  --shadow-lg: 0 24px 64px rgba(18, 31, 24, 0.18);
  --sidebar-width: 272px;
  --topbar-height: 72px;
  --radius: 8px;
  --radius-small: 6px;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0f634a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page-bg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

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

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button,
a,
input,
textarea,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-small);
  color: #fff;
  background: var(--text);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  width: var(--sidebar-width);
  height: 100vh;
  min-height: 560px;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: #fbfcfb;
}

.sidebar-header {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px 13px 18px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  border-radius: var(--radius-small);
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid #165d49;
  border-radius: var(--radius-small);
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-small) - 1px);
  object-fit: cover;
}

.brand-mark.has-custom-icon {
  overflow: hidden;
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: none;
}

.brand-mark.has-custom-icon svg {
  display: none;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.sidebar-close,
button.mobile-menu-button {
  display: none;
}

.sidebar-section-label {
  padding: 19px 20px 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.primary-navigation {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 10px 16px;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.navigation-loading {
  display: grid;
  gap: 13px;
  padding: 12px 10px;
}

.skeleton-line {
  display: block;
  width: 74%;
  height: 9px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-strong);
}

.skeleton-line-wide {
  width: 92%;
}

.skeleton-line-short {
  width: 56%;
}

.nav-capability,
.nav-group,
[data-nav-level="capability"] {
  margin: 2px 0 8px;
}

.nav-disclosure,
.nav-capability-button,
.nav-group-trigger,
[data-nav-trigger="capability"] {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 0;
  border-radius: var(--radius-small);
  color: #303b35;
  background: transparent;
  font-weight: 650;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}

.nav-disclosure:hover,
.nav-capability-button:hover,
.nav-group-trigger:hover,
[data-nav-trigger="capability"]:hover {
  color: var(--text);
  background: #f0f3f1;
}

.nav-disclosure > svg:first-child,
.nav-capability-button > svg:first-child,
.nav-group-trigger > svg:first-child {
  width: 17px;
  height: 17px;
  color: var(--text-secondary);
}

.nav-chevron,
.nav-disclosure > svg:last-child,
.nav-capability-button > svg:last-child,
.nav-group-trigger > svg:last-child {
  width: 15px;
  height: 15px;
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 150ms ease;
}

[aria-expanded="false"] > .nav-chevron,
.nav-disclosure[aria-expanded="false"] > svg:last-child,
.nav-capability-button[aria-expanded="false"] > svg:last-child,
.nav-group-trigger[aria-expanded="false"] > svg:last-child,
.nav-provider-button[aria-expanded="false"] > svg:last-child,
.nav-subgroup-trigger[aria-expanded="false"] > svg:last-child {
  transform: rotate(-90deg);
}

.nav-capability-content,
.nav-group-content,
[data-nav-children] {
  display: grid;
  gap: 3px;
  margin: 1px 0 4px 14px;
  padding-left: 11px;
  border-left: 1px solid var(--border);
}

.nav-provider,
.nav-subgroup,
[data-nav-level="provider"] {
  min-width: 0;
}

.nav-provider-button,
.nav-subgroup-trigger,
[data-nav-trigger="provider"] {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 620;
  text-align: left;
}

.nav-provider-button:hover,
.nav-subgroup-trigger:hover,
[data-nav-trigger="provider"]:hover {
  color: var(--text);
  background: #f1f4f2;
}

.nav-provider-button svg,
.nav-subgroup-trigger svg {
  width: 14px;
  height: 14px;
  margin-left: auto;
}

.nav-project-list,
.nav-projects,
[data-nav-projects] {
  display: grid;
  gap: 2px;
  margin: 1px 0 5px;
}

.nav-project,
.nav-project-button,
[data-project-id] {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 36px;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 11px;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}

.nav-project:hover,
.nav-project-button:hover,
[data-project-id]:hover {
  color: var(--text);
  background: #f0f3f1;
}

.nav-project.is-active,
.nav-project-button.is-active,
.nav-project[aria-current="page"],
.nav-project-button[aria-current="page"],
[data-project-id].is-active,
[data-project-id][aria-current="page"] {
  color: #105741;
  background: var(--accent-soft);
  font-weight: 650;
}

.nav-project.is-active::before,
.nav-project-button.is-active::before,
.nav-project[aria-current="page"]::before,
[data-project-id].is-active::before,
[data-project-id][aria-current="page"]::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -12px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
  content: "";
}

.nav-project-icon {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  background: var(--surface);
}

.nav-project-icon svg {
  width: 11px;
  height: 11px;
}

.nav-project-name {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: #fbfcfb;
}

.sidebar-action {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
}

.sidebar-action:hover {
  color: var(--text);
  background: #f0f3f1;
}

.sidebar-action svg {
  width: 17px;
  height: 17px;
}

.sidebar-count {
  min-width: 23px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-strong);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.connection-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #98a19c;
  box-shadow: 0 0 0 3px rgba(123, 133, 127, 0.12);
}

.connection-dot.is-connected,
.is-connected .connection-dot {
  background: #28906e;
  box-shadow: 0 0 0 3px rgba(40, 144, 110, 0.13);
}

.connection-dot.is-error,
.is-error .connection-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(181, 64, 59, 0.12);
}

.connection-dot.is-pending,
.is-pending .connection-dot {
  background: #d08a2e;
  box-shadow: 0 0 0 3px rgba(208, 138, 46, 0.13);
}

.local-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 7px 7px 2px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.local-note svg {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: var(--warning);
}

.app-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-leading,
.topbar-actions,
.project-title-row,
.project-meta,
.workspace-quick-actions,
.result-actions,
.error-actions,
.form-actions,
.upload-limits,
.progress-meta,
.video-result-meta {
  display: flex;
  align-items: center;
}

.topbar-leading {
  min-width: 0;
  gap: 12px;
}

.project-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.project-title-row {
  min-width: 0;
  gap: 8px;
}

.project-title-row h1 {
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  font-weight: 680;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-status-badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  font-size: 10px;
  line-height: 17px;
}

.project-meta {
  min-width: 0;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.meta-divider {
  width: 3px;
  height: 3px;
  flex: 0 0 3px;
  border-radius: 50%;
  background: var(--border-strong);
}

.model-name {
  overflow: hidden;
  max-width: min(34vw, 360px);
  font-family: var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.connection-status {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}

.connection-status:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-subtle);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.icon-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-strong);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.small-button {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.small-button svg {
  width: 15px;
  height: 15px;
}

.main-content {
  min-width: 0;
  padding: 25px 24px 36px;
}

.workspace-intro {
  display: flex;
  max-width: 1680px;
  min-height: 54px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 17px;
}

.workspace-intro h2,
.drawer-header h2,
.dialog-header h2,
.preview-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 680;
  line-height: 1.3;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}

.workspace-quick-actions {
  gap: 8px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.84fr) minmax(420px, 1.16fr);
  max-width: 1680px;
  min-width: 0;
  align-items: stretch;
  gap: 16px;
  margin: 0 auto;
}

.workspace-grid:has(.session-panel:not([hidden])) {
  grid-template-columns: minmax(190px, 220px) minmax(310px, 0.78fr) minmax(380px, 1.22fr);
}

.work-panel,
.session-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.work-panel {
  display: flex;
  min-height: 650px;
  flex-direction: column;
}

.session-panel {
  display: flex;
  min-height: 650px;
  flex-direction: column;
  background: #fafbfa;
}

.panel-heading {
  display: flex;
  min-height: 68px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--border);
}

.panel-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 680;
  line-height: 1.35;
}

.compact-heading {
  min-height: 68px;
  padding-inline: 13px;
}

.compact-heading p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.state-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  font-size: 10px;
  font-weight: 650;
}

.state-pill[data-state="uploading"],
.state-pill[data-state="submitting"],
.state-pill[data-state="polling"] {
  border-color: #c7dbe6;
  color: var(--info);
  background: var(--info-soft);
}

.state-pill[data-state="completed"] {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.state-pill[data-state="failed"] {
  border-color: #ecc7c4;
  color: var(--danger);
  background: var(--danger-soft);
}

.state-pill[data-state="cancelled"] {
  color: var(--warning);
  background: var(--warning-soft);
}

.task-form-container {
  min-height: 0;
  flex: 1 1 auto;
}

.task-form {
  display: flex;
  min-height: 580px;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

.field {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field-label,
.field-label-row {
  color: #354039;
  font-size: 12px;
  font-weight: 650;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.optional-label,
.requirement-label {
  font-size: 10px;
  font-weight: 550;
}

.optional-label {
  color: var(--text-muted);
}

.requirement-label {
  color: var(--warning);
}

.field input:not([type="range"]):not([type="checkbox"]):not([type="file"]),
.field textarea,
.field select,
.history-toolbar select,
.search-field {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  color: var(--text);
  background: var(--surface);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.field input:not([type="range"]):not([type="checkbox"]):not([type="file"]),
.field select,
.history-toolbar select {
  height: 40px;
  padding: 0 11px;
}

.field textarea {
  min-height: 82px;
  max-height: 360px;
  padding: 10px 11px;
  line-height: 1.55;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.search-field input::placeholder {
  color: #9ba39f;
  opacity: 1;
}

.field input:not([type="range"]):not([type="checkbox"]):not([type="file"]):hover,
.field textarea:hover,
.field select:hover,
.history-toolbar select:hover,
.search-field:hover {
  border-color: #aebbb3;
}

.field input:not([type="range"]):not([type="checkbox"]):not([type="file"]):focus,
.field textarea:focus,
.field select:focus,
.history-toolbar select:focus,
.search-field:focus-within {
  border-color: var(--accent);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--danger);
}

.field small {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.field small code {
  padding: 1px 3px;
  border-radius: 3px;
  color: #3c4c43;
  background: var(--surface-strong);
  font-family: var(--font-mono);
}

.field-counter {
  position: absolute;
  right: 10px;
  bottom: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.9);
  font-size: 9px;
  pointer-events: none;
}

.field:has(.field-counter) textarea {
  padding-bottom: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.compact-grid {
  gap: 13px;
}

.field-span-2 {
  grid-column: span 2;
}

/* Image dimensions are intentionally split into independent, capability-driven choices. */
.image-size-panel,
.image-option-section {
  min-width: 0;
  margin: 0;
  border: 0;
}

.image-size-panel {
  display: grid;
  gap: 15px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.image-size-panel > legend {
  width: auto;
  padding: 0 4px;
}

.image-option-section {
  display: grid;
  gap: 7px;
  padding: 0;
}

.image-option-label {
  padding: 0;
  color: #354039;
  font-size: 11px;
  font-weight: 650;
}

.image-choice-grid {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.image-orientation-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-ratio-options {
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
}

.image-resolution-options {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.image-choice {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 38px;
  align-items: stretch;
  justify-content: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.image-choice:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: #fff;
}

.image-choice.is-selected,
.image-choice:has(.image-choice-input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.image-choice:has(.image-choice-input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.image-choice.is-disabled,
.image-choice:has(.image-choice-input:disabled) {
  cursor: not-allowed;
  opacity: 0.5;
}

.image-choice-content {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 6px 5px;
  text-align: center;
}

.image-choice-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.image-choice-input:focus-visible + .image-choice-content,
.image-choice-input:focus-visible ~ .image-choice-content {
  border-radius: 4px;
  box-shadow: var(--focus-ring);
}

.image-choice-name {
  min-width: 0;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
}

.image-choice > .image-choice-name {
  display: grid;
  width: 100%;
  min-height: 36px;
  place-items: center;
  padding: 6px;
}

.image-choice-meta {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orientation-choice {
  min-height: 62px;
}

.orientation-glyph {
  display: block;
  width: 17px;
  height: 17px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.orientation-glyph-landscape {
  width: 23px;
  height: 15px;
}

.orientation-glyph-portrait {
  width: 13px;
  height: 22px;
}

.image-option-hint {
  min-height: 15px;
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.image-request-summary {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.image-request-summary-label {
  color: var(--text-muted);
  font-size: 10px;
}

.image-request-summary-value {
  min-width: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-align: right;
}

.image-legacy-dimension-controls {
  display: none !important;
}

.image-gpt-options {
  min-width: 0;
}

#image-output-compression-field {
  grid-column: span 2;
}

.image-quantity-field {
  gap: 5px;
}

.image-quantity-field input[type="range"] {
  margin-top: 0;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font: 9px/1 var(--font-mono);
}

input[type="range"] {
  width: 100%;
  height: 36px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

output {
  min-width: 30px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}

.toggle-row {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.compact-toggle {
  margin-top: -2px;
}

.toggle-row > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.toggle-row strong {
  color: #354039;
  font-size: 12px;
  font-weight: 650;
}

.toggle-row small {
  color: var(--text-muted);
  font-size: 10px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch > span {
  position: relative;
  display: block;
  width: 38px;
  height: 22px;
  border: 1px solid #b8c1bc;
  border-radius: 999px;
  background: #dce1de;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.switch > span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(18, 31, 24, 0.25);
  content: "";
  transition: transform 150ms ease;
}

.switch input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.switch input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

.switch input:disabled + span {
  opacity: 0.55;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, transform 100ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button svg {
  width: 16px;
  height: 16px;
}

.button-primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button-secondary {
  border-color: var(--border-strong);
  color: #344038;
  background: var(--surface);
}

.button-secondary:hover {
  border-color: #aebbb3;
  background: var(--surface-strong);
}

.button-ghost,
.button-danger-ghost {
  border-color: transparent;
  background: transparent;
}

.button-ghost {
  color: var(--text-secondary);
}

.button-ghost:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.button-danger-ghost {
  color: var(--danger);
}

.button-danger-ghost:hover {
  border-color: #efcfcd;
  color: var(--danger-hover);
  background: var(--danger-soft);
}

.button-light {
  border-color: rgba(255, 255, 255, 0.65);
  color: var(--text);
  background: #fff;
}

.form-actions {
  min-height: 48px;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.footer-spacer {
  flex: 1 1 auto;
}

.upload-field {
  gap: 9px;
}

.drop-zone {
  display: grid;
  min-height: 126px;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 15px;
  border: 1px dashed #b9c5be;
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: var(--surface-subtle);
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone.is-validating {
  cursor: progress;
  opacity: 0.72;
}

.drop-zone:not([data-selection-count="0"]) {
  border-style: solid;
  border-color: var(--accent-border);
}

.drop-zone:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.drop-zone:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.drop-zone-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-small);
  color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone-icon svg {
  width: 17px;
  height: 17px;
}

.drop-zone strong {
  color: #344038;
  font-size: 12px;
}

.drop-zone small {
  color: var(--text-muted);
  font-size: 10px;
}

.drop-zone-compact {
  min-height: 92px;
  grid-template-columns: 34px auto;
  justify-content: center;
  text-align: left;
}

.drop-zone-compact small {
  grid-column: 2;
  margin-top: -5px;
}

.file-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.file-list[hidden] {
  display: none;
}

.file-selection-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.file-selection-summary {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 620;
  line-height: 1.45;
}

.file-clear {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
  font: inherit;
  font-size: 10px;
}

.file-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.file-clear:focus-visible,
.file-remove:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.file-clear svg,
.file-remove svg {
  width: 16px;
  height: 16px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 8px;
  min-width: 0;
}

.file-list.is-single .file-grid {
  grid-template-columns: minmax(0, 1fr);
}

.file-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 44px;
  min-width: 0;
  min-height: 72px;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.file-thumbnail {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--surface-strong);
}

.file-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-order {
  position: absolute;
  top: 3px;
  left: 3px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding-inline: 4px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 3px;
  color: #fff;
  background: rgba(20, 32, 26, 0.78);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.file-meta {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.file-meta strong,
.file-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta strong {
  font-size: 11px;
  font-weight: 620;
}

.file-meta span {
  color: var(--text-muted);
  font-size: 9px;
}

.file-remove {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
}

.file-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.session-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 9px;
}

.session-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 7px;
  min-width: 0;
  padding: 9px 8px 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: transparent;
}

.session-item:hover {
  background: var(--surface-strong);
}

.session-item.is-active,
.session-item[aria-current="true"] {
  border-color: var(--accent-border);
  color: var(--text);
  background: var(--accent-soft);
}

.session-select {
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.session-title,
.session-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-title {
  font-size: 11px;
  font-weight: 650;
}

.session-preview {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9px;
}

.session-delete {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  align-self: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  opacity: 0;
}

.session-item:hover .session-delete,
.session-delete:focus-visible {
  opacity: 1;
}

.session-delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.panel-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-height: 220px;
  padding: 28px;
  color: var(--text-muted);
  text-align: center;
}

.panel-empty svg {
  width: 24px;
  height: 24px;
  margin-bottom: 5px;
  color: #a3ada7;
}

.panel-empty p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.panel-empty span {
  font-size: 10px;
}

.compact-empty {
  min-height: 160px;
  margin: auto 0;
  padding: 18px;
}

.result-panel {
  background: #fbfcfb;
}

.result-heading {
  background: var(--surface);
}

.result-actions {
  gap: 5px;
}

.result-stage {
  position: relative;
  display: flex;
  min-height: 580px;
  flex: 1 1 auto;
  overflow: hidden;
}

.result-state {
  width: 100%;
}

.result-task-queue {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
}

.task-queue-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.task-queue-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 680;
}

.task-queue-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.task-queue-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.task-queue-actions .button {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 10px;
}

.task-queue-capacity {
  height: 5px;
  margin: 12px 0 2px;
  overflow: hidden;
  border-radius: 3px;
  background: #dfe6e2;
}

.task-queue-capacity span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.task-queue-list {
  display: grid;
  align-content: start;
}

.generation-task-row {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.generation-task-row:last-child {
  border-bottom: 0;
}

.generation-task-header,
.generation-task-heading,
.generation-task-actions,
.generation-task-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.generation-task-header {
  justify-content: space-between;
}

.generation-task-heading {
  overflow: hidden;
}

.generation-task-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.generation-task-index {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-muted);
  background: var(--surface-subtle);
  font: 10px var(--font-mono);
}

.generation-task-status {
  display: inline-flex;
  min-height: 22px;
  flex: 0 0 auto;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  font-size: 9px;
  font-weight: 650;
}

.generation-task-status[data-status="running"],
.generation-task-status[data-status="queued"] {
  border-color: #c7dbe6;
  color: var(--info);
  background: var(--info-soft);
}

.generation-task-status[data-status="completed"] {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.generation-task-status[data-status="failed"] {
  border-color: #ecc7c4;
  color: var(--danger);
  background: var(--danger-soft);
}

.generation-task-status[data-status="cancelled"] {
  color: var(--warning);
  background: var(--warning-soft);
}

.generation-task-prompt {
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-task-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 3px;
  background: #e2e8e4;
}

.generation-task-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.generation-task-meta {
  flex-wrap: wrap;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
}

.generation-task-message {
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.generation-task-message.is-error {
  color: var(--danger);
}

.generation-task-actions {
  justify-content: flex-end;
}

.generation-task-actions .button,
.generation-task-actions .icon-button {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 10px;
}

.generation-task-actions .icon-button {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.generation-task-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.generation-task-image {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
  aspect-ratio: 1 / 1;
}

.generation-task-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.generation-task-image-actions {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: flex;
  gap: 4px;
}

.generation-task-image-actions .icon-button {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-color: rgba(255, 255, 255, 0.72);
  color: #fff;
  background: rgba(18, 28, 23, 0.82);
}

/* Task-local telemetry stays with the generated media so each result has an
   unambiguous request and response context. */
.generation-task-timing {
  display: flex;
  min-width: 0;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.generation-task-timing-item {
  display: grid;
  min-width: 112px;
  flex: 1 1 112px;
  align-content: center;
  gap: 2px;
  padding: 8px 10px;
  border-right: 1px solid var(--border);
}

.generation-task-timing-item:last-child {
  border-right: 0;
}

.generation-task-timing-item > span,
.generation-task-timing-item > small,
.generation-task-timing-item > label {
  min-width: 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
}

.generation-task-timing-item > strong,
.generation-task-timing-item > time,
.generation-task-timing-item > output {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font: 10px/1.4 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-task-timing-item > output {
  color: var(--accent);
  font-weight: 650;
}

.generation-task-debug {
  display: block;
  min-width: 0;
  margin-top: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.generation-task-debug-summary {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  padding: 8px 10px;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  cursor: pointer;
  list-style: none;
}

.generation-task-debug-summary::-webkit-details-marker {
  display: none;
}

.generation-task-debug-summary::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
  transform: rotate(-45deg) translate(-1px, -1px);
  transition: transform 140ms ease;
}

.generation-task-debug[open] > .generation-task-debug-summary::before {
  transform: rotate(45deg) translate(-1px, -1px);
}

.generation-task-debug-summary:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.generation-task-debug-heading {
  display: grid;
  min-width: 0;
  flex: 1 1 150px;
  gap: 2px;
}

.generation-task-debug-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-task-debug-heading span,
.generation-task-debug-heading small {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font: 9px/1.35 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-task-debug-status {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  min-height: 22px;
  flex: 0 1 auto;
  align-items: center;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-task-debug-status[data-status="success"],
.generation-task-debug-status[data-status="completed"] {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.generation-task-debug-status[data-status="error"],
.generation-task-debug-status[data-status="failed"] {
  border-color: #ecc7c4;
  color: var(--danger);
  background: var(--danger-soft);
}

.generation-task-debug-status[data-status="running"],
.generation-task-debug-status[data-status="pending"] {
  border-color: #c7dbe6;
  color: var(--info);
  background: var(--info-soft);
}

.generation-task-debug-body {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.generation-task-debug-exchanges {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.generation-task-debug-exchange {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-subtle);
}

.generation-task-debug-exchange > summary {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 8px 9px;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  list-style-position: inside;
}

.generation-task-debug-exchange > summary:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.generation-task-debug-section {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.generation-task-debug-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.generation-task-debug-section > strong,
.generation-task-debug-section > h5,
.generation-task-debug-section > h6,
.generation-task-debug-section > summary {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 680;
  line-height: 1.4;
}

.generation-task-debug-section > summary {
  cursor: pointer;
  list-style-position: inside;
}

.generation-task-debug-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.generation-task-debug-actions .button,
.generation-task-debug-actions .icon-button {
  min-width: 0;
  max-width: 100%;
}

.generation-task-debug-actions .button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.generation-task-debug-actions .icon-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.generation-task-debug-code {
  display: block;
  width: 100%;
  min-width: 0;
  max-height: 250px;
  margin: 0;
  padding: 9px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  background: #f7f9f7;
  font: 10px/1.55 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: copy;
}

.generation-task-debug-code:empty {
  display: none;
}

.generation-task-video {
  width: 100%;
  max-height: 260px;
  border: 1px solid #29332e;
  border-radius: var(--radius-small);
  background: #111814;
  aspect-ratio: 16 / 9;
}

.generation-task-videos,
.video-result-variants {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.generation-task-video-item,
.video-result-variant {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.generation-task-video-language,
.video-result-variant-heading strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.video-result-variant-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.video-result-variant-heading span {
  min-width: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-result-variant-player {
  width: 100%;
  max-height: 300px;
  border: 1px solid #29332e;
  border-radius: var(--radius-small);
  background: #111814;
  aspect-ratio: 16 / 9;
}

.result-empty,
.result-progress,
.result-error {
  display: grid;
  min-height: 100%;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 42px 30px;
  text-align: center;
}

.empty-icon,
.error-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--surface);
}

.empty-icon svg,
.error-icon svg {
  width: 22px;
  height: 22px;
}

.result-empty h4,
.result-progress h4,
.result-error h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 680;
}

.result-empty p,
.result-progress p,
.result-error > p {
  max-width: 380px;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.progress-visual {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.progress-visual span {
  width: 5px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  animation: activity-bar 900ms ease-in-out infinite alternate;
}

.progress-visual span:nth-child(2) {
  animation-delay: 160ms;
}

.progress-visual span:nth-child(3) {
  animation-delay: 320ms;
}

@keyframes activity-bar {
  from { transform: scaleY(0.42); opacity: 0.5; }
  to { transform: scaleY(1); opacity: 1; }
}

.progress-track {
  width: min(320px, 100%);
  height: 5px;
  overflow: hidden;
  margin-top: 15px;
  border-radius: 3px;
  background: #dfe6e2;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 250ms ease;
}

.progress-meta {
  width: min(320px, 100%);
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 10px;
}

.result-progress .button {
  margin-top: 16px;
}

.error-icon {
  border-color: #efcfcd;
  color: var(--danger);
  background: var(--danger-soft);
}

.error-actions {
  gap: 7px;
  margin-top: 13px;
}

.error-details {
  width: min(430px, 100%);
  margin-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: left;
}

.error-details summary {
  padding: 10px 2px;
  font-size: 10px;
  cursor: pointer;
}

.error-details pre {
  max-height: 150px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: #4f5853;
  background: var(--surface);
  font: 10px/1.5 var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.result-content {
  width: 100%;
  min-width: 0;
  overflow: auto;
  padding: 18px;
}

.text-result {
  min-height: 100%;
  margin: 0;
  color: #27312b;
  font: 13px/1.75 var(--font-sans);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 17px;
}

.chat-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  max-width: 100%;
}

.chat-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
}

.chat-message.is-assistant .chat-avatar,
.chat-message.assistant .chat-avatar {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.chat-avatar svg {
  width: 15px;
  height: 15px;
}

.message-content {
  min-width: 0;
}

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.message-meta strong {
  font-size: 11px;
}

.message-meta time {
  color: var(--text-muted);
  font-size: 9px;
}

.message-text,
.message-bubble {
  margin: 0;
  color: #303a34;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.is-user .message-text,
.chat-message.user .message-text,
.chat-message.is-user .message-bubble,
.chat-message.user .message-bubble {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
}

.image-result-item,
.image-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-strong);
  aspect-ratio: 1 / 1;
  margin: 0;
}

.session-actions {
  display: flex;
  align-self: center;
  gap: 2px;
}

.session-actions .session-delete {
  opacity: 1;
}

.history-copy {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.chat-message.is-pending {
  opacity: 0.72;
}

.image-result-item img,
.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-item-actions,
.image-tile-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.image-result-item:hover .image-item-actions,
.image-result-item:focus-within .image-item-actions,
.image-tile:hover .image-tile-actions,
.image-tile:focus-within .image-tile-actions {
  opacity: 1;
  transform: translateY(0);
}

.image-item-actions .icon-button,
.image-tile-actions .icon-button {
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
  background: rgba(18, 28, 23, 0.82);
  backdrop-filter: blur(6px);
}

.video-result {
  display: grid;
  gap: 15px;
}

.video-frame {
  position: relative;
  display: grid;
  width: 100%;
  overflow: hidden;
  place-items: center;
  border: 1px solid #29332e;
  border-radius: var(--radius);
  background: #111814;
  aspect-ratio: 16 / 9;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #aebbb4;
  font-size: 11px;
}

.video-placeholder svg {
  width: 26px;
  height: 26px;
}

.video-result-meta {
  gap: 12px;
}

.video-result-meta > div {
  display: grid;
  min-width: 0;
  flex: 1 1 0;
  gap: 3px;
  padding: 10px 11px;
  border-left: 2px solid var(--border-strong);
}

.video-result-meta span {
  color: var(--text-muted);
  font-size: 9px;
}

.video-result-meta strong {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-download-status {
  min-width: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.video-download-status[data-status="saved"] { color: #2f7d57; }
.video-download-status[data-status="expired"],
.video-download-status[data-status="failed"] { color: #a84a42; }

.video-result-actions,
.settings-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.settings-inline-actions .field-hint {
  min-width: 0;
  flex: 1 1 240px;
  overflow-wrap: anywhere;
}

.settings-inline-actions .button {
  flex: 0 0 auto;
}

.audio-result {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}

.audio-player-shell {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.audio-result-icon,
.voice-resource-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-small);
  color: var(--accent);
  background: var(--surface);
}

.audio-result-icon svg {
  width: 21px;
  height: 21px;
}

.audio-player-content {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.audio-player-content strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-player-content audio,
.generation-task-audio {
  display: block;
  width: 100%;
  min-width: 0;
  height: 38px;
}

.audio-result-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.audio-result-meta > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 9px 10px;
  border-left: 2px solid var(--accent-border);
  background: var(--surface-subtle);
}

.audio-result-meta span {
  color: var(--text-muted);
  font-size: 9px;
}

.audio-result-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font: 10px var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-use-menu {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.audio-use-menu > summary {
  list-style: none;
}

.audio-use-menu > summary::-webkit-details-marker {
  display: none;
}

.audio-use-menu > summary svg:last-child {
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

.audio-use-options {
  position: absolute;
  z-index: 4;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  min-width: 190px;
  max-width: min(260px, calc(100vw - 48px));
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.audio-use-options button {
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 4px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.audio-use-options button:hover,
.audio-use-options button:focus-visible {
  color: var(--text);
  background: var(--surface-strong);
}

.voice-resource-result {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.resource-result-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.resource-result-heading > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
}

.resource-result-heading strong {
  font-size: 13px;
  font-weight: 680;
}

.resource-result-heading span {
  color: var(--text-muted);
  font-size: 10px;
}

.voice-resource-list {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.voice-resource-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.voice-resource-item:has(> .voice-resource-body:first-child) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.voice-resource-icon {
  width: 38px;
  height: 38px;
  border-color: var(--border);
  color: var(--text-secondary);
  background: var(--surface);
}

.voice-resource-icon svg {
  width: 17px;
  height: 17px;
}

.voice-resource-body {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.voice-resource-body strong,
.voice-resource-body code,
.voice-resource-body span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-resource-body strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 680;
}

.voice-resource-body code {
  color: var(--text-secondary);
  font: 9px var(--font-mono);
}

.voice-resource-body span {
  color: var(--text-muted);
  font-size: 9px;
}

.voice-resource-body span.is-warning {
  color: var(--warning);
}

.voice-resource-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.voice-resource-actions .icon-button {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.voice-resource-actions .icon-button.is-danger {
  color: var(--danger);
}

.voice-resource-actions .icon-button.is-danger:hover {
  border-color: #efcfcd;
  background: var(--danger-soft);
}

.voice-resource-empty {
  margin: 0;
  padding: 32px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-small);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.generation-task-audio {
  margin-top: 2px;
  border-radius: var(--radius-small);
}

.generation-task-actions {
  flex-wrap: wrap;
}

.audio-target-dialog {
  width: min(480px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.compact-dialog-header {
  min-height: 68px;
  padding: 13px 16px;
}

.compact-dialog-header h2 {
  font-size: 18px;
}

.audio-target-options {
  display: grid;
  gap: 7px;
  padding: 14px 16px 16px;
}

.audio-target-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 17px;
  min-width: 0;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface-subtle);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.audio-target-option:hover {
  border-color: var(--accent-border);
  color: var(--text);
  background: var(--accent-soft);
}

.audio-target-option:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.audio-target-option > svg:first-child {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

.audio-target-option > svg:last-child {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.audio-target-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.audio-target-option strong,
.audio-target-option small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.audio-target-option strong {
  color: inherit;
  font-size: 12px;
  font-weight: 680;
}

.audio-target-option small {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
}

.history-panel {
  position: fixed;
  z-index: 70;
  top: 0;
  right: 0;
  display: flex;
  width: min(420px, 100vw);
  height: 100vh;
  min-height: 520px;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 190ms ease, visibility 190ms step-end;
}

.history-panel.is-open,
.history-panel[aria-hidden="false"] {
  transform: translateX(0);
  visibility: visible;
  transition: transform 190ms ease, visibility 0s step-start;
}

.utility-overlay,
.page-overlay {
  position: fixed;
  z-index: 60;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(17, 25, 21, 0.38);
  backdrop-filter: blur(1px);
}

.page-overlay {
  z-index: 35;
}

.drawer-header,
.dialog-header,
.preview-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-field {
  display: flex;
  height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.search-field svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.history-toolbar select {
  height: 38px;
  font-size: 11px;
}

.history-list {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px;
}

.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.history-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.history-thumb,
.history-kind {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-small);
  color: var(--accent);
  background: var(--accent-soft);
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-kind svg {
  width: 17px;
  height: 17px;
}

.history-copy {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
}

.history-copy strong,
.history-copy p,
.history-copy span {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy strong {
  font-size: 11px;
  font-weight: 650;
}

.history-copy p {
  color: var(--text-secondary);
  font-size: 10px;
}

.history-copy span {
  color: var(--text-muted);
  font-size: 9px;
}

.history-item-menu {
  align-self: center;
}

.history-item-actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 4px;
}

.history-empty {
  flex: 1 1 auto;
}

.drawer-footer {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

dialog {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
}

dialog::backdrop {
  background: rgba(17, 25, 21, 0.42);
  backdrop-filter: blur(2px);
}

.settings-dialog {
  width: min(720px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.settings-form {
  display: flex;
  max-height: calc(100vh - 32px);
  flex-direction: column;
}

.dialog-header {
  flex: 0 0 auto;
  padding-inline: 20px;
}

.security-notice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  margin: 14px 20px 0;
  padding: 10px 12px;
  border: 1px solid #ecd8ad;
  border-radius: var(--radius-small);
  color: #77501b;
  background: var(--warning-soft);
}

.security-notice > svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.security-notice strong {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
}

.security-notice p {
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.settings-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  overflow-x: auto;
  margin: 12px 20px 0;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  min-width: 98px;
  min-height: 33px;
  flex: 1 0 auto;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 11px;
  font-weight: 630;
}

.settings-tab:hover {
  color: var(--text);
}

.settings-tab.is-active,
.settings-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.settings-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 20px 22px;
}

.settings-panel {
  min-width: 0;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.settings-section-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 680;
}

.settings-section-heading p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.provider-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.provider-openai {
  color: #275e4c;
  background: #edf5f1;
}

.provider-branding {
  color: #315d59;
  background: #edf5f4;
}

.provider-gemini {
  color: #3d6080;
  background: #edf4fa;
}

.provider-omni {
  color: #895622;
  background: #fff4e6;
}

.provider-likeadmin {
  color: #35645f;
  background: #edf7f3;
}

.provider-minimax {
  color: #7b4b35;
  background: #fff1e8;
}

.provider-minimax svg {
  width: 16px;
  height: 16px;
}

.provider-heygen {
  color: #5d4d35;
  background: #fff7e8;
}

.provider-heygen svg {
  width: 16px;
  height: 16px;
}

.heygen-settings-note {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  gap: 9px;
  margin-top: 16px;
  padding: 10px 11px;
  border: 1px solid #ead8b2;
  border-radius: var(--radius-small);
  color: #74541e;
  background: var(--warning-soft);
  font-size: 10px;
  line-height: 1.55;
}

.heygen-settings-note svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.application-workflow-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.application-workflow-heading h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
}

.application-workflow-heading p {
  max-width: 560px;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.application-video-form .field[hidden],
.application-video-form [data-app-field][hidden],
.application-video-form [data-app-fields][hidden] {
  display: none;
}

.application-video-form .wan-role-options {
  margin-top: 8px;
}

.application-video-form .wan-role-options .field-label {
  font-size: 11px;
}

.application-video-form .drop-zone-compact {
  min-width: 0;
}

/* Audio and voice workflows share the task form, but need a quieter hierarchy
   for the many optional synthesis controls and management actions. */
.audio-workflow-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.audio-workflow-heading h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  line-height: 1.3;
}

.audio-workflow-heading p {
  max-width: 560px;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.audio-task-form [data-audio-workflow] {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.audio-task-form [data-audio-workflow][hidden] {
  display: none;
}

.segmented-control {
  display: flex;
  min-width: 0;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-strong);
}

.segmented-control > label {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 36px;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 620;
  text-align: center;
  cursor: pointer;
}

.segmented-control > label:hover {
  color: var(--text);
}

.segmented-control > label:has(input:checked) {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.segmented-control > label:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.segmented-control > label:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.compact-segments {
  width: fit-content;
  max-width: 100%;
}

.compact-segments > label {
  min-height: 32px;
  padding-inline: 9px;
  font-size: 10px;
}

.advanced-options {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.advanced-options > summary {
  padding: 10px 11px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.advanced-options > summary::marker {
  color: var(--accent);
}

.advanced-options-body {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 0 11px 12px;
}

.audio-task-form .drop-zone {
  min-height: 112px;
}

.audio-task-form .drop-zone-compact {
  min-height: 78px;
}

.heygen-task-form {
  gap: 16px;
}

.heygen-workflow-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.heygen-workflow-heading h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  line-height: 1.3;
}

.heygen-workflow-heading p {
  max-width: 580px;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.heygen-task-form [data-heygen-avatar-source][hidden],
.heygen-task-form [data-heygen-audio-input][hidden],
.heygen-task-form [data-heygen-translation-video][hidden],
.heygen-task-form [data-heygen-lipsync-audio][hidden],
.heygen-task-form [data-heygen-avatar-action][hidden],
.heygen-task-form [data-heygen-avatar-creation][hidden],
.heygen-task-form [data-heygen-voice-workflow][hidden],
.heygen-task-form [data-heygen-proofread-step][hidden] {
  display: none;
}

.heygen-source-panel,
.heygen-task-form [data-heygen-avatar-action="create"],
.heygen-task-form [data-heygen-avatar-action="list"],
.heygen-task-form [data-heygen-avatar-action="delete"],
.heygen-task-form [data-heygen-voice-workflow] {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.heygen-task-form .drop-zone {
  min-height: 108px;
}

.heygen-task-form .drop-zone-compact {
  min-height: 78px;
}

.heygen-language-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.heygen-language-grid label {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface-subtle);
  font-size: 10px;
  cursor: pointer;
}

.heygen-language-grid label:hover {
  border-color: var(--accent-border);
  color: var(--text);
  background: var(--accent-soft);
}

.heygen-language-grid input {
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.heygen-step-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.heygen-proofread-editor {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-small);
  background: var(--accent-soft);
}

.heygen-proofread-editor[hidden] {
  display: none;
}

.heygen-proofread-editor-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.heygen-proofread-editor-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.heygen-proofread-editor-heading p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.5;
}

.heygen-proofread-editor-list {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.heygen-proofread-editor-item {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.heygen-proofread-editor-item .field-label-row,
.heygen-proofread-editor-item .field-label-row > span {
  min-width: 0;
}

.heygen-proofread-editor-item .field-label,
.heygen-proofread-editor-item .optional-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heygen-proofread-editor-item .field-label {
  flex: 0 1 auto;
}

.heygen-proofread-editor-item .optional-label {
  flex: 1 1 auto;
  text-align: right;
}

.heygen-proofread-editor-item textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 156px;
  resize: vertical;
  font: 11px/1.5 var(--font-mono);
}

.heygen-proofread-editor-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.heygen-proofread-editor-actions .toggle-row {
  flex: 1 1 260px;
  margin: 0;
}

.heygen-proofread-editor-actions .button {
  flex: 0 1 auto;
}

.heygen-resource-list {
  display: grid;
  min-height: 92px;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-small);
  color: var(--text-muted);
  background: var(--surface-subtle);
}

.heygen-resource-list:empty::before {
  display: grid;
  min-height: 74px;
  place-items: center;
  content: "执行查询后，HeyGen 资源会显示在这里";
  font-size: 10px;
}

.heygen-resource-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.heygen-resource-row:has(> .heygen-resource-thumbnail) {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.heygen-resource-body {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.heygen-resource-body strong,
.heygen-resource-body span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heygen-resource-body strong {
  color: var(--text);
  font-size: 11px;
}

.heygen-resource-body span {
  color: var(--text-muted);
  font: 9px/1.4 var(--font-mono);
}

.heygen-resource-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.heygen-resource-actions .icon-button {
  width: 30px;
  height: 30px;
}

.heygen-resource-thumbnail {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--border);
  border-radius: 5px;
  object-fit: cover;
  background: var(--surface-strong);
}

.heygen-agent-console > .advanced-options-body {
  gap: 12px;
}

.heygen-agent-toolbar {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.heygen-agent-toolbar .button {
  min-width: 0;
  flex: 1 1 132px;
}

.heygen-agent-status {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.heygen-agent-status[data-tone="success"] {
  color: var(--accent);
}

.heygen-agent-status[data-tone="warning"] {
  color: var(--warning);
}

.heygen-agent-status[data-tone="error"] {
  color: var(--danger);
}

.heygen-agent-browser-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.heygen-agent-browser-section,
.heygen-agent-session-detail,
.heygen-agent-detail-grid > section {
  min-width: 0;
}

.heygen-agent-section-heading,
.heygen-agent-session-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.heygen-agent-section-heading h4,
.heygen-agent-session-heading h4,
.heygen-agent-detail-grid h5 {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.heygen-agent-section-heading span,
.heygen-agent-session-heading p {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font: 9px/1.4 var(--font-mono);
  overflow-wrap: anywhere;
}

.heygen-agent-list {
  min-height: 104px;
  max-height: 270px;
  overflow: auto;
  overscroll-behavior: contain;
}

.heygen-agent-list .empty-description {
  align-self: center;
  margin: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

.heygen-agent-session-detail {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.heygen-agent-session-detail[hidden] {
  display: none;
}

.heygen-agent-session-heading > div {
  min-width: 0;
}

.heygen-agent-detail-grid {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.heygen-agent-detail-grid > section {
  display: grid;
  gap: 6px;
}

.heygen-agent-message-list {
  display: grid;
  min-width: 0;
  max-height: 340px;
  gap: 6px;
  overflow: auto;
  overscroll-behavior: contain;
}

.heygen-agent-message-list > .empty-description {
  margin: 0;
  padding: 14px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-small);
  text-align: center;
}

.heygen-agent-message {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.heygen-agent-message.is-user {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.heygen-agent-message > div:first-child {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px 8px;
}

.heygen-agent-message strong {
  color: var(--text);
  font-size: 10px;
}

.heygen-agent-message > div:first-child span {
  color: var(--text-muted);
  font: 9px/1.4 var(--font-mono);
}

.heygen-agent-message p {
  min-width: 0;
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.heygen-agent-message-resources {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
}

.heygen-agent-message-resources button {
  min-width: 0;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  font: 9px/1.3 var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.heygen-agent-message-resources button:hover,
.heygen-agent-message-resources button:focus-visible {
  border-color: var(--accent-border);
  color: var(--text);
}

.heygen-task-form .advanced-options {
  margin-top: 0;
}

.application-audio-source > [data-application-audio-source] {
  min-width: 0;
}

.provider-upload {
  color: #675585;
  background: #f4f0fa;
}

.provider-sync {
  color: #315d59;
  background: #edf5f4;
}

.provider-branding svg,
.provider-upload svg,
.provider-sync svg {
  width: 16px;
  height: 16px;
}

.branding-icon-editor {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding-top: 4px;
}

.branding-icon-preview {
  display: grid;
  width: 72px;
  height: 72px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #165d49;
  border-radius: var(--radius);
  color: #fff;
  background: var(--accent);
}

.branding-icon-preview svg {
  width: 28px;
  height: 28px;
}

.branding-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.branding-icon-preview.has-custom-icon {
  border-color: var(--border-strong);
  background: var(--surface);
}

.branding-icon-preview.has-custom-icon svg {
  display: none;
}

.branding-icon-controls {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.branding-icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.branding-icon-status {
  min-height: 17px;
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.branding-icon-status.is-error {
  color: var(--danger);
}

.settings-panel .toggle-row {
  margin-top: 20px;
}

.provider-debug {
  color: #6a4e1f;
  background: #fff6e6;
}

.provider-debug svg {
  width: 16px;
  height: 16px;
}

.debug-storage-summary {
  min-height: 20px;
  margin-top: 14px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-muted);
  background: var(--surface-subtle);
  font: 10px/1.5 var(--font-mono);
}

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

.debug-archive-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.debug-archive-item {
  min-width: 0;
  padding: 9px 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
  font-size: 10px;
}

.debug-request-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.task-form.showing-debug-raw > :not(.debug-request-editor):not(.form-actions) {
  display: none;
}

.debug-editor-heading,
.debug-timeline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.debug-editor-heading strong,
.debug-timeline-heading strong {
  font-size: 11px;
  font-weight: 680;
}

.debug-editor-sync {
  color: var(--text-muted);
  font-size: 9px;
}

.debug-editor-sync[data-state="dirty"] {
  color: var(--warning);
}

.debug-editor-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.debug-editor-tabs button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.debug-editor-tabs button[aria-selected="true"] {
  color: var(--text);
  background: var(--surface-subtle);
  box-shadow: var(--shadow-sm);
}

.debug-editor-raw {
  display: grid;
  gap: 10px;
}

.debug-editor-raw input,
.debug-editor-raw textarea {
  width: 100%;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 10px;
}

.debug-editor-raw textarea {
  min-height: 86px;
  resize: vertical;
}

.debug-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.debug-editor-actions .button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 10px;
}

.debug-timeline {
  display: grid;
  gap: 10px;
  margin: 12px 16px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.debug-exchange-list {
  display: grid;
  gap: 6px;
}

.debug-exchange {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.debug-exchange > summary {
  padding: 9px 10px;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
}

.debug-exchange-body {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.debug-exchange-body > pre {
  max-height: 220px;
  margin: 0;
  padding: 9px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  background: var(--surface);
  font: 10px/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: copy;
}

.debug-exchange-body .button {
  justify-self: start;
  min-height: 32px;
  padding: 6px 9px;
  font-size: 10px;
}

.debug-copy-button {
  margin-top: 2px;
}

.secret-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.secret-input-single {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.secret-input:hover {
  border-color: #aebbb3;
}

.secret-input:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field .secret-input input {
  height: 38px !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.field-icon-button {
  display: grid;
  width: 36px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
}

.field-icon-button:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.field-icon-button svg {
  width: 14px;
  height: 14px;
}

.upload-limits {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.upload-limits span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface-subtle);
  font-size: 10px;
}

.upload-limits svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.upload-test {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.upload-test-heading h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 680;
}

.upload-test-heading p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.upload-test-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.upload-test-file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-test-status {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.upload-test-status.is-success {
  color: var(--accent);
}

.upload-test-status.is-error {
  color: var(--danger);
}

.upload-test-result {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.upload-test-result[hidden] {
  display: none;
}

.upload-test-preview-frame {
  position: relative;
  display: grid;
  width: 112px;
  aspect-ratio: 1;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.upload-test-preview-frame img,
.upload-test-preview-frame video,
.upload-test-preview-frame audio {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upload-test-preview-frame video {
  background: #000;
}

.upload-test-preview-frame audio {
  width: calc(100% - 10px);
  height: 38px;
}

.upload-test-preview-error {
  display: grid;
  gap: 7px;
  place-items: center;
  padding: 10px;
  color: var(--danger);
  font-size: 10px;
  text-align: center;
  overflow-wrap: anywhere;
}

.upload-test-preview-error[hidden] {
  display: none;
}

.upload-test-preview-error svg {
  width: 22px;
  height: 22px;
}

.upload-test-result-body {
  min-width: 0;
}

.upload-test-result-summary {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.upload-test-result-summary strong {
  font-size: 11px;
}

.upload-test-result-summary span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-test-url-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px 38px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.upload-test-url-control:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field .upload-test-url-control input {
  min-width: 0;
  height: 38px !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.upload-test-url-control .field-icon-button {
  height: 38px;
  text-decoration: none;
}

.sync-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.sync-status {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.sync-status.is-success {
  color: var(--accent);
}

.sync-status.is-error {
  color: var(--danger);
}

.dialog-footer {
  display: flex;
  min-height: 70px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.preview-dialog {
  width: min(1120px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  background: #111714;
  box-shadow: var(--shadow-lg);
}

.preview-dialog::backdrop {
  background: rgba(6, 10, 8, 0.78);
}

.preview-dialog[open] {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 66px;
}

.preview-header {
  min-height: 64px;
  border-color: #29332e;
}

.preview-header h2 {
  font-size: 15px;
}

.inverse-button {
  border-color: #3a4540;
  color: #e5ebe7;
  background: #202824;
}

.inverse-button:hover {
  border-color: #59645e;
  color: #fff;
  background: #2b342f;
}

.preview-body {
  display: grid;
  min-height: 0;
  overflow: auto;
  place-items: center;
  padding: 18px;
}

.preview-body img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-footer {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid #29332e;
}

.toast-region {
  position: fixed;
  z-index: 120;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(18, 31, 24, 0.16);
  pointer-events: auto;
}

.toast > svg {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--accent);
}

.toast.is-error > svg {
  color: var(--danger);
}

.toast-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.toast-copy strong {
  font-size: 11px;
}

.toast-copy span {
  color: var(--text-secondary);
  font-size: 10px;
}

.toast-close {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
}

.noscript-message {
  position: fixed;
  z-index: 200;
  right: 16px;
  bottom: 16px;
  left: 16px;
  max-width: 560px;
  margin: auto;
  padding: 12px 16px;
  border: 1px solid #ecc7c4;
  border-radius: var(--radius);
  color: #7e2f2b;
  background: var(--danger-soft);
  text-align: center;
}

.inline-error {
  color: var(--danger);
  font-size: 10px;
}

.is-loading {
  pointer-events: none;
}

.is-loading > svg {
  animation: spin 700ms linear infinite;
}

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

@media (max-width: 1280px) {
  :root {
    --sidebar-width: 252px;
  }

  .topbar {
    padding-inline: 20px;
  }

  .main-content {
    padding-inline: 20px;
  }

  .workspace-grid:has(.session-panel:not([hidden])) {
    grid-template-columns: minmax(180px, 196px) minmax(300px, 0.8fr) minmax(350px, 1.2fr);
  }
}

@media (max-width: 1120px) {
  .workspace-grid,
  .workspace-grid:has(.session-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }

  .session-panel {
    min-height: 230px;
    max-height: 300px;
  }

  .work-panel {
    min-height: 560px;
  }

  .task-form,
  .result-stage {
    min-height: 490px;
  }

  .session-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-empty {
    min-height: 130px;
  }

  .image-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    width: min(292px, calc(100vw - 46px));
    max-width: 292px;
    transform: translateX(-105%);
    visibility: hidden;
    box-shadow: 14px 0 38px rgba(18, 31, 24, 0.16);
    transition: transform 190ms ease, visibility 190ms step-end;
  }

  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 190ms ease, visibility 0s step-start;
  }

  button.sidebar-close,
  button.mobile-menu-button {
    display: inline-grid;
  }

  .topbar {
    padding-inline: 16px;
  }

  .main-content {
    padding: 21px 18px 32px;
  }

  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .debug-request-editor {
    padding: 10px;
  }

  .debug-editor-tabs {
    width: 100%;
  }

  .debug-editor-tabs button {
    flex: 1 1 0;
  }

  .debug-timeline {
    margin-inline: 10px;
  }

  .debug-archive-actions .button {
    flex: 1 1 auto;
  }

  :root {
    --topbar-height: 64px;
  }

  .topbar {
    gap: 9px;
    padding-inline: 12px;
  }

  .topbar-leading {
    gap: 9px;
  }

  .project-title-row h1 {
    max-width: 42vw;
    font-size: 14px;
  }

  .project-status-badge,
  .project-meta {
    display: none;
  }

  .connection-status {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .connection-status > span:last-child {
    display: none;
  }

  .desktop-history-button {
    display: none;
  }

  .main-content {
    padding: 17px 12px 26px;
  }

  .workspace-intro {
    min-height: 50px;
    align-items: center;
    margin-bottom: 13px;
  }

  .workspace-intro h2 {
    max-width: 55vw;
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-quick-actions {
    flex: 0 0 auto;
  }

  .workspace-quick-actions .button {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .workspace-quick-actions .button span {
    display: none;
  }

  .workspace-grid {
    gap: 12px;
  }

  .work-panel {
    min-height: 510px;
  }

  .panel-heading {
    min-height: 60px;
    padding: 11px 14px;
  }

  .task-form {
    min-height: 450px;
    gap: 15px;
    padding: 15px 14px;
  }

  .result-stage {
    min-height: 440px;
  }

  .result-content {
    padding: 14px;
  }

  .audio-workflow-heading {
    gap: 10px;
  }

  .audio-task-form [data-audio-workflow] {
    gap: 13px;
  }

  .segmented-control {
    width: 100%;
  }

  .compact-segments {
    width: 100%;
  }

  .compact-segments > label {
    padding-inline: 6px;
  }

  .audio-result {
    max-width: none;
  }

  .audio-player-shell {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    padding: 11px;
  }

  .audio-result-icon {
    width: 36px;
    height: 36px;
  }

  .audio-result-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .audio-use-menu {
    width: 100%;
  }

  .audio-use-menu > summary {
    width: 100%;
  }

  .audio-use-options {
    right: 0;
    left: auto;
    min-width: 0;
    width: 100%;
  }

  .voice-resource-item {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .voice-resource-icon {
    width: 34px;
    height: 34px;
  }

  .voice-resource-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 5px;
    border-top: 1px solid var(--border);
  }

  .audio-target-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .audio-target-options {
    padding: 12px;
  }

  .result-task-queue {
    padding: 14px;
  }

  .task-queue-header {
    align-items: stretch;
    flex-direction: column;
  }

  .task-queue-actions {
    justify-content: flex-start;
  }

  .generation-task-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .generation-task-timing-item {
    min-width: 100px;
    flex-basis: 100px;
    padding: 7px 8px;
  }

  .generation-task-timing-item:nth-child(2n) {
    border-right: 0;
  }

  .generation-task-timing-item:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .generation-task-debug-summary {
    align-items: flex-start;
    padding: 8px;
  }

  .generation-task-debug-heading {
    flex-basis: calc(100% - 24px);
  }

  .generation-task-debug-status {
    margin-left: 14px;
  }

  .generation-task-debug-body {
    gap: 8px;
    padding: 8px;
  }

  .generation-task-debug-code {
    max-height: 210px;
    padding: 8px;
    font-size: 9px;
  }

  .form-grid,
  .compact-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  #image-output-compression-field {
    grid-column: span 1;
  }

  .image-size-panel {
    gap: 13px;
    padding: 12px;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions .button-primary {
    min-width: 124px;
  }

  .session-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-item-actions,
  .image-tile-actions {
    opacity: 1;
    transform: none;
  }

  .result-empty,
  .result-progress,
  .result-error {
    padding: 32px 20px;
  }

  .history-panel {
    width: 100vw;
  }

  .history-toolbar {
    grid-template-columns: minmax(0, 1fr) 104px;
    padding-inline: 12px;
  }

  .history-list {
    padding-inline: 12px;
  }

  dialog {
    max-width: 100vw;
    max-height: 100vh;
  }

  .settings-dialog {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .settings-form {
    height: 100vh;
    max-height: 100vh;
  }

  .dialog-header {
    min-height: 66px;
    padding-inline: 14px;
  }

  .security-notice {
    margin: 12px 14px 0;
  }

  .settings-tabs {
    margin-inline: 14px;
  }

  .settings-tab {
    min-width: 64px;
    padding-inline: 6px;
  }

  .settings-body {
    padding: 16px 14px 20px;
  }

  .branding-icon-editor {
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .branding-icon-preview {
    width: 56px;
    height: 56px;
  }

  .branding-icon-actions .button {
    min-width: 0;
    padding-inline: 10px;
  }

  .upload-test-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .upload-test-actions > .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .upload-test-file-name {
    grid-column: 1 / -1;
  }

  .upload-test-result {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
  }

  .upload-test-preview-frame {
    width: 88px;
  }

  .upload-test-preview-frame audio {
    width: calc(100% - 6px);
  }

  .upload-test-result-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .dialog-footer {
    min-height: 66px;
    padding: 11px 14px;
  }

  .dialog-footer .button-danger-ghost span {
    display: none;
  }

  .preview-dialog {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .preview-dialog[open] {
    grid-template-rows: 60px minmax(0, 1fr) 62px;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (max-width: 390px) {
  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .icon-button,
  .mobile-menu-button,
  .connection-status {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .project-title-row h1 {
    max-width: 36vw;
  }

  .workspace-intro h2 {
    max-width: 50vw;
  }

  .image-size-panel {
    padding: 11px;
  }

  .image-choice-grid,
  .image-orientation-options {
    gap: 6px;
  }

  .image-ratio-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .image-resolution-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orientation-choice {
    min-height: 56px;
  }

  .orientation-choice .image-choice-meta {
    display: none;
  }

  .image-request-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .image-request-summary-value {
    text-align: left;
  }

  .form-actions .footer-spacer {
    display: none;
  }

  .form-actions .button {
    flex: 1 1 auto;
  }

  .task-queue-actions .button {
    flex: 1 1 auto;
  }

  .generation-task-images {
    grid-template-columns: minmax(0, 1fr);
  }

  .generation-task-timing-item {
    min-width: 50%;
    flex-basis: 50%;
  }

  .generation-task-timing-item:nth-child(2n) {
    border-right: 0;
  }

  .generation-task-debug-actions {
    align-items: stretch;
  }

  .generation-task-debug-actions .button {
    flex: 1 1 132px;
  }

  .generation-task-debug-actions .icon-button {
    flex: 0 0 32px;
  }

  .generation-task-debug-exchange > summary {
    padding-inline: 7px;
  }

  .dialog-footer .footer-spacer {
    min-width: 4px;
  }

  .dialog-footer .button {
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .brand-mark,
  .connection-dot,
  .progress-track span,
  .switch input:checked + span,
  .image-choice.is-selected,
  .image-choice:has(.image-choice-input:checked) {
    forced-color-adjust: none;
  }
}

@media (max-width: 640px) {
  .heygen-agent-browser-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .heygen-agent-toolbar .button {
    flex-basis: calc(50% - 3px);
  }

  .heygen-agent-list {
    max-height: 240px;
  }

  .heygen-language-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .heygen-proofread-editor-item .field-label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .heygen-proofread-editor-item .field-label,
  .heygen-proofread-editor-item .optional-label {
    width: 100%;
    text-align: left;
  }

  .heygen-proofread-editor-actions .button {
    flex: 1 1 100%;
  }

  .heygen-resource-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .heygen-resource-row:has(> .heygen-resource-thumbnail) {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .heygen-resource-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }

  .heygen-task-form .icon-button,
  .heygen-resource-actions .icon-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    flex-basis: 36px;
  }

  .voice-resource-item:has(> .voice-resource-body:first-child) {
    grid-template-columns: minmax(0, 1fr);
  }

  .voice-resource-item:has(> .voice-resource-body:first-child) > .button,
  .voice-resource-item:has(> .voice-resource-body:first-child) > .empty-description {
    grid-column: 1;
    justify-self: stretch;
  }

  .heygen-workflow-heading {
    gap: 10px;
  }

  .heygen-workflow-heading h3 {
    font-size: 15px;
  }

  .heygen-workflow-heading p {
    font-size: 10px;
  }

  .heygen-settings-note {
    margin-top: 12px;
  }
}

@media (max-width: 390px) {
  .heygen-agent-toolbar .button {
    width: 100%;
    flex-basis: 100%;
  }

  .heygen-agent-session-heading {
    align-items: flex-start;
  }

  .heygen-agent-message-resources button {
    width: 100%;
  }

  .heygen-language-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .heygen-task-form .segmented-control {
    flex-wrap: wrap;
  }

  .heygen-task-form .segmented-control > label {
    flex: 1 1 44%;
  }
}

/* MiniMax-H3 keeps its provider-specific media modes separate from the
   legacy Omni form. The controls remain fieldset/radio based so keyboard
   users can move through the same choices as pointer users. */
.minimax-h3-video-form {
  gap: 16px;
}

.minimax-h3-workflow-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.minimax-h3-workflow-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 680;
  line-height: 1.3;
}

.minimax-h3-workflow-heading p {
  max-width: 620px;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.minimax-h3-choice-panel {
  display: grid;
  min-width: 0;
  gap: 9px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.minimax-h3-choice-panel > legend {
  width: auto;
  padding: 0 4px;
  color: #354039;
  font-size: 12px;
  font-weight: 650;
}

.minimax-h3-mode-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
}

.minimax-h3-mode-options > label {
  min-width: 0;
}

.minimax-h3-mode-options > label span {
  overflow-wrap: anywhere;
}

.minimax-h3-ratio-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
  gap: 7px;
}

.minimax-h3-choice {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 46px;
  align-items: stretch;
  justify-content: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.minimax-h3-choice:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.minimax-h3-choice:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.minimax-h3-choice:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.minimax-h3-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.minimax-h3-choice > span {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
}

.minimax-h3-choice small {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minimax-h3-choice:has(input:checked) small {
  color: currentColor;
  opacity: 0.8;
}

.minimax-h3-media-stack,
.minimax-h3-media-panel {
  display: grid;
  min-width: 0;
  gap: 11px;
}

.minimax-h3-media-panel {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.minimax-h3-media-panel[hidden],
.minimax-h3-media-panel [data-minimax-h3-source][hidden] {
  display: none;
}

.minimax-h3-frame-slot,
.minimax-h3-reference-field {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 8px;
}

.minimax-h3-frame-slot > strong {
  color: #354039;
  font-size: 11px;
  font-weight: 650;
}

.minimax-h3-video-form .drop-zone {
  min-width: 0;
  min-height: 104px;
}

.minimax-h3-video-form .drop-zone strong,
.minimax-h3-video-form .drop-zone small {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.minimax-h3-submit-options {
  align-items: end;
}

.minimax-h3-submit-options .toggle-row {
  min-height: 40px;
  margin: 0;
}

.minimax-h3-submit-options output {
  min-width: 2ch;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.minimax-h3-video-form input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.minimax-h3-video-form .field-hint {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .minimax-h3-mode-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .minimax-h3-ratio-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .minimax-h3-workflow-heading {
    gap: 10px;
  }

  .minimax-h3-workflow-heading h3 {
    font-size: 15px;
  }

  .minimax-h3-workflow-heading p {
    font-size: 10px;
  }

  .minimax-h3-mode-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .minimax-h3-ratio-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .minimax-h3-submit-options {
    grid-template-columns: minmax(0, 1fr);
  }
}
