:root {
  --bg: #f6f7f9;
  --bg-soft: #fbfbfc;
  --surface: #ffffff;
  --surface-soft: #f5f6f8;
  --ink: #17181c;
  --ink-soft: #3b3f47;
  --muted: #7b818c;
  --line: #e8e9ee;
  --line-strong: #dcdde3;
  --primary: #f0382f;
  --primary-dark: #d92a20;
  --primary-soft: #fdecea;
  --accent: #f0382f;
  --accent-soft: #fdecea;
  --warning: #b3761a;
  --warning-soft: #fdf4e3;
  --danger: #d33127;
  --danger-soft: #fdecea;
  --blue: #3457c0;
  --blue-soft: #eef1fc;
  --green: #1f9254;
  --green-soft: #eaf6ee;
  --shadow-sm: 0 1px 2px rgba(20, 22, 28, 0.04), 0 4px 14px rgba(20, 22, 28, 0.04);
  --shadow: 0 2px 6px rgba(20, 22, 28, 0.05), 0 18px 44px rgba(20, 22, 28, 0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --pill: 999px;
  --header-h: 68px;
}

* {
  box-sizing: border-box;
}

/* Elements marked `hidden` must stay hidden even when a component rule sets a
   display mode (for example .workflow-note / .nav-item / .account-menu). */
[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

i[data-lucide] {
  display: inline-block;
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(20, 22, 28, 0.06);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1240px;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #ff5a48 0%, #ec2a21 100%);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(240, 56, 47, 0.28);
}

.brand-mark i {
  width: 21px;
  height: 21px;
}

.brand-text {
  display: grid;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-text em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 14px;
  padding: 5px;
  background: #e8ecf4;
  border: 1px solid #d9dfeb;
  border-radius: var(--pill);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.07);
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 22px;
  color: #5d687e;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pill);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.nav-item:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(226, 32, 47, 0.3);
}

.nav-item:focus-visible {
  outline: 3px solid rgba(226, 32, 47, 0.35);
  outline-offset: 2px;
}

.nav-item.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, #f2454f 0%, #cf1120 100%);
  border-color: transparent;
  box-shadow:
    0 10px 20px rgba(207, 17, 32, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.nav-item.is-active:hover {
  color: #ffffff;
  background: linear-gradient(135deg, #f2454f 0%, #cf1120 100%);
  border-color: transparent;
  transform: none;
}

.nav-item.is-active .nav-count {
  color: var(--primary);
  background: #ffffff;
}

.nav-item i {
  width: 16px;
  height: 16px;
}

.nav-count {
  min-width: 20px;
  padding: 1px 6px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: var(--pill);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  color: #a8630f;
  background: linear-gradient(180deg, #fff8ea 0%, #fdf0d9 100%);
  border: 1px solid #f6e2be;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.credit-pill i {
  width: 16px;
  height: 16px;
}

.credit-pill strong {
  color: #8a4f08;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.credit-pill.is-low {
  color: #b23a30;
  background: linear-gradient(180deg, #fff4f2 0%, #fde8e5 100%);
  border-color: #f8d3ce;
}

.credit-pill.is-low strong {
  color: #a02a21;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  transition:
    color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.icon-button:hover {
  color: var(--primary);
  border-color: #f7c7c3;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------ page */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 22px 70px;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
  animation: view-in 240ms ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 8px 0 0;
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.page-head p {
  max-width: 700px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.head-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 14px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.head-badge i {
  width: 15px;
  height: 15px;
}

.announcement,
.mode-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.announcement {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #dde3f8;
}

.announcement[hidden],
.mode-alert[hidden] {
  display: none;
}

.mode-alert {
  color: #8a5a12;
  background: var(--warning-soft);
  border: 1px solid #f2e3c4;
}

.announcement i,
.mode-alert i {
  flex: 0 0 auto;
  margin-top: 2px;
}

.mode-alert strong,
.mode-alert span {
  display: block;
}

.mode-alert strong {
  font-size: 12.5px;
}

.mode-alert span {
  margin-top: 3px;
  font-size: 12px;
}

/* ----------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.72fr);
  gap: 20px;
  align-items: start;
}

.form-panel {
  padding: 26px 28px 28px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 7px 0 0;
  font-size: 19px;
  font-weight: 700;
}

.unit-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 7px 13px;
  color: #a8630f;
  background: #fff8ea;
  border: 1px solid #f6e2be;
  border-radius: var(--pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.unit-price i {
  width: 14px;
  height: 14px;
}

.unit-price strong {
  font-size: 13px;
  color: #8a4f08;
}

.field {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin-top: 22px;
}

.field-label {
  font-size: 13px;
  font-weight: 650;
}

.field small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.field small b {
  color: var(--ink-soft);
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 15px;
  color: #9aa0aa;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.input-wrap:focus-within {
  background: #ffffff;
  border-color: #f6b5b0;
  box-shadow: 0 0 0 4px rgba(240, 56, 47, 0.1);
}

.input-wrap-large {
  min-height: 54px;
}

.input-wrap input {
  min-width: 0;
  flex: 1;
  height: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
}

.input-wrap input::placeholder {
  color: #a8adb6;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.stepper {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: stretch;
  min-height: 48px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.stepper button {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  transition:
    color 150ms ease,
    background 150ms ease;
}

.stepper button:hover {
  color: var(--primary);
  background: #ffffff;
}

.stepper input {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  outline: none;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cost-field {
  align-content: start;
}

.cost-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-height: 48px;
  padding: 0 16px;
  background: var(--primary-soft);
  border: 1px solid #fad6d2;
  border-radius: var(--radius-sm);
}

.cost-value strong {
  color: var(--primary);
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.cost-value span {
  color: #b4453c;
  font-size: 12px;
  font-weight: 600;
}

.balance-hint {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 12px 15px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.balance-hint i {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.balance-hint strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.balance-hint.is-low {
  color: #a02a21;
  background: var(--danger-soft);
}

.balance-hint.is-low i,
.balance-hint.is-low strong {
  color: #a02a21;
}

/* ------------------------------------------------------ 高级选项（导出列） */

.advanced-options {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.advanced-options > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.advanced-options > summary::-webkit-details-marker {
  display: none;
}

.advanced-options > summary i {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.advanced-options > summary em {
  color: var(--muted);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 500;
}

.advanced-options[open] > summary {
  border-bottom: 1px solid var(--line);
}
.column-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 8px;
  padding: 12px 14px;
}

.column-pick label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px;
  cursor: pointer;
}

.column-pick label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-pick input {
  flex: none;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

.advanced-note {
  padding: 0 14px 10px;
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  line-height: 1.6;
}

.advanced-actions {
  display: flex;
  gap: 16px;
  padding: 0 14px 12px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}

.link-button:hover {
  text-decoration: underline;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.form-hint {
  color: var(--muted);
  font-size: 11.5px;
}

/* ---------------------------------------------------------------- buttons */

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  font-weight: 650;
  white-space: nowrap;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.primary-button {
  min-height: 46px;
  padding: 0 24px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff5545 0%, #ee2f26 100%);
  border-radius: var(--pill);
  box-shadow: 0 8px 22px rgba(240, 56, 47, 0.28);
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff6152 0%, #e42a21 100%);
  box-shadow: 0 10px 26px rgba(240, 56, 47, 0.34);
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 38px;
  padding: 0 16px;
  font-size: 12.5px;
}

.secondary-button {
  min-height: 42px;
  padding: 0 20px;
  color: var(--ink-soft);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
}

.secondary-button:hover:not(:disabled) {
  color: var(--primary);
  border-color: #f6b5b0;
  box-shadow: var(--shadow-sm);
}

.text-button {
  padding: 6px 4px;
  color: var(--muted);
  background: transparent;
  font-size: 12.5px;
}

.text-button:hover {
  color: var(--primary);
}

.text-button i {
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------- workflow */

.workflow-panel {
  padding: 26px 24px 24px;
}

.workflow-list {
  display: grid;
  gap: 4px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  padding: 13px 0;
}

.workflow-list li:not(:last-child) {
  border-bottom: 1px dashed var(--line);
}

.workflow-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 11px;
}

.workflow-icon i {
  width: 18px;
  height: 18px;
}

.workflow-list strong {
  display: block;
  font-size: 13.5px;
}

.workflow-list p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.source-box {
  margin-top: 18px;
  padding: 15px 16px;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

.source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-row + .source-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.source-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

.source-row strong {
  font-size: 12.5px;
}

.source-box p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(31, 146, 84, 0.14);
}

.status-dot.is-warning {
  background: #e0a33c;
  box-shadow: 0 0 0 3px rgba(224, 163, 60, 0.16);
}

.workflow-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 12px 14px;
  color: #8a5a12;
  background: var(--warning-soft);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.6;
}

.workflow-note i {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

/* ---------------------------------------------------------------- latest */

.latest-section {
  margin-top: 30px;
}

.section-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-row h2 {
  margin: 6px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.latest-task {
  min-height: 88px;
}

.empty-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 88px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: 12.5px;
}

.empty-inline i {
  width: 17px;
  height: 17px;
}

.latest-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.latest-card.is-failed {
  border-left-color: var(--danger);
}

.latest-card > .latest-body {
  min-width: 0;
  flex: 1;
}

.latest-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.latest-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.latest-meta i {
  width: 14px;
  height: 14px;
}

.latest-message {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.latest-message.is-failed {
  color: var(--danger);
}

.progress-track {
  width: 100%;
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  appearance: none;
  background: var(--surface-soft);
  border: 0;
  border-radius: var(--pill);
}

.progress-track::-webkit-progress-bar {
  background: var(--surface-soft);
  border-radius: var(--pill);
}

.progress-track::-webkit-progress-value {
  background: linear-gradient(90deg, #ff6a58 0%, #ee2f26 100%);
  border-radius: var(--pill);
}

.progress-track::-moz-progress-bar {
  background: linear-gradient(90deg, #ff6a58 0%, #ee2f26 100%);
  border-radius: var(--pill);
}

.progress-track.is-failed::-webkit-progress-value,
.progress-track.is-failed::-moz-progress-bar {
  background: var(--danger);
}

/* --------------------------------------------------------------- records */

.records-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.records-table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.records-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.records-table th,
.records-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.records-table th {
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.records-table td {
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.records-table tbody tr:last-child td {
  border-bottom: 0;
}

.records-table tbody tr:hover {
  background: #fcfcfd;
}

.records-table tbody tr.is-selected {
  background: var(--primary-soft);
}

.records-table .align-right {
  text-align: right;
}

.task-profile {
  display: grid;
  max-width: 260px;
}

.task-profile strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-profile span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--pill);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-chip::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: '';
}

.status-queued,
.status-running {
  color: #a8630f;
  background: var(--warning-soft);
}

.status-running::before {
  animation: pulse 1.4s ease-in-out infinite;
}

.status-completed {
  color: var(--green);
  background: var(--green-soft);
}

.status-failed {
  color: var(--danger);
  background: var(--danger-soft);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.table-actions {
  display: inline-flex;
  gap: 6px;
}

.table-action {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  transition:
    color 150ms ease,
    border-color 150ms ease;
}

.table-action:hover:not(:disabled) {
  color: var(--primary);
  border-color: #f6b5b0;
}

.table-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.table-action i {
  width: 15px;
  height: 15px;
}

.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
}

.empty-state.is-visible {
  display: flex;
}

.empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 16px;
}

.empty-icon i {
  width: 22px;
  height: 22px;
}

.empty-state strong {
  font-size: 14.5px;
}

.empty-state p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.preview-panel {
  padding: 22px 22px 20px;
}

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.preview-head h3 {
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.preview-meta:empty {
  display: none;
}

.meta-pill {
  padding: 4px 11px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: var(--pill);
  font-size: 11.5px;
}

.preview-table-wrap {
  max-height: 460px;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 210px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.preview-empty i {
  width: 22px;
  height: 22px;
}

.preview-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.preview-table th,
.preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

.preview-table th {
  position: sticky;
  top: 0;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 650;
  white-space: nowrap;
}

.preview-table td:nth-child(4),
.preview-table td:nth-child(10) {
  min-width: 240px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.preview-table a {
  color: var(--primary);
  text-decoration: none;
}

.preview-table a:hover {
  text-decoration: underline;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ----------------------------------------------------------------- toast */

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  animation: toast-in 220ms ease both;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast i {
  width: 17px;
  height: 17px;
  color: var(--green);
}

.toast.is-error i {
  color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 1100px) {
  .create-grid,
  .records-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  :root {
    --header-h: auto;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  .brand-text em {
    display: none;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 3px;
    padding: 4px;
    justify-content: space-between;
  }

  .nav-item {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    font-size: 13.5px;
  }

  /* 小屏下页签文字允许收窄，避免两个页签把顶栏顶出横向滚动条。
     nav-count 是数字徽标，不能跟着省略号化，所以排除它。 */
  .nav-item > span:not(.nav-count) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-side {
    gap: 8px;
  }

  .credit-label {
    display: none;
  }

  .page {
    padding: 20px 16px 60px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .form-panel,
  .workflow-panel,
  .preview-panel {
    padding: 20px 18px;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-head {
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button {
    width: 100%;
  }

  .form-hint {
    text-align: center;
  }

  .latest-card {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-actions {
    flex-direction: column-reverse;
  }

  .preview-actions .primary-button,
  .preview-actions .secondary-button {
    width: 100%;
  }

  .toast-region {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }
}

/* ------------------------------------------------------- account + modals */

.account-area {
  position: relative;
  flex: 0 0 auto;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  color: var(--ink-soft);
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.account-button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.account-button.is-agent {
  color: var(--primary);
  border-color: rgba(240, 56, 47, 0.4);
  background: var(--primary-soft);
}

.account-button i {
  width: 17px;
  height: 17px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 248px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.account-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.account-menu-head strong {
  font-size: 14px;
}

.account-menu-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-weight: 600;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
}

.account-menu button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.account-menu button i {
  width: 16px;
  height: 16px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  padding: 24px 16px;
  place-items: center;
  overflow-y: auto;
  background: rgba(17, 18, 22, 0.5);
  backdrop-filter: blur(4px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: view-in 0.24s ease both;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 4px 0 0;
  font-size: 19px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface-soft);
  border-radius: var(--pill);
}

.auth-tab {
  flex: 1;
  padding: 9px;
  color: var(--muted);
  font-weight: 600;
  background: none;
  border: none;
  border-radius: var(--pill);
}

.auth-tab.is-active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form .primary-button,
.auth-form .secondary-button {
  width: 100%;
  margin-top: 4px;
}

.form-divider {
  display: block;
  padding-top: 16px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--line);
}

.auth-hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

/* ---------------------------------------------------------- stat + agent */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.stat-card > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 12.5px;
}

.stat-card strong {
  font-size: 21px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stat-icon {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
}

.stat-icon.red {
  color: var(--primary);
  background: var(--primary-soft);
}

.stat-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.stat-icon.green {
  color: var(--green);
  background: var(--green-soft);
}

.stat-icon.amber {
  color: var(--warning);
  background: var(--warning-soft);
}

.agent-stats {
  margin-bottom: 18px;
}

.invite-panel {
  margin-bottom: 18px;
}

.invite-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.invite-row .input-wrap {
  flex: 1;
}

.invite-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.agent-grid .panel {
  padding: 22px;
}

.cell-strong {
  display: block;
  font-weight: 600;
}

.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.commission-cell {
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .agent-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .record-filter {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .record-filter-group {
    justify-content: space-between;
  }

  .platform-filter {
    flex: 1;
  }

  .record-filter-date {
    flex: 1 1 132px;
    min-width: 132px;
    height: 38px;
    font-size: 13px;
  }

  .header-side {
    flex: 1;
    justify-content: flex-end;
  }

  .account-button {
    padding: 0 12px;
  }

  .account-button span {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-menu {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .invite-row {
    flex-direction: column;
    align-items: stretch;
  }

  .invite-row .primary-button {
    width: 100%;
  }

  .agent-grid .panel {
    padding: 18px 16px;
  }

  .modal-card {
    padding: 20px 18px;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .records-table {
    min-width: 760px;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 15px;
  }

  .stat-card strong {
    font-size: 19px;
  }
}
@media (max-width: 560px) {
  /* 手机端：标题与说明各占一行，避免「高级选项」被挤出两行 */
  .advanced-options > summary {
    flex-wrap: wrap;
    row-gap: 2px;
    padding: 11px 12px;
  }

  .advanced-options > summary em {
    flex-basis: 100%;
    margin-left: 24px;
    line-height: 1.5;
  }

  .column-pick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px 12px;
  }
}

/* -------------------------------------------------- platforms & login */

.platform-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

/* 后台关闭平台选择区时，用一行浅色提示告诉用户当前用哪个平台。 */
.platform-auto-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-soft);
  background: #fdf5f2;
  border: 1px solid #f6ddd6;
  border-radius: 10px;
}

.platform-auto-hint[hidden] {
  display: none;
}

.platform-auto-hint svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--red);
}

.platform-auto-hint strong {
  color: var(--ink);
  font-weight: 700;
}

.platform-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 12px 12px;
  text-align: left;
  color: var(--ink-soft);
  font: inherit;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.platform-tab:hover {
  border-color: #f4b3ae;
  background: #fffafa;
  transform: translateY(-1px);
}

.platform-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(240, 56, 47, 0.16);
}

.platform-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: #4a4d55;
  background: #f2f3f6;
  border-radius: 10px;
}

.platform-tab-icon svg {
  width: 18px;
  height: 18px;
}

.platform-tab[data-platform='douyin'] .platform-tab-icon {
  color: #111318;
  background: #eceef2;
}

.platform-tab[data-platform='xiaohongshu'] .platform-tab-icon {
  color: #ff2e4d;
  background: #ffecef;
}

.platform-tab[data-platform='kuaishou'] .platform-tab-icon {
  color: #ff6a00;
  background: #fff1e6;
}

.platform-tab[data-platform='wechat_channels'] .platform-tab-icon {
  color: #07c160;
  background: #e8f8ef;
}

.platform-tab-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.platform-tab-name {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
}

.platform-tab-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.platform-tab-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.platform-tab-check svg {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

.platform-tab.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(240, 56, 47, 0.09);
}

.platform-tab.is-active .platform-tab-name {
  color: var(--primary-dark);
}

.platform-tab.is-active .platform-tab-sub {
  color: #a8423b;
}

.platform-tab.is-active .platform-tab-check {
  opacity: 1;
  transform: scale(1);
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--pill);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.platform-chip.is-douyin {
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.platform-chip.is-xiaohongshu {
  color: #c0182a;
  background: #fdeaec;
}

.platform-chip.is-kuaishou {
  color: #b34a00;
  background: #fff1e6;
}

.platform-chip.is-wechat_channels {
  color: #05874a;
  background: #e8f8ef;
}

.login-panel {
  margin-top: 18px;
  position: relative;
}

/* 登录弹窗：平时完全隐藏，只有后台采集账号失效时才浮出来要求登录。 */
.login-panel.is-modal {
  position: fixed;
  z-index: 90;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  margin: 0;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.login-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.login-modal-close {
  margin-left: 10px;
}

.login-panel.is-modal .panel-head {
  flex-wrap: wrap;
}

.login-panel.is-modal .panel-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.login-panel.is-modal #loginStatusBadge {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

/* ------------------------------ 生成记录筛选 ------------------------------ */

.record-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.record-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.record-filter-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
}

.platform-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-filter-chip {
  padding: 6px 14px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 160ms ease;
}

.platform-filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.platform-filter-chip.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 6px 14px rgba(226, 32, 47, 0.22);
}

.record-filter-date {
  height: 34px;
  padding: 0 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink);
}

.record-filter-dash {
  color: var(--muted);
  font-size: 12px;
}

.record-filter-quick,
.record-filter-reset {
  height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.record-filter-quick:hover,
.record-filter-reset:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.record-filter-quick.is-active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
}

/* 筛选状态行：写清「现在筛了什么、命中多少条」，改筛选条件时用户能立刻确认生效。 */
.record-filter-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: -4px 0 14px;
  padding: 9px 14px;
  color: var(--ink-soft);
  background: #f5f7fc;
  border: 1px solid var(--line);
  border-left: 3px solid #cdd5e4;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
}

.record-filter-summary.is-filtered {
  color: var(--ink);
  background: var(--primary-soft);
  border-color: rgba(226, 32, 47, 0.22);
  border-left-color: var(--primary);
}

.record-filter-summary strong {
  color: var(--primary);
  font-weight: 750;
}

.record-filter-summary .record-filter-summary-hint {
  color: var(--muted);
  font-weight: 550;
}

.record-filter-summary.is-filtered .record-filter-summary-hint {
  color: var(--ink-soft);
}

.login-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.login-status.is-ok {
  color: var(--green);
  background: var(--green-soft);
}

.login-status.is-warn {
  color: #a8630f;
  background: var(--warning-soft);
}

.login-panel-note {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.login-body {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.login-qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 196px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

.login-qr img {
  width: 168px;
  height: 168px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}

.login-qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.login-qr-placeholder svg {
  width: 26px;
  height: 26px;
}

.login-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-controls textarea {
  width: 100%;
  min-height: 84px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.login-controls textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.login-controls > .secondary-button {
  align-self: flex-start;
}

.login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

@media (max-width: 820px) {
  .login-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-qr-box {
    min-height: 168px;
  }

  .platform-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
  }

  .platform-tab {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 76px;
    padding: 11px 10px;
  }

  .platform-tab-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .platform-tab-icon svg {
    width: 16px;
    height: 16px;
  }

  .platform-tab-name {
    font-size: 13.5px;
  }

  .platform-tab-sub {
    font-size: 10.5px;
  }
}

@media (max-width: 560px) {
  .platform-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .platform-tab {
    align-items: center;
    gap: 4px;
    min-height: 78px;
    padding: 10px 4px 9px;
    text-align: center;
  }

  .platform-tab-body {
    align-items: center;
  }

  .platform-tab-sub {
    display: none;
  }

  .platform-tab-check {
    top: 6px;
    right: 6px;
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 380px) {
  .platform-tab {
    min-height: 72px;
    padding: 9px 3px 8px;
  }

  .platform-tab-icon {
    width: 24px;
    height: 24px;
  }

  .platform-tab-icon svg {
    width: 14px;
    height: 14px;
  }

  .platform-tab-name {
    font-size: 12.5px;
  }
}

/* ------------------------------------------------------- 充值 / 卡密 弹窗 */

.credit-pill {
  cursor: pointer;
  font-family: inherit;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.credit-pill:hover {
  border-color: #eecfa1;
  box-shadow: 0 4px 14px rgba(168, 99, 15, 0.14);
}

.credit-pill:active {
  transform: translateY(1px);
}

.credit-plus {
  padding-left: 7px;
  margin-left: 1px;
  color: #a8630f;
  font-size: 11px;
  font-weight: 700;
  border-left: 1px solid #f0dab4;
}

.modal-card-wide {
  width: min(540px, 100%);
}

.recharge-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  color: #8a4f08;
  background: linear-gradient(135deg, #fff8ea 0%, #fdf0d9 100%);
  border: 1px solid #f6e2be;
  border-radius: var(--radius-sm);
}

.recharge-balance span {
  font-size: 12.5px;
  font-weight: 600;
}

.recharge-balance strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.redeem-form {
  display: grid;
  gap: 9px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.redeem-row {
  display: flex;
  gap: 9px;
  align-items: stretch;
}

.redeem-row .input-wrap {
  flex: 1;
  min-width: 0;
  min-height: 44px;
}

.redeem-row .primary-button.compact {
  width: auto;
  min-width: 106px;
  margin: 0;
  white-space: nowrap;
}

.recharge-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.recharge-section {
  display: grid;
  gap: 12px;
  padding-top: 20px;
}

.recharge-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.recharge-section-head strong {
  font-size: 13px;
  font-weight: 650;
}

.recharge-section-head span {
  color: var(--muted);
  font-size: 11.5px;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tier-grid:empty {
  display: none;
}

.tier-card {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 14px 14px 13px;
  text-align: left;
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.tier-card:hover {
  border-color: #f6b5b0;
  background: #fffafa;
}

.tier-card.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(240, 56, 47, 0.09);
}

.tier-price {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tier-credits {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tier-card.is-selected .tier-credits {
  color: #a8423b;
}

.tier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.tier-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  color: #fff;
  background: var(--primary);
  border-radius: var(--pill);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.6;
}

.recharge-section .primary-button {
  width: 100%;
  margin-top: 2px;
}

@media (max-width: 560px) {
  .credit-plus {
    display: none;
  }

  .modal-card-wide {
    width: 100%;
    padding: 20px 18px;
  }

  .tier-grid {
    gap: 8px;
  }

  .tier-card {
    padding: 12px 11px;
  }

  .tier-price {
    font-size: 15.5px;
  }

  .redeem-row {
    flex-direction: column;
  }

  .redeem-row .primary-button.compact {
    width: 100%;
    min-width: 0;
  }

  .tier-tag {
    padding: 1px 6px;
    font-size: 9.5px;
  }
}

@media (max-width: 560px) {
  /* 手机端筛选条：平台与时间各占一行，日期输入保证完整显示 yyyy-mm-dd */
  .record-filter {
    padding: 12px 12px;
    gap: 12px;
    margin-top: 14px;
  }

  .record-filter-group {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .record-filter-group > .record-filter-label {
    flex: 0 0 100%;
    font-size: 12px;
    letter-spacing: 0.02em;
  }

  .platform-filter {
    flex: 1 1 100%;
    gap: 6px;
  }

  .platform-filter-chip {
    flex: 1 1 auto;
    min-width: 60px;
    padding: 7px 10px;
    text-align: center;
  }

  .record-filter-date {
    flex: 1 1 calc(50% - 18px);
    min-width: 0;
    height: 40px;
    padding: 0 8px;
    font-size: 13px;
  }

  .record-filter-dash {
    flex: 0 0 auto;
  }

  .record-filter-quick,
  .record-filter-reset {
    flex: 1 1 auto;
    height: 36px;
    padding: 0 10px;
    text-align: center;
  }
}

/* ===== 联系客服（用户端） ===== */
.support-floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f0382f, #ff7a59);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(240, 56, 47, 0.32);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.support-floating:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(240, 56, 47, 0.38);
}

.support-floating:focus-visible {
  outline: 2px solid #f0382f;
  outline-offset: 3px;
}

.support-floating i {
  width: 18px;
  height: 18px;
}

.support-modal-card {
  width: min(600px, calc(100vw - 32px));
  max-width: 600px;
}

.support-tip {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

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

.support-grid.is-single {
  grid-template-columns: minmax(0, 260px);
  justify-content: center;
}

.support-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  text-align: center;
}

.support-label {
  font-size: 13px;
  color: var(--muted);
}

.support-wechat {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.35;
}

.support-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.support-qr {
  width: 168px;
  height: 168px;
  object-fit: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.support-qr-caption {
  font-size: 12px;
  color: var(--muted);
}

.support-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.support-actions .secondary-button,
.support-actions .primary-button {
  min-width: 112px;
}

@media (max-width: 640px) {
  .support-floating {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  .support-floating span {
    display: none;
  }

  .support-modal-card {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }

  .support-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-grid.is-single {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-qr {
    width: min(220px, 62vw);
    height: min(220px, 62vw);
  }

  .support-actions {
    flex-direction: column-reverse;
  }

  .support-actions .secondary-button,
  .support-actions .primary-button {
    width: 100%;
  }
}

/* 手机端客服弹窗：两个二维码并排，避免整屏滚动 */
@media (max-width: 640px) {
  .support-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .support-grid.is-single {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-block {
    gap: 8px;
    padding: 14px 10px;
  }

  .support-wechat {
    font-size: 16px;
  }

  .support-block .secondary-button.compact {
    padding: 0 12px;
    font-size: 13px;
  }

  .support-qr {
    width: min(150px, 36vw);
    height: min(150px, 36vw);
  }
}
