.ai-image-shell {
  display: grid;
  gap: 18px;
}

.ai-image-hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 18px;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 38%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.92));
  color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.16);
}

.ai-image-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #bfdbfe;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.ai-image-hero h2 {
  margin: 14px 0 10px;
  font-size: 30px;
  line-height: 1.15;
}

.ai-image-hero p {
  margin: 0;
  color: rgba(226, 232, 240, 0.82);
  line-height: 1.7;
}

.ai-image-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.ai-image-metric {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-image-metric strong {
  display: block;
  font-size: 20px;
  color: #fff;
}

.ai-image-metric span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(226, 232, 240, 0.72);
}

.ai-image-hero-note {
  display: grid;
  gap: 12px;
}

.ai-image-note-card {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-image-note-card strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
}

.ai-image-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 320px;
  gap: 18px;
}

.ai-image-card {
  background: var(--card-bg, #fff);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.ai-image-card-head {
  padding: 18px 20px 0;
}

.ai-image-card-head h3 {
  margin: 0;
  font-size: 18px;
}

.ai-image-card-head p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.ai-image-card-body {
  padding: 18px 20px 20px;
}

.ai-image-form {
  display: grid;
  gap: 14px;
}

.ai-image-form textarea,
.ai-image-form select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
  background: rgba(248, 250, 252, 0.92);
  color: #0f172a;
}

.ai-image-form textarea {
  min-height: 144px;
  resize: vertical;
  line-height: 1.7;
}

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

.ai-image-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.ai-image-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
}

.ai-image-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-image-summary {
  display: grid;
  gap: 10px;
}

.ai-image-preview-wrap {
  display: grid;
  gap: 12px;
}

.ai-image-stage {
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.06), rgba(37, 99, 235, 0.08));
  border: 1px solid rgba(148, 163, 184, 0.18);
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-image-stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
}

.ai-image-empty {
  padding: 42px 24px;
  text-align: center;
  color: #64748b;
  line-height: 1.8;
}

.ai-image-status {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  font-size: 13px;
}

.ai-image-status.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.ai-image-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.ai-image-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-image-meta span {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #334155;
  font-size: 12px;
}

.ai-image-history-list,
.ai-image-version-list {
  display: grid;
  gap: 12px;
}

.ai-image-thumb-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.8);
  cursor: pointer;
}

.ai-image-thumb-item.active {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.ai-image-thumb-item img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 14px;
  background: #e2e8f0;
}

.ai-image-thumb-title {
  margin: 0 0 6px;
  font-size: 13px;
  color: #0f172a;
  line-height: 1.5;
}

.ai-image-thumb-meta {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
}

.ai-image-side-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px dashed rgba(148, 163, 184, 0.36);
  color: #475569;
  font-size: 12px;
  line-height: 1.7;
}

[data-theme="dark"] .ai-image-card {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28);
}

[data-theme="dark"] .ai-image-card-head p,
[data-theme="dark"] .ai-image-empty,
[data-theme="dark"] .ai-image-thumb-meta,
[data-theme="dark"] .ai-image-side-note,
[data-theme="dark"] .ai-image-form label {
  color: #94a3b8;
}

[data-theme="dark"] .ai-image-form textarea,
[data-theme="dark"] .ai-image-form select,
[data-theme="dark"] .ai-image-thumb-item,
[data-theme="dark"] .ai-image-side-note {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

[data-theme="dark"] .ai-image-thumb-title,
[data-theme="dark"] .ai-image-card-head h3 {
  color: #f8fafc;
}

[data-theme="dark"] .ai-image-meta span {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

@media (max-width: 1280px) {
  .ai-image-grid {
    grid-template-columns: 1fr;
  }

  .ai-image-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ai-image-form-grid,
  .ai-image-metrics {
    grid-template-columns: 1fr;
  }
}

.ai-image-chat-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 132px);
  min-height: 640px;
  max-height: calc(100vh - 96px);
  align-items: stretch;
  overflow: hidden;
}

