:root {
  --bg: #eef6ff;
  --panel: #ffffff;
  --text: #10233f;
  --muted: #5b7191;
  --line: #d7e4f7;
  --blue: #1677ff;
  --blue-soft: #eaf3ff;
  --green: #0f9f6e;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 18px 50px rgba(42, 99, 160, 0.12);
  --workbench-sidebar-w: clamp(292px, 20vw, 348px);
  --result-row-min-height: 236px;
  --result-page-col: 72px;
  --result-original-col: minmax(260px, 1fr);
  --result-draft-col: minmax(320px, 1.15fr);
  --result-color-col: minmax(340px, 1.25fr);
  --result-action-col: minmax(240px, 280px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1180px;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #213653;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
}

.btn-blue,
.btn-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn-success-soft {
  border-color: rgba(15, 159, 110, 0.25);
  background: #eafaf4;
  color: #087951;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
}

.modern-workbench.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--workbench-sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 16px;
  padding: 16px;
}

.app-header {
  grid-column: 1 / -1;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border: 1px solid rgba(135, 157, 188, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
}

.topbar-center {
  justify-content: center;
}

.topbar-right {
  justify-content: flex-end;
  gap: 10px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #1677ff, #23c6e8);
}

.brand-mark img {
  width: 34px;
  height: 34px;
}

.brand-title {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.brand-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.config-entry-button {
  height: 42px;
  padding: 0 22px;
  border-radius: 12px;
}

.topbar-nav-button,
.user-menu-trigger {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #243a59;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.credit-nav-button strong {
  color: var(--blue);
}

.user-menu-shell {
  position: relative;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 20;
  width: 180px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.13);
}

.user-dropdown-menu button {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  padding: 0 10px;
  color: #2f405a;
}

.user-dropdown-menu .danger {
  color: var(--red);
}

.workspace-column {
  min-width: 0;
}

.results-column {
  overflow-x: auto;
}

.task-settings-panel,
.panel {
  border: 1px solid rgba(135, 157, 188, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.task-settings-panel {
  padding: 14px;
  align-self: start;
}

.task-settings-stack {
  display: grid;
  gap: 14px;
}

.task-section {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  padding: 16px;
}

.task-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.task-section-number {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.task-section-head strong {
  font-size: 15px;
}

.task-section-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.task-dashed-upload,
.task-reference-add-tile {
  width: 100%;
  min-height: 94px;
  border: 1px dashed #a9c5eb;
  border-radius: 14px;
  background: #f8fbff;
  color: #2f5f9f;
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
}

.task-dashed-upload strong,
.task-reference-add-tile strong {
  color: #174978;
}

.task-dashed-upload span,
.task-reference-add-tile span {
  color: var(--muted);
  font-size: 12px;
}

.upload-icon {
  font-size: 22px;
  color: var(--blue);
  font-weight: 800;
}

.task-file-list {
  display: grid;
  gap: 8px;
}

.task-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  background: #f8fbff;
}

.task-file-main {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.task-file-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

.task-file-copy {
  min-width: 0;
  display: grid;
}

.task-file-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-file-copy small {
  color: var(--muted);
}

.task-remove-button,
.task-reference-tile button {
  border: 0;
  background: #fff;
  color: var(--red);
  border-radius: 8px;
}

.task-pdf-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-pdf-actions button {
  flex: 1;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.task-reference-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.task-reference-tile,
.task-reference-add-tile {
  width: 86px;
  height: 74px;
  min-height: 74px;
  position: relative;
  overflow: hidden;
}

.task-reference-add-tile.empty {
  width: 100%;
  height: 94px;
}

.task-reference-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-reference-tile button {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 22px;
  height: 22px;
}

.task-config-form {
  display: grid;
  gap: 13px;
}

.task-config-row {
  display: grid;
  gap: 8px;
}

.task-config-row > span,
.task-custom-prompt > span {
  color: #4f6685;
  font-size: 13px;
  font-weight: 700;
}

.task-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.task-mode-grid button,
.task-choice-row button,
.task-ratio-grid button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #243a59;
  padding: 10px;
}

.task-mode-grid button {
  display: grid;
  gap: 4px;
  text-align: left;
}

.task-mode-grid small,
.task-ratio-grid small {
  color: var(--muted);
  font-size: 12px;
}

.task-mode-grid button.active,
.task-choice-row button.active,
.task-ratio-grid button.active,
.credit-ledger-tabs button.active,
.optimize-variant-grid button.selected,
.optimize-base-card.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #0f4fb8;
}

.task-custom-prompt {
  display: grid;
  gap: 7px;
}

.task-custom-prompt textarea,
.optimize-prompt-field textarea {
  width: 100%;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  resize: vertical;
}

.task-choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.task-page-options {
  display: grid;
  gap: 8px;
}

.task-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #364c69;
}

.task-radio-option.custom {
  display: grid;
  grid-template-columns: auto auto 1fr;
}

.task-page-range-input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
}

.task-ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.task-ratio-grid button {
  display: grid;
  gap: 3px;
  padding: 8px 6px;
}

.task-credit-card {
  margin-top: 14px;
  border: 1px solid #cfe0f6;
  border-radius: 13px;
  background: #f7fbff;
  padding: 12px;
}

.task-credit-card strong {
  color: var(--blue);
  font-size: 20px;
}

.task-credit-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.task-start-button,
.task-stop-button,
.task-clear-all {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  border-radius: 12px;
  font-weight: 800;
}

.task-start-button {
  border: 0;
  background: var(--blue);
  color: #fff;
}

.task-stop-button {
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: #fff5f5;
  color: var(--red);
}

.task-clear-all {
  border: 1px solid var(--line);
  background: #fff;
  color: #40536e;
}

.result-workbench {
  min-width: 1120px;
  overflow: hidden;
}

.result-workbench-header {
  display: flex;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.panel-title {
  margin: 0;
  font-size: 20px;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 16px 20px 20px;
}

.result-stack {
  display: grid;
  gap: 14px;
}

.generation-progress-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.generation-progress-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #f8fbff;
}

.generation-progress-title {
  display: flex;
  justify-content: space-between;
  color: #27415f;
  font-size: 13px;
}

.generation-progress-title span {
  color: var(--muted);
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #dfeaf8;
  margin: 10px 0 7px;
}

.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #26c6da);
}

