:root {
  --bg: #eef3f8;
  --ink: #0e1b2b;
  --muted: #52627a;
  --line: #cfdae8;
  --panel: rgba(255, 255, 255, 0.9);
  --blue: #2456de;
  --blue-strong: #1743c0;
  --green: #138a56;
  --red: #c43d42;
  --shadow: 0 18px 55px rgba(25, 47, 83, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% -10%, rgba(36, 86, 222, 0.16), transparent 28%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
  min-height: 100vh;
}

.page {
  width: min(1288px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1;
  margin-top: 6px;
}

.topbar p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

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

.ghost-link,
button,
.button-like {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #183154;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ghost-link:hover,
button:hover,
.button-like:hover {
  transform: translateY(-1px);
  border-color: #9fb2cf;
  box-shadow: 0 8px 22px rgba(25, 47, 83, 0.12);
}

.ghost-link.strong,
button.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

button.primary:hover {
  background: var(--blue-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
  backdrop-filter: blur(12px);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.payment-mode-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 24px;
  border-color: #e1b8ba;
  background: rgba(255, 246, 246, 0.94);
}

.payment-mode-panel.test-mode {
  border-color: #e0c477;
  background: rgba(255, 251, 235, 0.95);
}

.payment-mode-copy {
  display: grid;
  gap: 3px;
}

.payment-mode-copy strong {
  font-size: 20px;
}

.payment-mode-kicker {
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.test-mode .payment-mode-kicker {
  color: #9a6a00;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.mode-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
}

.mode-switch-track {
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 999px;
  background: #c65a60;
  transition: background 0.18s ease;
}

.mode-switch-track i {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s ease;
}

.mode-switch input:checked + .mode-switch-track {
  background: #d69a12;
}

.mode-switch input:checked + .mode-switch-track i {
  transform: translateX(20px);
}

.mode-switch input:focus-visible + .mode-switch-track {
  outline: 3px solid rgba(36, 86, 222, 0.22);
  outline-offset: 2px;
}

.mode-switch b {
  min-width: 64px;
  color: var(--red);
}

.test-mode .mode-switch b {
  color: #8d6200;
}

.payment-mode-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.environment-test-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border-color: #c7d7fe;
  background: linear-gradient(115deg, rgba(238, 244, 255, 0.98), rgba(255, 255, 255, 0.96));
}

.environment-test-copy { display: grid; gap: 4px; }
.environment-test-copy strong { font-size: 20px; }
.environment-test-badge { padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.environment-test-badge.idle { color: #475467; background: #f2f4f7; }
.environment-test-badge.running { color: #1849a9; background: #d1e9ff; }
.environment-test-badge.ok { color: #067647; background: #dcfae6; }
.environment-test-badge.error { color: #b42318; background: #fee4e2; }

.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.62);
  backdrop-filter: blur(5px);
}

.modal-backdrop.hidden { display: none; }
.environment-test-dialog {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 20px;
  padding: 26px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(16, 24, 40, 0.3);
}
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.dialog-head h2 { margin: 5px 0 4px; }
.dialog-close { min-width: 42px; padding: 0; font-size: 26px; line-height: 1; }
.environment-test-input textarea { min-height: 180px; font-family: "JetBrains Mono", monospace; font-size: 12px; }
.environment-selector-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.environment-selector-head > div { display: grid; gap: 2px; }
.environment-selector-head button { min-height: 34px; padding: 6px 12px; }
.environment-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 17px; }
.environment-choice { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 10px 12px; border: 1px solid #d0d5dd; border-radius: 10px; background: #fff; cursor: pointer; }
.environment-choice:has(input:checked) { border-color: #84adff; background: #eff8ff; }
.environment-choice input { width: 17px; height: 17px; min-height: 0; box-shadow: none; }
.environment-choice b { font-size: 14px; }
.diagnostic-warning { margin-top: 12px; padding: 12px 14px; border: 1px solid #fedf89; border-radius: 10px; color: #93370d; background: #fffaeb; font-size: 13px; line-height: 1.55; }
.dialog-actions { justify-content: flex-end; margin-top: 18px; }
.diagnostic-overview { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 10px; }
.diagnostic-overview > div { display: grid; gap: 4px; padding: 13px 14px; border: 1px solid #eaecf0; border-radius: 12px; background: #f9fafb; }
.diagnostic-overview span { color: var(--muted); font-size: 12px; }
.diagnostic-overview b { font-size: 18px; }
.diagnostic-profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.diagnostic-profile { min-width: 0; padding: 13px; border: 1px solid #eaecf0; border-radius: 12px; background: #fff; }
.diagnostic-profile b { display: block; margin-bottom: 7px; }
.diagnostic-profile span { color: var(--muted); font-size: 12px; }
.diagnostic-profile.running { border-color: #84adff; background: #eff8ff; }
.diagnostic-profile.ok { border-color: #75e0a7; background: #ecfdf3; }
.diagnostic-profile.error { border-color: #fda29b; background: #fef3f2; }
.diagnostic-log-head { display: flex; justify-content: space-between; margin: 18px 0 8px; }
.diagnostic-log { height: 230px; overflow: auto; padding: 12px 14px; border-radius: 12px; color: #d0d5dd; background: #101828; font: 12px/1.65 "JetBrains Mono", monospace; }
.diagnostic-log-row { display: grid; grid-template-columns: 64px 72px 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.diagnostic-log-row .ok { color: #6ce9a6; }
.diagnostic-log-row .error { color: #fda29b; }
.diagnostic-log-row .start, .diagnostic-log-row .retry { color: #84adff; }

.index {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8eeff;
  color: var(--blue);
  border-radius: 8px;
  font-weight: 800;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

small {
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: #41506a;
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #071323;
  font: 600 14px/1.48 "JetBrains Mono", Consolas, monospace;
  outline: none;
  padding: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: #7f9ee8;
  box-shadow: 0 0 0 3px rgba(36, 86, 222, 0.13);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

select {
  min-height: 45px;
}

.field-inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.field-inline-control button {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.proxy-library {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 249, 253, 0.82);
  padding: 14px;
}

.card-autofill {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 249, 253, 0.82);
  padding: 14px;
}

.data-library {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.data-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin-top: 10px;
}

.data-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 8px 2px;
  font-size: 13px;
}

.data-row input { width: auto; }
.data-row span { overflow-wrap: anywhere; }

.operation-progress {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

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

.progress-track i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #67a4ff);
  animation: operation-progress 1.05s ease-in-out infinite;
}

@keyframes operation-progress {
  from { transform: translateX(-105%); }
  to { transform: translateX(265%); }
}

.card-autofill small {
  display: block;
  margin-top: 10px;
}

.wide-card {
  grid-column: span 2;
}

.billing-grid {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.proxy-library-head,
.proxy-library-head > div,
.proxy-row,
.proxy-meta {
  display: flex;
  align-items: center;
}

.proxy-library-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.proxy-library-head > div {
  gap: 9px;
}

.count-badge {
  min-width: 42px;
  border-radius: 999px;
  background: #e1e8f5;
  color: #324965;
  padding: 3px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.danger-subtle {
  color: var(--red);
}

.compact-row {
  margin-top: 10px;
}

.proxy-pool-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  max-height: 238px;
  overflow: auto;
}

.proxy-row {
  min-height: 46px;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 8px 2px;
}

.proxy-row:first-child {
  border-top: 0;
}

.proxy-meta {
  min-width: 0;
  gap: 10px;
}

.proxy-position {
  width: 28px;
  flex: 0 0 28px;
  color: var(--blue);
  font-weight: 800;
  text-align: center;
}

.proxy-address {
  min-width: 0;
  overflow-wrap: anywhere;
  font: 600 13px/1.4 "JetBrains Mono", Consolas, monospace;
}

.proxy-details {
  display: block;
  color: var(--muted);
  font: 500 12px/1.35 "IBM Plex Sans", "Microsoft YaHei", sans-serif;
}

.proxy-remove {
  min-height: 34px;
  padding: 0 10px;
  flex: 0 0 auto;
}

.proxy-empty {
  color: var(--muted);
  padding: 14px 2px 6px;
  text-align: center;
}

#accessToken {
  min-height: 150px;
}

.session-inspect {
  margin-top: 10px;
  border: 1px solid #b9c9e2;
  border-radius: 8px;
  background: #f4f8ff;
  padding: 12px;
}

.session-inspect-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #304765;
  font-size: 13px;
}

.session-inspect-head span { color: var(--muted); }
.session-account-list { display: grid; gap: 8px; margin-top: 10px; }
.session-account { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 9px; font-size: 13px; }
.session-account span { color: var(--muted); overflow-wrap: anywhere; }
.session-account b { display: block; color: var(--ink); margin-top: 2px; }
.plan-active { color: var(--green) !important; }
.plan-free { color: var(--muted) !important; }
.cdk-entry { align-items: end; }
.cdk-entry small { padding: 10px 0; }
.cdk-library { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }

.grid-2,
.grid-4,
.result-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

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

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

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

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

.check-field label {
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0 12px;
  font-weight: 700;
  color: #40526d;
}

.check-field input {
  width: auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  padding: 12px 14px;
}

.status-card label {
  color: var(--muted);
  font-weight: 700;
}

.status-card b {
  color: var(--green);
}

.log-box {
  min-height: 150px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071323;
  color: #d8e6f7;
  padding: 14px;
  font: 600 13px/1.5 "JetBrains Mono", Consolas, monospace;
}

.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  z-index: 20;
}

.toast {
  min-width: 220px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #10213a;
  color: #fff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  padding: 12px 14px;
  font-weight: 700;
}

.toast.err {
  background: var(--red);
}

@media (max-width: 860px) {
  .page {
    width: min(100vw - 24px, 720px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid-2,
  .grid-4,
  .result-grid,
  .session-account {
    grid-template-columns: 1fr;
  }

  .button-row button {
    flex: 1 1 180px;
  }

  .proxy-row {
    align-items: flex-start;
  }
}

/* 2026 console refresh */
:root {
  --bg: #f2f4f7;
  --ink: #111827;
  --muted: #667085;
  --line: #e4e7ec;
  --panel: #ffffff;
  --blue: #635bff;
  --blue-strong: #5149e8;
  --green: #079455;
  --red: #d92d20;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.07);
}

body {
  background: #f2f4f7;
}

.page {
  width: min(1380px, calc(100vw - 48px));
  padding: 24px 0 56px;
}

.topbar {
  align-items: center;
  overflow: hidden;
  position: relative;
  margin-bottom: 22px;
  border-radius: 22px;
  padding: 28px 30px;
  color: #fff;
  background: linear-gradient(125deg, #101828 0%, #1d2939 62%, #3538cd 140%);
  box-shadow: 0 18px 45px rgba(16, 24, 40, 0.18);
}

.topbar::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: 8%;
  top: -190px;
  border-radius: 50%;
  border: 44px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.topbar h1 { font-size: clamp(36px, 4vw, 52px); }
.topbar p { color: #d0d5dd; }
.topbar .eyebrow { color: #a4bcfd; letter-spacing: .13em; }
.topbar .ghost-link { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; }
.topbar .ghost-link.strong { border-color: #fff; background: #fff; color: #101828; }

.panel {
  border-radius: 18px;
  padding: 24px;
  margin-top: 20px;
  backdrop-filter: none;
}

.panel-head { margin-bottom: 20px; }
.panel-head h2 { font-size: 19px; }
.index { border-radius: 10px; background: #eef4ff; color: #3538cd; }

.ghost-link, button, .button-like {
  min-height: 42px;
  border-radius: 10px;
  background: #fff;
  color: #344054;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

button.primary, .ghost-link.strong {
  background: var(--blue);
  border-color: var(--blue);
}

input, textarea, select {
  border-radius: 10px;
  border-color: #d0d5dd;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

input:focus, textarea:focus, select:focus {
  outline: 3px solid rgba(99,91,255,.12);
  border-color: #7f77ff;
}

.proxy-library, .data-library, .status-card, .session-inspect {
  border-radius: 14px;
  border-color: #eaecf0;
  background: #f9fafb;
}

.admin-panel { border-top: 3px solid #7f77ff; }
.admin-create-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
}
.admin-list { margin-top: 18px; border-top: 1px solid var(--line); }
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.admin-row > div { display: flex; align-items: center; gap: 10px; }
.admin-row b { color: var(--ink); }
.admin-row small { color: var(--green); background: #ecfdf3; border-radius: 999px; padding: 3px 8px; }

/* Login */
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 28px; background: #eef2f6; }
.auth-shell { display: grid; grid-template-columns: 1.05fr .95fr; width: min(980px, 100%); min-height: 580px; overflow: hidden; border-radius: 26px; background: #fff; box-shadow: 0 30px 80px rgba(16,24,40,.16); }
.auth-brand { position: relative; overflow: hidden; padding: 56px; color: #fff; background: linear-gradient(145deg,#101828,#252d72); }
.auth-brand::after { content:""; position:absolute; width:360px; height:360px; right:-190px; bottom:-190px; border:55px solid rgba(255,255,255,.07); border-radius:50%; }
.brand-mark { display:inline-grid; place-items:center; width:48px; height:48px; border-radius:14px; background:#7f77ff; font-size:24px; font-weight:800; }
.auth-brand h1 { margin-top: 92px; font-size: 48px; }
.auth-brand p { margin-top: 18px; color:#d0d5dd; line-height:1.8; }
.auth-card { display:flex; flex-direction:column; justify-content:center; padding: clamp(36px,6vw,72px); }
.auth-card h2 { font-size:30px; }
.auth-muted { margin:10px 0 30px; color:var(--muted); }
.auth-submit { width:100%; margin-top:12px; }
.auth-error { min-height:24px; margin-top:14px; color:var(--red); font-weight:600; }

@media (max-width: 860px) {
  .topbar { padding: 24px; }
  .payment-mode-panel { grid-template-columns: 1fr; }
  .payment-mode-note { grid-column: 1; }
  .environment-test-panel { grid-template-columns: 1fr; }
  .environment-test-badge { justify-self: start; }
  .diagnostic-overview { grid-template-columns: repeat(2, 1fr); }
  .diagnostic-profiles { grid-template-columns: repeat(2, 1fr); }
  .environment-selector { grid-template-columns: repeat(2, 1fr); }
  .diagnostic-log-row { grid-template-columns: 56px 64px 1fr; }
  .admin-create-row { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns:1fr; min-height:unset; }
  .auth-brand { padding:32px; }
  .auth-brand h1 { margin-top:34px; font-size:38px; }
  .auth-card { padding:36px 30px; }
}