.ai-image-sidebar,
.ai-image-chat-main {
  background: var(--card-bg, #fff);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.ai-image-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.ai-image-sidebar-head {
  flex: 0 0 auto;
  padding: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.ai-image-new-btn {
  width: 100%;
}

.ai-image-sidebar-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: #64748b;
}

.ai-image-retention-note {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: #92400e;
  font-size: 12px;
  line-height: 1.6;
}

.ai-image-sidebar-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 9px 10px 12px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.ai-image-sidebar-list::-webkit-scrollbar {
  width: 8px;
}

.ai-image-sidebar-list::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
}

.ai-image-sidebar-list::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.38);
  border-radius: 999px;
}

.ai-image-conv-group {
  display: grid;
  gap: 7px;
}

.ai-image-conv-group-title {
  position: sticky;
  top: -9px;
  z-index: 1;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  padding: 7px 4px 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86));
  backdrop-filter: blur(8px);
}

.ai-image-sidebar-empty {
  padding: 18px;
  color: #64748b;
  line-height: 1.8;
  text-align: center;
}

.ai-image-conv-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  padding: 7px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(248, 250, 252, 0.78);
  cursor: pointer;
  min-height: 58px;
}

.ai-image-conv-item.active {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.ai-image-conv-thumb img,
.ai-image-conv-fallback {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.ai-image-conv-thumb img {
  object-fit: cover;
  background: #e2e8f0;
}

.ai-image-conv-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe, #e2e8f0);
  color: #1d4ed8;
  font-weight: 700;
}

.ai-image-conv-body h4 {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.ai-image-conv-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.ai-image-conv-title-row h4 {
  flex: 1 1 auto;
  min-width: 0;
}

.ai-image-conv-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ai-image-conv-status.processing {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.ai-image-rename-btn,
.ai-image-delete-btn {
  flex: 0 0 auto;
  padding: 2px 5px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: #64748b;
}

.ai-image-delete-btn {
  border-color: rgba(248, 113, 113, 0.3);
  color: #b91c1c;
}

.ai-image-rename-btn:hover,
.ai-image-delete-btn:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.28);
  color: #1d4ed8;
}

.ai-image-delete-btn:hover {
  border-color: rgba(239, 68, 68, 0.42);
  color: #dc2626;
}

.ai-image-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.ai-image-conv-body p {
  margin: 2px 0;
  font-size: 11px;
  line-height: 1.3;
  color: #64748b;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ai-image-conv-meta {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ai-image-chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.ai-image-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.ai-image-chat-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

.ai-image-chat-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
}

.ai-image-chat-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-image-chat-summary span,
.ai-image-msg-tags span {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #334155;
  font-size: 12px;
}

.ai-image-chat-flow {
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.04), transparent 42%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.92));
}

.ai-image-chat-empty {
  max-width: 520px;
  margin: 80px auto;
  padding: 28px;
  text-align: center;
  border-radius: 22px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  color: #64748b;
  line-height: 1.8;
}

.ai-image-chat-lock {
  max-width: 560px;
  margin: 120px auto;
  padding: 32px 28px;
  text-align: center;
  border-radius: 24px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.86);
}

.ai-image-chat-empty-title {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
}

