:root {
  --ink: #111827;
  --muted: #7a8497;
  --line: #e6eaf1;
  --page: #f3f6fb;
  --panel: #ffffff;
  --sidebar: #111723;
  --sidebar-soft: #1d2433;
  --blue: #4096ff;
  --blue-deep: #1677ff;
  --green: #52c41a;
  --orange: #f59e0b;
  --red: #ef4444;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
}

body {
  color: var(--ink);
  background: var(--page);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: #fff;
}

.auth-box {
  width: min(360px, 100%);
}

.auth-box h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-visual {
  position: relative;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.42), rgba(64, 150, 255, 0.12)),
    url("./assets/ym-image-hero.webp") center / cover no-repeat;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 36px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #5bd5a7, #4096ff);
  font-weight: 800;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  margin: 8px 0 16px;
  font-size: 13px;
  line-height: 1.7;
}

.form,
.field {
  display: grid;
  gap: 12px;
}

.form {
  margin-top: 26px;
}

.field span,
.control-panel label {
  color: #7a8497;
  font-size: 14px;
}

.field.compact {
  margin: 16px 0;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}

.input,
.select {
  height: 40px;
  padding: 0 12px;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9aa4b2 50%), linear-gradient(135deg, #9aa4b2 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.textarea {
  min-height: 140px;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}

.prompt-box {
  min-height: 150px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(64, 150, 255, 0.12);
}

.btn {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 5px;
  color: #fff;
  background: var(--blue);
  font-weight: 600;
}

.btn:hover {
  background: var(--blue-deep);
}

.btn:disabled,
.btn:disabled:hover {
  color: #94a3b8;
  background: #e5e7eb;
  cursor: not-allowed;
}

.btn.secondary {
  color: #394150;
  background: #f1f5f9;
}

.btn.secondary:hover {
  background: #e2e8f0;
}

.btn.full {
  width: 100%;
  height: 46px;
  margin-top: 8px;
}

.compact-btn {
  min-height: 34px;
  padding: 0 12px;
}

.link-btn,
.link-action,
.chevron,
.icon-button {
  background: transparent;
  color: var(--blue-deep);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #d7deea;
}

.sidebar-brand {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}

.sidebar-brand .brand-title {
  color: #fff;
  font-size: 21px;
}

.nav-group-title {
  padding: 20px 32px 8px;
  font-size: 18px;
  color: #f9fafb;
}

.nav {
  display: grid;
  gap: 12px;
  padding: 14px 26px;
}

.nav button {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
  color: #cbd5e1;
  background: transparent;
  border-radius: 7px;
  text-align: left;
  font-size: 17px;
}

.nav button span {
  width: 22px;
  color: #a8b2c3;
  text-align: center;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: var(--sidebar-soft);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: #8fa0b7;
  font-size: 13px;
}

.main {
  min-width: 0;
}

.topbar {
  height: 69px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.top-left,
.top-actions,
.line-between,
.route-row,
.inline-form,
.key-copy-row,
.modal-actions {
  display: flex;
  align-items: center;
}

.top-left {
  gap: 16px;
}

.top-left h1 {
  margin: 0;
  font-size: 21px;
}

.top-actions {
  gap: 12px;
}

.icon-button,
.chevron {
  color: #4b5563;
  font-size: 20px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
}

.account {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 24px;
}

.page-card,
.experience-hero,
.control-panel,
.canvas-panel,
.history-panel,
.welcome-card,
.mini-panel,
.stat-card {
  background: var(--panel);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.page-card {
  padding: 26px;
}

.section-header,
.experience-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-header {
  margin-bottom: 28px;
}

.overview-page {
  display: grid;
  gap: 18px;
}

.welcome-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
}

.welcome-card h2 {
  margin: 0 0 8px;
  font-size: 25px;
}

.welcome-card p {
  margin: 0;
  color: #7a8497;
}

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

.stat-card {
  display: grid;
  gap: 8px;
  padding: 20px;
}

.stat-card span,
.stat-card small {
  color: #7a8497;
}

.stat-card strong {
  font-size: 28px;
  color: #1677ff;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.mini-panel {
  min-width: 0;
  padding: 20px;
}

.balance-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #1677ff;
  background: #edf5ff;
  font-weight: 700;
}

