:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f9fafc;
  --line: #e5e5e5;
  --text: #333333;
  --muted: #667085;
  --brand: #db5e77;
  --brand-strong: #c00c60;
  --brand-soft: rgba(219, 94, 119, 0.1);
  --accent: #bdd7ec;
  --accent-strong: #5a67d8;
  --shadow: 0 18px 48px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(189, 215, 236, 0.5), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #f5f7fa 100%);
}

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

.shell,
.admin-page {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(229, 229, 229, 0.9);
}

.topbar-inner,
.page,
.admin-wrap {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  box-shadow: 0 10px 24px rgba(192, 12, 96, 0.18);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.support-qr-menu {
  position: relative;
  z-index: 20;
}

.support-qr-menu .support-qr-panel {
  top: calc(100% + 10px);
  right: 0;
  transform: translateY(-6px) scale(0.98);
}

.support-qr-menu.open .support-qr-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.web-auth-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(37, 211, 102, 0.28);
  background: rgba(37, 211, 102, 0.08);
  color: #1d6b3a;
  font-size: 13px;
  white-space: nowrap;
}

.web-auth-avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.web-auth-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(37, 211, 102, 0.28);
  background: #fff;
}

.web-auth-avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(37, 211, 102, 0.28);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.web-auth-avatar-fallback.hidden {
  display: none;
}

.web-auth-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.web-auth-quota {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.web-auth-pill.is-logged-in .web-auth-quota {
  color: #1d6b3a;
}

.web-auth-pill.is-disabled {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
}

.web-auth-pill.is-logged-in {
  border-color: rgba(37, 211, 102, 0.36);
  background: rgba(37, 211, 102, 0.12);
}

.web-auth-btn {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 12px;
}

.web-bind-modal-card {
  width: min(520px, 100%);
}

.web-bind-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.web-bind-qr-box {
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.web-bind-qr-box img {
  display: block;
  width: 192px;
  height: 192px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

.web-bind-status strong {
  display: block;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.web-bind-status.is-bound strong {
  color: var(--accent-strong);
}

.web-bind-status p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.web-bind-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.order-pill {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.topbar-link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page {
  padding: 24px 0 32px;
}

.hero-band {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  align-items: stretch;
}

.hero-copy,
.hero-card,
.config-panel,
.editor-panel,
.result-panel,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  min-height: 196px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(219, 94, 119, 0.08) 0%, rgba(189, 215, 236, 0.2) 100%),
    var(--panel);
}

.hero-slide {
  position: absolute;
  inset: 28px;
  display: grid;
  align-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
}

.hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hero-copy h2 {
  max-width: 820px;
  font-size: 30px;
  line-height: 1.28;
}

.hero-copy p {
  margin-top: 12px;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-share-slide {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.hero-share-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero-share-btn {
  white-space: nowrap;
  text-decoration: none;
}

.hero-carousel-controls {
  position: absolute;
  right: 22px;
  bottom: 16px;
  display: flex;
  gap: 7px;
  z-index: 2;
}

.hero-carousel-dot {
  width: 8px;
  height: 8px;
  min-height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 41, 55, 0.2);
  cursor: pointer;
  transition: width 0.2s ease, border-radius 0.2s ease, background 0.2s ease;
}

.hero-carousel-dot.is-active {
  width: 22px;
  border-radius: 999px;
  background: var(--brand);
}

.hero-card {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.hero-kpi {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid rgba(229, 229, 229, 0.9);
}

.hero-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.hero-kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.service-band {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.service-card {
  text-align: left;
  padding: 18px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.service-card:hover {
  transform: translateY(-1px);
  border-color: rgba(219, 94, 119, 0.35);
}

.service-card.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, rgba(219, 94, 119, 0.1) 0%, rgba(189, 215, 236, 0.16) 100%);
  box-shadow: 0 14px 32px rgba(31, 41, 55, 0.08);
}

.service-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--brand-strong);
  font-weight: 700;
}

.service-card strong {
  display: block;
  font-size: 18px;
}

.service-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.workspace {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  grid-template-columns: 320px minmax(0, 1fr) minmax(320px, 0.9fr);
}

.config-panel,
.editor-panel,
.result-panel,
.admin-card {
  padding: 18px;
}

.config-head p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.mode-switch {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.mode-tab,
.primary-btn,
.soft-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.mode-tab {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--panel-soft);
  color: var(--muted);
}

.mode-tab.active {
  background: var(--accent);
  color: var(--text);
}

.order-modal-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  background: var(--panel-soft);
}

.order-modal-tabs .mode-tab {
  min-height: 42px;
  border-radius: 11px;
  background: transparent;
}

.order-modal-tabs .mode-tab.active {
  background: linear-gradient(135deg, #d9edf9 0%, #b7d8ef 100%);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(75, 118, 155, 0.14);
}

.order-modal-card {
  width: min(780px, 100%);
}

.order-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.order-modal-layout > .order-option-card:not(.active) {
  display: none;
}

.order-option-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 8%, rgba(217, 237, 249, 0.55), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 253, 0.92));
  box-shadow: 0 14px 34px rgba(43, 55, 78, 0.06);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.order-option-card.active {
  border-color: rgba(207, 63, 119, 0.42);
  box-shadow: 0 18px 42px rgba(207, 63, 119, 0.11);
}

.order-option-card-buy {
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 232, 240, 0.74), transparent 32%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 251, 0.78));
}