.ai-image-chat-error {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.ai-image-msg {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.ai-image-msg-user {
  grid-template-columns: minmax(0, 1fr) 46px;
}

.ai-image-msg-user .ai-image-msg-avatar {
  order: 2;
}

.ai-image-msg-user .ai-image-msg-bubble {
  order: 1;
  justify-self: end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.ai-image-msg-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #334155);
}

.ai-image-msg-user .ai-image-msg-avatar {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.ai-image-msg-bubble,
.ai-image-msg-card {
  max-width: min(760px, 100%);
  padding: 16px 18px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.ai-image-msg-user .ai-image-msg-bubble {
  border: none;
}

.ai-image-msg-error {
  background: rgba(254, 242, 242, 0.92);
  border-color: rgba(248, 113, 113, 0.24);
}

.ai-image-msg-pending {
  background: rgba(255, 251, 235, 0.92);
  border-color: rgba(251, 191, 36, 0.26);
}

.ai-image-msg-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.ai-image-msg-text {
  margin-top: 8px;
  line-height: 1.8;
  color: inherit;
  white-space: pre-wrap;
}

.ai-image-msg-time {
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
}

.ai-image-msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.ai-image-msg-footer .ai-image-msg-time {
  margin-top: 0;
}

.ai-image-msg-copy {
  flex: 0 0 auto;
  min-width: 44px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ai-image-msg-copy:hover {
  background: rgba(255, 255, 255, 0.26);
}

.ai-image-msg-user .ai-image-msg-time {
  color: rgba(255, 255, 255, 0.76);
}

.ai-image-msg-ref-wrap {
  margin-top: 10px;
}

.ai-image-msg-ref-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-image-msg-ref-image {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  cursor: zoom-in;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.ai-image-msg-ref-count {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
}

.ai-image-msg-image-wrap {
  margin-top: 12px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.05), rgba(37, 99, 235, 0.08));
}

.ai-image-msg-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  object-fit: contain;
  cursor: zoom-in;
}

.ai-image-msg-tags,
.ai-image-msg-actions,
.ai-image-composer-meta,
.ai-image-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-image-msg-tags {
  margin-top: 12px;
}

.ai-image-msg-actions {
  margin-top: 12px;
}

.ai-image-composer {
  padding: 16px 18px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.96);
}

.ai-image-composer-meta {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #475569;
  font-size: 12px;
  line-height: 1.7;
}

.ai-image-processing-tip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.ai-image-retention-tip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
  white-space: nowrap;
}

.ai-image-composer-input,
.ai-image-composer-settings select,
.ai-image-custom-size {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 12px 14px;
  font: inherit;
  background: rgba(248, 250, 252, 0.92);
}

.ai-image-custom-size-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.ai-image-custom-size-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ai-image-custom-size-grid label span {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.ai-image-custom-size-times {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 43px;
  color: #94a3b8;
  font-weight: 800;
}

.ai-image-custom-size {
  min-width: 0;
}

.ai-image-composer-box {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 22px;
  background: rgba(248, 250, 252, 0.92);
}

.ai-image-composer-input {
  min-height: 84px;
  max-height: 252px;
  resize: none;
  line-height: 1.8;
  border: 0;
  border-radius: 16px;
  padding: 10px 12px;
  background: transparent;
  outline: none;
}

.ai-image-composer-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.ai-image-settings-summary {
  margin-right: auto;
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

.ai-image-send-btn {
  min-width: 96px;
}

.ai-image-composer-settings {
  display: none;
  margin-top: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.ai-image-composer-settings.open {
  display: block;
}

.ai-image-composer-settings-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(150px, 1fr));
  gap: 10px;
  align-items: start;
}

.ai-image-setting-field {
  display: grid;
  gap: 7px;
}

.ai-image-setting-field-wide {
  min-width: 0;
}

.ai-image-field-label {
  margin: 2px 0 -2px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.ai-image-field-hint {
  margin: -3px 2px 2px;
  font-size: 11px;
  line-height: 1.45;
  color: #94a3b8;
}

.ai-image-composer-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.ai-image-edit-chip {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.16);
}

.ai-image-edit-chip img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
}

.ai-image-paste-chip {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 76px;
  background: rgba(245, 158, 11, 0.09);
  border-color: rgba(245, 158, 11, 0.22);
}

.ai-image-paste-chip img {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.ai-image-paste-thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: min(520px, 42vw);
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.ai-image-paste-thumbs img {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
}

.ai-image-edit-chip-body strong,
.ai-image-viewer-head strong {
  display: block;
  color: #0f172a;
}

.ai-image-edit-chip-body span {
  display: block;
  margin-top: 4px;
  color: #475569;
  font-size: 12px;
  line-height: 1.7;
}

.ai-image-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 6, 23, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ai-image-viewer {
  width: min(1180px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(2, 6, 23, 0.4);
}

.ai-image-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.ai-image-viewer-stage {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.92));
}

.ai-image-viewer-canvas-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.ai-image-viewer-img {
  display: block;
  max-width: min(100%, 980px);
  max-height: 72vh;
  border-radius: 20px;
}

.ai-image-viewer-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 20px;
}