.billing-banner {
  margin-bottom: 18px;
  padding: 15px 16px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.billing-banner p {
  margin: 8px 0 0;
  color: #7a8497;
}

.billing-page {
  display: grid;
  gap: 18px;
}

.billing-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.payment-panel {
  min-width: 0;
  padding: 22px;
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}

.payment-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.payment-head strong {
  font-size: 18px;
}

.payment-head p {
  margin: 7px 0 0;
  color: #7a8497;
}

.pay-method {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: #1677ff;
  background: #edf5ff;
  font-weight: 700;
  white-space: nowrap;
}

.pay-type-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.pay-type {
  min-height: 42px;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  color: #394150;
  background: #fff;
  font-weight: 700;
}

.pay-type:hover,
.pay-type.active {
  color: #1677ff;
  border-color: #4096ff;
  background: #edf5ff;
  box-shadow: 0 7px 18px rgba(64, 150, 255, 0.12);
}

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

.plan-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e0e6ef;
  border-radius: 8px;
  background: #fff;
}

.plan-card:hover {
  border-color: #4096ff;
  box-shadow: 0 8px 20px rgba(64, 150, 255, 0.12);
}

.plan-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.plan-card strong {
  color: #111827;
  font-size: 20px;
}

.plan-card span {
  color: #1677ff;
  font-weight: 800;
}

.plan-card p {
  min-height: 40px;
  margin: 0;
  color: #7a8497;
  line-height: 1.5;
}

.custom-payment-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5ebf3;
}

.credit-plus {
  color: #237804;
  font-weight: 700;
}

.credit-minus {
  color: #ef4444;
  font-weight: 700;
}

.docs-page {
  max-width: 980px;
}

.doc-block {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.doc-block h3 {
  margin: 0;
  font-size: 18px;
}

.doc-block pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px 16px;
  border-radius: 8px;
  color: #d7e4ff;
  background: #111827;
  line-height: 1.6;
}

.doc-block .hint {
  margin: 0;
}

.section-header h2,
.experience-hero h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.section-header p,
.experience-hero p {
  margin: 0;
  color: #7a8497;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 15px;
  color: #596579;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 15px;
}

.data-table td {
  padding: 16px 15px;
  border-bottom: 1px solid #eef2f7;
  color: #293241;
}

.table-empty {
  height: 140px;
  color: var(--muted);
  text-align: center;
}

.key-prefix {
  padding: 4px 8px;
  border-radius: 5px;
  color: #3478f6;
  background: #eaf3ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  color: #5f6b7a;
  background: #eef2f7;
  font-size: 13px;
}

.tag.success {
  color: #237804;
  background: #edf8e8;
}

.tag.danger {
  color: #b42318;
  background: #fff1f0;
}

.link-action {
  padding: 0 8px 0 0;
  color: #1677ff;
}

.danger-text {
  color: #ef4444;
}

.experience {
  display: grid;
  gap: 18px;
}

.experience-hero {
  min-height: 76px;
  padding: 16px 22px;
}

.spark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--blue);
  background: #eaf3ff;
  font-size: 22px;
}

.experience-hero > div:nth-child(2) {
  flex: 1;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #7a8497;
}

.hero-stats strong {
  color: #3478f6;
  font-size: 18px;
}

.config-ok {
  color: #237804;
}

.config-bad {
  color: #ef4444;
}

.tabs {
  height: 48px;
  display: flex;
  align-items: end;
  gap: 34px;
  border-bottom: 1px solid #dfe6f0;
}

.tabs button {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  color: #1f2937;
  background: transparent;
  font-size: 17px;
  font-weight: 600;
}

.tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.experience-grid {
  display: grid;
  grid-template-columns: 426px minmax(0, 1fr);
  gap: 18px;
}

.control-panel {
  padding: 24px;
}

.line-between {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.line-between strong {
  color: #3478f6;
}

.route-row {
  gap: 10px;
  margin-bottom: 10px;
}

.route-card {
  flex: 1;
  min-height: 93px;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid #dfe6f0;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.route-card.active {
  border-color: var(--blue);
  background: #eaf3ff;
}

.route-card strong {
  font-size: 16px;
}

.route-card span {
  color: #3478f6;
  font-weight: 700;
}

.route-card small {
  color: #7a8497;
}

.route-card:disabled,
.segment-control button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: #f8fafc;
}

.model-select {
  height: 50px;
  margin-top: 8px;
  font-size: 18px;
}

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

.ratio-card {
  min-height: 94px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
  border: 1px solid #e0e6ef;
  border-radius: 8px;
  color: #6b7280;
  background: #fff;
}

