: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;
}

.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 {
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(219, 94, 119, 0.08) 0%, rgba(189, 215, 236, 0.2) 100%),
    var(--panel);
}

.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-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);
}

.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;
}

.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;
}

.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;
}

.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%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}

.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;
}

@media (max-width: 1180px) {
  .hero-band,
  .workspace {
    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,
  .modal-actions,
  .result-head,
  .admin-head {
    flex-direction: column;
    align-items: stretch;
  }

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

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

  .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;
  }
}


/* 在线客服标签 */
.tawk-label {
  position: fixed;
  bottom: 20px;
  right: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  z-index: 99999;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: tawk-label-pulse 2s infinite;
}
.tawk-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}
@keyframes tawk-label-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}
@media (max-width: 480px) {
  .tawk-label {
    right: 60px;
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* 隐藏 Tawk.to 挥手动画图标 */
[id*="tawk"] .attention-grabber,
[id*="tawk"] img[src*="attention-grabber"],
.tawk-attention-grabber {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 隐藏 Tawk.to 挥手动画图标（Attention Grabber） */
[id*="tawk"] [class*="attention"],
[id*="tawk"] [class*="grabber"],
[id*="tawk"] [class*="grab"],
[id*="tawk"] [class*="waving"],
[id*="tawk"] [class*="wave"],
[id*="tawk"] [class*="hint"],
[id*="tawk"] .tawk-attention-grabber,
[id*="tawk"] .tawk-attention,
[id*="tawk"] img[src*="attention-grabber"],
[id*="tawk"] .twk-attention-grabber,
[id*="tawk"] .twk-attention,
.tawk-attention-grabber,
.tawk-attention,
.twk-attention-grabber {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  pointer-events: none !important;
}