.order-option-head {
  display: grid;
  gap: 6px;
}

.order-option-head span {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(75, 118, 155, 0.1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-option-head strong {
  color: var(--text);
  font-size: 18px;
}

.order-option-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.order-option-btn {
  width: 100%;
  min-height: 44px;
}

.config-stack,
.task-grid,
.admin-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.text-input,
.status-box {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.field input,
.field select,
#orderInput {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
}

.field-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.order-buy-panel,
.order-manual-panel {
  display: grid;
  gap: 12px;
}

.payment-plan-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payment-estimate-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(207, 63, 119, 0.22);
  border-radius: 14px;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 232, 240, 0.88), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 251, 0.9));
}

.payment-result .payment-estimate-card {
  margin-top: 2px;
  border-style: solid;
  background: #fff;
}

.payment-estimate-card div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.payment-estimate-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payment-estimate-card strong {
  color: var(--text);
  font-size: 16px;
  white-space: nowrap;
}

.payment-estimate-card div:last-child strong {
  color: var(--brand-strong);
}

.payment-empty {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(116, 155, 188, 0.08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.payment-plan-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  align-content: space-between;
  min-height: 128px;
  gap: 8px;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 253, 0.96));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.payment-plan-card:hover {
  transform: translateY(-1px);
  border-color: rgba(207, 63, 119, 0.36);
  box-shadow: 0 12px 28px rgba(43, 55, 78, 0.08);
}