.ratio-card.active {
  color: var(--blue);
  border-color: var(--blue);
  background: #edf5ff;
}

.ratio-shape {
  display: block;
  border-radius: 4px;
  border: 1px solid #e5ebf3;
  background: #f1f5f9;
}

.ratio-card.active .ratio-shape {
  background: var(--blue);
  border-color: var(--blue);
}

.ratio-shape.square {
  width: 46px;
  height: 46px;
}

.ratio-shape.wide {
  width: 54px;
  height: 34px;
}

.ratio-shape.tall {
  width: 34px;
  height: 54px;
}

.range {
  width: 100%;
  accent-color: var(--blue);
}

.advanced-options {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.advanced-option-block {
  display: grid;
  gap: 8px;
}

.info-dot {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #64748b;
  background: #edf2f7;
  font-size: 12px;
  font-weight: 700;
}

.segment-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #dfe6f0;
  border-radius: 7px;
  background: #fff;
}

.segment-control button {
  min-height: 38px;
  padding: 0 10px;
  border-right: 1px solid #e5ebf3;
  color: #4b5565;
  background: #fff;
  font-weight: 600;
}

.segment-control button:last-child {
  border-right: 0;
}

.segment-control button.active {
  color: #fff;
  background: var(--blue);
}

.canvas-panel {
  min-height: 654px;
  padding: 0;
  overflow: hidden;
}

.result-canvas {
  min-height: 654px;
  display: grid;
  place-items: center;
  background: #fff;
}

.result-canvas img,
.generated-image {
  display: block;
  max-width: 100%;
  max-height: 760px;
}

.result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 18px;
}

.result-grid .generated-image {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.result-card {
  width: min(100%, 760px);
  overflow: hidden;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #fff;
}

.result-grid .result-card {
  width: 100%;
}

.result-card .generated-image {
  width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #e5ebf3;
  background: #fff;
}

.result-actions button {
  min-height: 48px;
  color: #4b5565;
  border-right: 1px solid #e5ebf3;
  background: #fff;
  font-weight: 600;
}

.result-actions button:last-child {
  border-right: 0;
}

.result-actions button:hover {
  color: var(--blue);
  background: #f4f8ff;
}

.empty-state {
  text-align: center;
}

.empty-state h3 {
  margin: 10px 0 8px;
  font-size: 22px;
}

.empty-state p,
.empty-page p {
  color: #8a94a6;
}

.empty-icon {
  font-size: 54px;
}

.reference-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #7a8497;
}

.reference-upload-head strong {
  color: var(--blue);
  font-weight: 700;
}

.upload-box {
  min-height: 144px;
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 0 14px;
  border: 2px dashed #d7e0ed;
  border-radius: 6px;
  color: #7a8497;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.upload-box input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-content {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 144px;
  display: grid;
  place-items: center;
  padding: 20px;
}

.upload-actions {
  display: flex;
  gap: 10px;
  margin: -2px 0 10px;
}

.upload-action,
.upload-remove {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 5px;
  background: #edf5ff;
  color: var(--blue);
  font-size: 14px;
  cursor: pointer;
}

.upload-remove {
  color: #ef4444;
  background: #fff1f0;
}

.upload-box:hover,
.upload-box.dragging {
  color: var(--blue);
  border-color: var(--blue);
  background: #f8fbff;
}

.upload-box small {
  display: inline-block;
  margin-top: 7px;
  color: #9aa4b2;
}

.upload-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.upload-empty strong {
  color: #1f2937;
  font-size: 16px;
}

.upload-cloud {
  width: 38px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  color: #3d8bff;
  font-size: 34px;
  line-height: 1;
}

.reference-preview {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0;
}

.reference-preview figcaption {
  max-width: 100%;
  color: #6b7280;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-content img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.history-panel {
  padding: 24px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.history-card {
  overflow: hidden;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #fff;
}

.history-thumb-grid {
  min-height: 210px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 0;
  background: #f8fafc;
  color: #8a94a6;
}

.history-thumb-grid.multi {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 6px;
}

.history-thumb-grid.empty {
  place-items: center;
}

.history-thumb-item {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border-radius: 6px;
  background: #f8fafc;
}

.history-thumb-grid:not(.multi) .history-thumb-item {
  border-radius: 0;
}

.history-thumb-item.empty {
  display: grid;
  place-items: center;
}

.history-thumb-item .generated-image {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
}

.image-count-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, 0.58);
  font-size: 12px;
  line-height: 1;
}