.progress-fill.full {
  width: 100%;
}

.progress-fill.mid {
  width: 66%;
}

.progress-fill.low {
  width: 35%;
}

.generation-progress-card small {
  color: var(--muted);
}

.result-workbench-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.result-filters {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7fbff;
}

.result-filters button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4d6381;
  padding: 8px 10px;
  font-weight: 700;
}

.result-filters button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 8px 18px rgba(22, 119, 255, 0.12);
}

.result-list {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}

.real-empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed #c6d9f2;
  border-radius: 14px;
  background: #f8fbff;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.real-empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.result-table-head,
.result-workbench-card {
  display: grid;
  grid-template-columns: var(--result-page-col) var(--result-original-col) var(--result-draft-col) var(--result-color-col) var(--result-action-col);
  gap: 16px;
  min-width: 1120px;
}

.result-table-head {
  padding: 12px 16px;
  color: #536c8c;
  font-size: 12px;
  font-weight: 800;
}

.result-workbench-card {
  min-height: var(--result-row-min-height);
  padding: 16px;
  align-items: start;
  border-top: 1px solid var(--line);
  background: #fff;
}

.result-page-index,
.result-preview-column,
.result-draft-column,
.result-status-actions {
  min-width: 0;
}

.result-page-index {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.result-page-index strong {
  color: var(--text);
}

.result-column-title {
  display: block;
  margin-bottom: 8px;
  color: #3f5876;
  font-weight: 800;
  font-size: 13px;
}

.thumb-frame,
.draft-candidate-thumb,
.optimize-image-frame,
.preview-frame-large {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #d8e3f2;
  border-radius: 9px;
  background: #f8fafc;
}

.result-large-thumb {
  width: 100%;
  display: block;
  padding: 0;
}

.result-large-thumb img,
.draft-candidate-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pdf-page-frame,
.pdf-preview-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
  pointer-events: none;
}