.payment-plan-card.active {
  border-color: rgba(207, 63, 119, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 248, 251, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 14px 34px rgba(207, 63, 119, 0.12);
}

.payment-plan-card strong {
  font-size: 15px;
}

.payment-plan-meta {
  color: var(--muted);
  font-size: 12px;
}

.payment-plan-price {
  align-self: end;
  color: var(--brand-strong);
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.payment-custom-box,
.payment-result {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fff;
}

.payment-custom-box.active {
  border-color: rgba(207, 63, 119, 0.4);
  background: linear-gradient(135deg, rgba(255, 248, 251, 0.78), #fff);
}

.payment-custom-box label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payment-custom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.payment-custom-row input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.custom-payment-confirm {
  min-height: 42px;
  padding: 8px 12px;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.payment-custom-box p,
.payment-result p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.payment-result {
  border-style: solid;
  border-color: rgba(207, 63, 119, 0.18);
  background: linear-gradient(135deg, rgba(255, 248, 251, 0.9), rgba(248, 251, 253, 0.9));
}

.alipay-qr-frame-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 150px;
  height: 150px;
  padding: 8px;
  border: 1px solid rgba(207, 63, 119, 0.16);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.alipay-qr-frame-wrap img {
  width: 138px;
  height: 138px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.alipay-qr-frame-wrap img.loaded {
  opacity: 1;
}

.alipay-qr-tip {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.editor-panel,
.result-panel {
  display: grid;
  gap: 14px;
}

.editor-surface,
.task-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  overflow: hidden;
}

.surface-head,
.result-head,
.modal-head,
.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.surface-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  text-align: right;
}

.surface-head,
.task-panel,
.result-head,
.modal-card,
.admin-card {
  line-height: 1.5;
}

.surface-head {
  padding: 16px 16px 0;
}

.surface-head span,
.result-head span,
.modal-head p {
  color: var(--muted);
  font-size: 12px;
}

.text-input {
  width: 100%;
  min-height: 360px;
  padding: 16px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  resize: vertical;
  line-height: 1.72;
}

.surface-foot,
.surface-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-card > .modal-actions {
  position: sticky;
  bottom: -22px;
  z-index: 1;
  margin: 0 -22px -22px;
  padding: 14px 22px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), #fff 32%);
  border-top: 1px solid rgba(229, 229, 229, 0.78);
  border-radius: 0 0 18px 18px;
}

.modal-actions.web-bind-actions {
  justify-content: center;
}

.surface-foot,
.file-actions,
.task-panel,
.orders-table {
  padding: 16px;
}

.char-count {
  color: var(--muted);
  font-size: 12px;
}

.primary-btn,
.soft-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  min-height: 42px;
  padding: 10px 16px;
  background: #fff;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
}

.soft-btn {
  background: var(--accent);
  color: var(--text);
}

.ghost-btn {
  border-color: var(--line);
  color: var(--text);
}

.danger-btn {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.18);
  color: #b42318;
}

.icon-btn {
  width: 42px;
  padding: 0;
  font-size: 22px;
}

.compact-btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.compact-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary-btn:hover,
.soft-btn:hover,
.ghost-btn:hover,
.danger-btn:hover,
.icon-btn:hover,
.mode-tab:hover {
  transform: translateY(-1px);
}

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

.span-12 {
  grid-column: span 12;
}

.span-6 {
  grid-column: span 6;
}

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

.status-box {
  min-height: 60px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  white-space: pre-wrap;
  line-height: 1.7;
}

.status-box.subtle {
  background: var(--panel-soft);
}

.result-body {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 16px;
  overflow: auto;
}

.empty-state {
  min-height: 460px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand-strong);
}

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