.history-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
}

.history-actions button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.58);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
}

.history-actions button:hover {
  background: var(--blue);
}

.thumb {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: #f8fafc;
  color: #8a94a6;
}

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

.history-info {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.history-info p {
  min-height: 42px;
  margin: 0;
  color: #394150;
  line-height: 1.5;
}

.history-info small {
  color: #8a94a6;
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #ffe0b2;
  border-radius: 6px;
  color: #9a5b00;
  background: #fff7e8;
}

.notice.error,
.error {
  color: #b42318;
  border-color: #ffd4d1;
  background: #fff1f0;
}

.empty-page {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background: #fff;
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.empty-page.compact {
  min-height: 280px;
}

.empty-art {
  font-size: 64px;
  color: #c9d2e1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
}

.modal {
  position: relative;
  width: min(700px, calc(100vw - 32px));
  padding: 24px 20px 20px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.2);
}

.modal h2 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 500;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  color: #8a94a6;
  background: transparent;
  font-size: 26px;
}

.modal-warning {
  margin-bottom: 16px;
  padding: 13px 18px;
  border-radius: 5px;
  color: #d98906;
  background: #fff7e8;
}

.key-copy-row {
  align-items: stretch;
  margin-bottom: 20px;
}

.key-copy-row .input {
  height: 40px;
  border-radius: 5px 0 0 5px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.copy-button {
  width: 92px;
  color: #5c6678;
  border: 1px solid #dbe3ef;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  background: #f8fafc;
}

.modal-actions {
  justify-content: flex-end;
}

.preview-modal {
  padding: 22px;
}

.preview-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.24);
}

.preview-dialog img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  justify-self: center;
  object-fit: contain;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
}

.inline-form {
  gap: 8px;
}

.config-panel {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #f8fbff;
}

.config-panel p {
  margin: 6px 0 0;
  color: #7a8497;
}

.config-panel > div:last-child {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.config-panel small {
  color: #7a8497;
}

.settings-card {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #fff;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 20px;
  overflow-x: auto;
}

.admin-tabs button {
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  background: #fff;
  color: #576072;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 14px;
  white-space: nowrap;
}

.admin-tabs button.active {
  border-color: var(--blue);
  background: #eef6ff;
  color: var(--blue);
}

.admin-section-head {
  margin-bottom: 14px;
}

.test-mail-form {
  justify-content: flex-start;
}

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

.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #f8fbff;
}

.backup-row p {
  margin: 5px 0 0;
  color: #7a8497;
  font-size: 13px;
}

.prompt-cell {
  max-width: 320px;
  white-space: normal;
  word-break: break-word;
}

.mini-thumb-list {
  display: grid;
  grid-template-columns: repeat(2, 64px);
  gap: 8px;
  max-width: 140px;
}

.mini-thumb-list .history-thumb-item {
  aspect-ratio: 1;
  min-height: 64px;
}

.mini-thumb-list .history-actions {
  gap: 4px;
}

.mini-thumb-list .history-actions button {
  min-width: 0;
  width: 26px;
  height: 24px;
  padding: 0;
}

.settings-head,
.settings-actions,
.switch-row {
  display: flex;
  align-items: center;
}

.settings-head,
.settings-actions {
  justify-content: space-between;
  gap: 14px;
}

.settings-head p {
  margin: 6px 0 0;
  color: #7a8497;
}

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

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

.switch-row {
  gap: 9px;
  color: #394150;
  font-weight: 700;
}

.switch-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.settings-actions small {
  color: #7a8497;
}

.provider-list {
  display: grid;
  gap: 10px;
  margin: -8px 0 20px;
}

.provider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #fff;
}

.provider-row p {
  margin: 5px 0 0;
  color: #7a8497;
  font-size: 13px;
  word-break: break-all;
}

.provider-row > div:last-child {
  display: grid;
  justify-items: end;
  gap: 6px;
  white-space: nowrap;
}

.input.small {
  width: 78px;
}

.input.reason {
  width: 170px;
}

.upstream-url-input {
  min-width: 260px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .experience-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .two-column,
  .billing-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 180px;
  }

  .content,
  .control-panel,
  .page-card,
  .history-panel {
    padding: 16px;
  }

  .section-header,
  .experience-hero,
  .backup-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

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

  .plan-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    gap: 18px;
    overflow-x: auto;
  }
}