.ai-image-viewer-mask.active {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
  background: rgba(37, 99, 235, 0.03);
}

.ai-image-viewer-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.98);
}

.ai-image-viewer-input {
  width: 100%;
  min-height: 56px;
  max-height: 168px;
  resize: none;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.7;
  background: rgba(248, 250, 252, 0.94);
  outline: none;
}

.ai-image-viewer-send {
  min-width: 96px;
  min-height: 44px;
}

.ai-image-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
}

.ai-image-modal {
  width: min(460px, 92vw);
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.ai-image-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.ai-image-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.ai-image-modal-subtitle {
  margin-top: 5px;
  font-size: 12px;
  color: #64748b;
}

.ai-image-modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
  font-size: 20px;
  cursor: pointer;
}

.ai-image-modal-input {
  width: 100%;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  color: #0f172a;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.08);
}

.ai-image-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.ai-image-confirm-backdrop {
  z-index: 1400;
}

.ai-image-confirm-modal {
  width: min(520px, 92vw);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 24px;
}

.ai-image-confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.ai-image-confirm-modal.is-danger .ai-image-confirm-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.26);
}

.ai-image-confirm-copy {
  min-width: 0;
}

.ai-image-confirm-message {
  margin-top: 10px;
  color: #334155;
  line-height: 1.75;
  font-size: 14px;
}

.ai-image-confirm-detail {
  margin-top: 12px;
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #92400e;
  font-size: 13px;
  line-height: 1.65;
}

.ai-image-confirm-modal.is-danger .ai-image-confirm-detail {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.18);
  color: #991b1b;
}

.ai-image-confirm-actions {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.ai-image-confirm-primary {
  min-width: 108px;
}

[data-theme="dark"] .ai-image-sidebar,
[data-theme="dark"] .ai-image-chat-main,
[data-theme="dark"] .ai-image-msg-bubble,
[data-theme="dark"] .ai-image-msg-card,
[data-theme="dark"] .ai-image-composer,
[data-theme="dark"] .ai-image-viewer {
  background: rgba(15, 23, 42, 0.94);
  border-color: rgba(148, 163, 184, 0.16);
}

[data-theme="dark"] .ai-image-chat-flow {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.88), rgba(15, 23, 42, 0.96));
}

[data-theme="dark"] .ai-image-conv-group-title {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.86));
}

[data-theme="dark"] .ai-image-conv-item,
[data-theme="dark"] .ai-image-composer-input,
[data-theme="dark"] .ai-image-composer-settings select,
[data-theme="dark"] .ai-image-custom-size,
[data-theme="dark"] .ai-image-viewer-input {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}