.pdf-preview-frame {
  min-height: 70vh;
  pointer-events: auto;
}

.real-unavailable {
  border: 1px dashed #c6d9f2;
  border-radius: 9px;
  background: #f8fbff;
}

.mock-slide {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: #1e3a5f;
}

.mock-slide b,
.mock-slide i {
  display: block;
}

.mock-slide i {
  color: var(--muted);
  font-size: 12px;
}

.slide-original {
  background: linear-gradient(135deg, #f8fafc, #eaf2fb);
}

.slide-color {
  background: linear-gradient(135deg, #eaf3ff, #ffffff 54%, #dff7ff);
}

.draft {
  background: repeating-linear-gradient(135deg, #f7fafc, #f7fafc 10px, #e8eef6 10px, #e8eef6 20px);
}

.draft.alt {
  background: linear-gradient(135deg, #f3f8ff, #e9eef7);
}

.draft-candidates-inner {
  width: fit-content;
  max-width: 100%;
}

.draft-candidate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(118px, 150px));
  gap: 10px;
}

.draft-candidates-inner.count-4 .draft-candidate-grid {
  grid-template-columns: repeat(2, 142px);
}

.draft-candidate-card {
  width: 142px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 6px;
}

.draft-candidate-card.selected,
.draft-candidate-card.pending {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.draft-candidate-thumb {
  width: 100%;
  position: relative;
  display: block;
  padding: 0;
}

.draft-thumb-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  transition: opacity 0.16s;
}

.draft-candidate-thumb:hover .draft-thumb-overlay {
  opacity: 1;
}

.draft-candidate-foot {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}

.draft-candidate-foot strong {
  font-size: 12px;
  white-space: nowrap;
}

.draft-state-pill,
.draft-use-button {
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.draft-state-pill.selected {
  background: #dff7ee;
  color: #087951;
}

.draft-state-pill.pending {
  background: #fff7e8;
  color: var(--amber);
}

.draft-state-pill.failed,
.candidate-waiting.failed {
  background: #fff1f2;
  color: var(--red);
}

.draft-use-button {
  background: var(--blue);
  color: #fff;
}

.draft-confirm-bar {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  border: 1px solid #c8dcfb;
  border-radius: 12px;
  background: #eef6ff;
  padding: 9px;
}

.draft-confirm-bar strong,
.draft-confirm-bar span {
  display: block;
  font-size: 12px;
}

.draft-confirm-bar span {
  color: var(--muted);
}

.draft-confirm-bar button {
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.prompt-draft-placeholder,
.draft-placeholder-card,
.result-placeholder {
  height: 100%;
  min-height: 110px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.draft-placeholder-card {
  border: 1px dashed #c6d9f2;
  border-radius: 12px;
  background: #f8fbff;
  padding: 16px;
}

.result-placeholder {
  padding: 18px;
}

.result-placeholder strong,
.result-placeholder small {
  display: block;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d6e7ff;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

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

.status-tag {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-tag.ok {
  background: #e7f8f1;
  color: var(--green);
}

.status-tag.done {
  background: #e7f8f1;
  color: var(--green);
}

.status-tag.warn {
  background: #fff7e8;
  color: var(--amber);
}

.status-tag.run {
  background: #eaf3ff;
  color: var(--blue);
}

.result-status-actions {
  display: grid;
  gap: 10px;
}

.result-status-copy {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.editable-done-badge {
  width: fit-content;
  border-radius: 999px;
  background: #e7f8f1;
  color: var(--green);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.result-action-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.result-action-button {
  height: 36px;
  padding: 0 9px;
  font-size: 12px;
}

.editable-action {
  grid-column: 1 / -1;
  height: 40px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.credit-ledger-modal {
  width: 860px;
  max-width: calc(100vw - 48px);
  max-height: 82vh;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}

.credit-ledger-head,
.optimize-modal-head,
.optimize-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.credit-ledger-head h2 {
  margin: 0;
}

.credit-ledger-head span,
.optimize-modal-head span {
  color: var(--muted);
  font-size: 13px;
}

.credit-ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 20px;
  background: #f8fbff;
  border-bottom: 1px solid var(--line);
}

.credit-ledger-summary article {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.credit-ledger-summary span {
  color: var(--muted);
  font-size: 12px;
}

.credit-ledger-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.credit-ledger-summary .recharge strong {
  color: var(--green);
}

.credit-ledger-summary .usage strong {
  color: var(--red);
}

.credit-ledger-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.credit-ledger-tabs button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 16px;
  font-weight: 800;
}

.credit-ledger-body {
  max-height: 48vh;
  overflow-y: auto;
  padding: 16px 20px 20px;
}

.credit-ledger-list {
  display: grid;
  gap: 10px;
}

.credit-ledger-row {
  display: grid;
  grid-template-columns: 96px 150px 120px 1fr 150px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.credit-ledger-tag {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 900;
  font-size: 12px;
}

.credit-ledger-row.recharge .credit-ledger-tag {
  background: #e7f8f1;
  color: var(--green);
}

.credit-ledger-row.usage .credit-ledger-tag {
  background: #fff1f2;
  color: var(--red);
}

.credit-ledger-change {
  font-size: 16px;
}

.credit-ledger-row.recharge .credit-ledger-change {
  color: var(--green);
}

.credit-ledger-row.usage .credit-ledger-change {
  color: var(--red);
}

.credit-ledger-balance,
.credit-ledger-time {
  color: var(--muted);
  font-size: 12px;
}

.preview-modal {
  width: min(960px, calc(100vw - 48px));
  border-radius: 18px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26);
  position: relative;
}

.preview-close {
  position: absolute;
  right: 16px;
  top: 16px;
}

.preview-modal h3 {
  margin: 0 44px 14px 0;
}

.preview-frame-large {
  width: 100%;
  background: #0f172a;
}

.preview-frame-large .mock-slide {
  color: #fff;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.optimize-modal {
  width: min(1180px, calc(100vw - 48px));
  max-height: 90vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.2);
}

.optimize-modal-body {
  overflow-y: auto;
  padding: 18px 20px;
  display: grid;
  gap: 14px;
  background: #f8fbff;
}

.optimize-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.optimize-section-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.optimize-base-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.optimize-base-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.optimize-image-frame {
  width: 100%;
}

.optimize-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.optimize-quick-prompts button,
.optimize-variant-grid button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 12px;
}

.optimize-variant-grid {
  display: flex;
  gap: 10px;
}

.optimize-cost-card {
  margin-top: 12px;
  border: 1px solid #cfe0f6;
  border-radius: 12px;
  background: #f7fbff;
  padding: 12px;
}

.optimize-cost-card strong {
  color: var(--blue);
}

.optimize-cost-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.optimize-result-grid {
  display: grid;
  gap: 12px;
}

.optimize-result-grid.count-1 {
  grid-template-columns: minmax(220px, 420px);
}

.optimize-result-grid.count-2 {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.optimize-result-grid.count-4 {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.optimize-result-placeholder,
.optimize-result-card {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border: 1px dashed #c6d9f2;
  border-radius: 12px;
  color: var(--muted);
  background: #f8fbff;
}

.optimize-result-card {
  border-style: solid;
  color: var(--text);
  background: linear-gradient(135deg, #eaf3ff, #fff);
}

.h5-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 5000;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(22, 119, 255, 0.2);
  border-radius: 999px;
  background: #10233f;
  color: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.24);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 1360px) {
  .modern-workbench.app-shell {
    --workbench-sidebar-w: 300px;
    --result-row-min-height: 224px;
  }

  .app-header {
    grid-template-columns: minmax(240px, 1fr) auto minmax(300px, 1fr);
    padding: 12px 16px;
  }

  .topbar-nav-button span {
    display: none;
  }
}

@media (max-width: 1100px) {
  body {
    min-width: 0;
  }

  .modern-workbench.app-shell {
    grid-template-columns: 1fr;
  }

  .app-header {
    grid-template-columns: 1fr;
  }

  .topbar-center,
  .topbar-right {
    justify-content: flex-start;
  }

  .result-workbench {
    min-width: 1040px;
  }
}
