:root {
  --bg: #eef5ff;
  --panel: #ffffff;
  --text: #102033;
  --muted: #607086;
  --line: #d7e4f5;
  --brand: #1769ff;
  --brand-dark: #0d47bf;
  --brand-soft: #eaf2ff;
  --cyan: #1bb7ff;
  --accent: #0f75ff;
  --danger: #d92d20;
  --warning: #b86a00;
  --shadow: 0 18px 48px rgba(22, 84, 170, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(23, 105, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 105, 255, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.code-row button:disabled {
  border-color: #cbd8e8;
  background: #edf3fb;
  color: #6b7d93;
  opacity: 1;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(260px, 440px);
  gap: 18px;
  align-items: center;
  min-height: 82px;
  padding: 14px 28px;
  background: linear-gradient(180deg, #073b92 0%, #09275e 100%);
  color: #f8fbff;
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: linear-gradient(135deg, #2bc8ff, #1769ff);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  font-size: 17px;
  font-weight: 900;
  overflow: hidden;
}

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

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p,
.side-note span,
.panel p,
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.brand p,
.side-note span {
  color: #bed4f5;
  font-size: 13px;
}

nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px max(14px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(7, 45, 108, 0.96);
  backdrop-filter: blur(12px);
}

nav a {
  text-align: center;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  color: #dceaff;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-note {
  display: grid;
  gap: 8px;
  margin-top: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

main {
  padding: 20px 28px 92px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar,
.panel,
.action-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

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

.top-clear-button {
  flex: 0 0 auto;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.user-chip,
.points-chip {
  cursor: pointer;
  appearance: none;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: #24405f;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
}

.points-chip:hover {
  border-color: #9fc7fb;
  background: #eef6ff;
  color: var(--brand-dark);
}

.points-chip.active {
  border-color: #6ab0ff;
  background: #e4f1ff;
  box-shadow: 0 0 0 3px rgba(39, 132, 255, 0.12);
}

.user-chip strong,
.points-chip strong {
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff4e5;
  color: var(--warning);
  font-size: 12px;
}

.points-chip strong {
  background: #eaf2ff;
  color: var(--brand-dark);
}

#openRecharge {
  min-width: 76px;
}

.user-chip strong.verified {
  background: #e6f7ed;
  color: #087443;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.result-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: flex-end;
}

.invoice-select {
  display: grid;
  gap: 5px;
  min-width: min(360px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.invoice-select select {
  min-height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2,
.panel h3 {
  margin: 0;
}

.page {
  display: none;
  gap: 18px;
  min-width: 0;
}

.page.active {
  display: grid;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

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

.result-panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #324a66;
  font-size: 13px;
  font-weight: 800;
}

label.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

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

textarea {
  min-width: 160px;
  padding: 9px 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 105, 255, 0.14);
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 142px;
  border: 1px dashed #7aa7e8;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fbff, #eef6ff);
  color: var(--text);
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.upload-box.drag-over {
  border-color: var(--brand);
  background: linear-gradient(180deg, #eef7ff, #dfeeff);
  box-shadow: 0 0 0 4px rgba(23, 105, 255, 0.14);
}

.upload-box.upload-error {
  border-color: #d93025;
  background: linear-gradient(180deg, #fff7f6, #ffeceb);
  box-shadow: 0 0 0 4px rgba(217, 48, 37, 0.12);
}

.upload-box.upload-shake {
  animation: upload-shake 0.38s ease;
}

@keyframes upload-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  18% {
    transform: translateX(-8px);
  }
  36% {
    transform: translateX(7px);
  }
  54% {
    transform: translateX(-5px);
  }
  72% {
    transform: translateX(4px);
  }
}

.upload-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.upload-mode label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: #163a63;
}

.upload-mode input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.upload-box input {
  display: none;
}

.upload-box[hidden] {
  display: none;
}

.upload-box span {
  color: var(--brand-dark);
  font-size: 18px;
  font-weight: 900;
}

.upload-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upload-main b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e1f0ff;
  color: var(--brand);
  font-size: 18px;
  line-height: 1;
}

.upload-box small {
  color: var(--muted);
  font-weight: 500;
}

.upload-box.upload-error small {
  color: #b3261e;
  font-weight: 800;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.file-item img,
.pdf-thumb {
  width: 52px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--brand-soft);
}

.pdf-thumb {
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.file-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ── file upload status indicators ── */
.file-status {
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
  transition: color 0.15s ease;
}
.file-status-pending { color: #8c9db5; }
.file-status-loading { color: #1769ff; }
.file-status-uploading { color: #1769ff; }
.file-status-done { color: #0f973d; }
.file-status-error { color: #d92d20; }

.empty {
  color: var(--muted);
  font-size: 14px;
}

.product-options,
.price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.price-grid {
  margin-top: 18px;
}

.price-grid.compact {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  max-height: 46vh;
  overflow: auto;
  padding-right: 4px;
}

.dialog.scheme-dialog {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  width: min(1680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
}

.scheme-dialog > .dialog-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.scheme-dialog-body {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.scheme-form-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 2fr);
  gap: 18px;
  min-height: 100%;
}

.scheme-form-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.scheme-form-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.scheme-form-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.scheme-section-heading {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.scheme-section-heading strong {
  color: #183b5d;
  font-size: 16px;
}

.scheme-section-heading span {
  color: var(--muted);
  font-size: 12px;
}

.scheme-basic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.scheme-region-section {
  display: grid;
  grid-template-rows: auto auto minmax(90px, 1fr);
  align-content: start;
}

.scheme-region-trigger {
  width: 100%;
  min-height: 42px;
}

.scheme-region-section .region-tags {
  align-content: start;
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.scheme-prices-section {
  min-height: 0;
  padding-bottom: 20px;
}

.scheme-dialog > .dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 -8px 20px rgba(5, 20, 45, 0.08);
}

.scheme-dialog .price-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
  max-height: none;
  overflow: visible;
}

.scheme-dialog .price-item {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(88px, 110px);
}

.scheme-dialog .price-item > span,
.scheme-dialog .price-item input {
  min-width: 0;
}

.supplementary-agreement {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.supplementary-agreement-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 0;
  background: #f8fbff;
  color: #183b5d;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.supplementary-agreement-toggle:hover {
  background: #eef6ff;
}

.supplementary-agreement-toggle > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.supplementary-agreement-toggle b {
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.18s ease;
}

.supplementary-agreement-toggle[aria-expanded="true"] b {
  transform: rotate(180deg);
}

.supplementary-agreement-panel {
  padding: 12px 14px 10px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.supplementary-agreement-panel textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

.supplementary-agreement-panel small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  text-align: right;
}

.product-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.product-card strong {
  flex: 1;
}

.product-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

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

.rule-button {
  width: 26px;
  height: 26px;
  border: 1px solid #bfdbf7;
  border-radius: 50%;
  background: #eef7ff;
  color: var(--brand);
  font-weight: 900;
}

.rule-popover {
  position: absolute;
  z-index: 20;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #b9d4ee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(10, 49, 89, 0.16);
}

.rule-popover-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rule-popover-title button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}

.rule-popover dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.rule-popover dt {
  color: var(--brand-dark);
  font-weight: 900;
}

.rule-popover dd {
  margin: 0;
  color: #4b6178;
  line-height: 1.5;
}

.action-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, auto);
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-color: rgba(23, 105, 255, 0.26);
  background: linear-gradient(90deg, #eff6ff, #ffffff);
}

.calculate-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.calculate-side .primary-button {
  min-width: 132px;
}

.billing-rule-text {
  max-width: 290px;
  margin: 0;
  color: #4e6681;
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.status-copy span {
  display: block;
  margin-top: 4px;
  color: #4e6681;
}

#billingEstimate.warning {
  color: var(--danger);
  font-weight: 900;
}

.progress-panel {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  max-width: 520px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8e8ff;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--cyan));
  transition: width 0.22s ease;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), #0b89ff);
  color: #ffffff;
  box-shadow: 0 9px 22px rgba(23, 105, 255, 0.22);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.primary-button.mini {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.ghost-button.mini,
.danger-button.mini {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.ghost-button {
  background: #ffffff;
  border-color: var(--line);
  color: #163a63;
}

.ghost-button:hover {
  border-color: #95bced;
  background: #f6faff;
}

.danger-button {
  background: #fff5f4;
  border-color: #ffd8d4;
  color: var(--danger);
}

.danger-button:hover {
  background: #ffeceb;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #fff5f4;
  border-color: #ffd8d4;
  color: var(--danger);
  font-size: 20px;
}

.mini-delete {
  width: 30px;
  min-height: 30px;
  font-size: 18px;
}

.alert-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.alert-list[hidden] {
  display: none;
}

.alert-panel {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #d7e8fb;
  border-radius: 8px;
  background: #f8fbff;
}

.alert-panel[hidden],
.result-tab-panel {
  display: none;
}

.alert-panel-header,
.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.result-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f9ff;
}

.result-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: transparent;
  color: #46637f;
  font-weight: 900;
}

.result-tabs button.active {
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 5px 14px rgba(27, 100, 194, 0.12);
}

.result-tab-panel.active {
  display: block;
}

.alert-item {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
}

.alert-item.warning {
  border-color: #ffd99a;
  background: #fff8ea;
  color: var(--warning);
}

.alert-item.info {
  border-color: #a8cdfb;
  background: #edf6ff;
  color: #164f96;
}

.alert-item span {
  color: #52667c;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f7ff;
  color: #31506f;
  font-size: 13px;
  white-space: nowrap;
}

td input {
  min-width: 86px;
}

.thumb-button {
  border: 0;
  background: transparent;
  padding: 0;
}

.thumb-cell img {
  width: 76px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.thumb-cell small {
  display: block;
  max-width: 92px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  word-break: break-all;
}

.source-group-row td {
  padding: 10px 12px;
  background: #f8fbff;
  border-bottom-color: #d8e9fb;
}

.source-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-group strong {
  display: block;
  color: #183b5d;
}

.source-group span {
  color: var(--muted);
  font-size: 12px;
}

.group-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid #c9dff4;
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.source-thumb img,
.source-thumb-placeholder {
  width: 84px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #eaf4ff;
}

.source-thumb-placeholder {
  display: grid;
  place-items: center;
  color: #4a7197;
  font-weight: 900;
}

.review-cell {
  min-width: 92px;
}

.review-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: help;
}

.review-tag b {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
}

.review-tag.review {
  border-color: #ffd99a;
  background: #fff8ea;
  color: #9a5a00;
}

.review-tag.review b {
  background: #d98200;
}

.review-tag.ok {
  border-color: #b9e8cd;
  background: #eefcf4;
  color: #197645;
}

.review-tag.ok b {
  background: #2c9a5c;
}

.amount-cell,
#totalAmount {
  color: var(--accent);
  font-weight: 900;
}

tfoot td {
  background: #edf6ff;
  font-weight: 900;
}

.invoice-totals {
  display: grid;
  justify-content: end;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #cfe1f7;
  border-radius: 8px;
  background: #f5f9ff;
}

.invoice-totals > div {
  display: grid;
  grid-template-columns: minmax(240px, auto) 120px;
  gap: 20px;
  text-align: right;
}

.invoice-totals span {
  color: #46637f;
}

.invoice-totals strong {
  color: var(--accent);
}

.invoice-totals .grand-total {
  padding-top: 8px;
  border-top: 1px solid #cfe1f7;
  font-size: 17px;
}

.empty-row td {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.price-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.price-item strong {
  display: block;
}

.price-item span {
  color: var(--muted);
  font-size: 12px;
}

.scheme-list {
  display: grid;
  gap: 12px;
}

.scheme-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.scheme-card.active {
  border-color: #8dbbff;
  background: #f1f7ff;
}

.scheme-card strong {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.scheme-card span {
  color: var(--muted);
  font-size: 13px;
}

.scheme-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.default-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--brand-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

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

.history-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 170px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.history-limit-note {
  margin-top: 4px;
  color: #6b7f99;
  font-size: 13px;
}

.billing-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.billing-stats div {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.billing-stats span,
.package-card span,
.ledger-item span,
.ledger-item small {
  color: var(--muted);
  font-size: 13px;
}

.billing-stats strong {
  color: var(--brand-dark);
  font-size: 26px;
}

.package-list,
.ledger-list {
  display: grid;
  gap: 10px;
}

.package-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.package-card strong,
.ledger-item strong {
  display: block;
}

.package-meta {
  min-width: 150px;
  text-align: right;
}

.ledger-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 150px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.ledger-plus,
.ledger-minus {
  font-weight: 900;
  text-align: right;
}

.ledger-plus {
  color: #087443;
}

.ledger-page-size {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: #324a66;
  white-space: nowrap;
}

.ledger-page-size select {
  width: 96px;
}

.ledger-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ledger-pagination[hidden] {
  display: none;
}

.ledger-minus {
  color: var(--danger);
}

.history-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(670px, auto);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.history-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #324a66;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.history-select input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.history-card strong {
  display: block;
}

.history-card span {
  color: var(--muted);
  font-size: 13px;
}

.history-actions {
  display: grid;
  grid-template-columns: 110px 88px 220px 92px 72px;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.history-actions > strong {
  justify-self: end;
  min-width: 0;
  text-align: right;
  font-size: 16px;
  line-height: 1;
}

.history-actions .mini {
  justify-content: center;
  min-width: 0;
  width: 100%;
  white-space: nowrap;
}

.history-actions select {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  font-size: 13px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  align-items: stretch;
}

.admin-shell .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  grid-template-columns: 1fr;
  align-content: start;
  width: 168px;
  min-height: 100vh;
  padding: 20px 14px;
}

.admin-shell main {
  grid-column: 1 / -1;
  margin-left: 168px;
  min-width: 0;
  padding: 28px;
}

.admin-shell .brand {
  gap: 10px;
}

.admin-shell .brand-mark {
  width: 42px;
  height: 42px;
}

.admin-shell .brand h1 {
  font-size: 17px;
  line-height: 1.2;
}

.admin-nav {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0;
  border-top: 0;
  background: transparent;
  backdrop-filter: none;
}

.admin-nav a {
  justify-items: start;
  min-height: 44px;
  padding: 11px 12px;
  border-color: transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
}

.admin-nav a.active,
.admin-nav a:hover {
  border-color: rgba(120, 184, 255, 0.36);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 3px 0 0 #52b5ff;
  color: #ffffff;
}

.admin-policy-panel .panel-header {
  margin-bottom: 0;
}

.admin-status {
  max-width: 760px;
}

.admin-stats {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.trend-filters .primary-button {
  align-self: end;
}

.trend-failed {
  color: #b45309;
  font-weight: 600;
}

.trend-points-consumed {
  color: #b45309;
}

.trend-amount-positive {
  color: #16a34a;
  font-weight: 600;
}

.trend-rate-low {
  color: #b45309;
  font-weight: 600;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.admin-filters .wide {
  grid-column: span 2;
}

.admin-table {
  min-width: 920px;
}

.feedback-table {
  min-width: 1120px;
}

.compact-table {
  min-width: 840px;
}

.admin-table td strong,
.admin-list-item strong {
  display: block;
  color: #183b5d;
}

.admin-table td small,
.admin-list-item span,
.detail-card span,
.detail-section h4 {
  color: var(--muted);
  font-size: 13px;
}

.admin-table select {
  min-width: 116px;
}

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

.admin-list-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-pagination[hidden] {
  display: none;
}

.admin-pagination strong {
  color: #31506f;
}

.admin-page-size {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: #324a66;
  white-space: nowrap;
}

.admin-page-size select {
  width: 88px;
}

.user-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.detail-card,
.detail-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.detail-card strong {
  color: var(--brand-dark);
  font-size: 22px;
}

.detail-section {
  grid-column: span 2;
}

.detail-section.full-span,
.quote-detail {
  grid-column: 1 / -1;
}

.quote-detail {
  display: grid;
  gap: 12px;
}

.feedback-detail {
  display: grid;
  gap: 14px;
}

.quote-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.feedback-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.feedback-detail-grid .full-span,
.feedback-processing-form.full-span {
  grid-column: 1 / -1;
}

.detail-card small,
.feedback-reply-meta span {
  color: var(--muted);
  font-size: 13px;
}

.feedback-description,
.feedback-reply-meta p {
  margin: 0;
  color: #24374d;
  line-height: 1.7;
  white-space: pre-wrap;
}

.feedback-attachments {
  display: grid;
  gap: 10px;
}

.attachment-link {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #183b5d;
  text-decoration: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.attachment-link:hover {
  transform: translateY(-1px);
  border-color: #9abfe6;
  box-shadow: 0 10px 22px rgba(24, 59, 93, 0.1);
}

.attachment-link span {
  color: var(--muted);
  font-size: 13px;
}

.feedback-reply-meta {
  display: grid;
  gap: 6px;
}

.feedback-processing-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.4fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.feedback-processing-form .wide {
  grid-column: auto;
}

.feedback-processing-form textarea {
  min-height: 116px;
  resize: vertical;
}

.detail-section h4 {
  margin: 0;
  color: #31506f;
  font-size: 14px;
}

.empty {
  color: var(--muted);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(5, 20, 45, 0.72);
}

.image-modal[hidden],
.dialog-backdrop[hidden] {
  display: none;
}

.image-modal img {
  max-width: min(96vw, 1200px);
  max-height: 88vh;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 28px;
}

.modal-close.light {
  position: static;
  border-color: var(--line);
  background: #f5f9ff;
  color: var(--text);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 20, 45, 0.56);
}

.dialog {
  display: grid;
  gap: 16px;
  width: min(760px, 96vw);
  max-height: 92vh;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.tutorial-backdrop {
  z-index: 24;
}

.tutorial-dialog {
  width: min(960px, calc(100vw - 32px));
}

.tutorial-dialog video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 190px);
  border-radius: 8px;
  background: #07111f;
}

.recharge-backdrop {
  z-index: 22;
}

.recharge-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.28);
}

.recharge-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
}

.recharge-header h3 {
  margin: 0;
  font-size: 30px;
}

.recharge-header p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.recharge-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  min-height: 420px;
}

.recharge-left,
.recharge-right {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 32px;
}

.recharge-left {
  border-right: 1px solid var(--line);
}

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

.recharge-options button {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #151a21;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 5px 14px rgba(18, 34, 52, 0.08);
}

.recharge-options button.active {
  border-color: #c95f3d;
  background: #c95f3d;
  color: #ffffff;
}

.custom-recharge {
  position: relative;
}

.custom-recharge span {
  color: #324a66;
}

.custom-recharge input {
  height: 54px;
  padding-left: 42px;
  font-size: 18px;
}

.custom-recharge::before {
  content: "¥";
  position: absolute;
  left: 16px;
  bottom: 13px;
  color: var(--muted);
  font-size: 24px;
  font-weight: 700;
}

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

.payment-methods button {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font-weight: 900;
  overflow: hidden;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.payment-methods button::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.payment-methods button:hover {
  transform: translateY(-1px);
  border-color: #a9c9f7;
  box-shadow: 0 10px 22px rgba(23, 105, 255, 0.12);
}

.payment-methods button.active {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(22, 84, 170, 0.16);
}

.payment-methods button.active::before {
  opacity: 1;
}

.payment-methods button.alipay::before {
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.12), rgba(255, 255, 255, 0));
}

.payment-methods button.wechat::before {
  background: linear-gradient(135deg, rgba(7, 193, 96, 0.12), rgba(255, 255, 255, 0));
}

.payment-methods button.alipay.active {
  border-color: #1677ff;
  color: #0f5fc8;
}

.payment-methods button.wechat.active {
  border-color: #07c160;
  color: #087443;
}

.pay-brand-mark,
.pay-check {
  position: relative;
  z-index: 1;
}

.pay-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alipay-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: #1677ff;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.wechat-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: #07c160;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.alipay-text {
  color: #111827;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.wechat-text {
  color: #111827;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.pay-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #dbe5f1;
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.payment-methods button.active .pay-check {
  opacity: 1;
  transform: scale(1);
}

.payment-methods button.alipay.active .pay-check {
  background: #1677ff;
}

.payment-methods button.wechat.active .pay-check {
  background: #07c160;
}

.secure-pay-note {
  display: grid;
  gap: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.secure-pay-note strong {
  color: #324a66;
}

.recharge-gain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 24px;
  border: 1px solid #9fdcc8;
  border-radius: 8px;
  background: #ecfff8;
  color: #087b5b;
}

.recharge-gain span {
  grid-column: 1 / -1;
  font-weight: 900;
}

.recharge-gain strong {
  font-size: 44px;
  line-height: 1;
}

.recharge-gain em {
  font-style: normal;
  font-weight: 900;
}

.recharge-pay-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding-top: 26px;
  border-top: 1px dashed var(--line);
}

.recharge-pay-row span {
  color: #1f2937;
  font-size: 20px;
  font-weight: 900;
}

.recharge-pay-row strong {
  font-size: 34px;
}

.recharge-submit {
  width: 100%;
  min-height: 58px;
  background: #c95f3d;
  font-size: 18px;
}

.payment-success-backdrop {
  z-index: 120;
}

.payment-success-dialog {
  width: min(380px, calc(100vw - 32px));
  padding: 36px 28px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgb(15 23 42 / 24%);
  text-align: center;
}

.payment-success-dialog h3 {
  margin: 16px 0 8px;
  color: #087443;
  font-size: 26px;
}

.payment-success-dialog p {
  margin: 0;
  color: #52606d;
  line-height: 1.7;
}

.payment-success-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  background: #16a765;
  color: #ffffff;
  font-size: 36px;
  font-weight: 900;
}

.payment-waiting {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(320px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid #b9d7ff;
  border-radius: 8px;
  background: #f3f8ff;
  color: #174f9a;
  text-align: center;
}

.payment-waiting[hidden] {
  display: none;
}

.payment-qr-image {
  display: block;
  width: min(240px, 100%);
  aspect-ratio: 1;
  margin: 6px auto;
  padding: 10px;
  border: 1px solid #d3e3f7;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
}

.payment-loading {
  width: min(240px, 100%);
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  margin: 6px auto;
  border: 1px solid #d3e3f7;
  border-radius: 8px;
  background: #fff;
  color: #52647a;
}

.payment-loading[hidden] {
  display: none;
}

.payment-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #dbe8f8;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: payment-loading-spin 0.8s linear infinite;
}

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

.payment-waiting .button-row {
  justify-content: center;
}

.payment-frame {
  width: min(240px, 100%);
  height: 240px;
  border: 1px solid #d9dee8;
  border-radius: 6px;
  background: #fff;
}

.payment-frame[hidden] {
  display: none;
}

.payment-qr-image[hidden] {
  display: none;
}

.payment-waiting a {
  max-width: 100%;
  word-break: break-word;
  color: #0f63c7;
  font-size: 13px;
  font-weight: 800;
}

.recharge-right small {
  color: var(--muted);
  text-align: center;
}

.feedback-backdrop {
  z-index: 23;
}

.feedback-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

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

.feedback-form .wide {
  grid-column: 1 / -1;
}

.feedback-upload {
  padding: 14px;
  border: 1px dashed #7aa7e8;
  border-radius: 8px;
  background: #f8fbff;
}

.feedback-upload input {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.feedback-upload span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.feedback-file-list {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.feedback-file-list.empty {
  padding: 12px 0 2px;
}

.feedback-file-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.feedback-file-icon {
  display: grid;
  width: 52px;
  height: 40px;
  place-items: center;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

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

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.dialog-header h3 {
  margin: 0;
}

.dialog-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(23, 105, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 105, 255, 0.05) 1px, transparent 1px),
    #eef5ff;
  background-size: 36px 36px;
}

.auth-shell {
  width: min(1080px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 56px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 28px;
  align-items: center;
}

.auth-brand {
  display: grid;
  gap: 14px;
  align-content: center;
}

.auth-logo {
  width: 58px;
  height: 58px;
}

.auth-brand h1 {
  margin: 0;
  color: #0b2a55;
  font-size: 40px;
  line-height: 1.15;
}

.auth-brand p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.auth-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: grid;
}

.auth-header h2 {
  margin: 0;
  font-size: 24px;
}

.auth-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8ff;
}

.auth-tabs button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4c6380;
  font-weight: 900;
}

.auth-tabs button.active {
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 6px 18px rgba(23, 105, 255, 0.12);
}

.auth-form {
  display: none;
  gap: 14px;
}

.auth-form.active {
  display: grid;
}

.auth-subpanel {
  display: none;
  gap: 14px;
}

.auth-subpanel.active {
  display: grid;
}

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

.agree-line {
  display: flex;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
  color: #425a76;
  font-size: 13px;
  font-weight: 700;
}

.agree-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.dev-code,
.auth-status {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.dev-code {
  border: 1px solid #b7dafc;
  background: #edf7ff;
  color: #0b5cad;
}

.auth-status {
  border: 1px solid var(--line);
  background: #f8fbff;
  color: #24405f;
}

.auth-status.error {
  border-color: #ffd0cb;
  background: #fff4f2;
  color: var(--danger);
}

.auth-status.success {
  border-color: #b9e8ca;
  background: #effaf3;
  color: #087443;
}

.auth-submit {
  width: 100%;
}

.text-button {
  width: fit-content;
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.auth-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.auth-portal-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f9ff;
}

.auth-portal-switch button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.auth-portal-switch button.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 8px 18px rgba(23, 105, 255, 0.12);
}

.text-button:hover {
  color: var(--brand-dark);
}

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

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

.captcha-backdrop[hidden] {
  display: none;
}

.captcha-dialog {
  max-width: 420px;
}

.captcha-question {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
  color: var(--brand-dark);
  font-size: 22px;
}

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

@media (max-width: 980px) {
  .sidebar {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px;
  }

  .admin-shell .sidebar {
    position: fixed;
    width: 168px;
    min-height: 100vh;
    padding: 20px 14px;
  }

  .admin-shell main {
    margin-left: 168px;
  }

  .section-grid,
  .form-grid,
  .scheme-form-layout {
    grid-template-columns: 1fr;
  }

  .scheme-form-sidebar,
  .scheme-form-main {
    grid-template-rows: auto;
  }

  .scheme-dialog .price-grid.compact {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }

  .product-options,
  .price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .history-card {
    grid-template-columns: 1fr;
  }

  .history-actions {
    grid-template-columns: 100px 88px minmax(150px, 1fr) 92px 72px;
    justify-content: flex-start;
  }

  .recharge-body {
    grid-template-columns: 1fr;
  }

  .recharge-left {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .admin-stats,
  .user-detail-grid,
  .feedback-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-filters,
  .feedback-processing-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 28px 0;
  }

  .auth-brand h1 {
    font-size: 32px;
  }
}

@media (max-width: 640px) {
  main {
    padding: 14px;
  }

  .topbar,
  .panel-header,
  .action-band,
  .history-card,
  .package-card,
  .ledger-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header {
    flex-direction: column;
  }

  .button-row,
  .result-header-actions,
  .topbar-actions,
  .scheme-actions,
  .history-actions {
    justify-content: flex-start;
  }

  .invoice-select,
  .invoice-totals {
    width: 100%;
  }

  .invoice-totals > div {
    grid-template-columns: 1fr auto;
  }

  .history-actions {
    grid-template-columns: 1fr 1fr;
  }

  .history-select {
    justify-content: flex-start;
  }

  .history-actions > strong {
    justify-self: start;
    text-align: left;
  }

  .history-actions select {
    grid-column: 1 / -1;
  }

  .product-options,
  .price-grid,
  .price-grid.compact,
  .upload-mode {
    grid-template-columns: 1fr;
  }

  .scheme-card,
  .dialog-actions,
  .code-row,
  .region-select-row,
  .billing-stats,
  .admin-stats,
  .admin-filters,
  .user-detail-grid,
  .feedback-detail-grid,
  .feedback-processing-form {
    grid-template-columns: 1fr;
  }

  .admin-filters .wide,
  .feedback-processing-form .wide,
  .detail-section {
    grid-column: auto;
  }

  .package-meta,
  .ledger-plus,
  .ledger-minus,
  .billing-rule-text {
    text-align: left;
  }

  .calculate-side {
    justify-items: stretch;
  }

  .recharge-header,
  .recharge-left,
  .recharge-right {
    padding: 20px;
  }

  .recharge-header h3 {
    font-size: 24px;
  }

  .feedback-form,
  .feedback-actions {
    grid-template-columns: 1fr;
  }

  .feedback-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .tutorial-dialog {
    width: calc(100vw - 20px);
    padding: 14px;
  }

  .tutorial-dialog video {
    max-height: calc(100vh - 160px);
  }

  .feedback-file-item {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .feedback-file-icon {
    width: 44px;
  }

  .recharge-options,
  .payment-methods {
    grid-template-columns: 1fr;
  }

  .recharge-gain strong {
    font-size: 34px;
  }

  .recharge-pay-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ===== 价格方案 - 服务方类型标签 ===== */
.type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.type-individual {
  background: #e8f4fd;
  color: #1976d2;
}
.type-provider {
  background: #e8f5e9;
  color: #388e3c;
}

/* ===== 价格方案 - 覆盖城市统计 ===== */
.region-count {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* ===== 价格方案省市选择 ===== */
.region-tags {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.region-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 13px;
}
.region-picker-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  max-height: min(760px, 90vh);
}
.region-picker-status {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  background: #fff8e8;
  color: #835200;
}
.region-linkage {
  display: grid;
  grid-template-columns: minmax(220px, 38%) minmax(0, 62%);
  height: min(420px, 52vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.region-linkage input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}
.region-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #fff;
}
.region-province-pane {
  border-right: 1px solid var(--line);
}
.region-pane-title {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
  color: #35516f;
  font-size: 13px;
  font-weight: 800;
}
.region-province-list,
.region-city-list {
  min-height: 0;
  overflow-y: auto;
}
.region-city-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}
.region-city-panel h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
  color: #35516f;
  font-size: 13px;
}
.region-province-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 6px 10px;
  border-bottom: 1px solid #edf2f8;
}
.region-province-row.active {
  background: var(--brand-soft);
}
.region-province-name {
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: 700;
}
.region-province-row > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.region-city-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px 14px;
  padding: 14px;
}
.region-city-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}
.region-empty {
  color: var(--muted);
  font-size: 13px;
}
.region-summary-section {
  margin-top: 12px;
}
.region-selection-summary {
  max-height: 128px;
  overflow-y: auto;
  padding-top: 8px;
}
.region-summary-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
}
.region-summary-item + .region-summary-item {
  margin-top: 6px;
}
.region-summary-item summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  color: #294868;
  font-size: 13px;
  font-weight: 700;
}
.region-summary-cities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 10px 8px;
}
.region-summary-city {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
}
.region-summary-city small {
  color: var(--warning);
  font-size: 10px;
}
.region-summary-city-invalid {
  border: 1px solid #f0c36d;
}
.region-summary-city-remove {
  margin-left: auto;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: #7b8794;
  font-size: 16px;
}
.region-summary-city-remove:hover,
.region-summary-clear:hover {
  color: var(--danger);
}
.region-summary-clear {
  margin: 0 10px 8px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .dialog.scheme-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .scheme-dialog > .dialog-header,
  .scheme-dialog-body {
    padding: 14px;
  }

  .scheme-basic-grid {
    grid-template-columns: 1fr;
  }

  .scheme-form-section {
    padding: 14px;
  }

  .scheme-section-heading {
    display: grid;
    gap: 4px;
  }

  .scheme-dialog > .dialog-actions {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .scheme-dialog .price-grid.compact {
    grid-template-columns: 1fr;
  }

  .region-picker-dialog {
    width: calc(100vw - 20px);
    max-height: 92vh;
  }

  .region-linkage {
    grid-template-columns: 1fr;
    height: auto;
  }

  .region-province-pane {
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .region-city-panel {
    min-height: 220px;
    max-height: 320px;
  }

  .region-city-list,
  .region-summary-cities {
    grid-template-columns: 1fr;
  }
}