[data-theme="dark"] .ai-image-composer-box,
[data-theme="dark"] .ai-image-composer-settings,
[data-theme="dark"] .ai-image-viewer-composer {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .ai-image-custom-size-grid label span {
  color: #94a3b8;
}

[data-theme="dark"] .ai-image-chat-title,
[data-theme="dark"] .ai-image-conv-body h4,
[data-theme="dark"] .ai-image-msg-title,
[data-theme="dark"] .ai-image-chat-empty-title,
[data-theme="dark"] .ai-image-edit-chip-body strong,
[data-theme="dark"] .ai-image-viewer-head strong {
  color: #f8fafc;
}

[data-theme="dark"] .ai-image-sidebar-note,
[data-theme="dark"] .ai-image-conv-body p,
[data-theme="dark"] .ai-image-chat-subtitle,
[data-theme="dark"] .ai-image-chat-empty,
[data-theme="dark"] .ai-image-composer-meta,
[data-theme="dark"] .ai-image-chat-lock,
[data-theme="dark"] .ai-image-edit-chip-body span {
  color: #94a3b8;
}

[data-theme="dark"] .ai-image-chat-summary span,
[data-theme="dark"] .ai-image-msg-tags span {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

[data-theme="dark"] .ai-image-retention-note,
[data-theme="dark"] .ai-image-retention-tip {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.24);
  color: #fbbf24;
}

[data-theme="dark"] .ai-image-rename-btn,
[data-theme="dark"] .ai-image-delete-btn {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

[data-theme="dark"] .ai-image-delete-btn {
  border-color: rgba(248, 113, 113, 0.28);
  color: #fca5a5;
}

[data-theme="dark"] .ai-image-msg-ref-image {
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="dark"] .ai-image-conv-status.processing,
[data-theme="dark"] .ai-image-processing-tip {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

[data-theme="dark"] .ai-image-modal {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
  border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .ai-image-modal-title {
  color: #f8fafc;
}

[data-theme="dark"] .ai-image-modal-subtitle {
  color: #94a3b8;
}

[data-theme="dark"] .ai-image-modal-input {
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
}

[data-theme="dark"] .ai-image-confirm-message {
  color: #cbd5e1;
}

[data-theme="dark"] .ai-image-confirm-detail {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.24);
  color: #fbbf24;
}

[data-theme="dark"] .ai-image-confirm-modal.is-danger .ai-image-confirm-detail {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.ai-image-progress-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
}

.ai-image-progress-card {
  width: min(430px, 92vw);
  padding: 26px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,251,235,.96));
  border: 1px solid rgba(254, 215, 170, 0.9);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.ai-image-progress-orb {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f97316, #facc15, #22d3ee, #f97316);
  animation: aiImageSpin 1.2s linear infinite;
  box-shadow: 0 14px 34px rgba(249, 115, 22, 0.22);
}

.ai-image-progress-orb::after {
  content: '';
  display: block;
  width: 34px;
  height: 34px;
  margin: 10px;
  border-radius: 50%;
  background: #fff;
}

.ai-image-progress-title {
  font-size: 18px;
  font-weight: 900;
  color: #111827;
}

.ai-image-progress-text,
.ai-image-progress-note {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.65;
}

.ai-image-progress-note {
  color: #92400e;
  font-size: 12px;
}

.ai-image-progress-bar {
  height: 9px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffedd5;
}

.ai-image-progress-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f97316, #facc15);
  animation: aiImageProgress 1.45s ease-in-out infinite;
}

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

@keyframes aiImageProgress {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

[data-theme="dark"] .ai-image-progress-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
  border-color: rgba(245, 158, 11, 0.25);
}

[data-theme="dark"] .ai-image-progress-title {
  color: #f8fafc;
}

[data-theme="dark"] .ai-image-progress-orb::after {
  background: #0f172a;
}

@media (max-width: 1200px) {
  .ai-image-chat-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .ai-image-sidebar {
    height: auto;
    max-height: 48vh;
  }

  .ai-image-sidebar-list {
    max-height: calc(48vh - 116px);
  }

  .ai-image-chat-main {
    height: min(78vh, 820px);
  }

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

@media (max-width: 720px) {
  .ai-image-sidebar {
    max-height: 44vh;
  }

  .ai-image-sidebar-list {
    max-height: calc(44vh - 112px);
  }

  .ai-image-chat-main {
    height: 74vh;
  }

  .ai-image-composer-inline-actions {
    justify-content: stretch;
  }

  .ai-image-settings-summary {
    width: 100%;
    margin-right: 0;
  }

  .ai-image-composer-settings-grid {
    grid-template-columns: 1fr;
  }

  .ai-image-viewer-composer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-image-confirm-modal {
    grid-template-columns: 1fr;
  }

  .ai-image-confirm-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}