.metric-card,
.segment-card,
.link-card,
.order-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric-card {
  padding: 14px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.segments,
.links {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.segment-card {
  padding: 14px;
}

.segment-tag {
  display: inline-flex;
  min-height: 26px;
  padding: 4px 10px;
  align-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
}

.segment-card p {
  margin-top: 10px;
  line-height: 1.7;
}

.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.link-card a {
  color: var(--brand-strong);
  text-decoration: none;
  word-break: break-all;
}

/* 售后群二维码 */
.support-qr-widget {
  position: fixed;
  right: 18px;
  top: 44%;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(-50%);
}

.support-qr-toggle {
  width: 44px;
  min-height: 104px;
  padding: 12px 8px;
  border: 1px solid rgba(219, 94, 119, 0.24);
  border-radius: 14px 0 0 14px;
  background: #fff;
  color: var(--brand-strong);
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.12);
  text-orientation: upright;
  writing-mode: vertical-rl;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.support-qr-toggle:hover {
  transform: translateX(-2px);
  border-color: rgba(219, 94, 119, 0.48);
  box-shadow: 0 16px 36px rgba(31, 41, 55, 0.16);
}

.support-qr-panel {
  position: absolute;
  right: 52px;
  width: 224px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 52px rgba(31, 41, 55, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px) scale(0.98);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.support-qr-widget.open .support-qr-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.support-qr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.support-qr-head strong {
  font-size: 15px;
}

.support-qr-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.support-qr-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.32;
  object-fit: contain;
  border-radius: 10px;
  background: #111;
}

.support-qr-panel p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.share-referral-widget {
  position: fixed;
  top: 44%;
  right: 18px;
  z-index: 30;
  transform: translateY(-50%);
}

.share-referral-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 104px;
  padding: 12px 8px;
  border: 1px solid rgba(37, 125, 211, 0.24);
  border-radius: 14px 0 0 14px;
  background: #fff;
  color: #1769aa;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.25;
  text-decoration: none;
  writing-mode: vertical-rl;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.12);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.share-referral-toggle:hover {
  transform: translateX(-2px);
  border-color: rgba(37, 125, 211, 0.5);
  box-shadow: 0 16px 36px rgba(31, 41, 55, 0.16);
}

.support-qr-admin-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 220px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.support-qr-admin-preview img {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

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

.modal-card {
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
  overscroll-behavior: contain;
}

.modal-card.order-modal-card {
  width: min(780px, 100%);
}

.upload-estimate-card {
  width: min(420px, 100%);
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.upload-estimate-card strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  margin-bottom: 4px;
}

.upload-estimate-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.upload-estimate-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid rgba(207, 63, 119, 0.16);
  border-top-color: var(--brand-strong);
  animation: upload-spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

.admin-page {
  background: var(--bg);
}

.history-hero-band {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.history-card {
  margin-top: 20px;
}

.history-actions {
  margin-top: 12px;
}

.order-download-btn {
  min-height: 34px;
  padding: 6px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-wrap {
  padding: 28px 0 32px;
  display: grid;
  gap: 16px;
}

.admin-head {
  margin-bottom: 16px;
}

.orders-table {
  display: grid;
  gap: 10px;
}

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

.admin-toolbar {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.admin-toolbar .field {
  min-width: 220px;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.order-page-meta {
  color: var(--muted);
  font-size: 13px;
}

.order-row {
  padding: 14px;
}

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

.order-row strong {
  display: block;
}

.order-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.order-delete-btn {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
}

.model-row.is-hidden-model {
  opacity: 0.72;
}

.model-badge {
  display: inline-flex !important;
  align-items: center;
  min-height: 28px;
  margin-top: 0 !important;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.model-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.model-name-input {
  min-width: min(360px, 100%);
  flex: 1;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.balance-adjust-form select,
.balance-adjust-form input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.balance-adjust-form .balance-amount-input {
  min-width: 120px;
  max-width: 160px;
}

.balance-adjust-form .balance-time-input {
  min-width: 190px;
  max-width: 220px;
}

.balance-subhead {
  margin-top: 12px;
  margin-bottom: 8px;
}

.ai-rate-track {
  position: relative;
  display: block;
  width: 100%;
  min-width: 120px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
}

.ai-rate-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.ai-rate-track .before {
  background: linear-gradient(90deg, #ff8a65, #d92550);
}

.ai-rate-track .after {
  background: linear-gradient(90deg, #80cbc4, #2e7d6b);
}

.rate-width-0 { width: 0%; }
.rate-width-5 { width: 5%; }
.rate-width-10 { width: 10%; }
.rate-width-15 { width: 15%; }
.rate-width-20 { width: 20%; }
.rate-width-25 { width: 25%; }
.rate-width-30 { width: 30%; }
.rate-width-35 { width: 35%; }
.rate-width-40 { width: 40%; }
.rate-width-45 { width: 45%; }
.rate-width-50 { width: 50%; }
.rate-width-55 { width: 55%; }
.rate-width-60 { width: 60%; }
.rate-width-65 { width: 65%; }
.rate-width-70 { width: 70%; }
.rate-width-75 { width: 75%; }
.rate-width-80 { width: 80%; }
.rate-width-85 { width: 85%; }
.rate-width-90 { width: 90%; }
.rate-width-95 { width: 95%; }
.rate-width-100 { width: 100%; }

/* Keep the desktop header stable when the logged-in quota and order actions are visible. */
@media (min-width: 1181px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 18px;
  }

  .brand {
    flex: 0 0 auto;
    min-width: 150px;
  }

  .brand h1 {
    white-space: nowrap;
  }

  .topbar-actions {
    min-width: 0;
    justify-content: flex-end;
    gap: 8px;
  }

  .topbar-actions > a,
  .topbar-actions > button,
  .topbar-actions .topbar-link-btn {
    white-space: nowrap;
  }

  .web-auth-pill {
    max-width: 420px;
  }

  .order-pill {
    max-width: 285px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace {
    align-items: start;
  }

  .config-panel {
    align-self: start;
  }

  .editor-panel,
  .result-panel {
    min-height: 620px;
  }
}

@media (max-width: 1180px) {
  .hero-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .order-modal-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 760px) {
  .topbar-inner,
  .page,
  .admin-wrap {
    width: min(100% - 20px, 1400px);
  }

  .topbar-inner,
  .topbar-actions,
  .surface-foot,
  .surface-actions,
  .surface-head-actions,
  .result-head,
  .admin-head {
    flex-direction: column;
    align-items: stretch;
  }

  .payment-custom-row,
  .payment-plan-card {
    grid-template-columns: 1fr;
  }

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

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

  .payment-plan-price {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .order-modal-card {
    width: min(100%, 560px);
  }

  .order-option-card {
    padding: 14px;
  }

  .alipay-qr-frame-wrap img {
    width: 138px;
    height: 138px;
  }

  .alipay-qr-tip {
    font-size: 14px;
  }

  .support-qr-widget {
    top: auto;
    right: 12px;
    bottom: 74px;
    transform: none;
  }

  .share-referral-widget {
    top: auto;
    right: 12px;
    bottom: 74px;
    transform: none;
  }

  .share-referral-toggle {
    width: auto;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 999px;
    letter-spacing: 0.08em;
    writing-mode: horizontal-tb;
  }

  .support-qr-toggle {
    width: auto;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 999px;
    letter-spacing: 0.08em;
    writing-mode: horizontal-tb;
  }

  .support-qr-panel {
    right: 0;
    bottom: 52px;
    width: min(224px, calc(100vw - 24px));
  }

  .service-band {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    font-size: 24px;
  }

  .hero-copy {
    min-height: 250px;
  }

  .hero-slide {
    inset: 22px;
  }

  .hero-share-slide {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 16px;
  }

  .hero-share-btn {
    justify-self: start;
  }

  .hero-carousel-controls {
    right: 18px;
    bottom: 14px;
  }

  .metric-grid,
  .file-grid,
  .admin-summary-grid {
    grid-template-columns: 1fr;
  }

  .span-6,
  .span-12 {
    grid-column: span 1;
  }

  .admin-toolbar {
    flex-direction: column;
  }

  .admin-pagination {
    flex-direction: column;
    align-items: stretch;
  }
}

.upstream-status-card {
  display: grid;
  gap: 12px;
}

.upstream-status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.upstream-status-line strong {
  min-width: 44px;
  font-size: 16px;
}

.upstream-status-line > span:last-child,
.upstream-status-meta {
  color: var(--muted);
  font-size: 12px;
}

.upstream-status-dot {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9ca3af;
  box-shadow: 0 0 0 4px rgb(156 163 175 / 14%);
}

.upstream-status-dot.is-idle {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgb(22 163 74 / 14%);
}

.upstream-status-dot.is-general {
  background: #d97706;
  box-shadow: 0 0 0 4px rgb(217 119 6 / 14%);
}

.upstream-status-dot.is-busy {
  background: #dc2626;
  box-shadow: 0 0 0 4px rgb(220 38 38 / 14%);
}

.upstream-status-dot.is-unknown,
.upstream-status-dot.is-loading {
  background: #6b7280;
  box-shadow: 0 0 0 4px rgb(107 114 128 / 14%);
}

.forced-login-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(17 24 39 / 72%);
  backdrop-filter: blur(5px);
}

.forced-login-gate.hidden {
  display: none;
}

