:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 252, 246, 0.9);
  --text: #2a2016;
  --muted: #7c6750;
  --accent: #ba8751;
  --accent-strong: #8d5e2b;
  --danger: #b54a3a;
  --border: rgba(100, 74, 35, 0.13);
  --shadow: rgba(93, 69, 38, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-y: scroll;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(186, 135, 81, 0.18), transparent 28%),
    linear-gradient(145deg, #faf6ef 0%, #f3ece0 48%, #eadfce 100%);
}

.auth-shell,
.dashboard-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card,
.panel,
.topbar {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 28px 90px var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(460px, 100%);
  padding: 36px;
}

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

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.22em;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

h1, h2 { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { margin-bottom: 18px; }

.muted { color: var(--muted); line-height: 1.7; }
.hidden { display: none !important; }

.form-stack,
.admin-form {
  display: grid;
  gap: 16px;
}

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

label span,
.label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(141, 94, 43, 0.45);
  box-shadow: 0 0 0 4px rgba(186, 135, 81, 0.12);
}

button,
.ghost,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fffaf2;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.ghost {
  border: 1px solid var(--border);
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.62);
}

.danger {
  background: var(--danger);
}

.small {
  padding: 8px 10px;
  font-size: 0.86rem;
}

.back-link { margin-top: 16px; }

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

.panel {
  padding: 26px;
  margin-bottom: 20px;
}

.panel strong {
  display: block;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  margin: 10px 0;
}

.highlight {
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(245, 229, 204, 0.92));
}

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

.dashboard-tabs {
  --active-tab: 0;
  position: sticky;
  top: 14px;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: -4px 0 20px;
  padding: 7px;
  border: 1px solid rgba(100, 74, 35, 0.12);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.78), rgba(248, 239, 226, 0.72)),
    rgba(255, 252, 246, 0.84);
  box-shadow: 0 18px 48px rgba(93, 69, 38, 0.12);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.dashboard-tab-indicator {
  position: absolute;
  left: 7px;
  top: 7px;
  width: calc((100% - 14px) / 3);
  height: calc(100% - 14px);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(141, 94, 43, 0.96), rgba(186, 135, 81, 0.96));
  box-shadow: 0 12px 26px rgba(141, 94, 43, 0.22), inset 0 1px 0 rgba(255,255,255,0.28);
  transform: translateX(calc(var(--active-tab) * 100%));
  transition: transform 260ms cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}

.dashboard-tab {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 42px;
  padding: 11px 14px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  transition: color 180ms ease, transform 180ms ease;
}

.dashboard-tab.active {
  color: #fffaf2;
  background: transparent;
  box-shadow: none;
}

.dashboard-tab:active {
  transform: scale(0.98);
}

.dashboard-section {
  display: none !important;
  width: 100%;
}

.dashboard-section.active {
  display: block !important;
}

.grid.dashboard-section.active {
  display: grid !important;
}

.traffic-dashboard {
  position: relative;
  overflow: hidden;
  padding: 30px;
  background:
    radial-gradient(circle at 12% 16%, rgba(186, 135, 81, 0.2), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248, 238, 222, 0.92));
}

.traffic-dashboard::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -120px;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  background: rgba(186, 135, 81, 0.12);
  pointer-events: none;
}

.traffic-hero,
.traffic-content {
  position: relative;
  z-index: 1;
}

.traffic-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.traffic-hero h2 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
}

.traffic-hero .muted {
  max-width: 620px;
  margin: 0;
}

.traffic-content {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.traffic-ring {
  --traffic-percent: 0;
  --traffic-color: #477a44;
  width: min(230px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    conic-gradient(var(--traffic-color) calc(var(--traffic-percent) * 1%), rgba(141, 94, 43, 0.12) 0),
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(245, 229, 204, 0.88));
  box-shadow: inset 0 0 0 1px rgba(141, 94, 43, 0.12), 0 22px 55px rgba(93, 69, 38, 0.14);
}

.traffic-ring-inner {
  width: 72%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: inherit;
  background: rgba(255, 252, 246, 0.96);
  box-shadow: inset 0 0 0 1px rgba(141, 94, 43, 0.1);
}

.traffic-ring-inner span {
  color: var(--text);
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  font-weight: 950;
  line-height: 1;
}

.traffic-ring-inner small {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 900;
}

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

.traffic-metric {
  min-height: 118px;
  padding: 18px;
  border: 1px solid rgba(141, 94, 43, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 12px 30px rgba(93, 69, 38, 0.07);
}

.traffic-spark-card {
  min-height: 118px;
  padding: 14px 16px 12px;
  cursor: pointer;
}

.traffic-spark-card canvas {
  display: block;
  width: 100%;
  height: 70px;
  margin-top: 8px;
}

.traffic-spark-card .client-control-head {
  margin-bottom: 4px;
}

.traffic-spark-card .muted {
  margin: 8px 0 0;
  font-size: 0.82rem;
}

.traffic-metric span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.traffic-metric strong {
  margin: 10px 0 0;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  line-height: 1.12;
}

.traffic-metric.used strong { color: var(--accent-strong); }
.traffic-metric.remaining strong { color: #477a44; }
.traffic-metric.updated strong,
.traffic-metric.node-status strong {
  font-size: clamp(1rem, 1.7vw, 1.24rem);
}

.traffic-metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 700;
}

.traffic-metric.connection strong {
  display: flex;
  align-items: center;
  gap: 9px;
}

.traffic-metric.connection i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #9b8a78;
  box-shadow: 0 0 0 5px rgba(155, 138, 120, 0.12);
}

.traffic-metric.connection[data-online-status="online"] i {
  background: #2fa65a;
  box-shadow: 0 0 0 5px rgba(47, 166, 90, 0.14), 0 0 18px rgba(47, 166, 90, 0.45);
}

.traffic-metric.connection[data-online-status="offline"] i {
  background: #b54a3a;
  box-shadow: 0 0 0 5px rgba(181, 74, 58, 0.12);
}

.traffic-metric.connection[data-online-status="online"] strong { color: #2f7a48; }
.traffic-metric.connection[data-online-status="offline"] strong { color: var(--danger); }

.traffic-progress-track {
  position: relative;
  z-index: 1;
  height: 12px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(141, 94, 43, 0.12);
}

.dashboard-import-card {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(141, 94, 43, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 30px rgba(93, 69, 38, 0.07);
}

.dashboard-import-card .muted {
  margin: 10px 0 0;
}

.traffic-progress-track span {
  display: block;
  width: var(--traffic-percent, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #477a44, var(--accent));
  transition: width 300ms ease;
}

.traffic-dashboard[data-traffic-level="warning"] .traffic-ring { --traffic-color: #c58a2a; }
.traffic-dashboard[data-traffic-level="warning"] .traffic-progress-track span { background: linear-gradient(90deg, #c58a2a, #e0ad52); }
.traffic-dashboard[data-traffic-level="danger"] .traffic-ring { --traffic-color: var(--danger); }
.traffic-dashboard[data-traffic-level="danger"] .traffic-progress-track span { background: linear-gradient(90deg, var(--danger), #d77358); }
.traffic-dashboard[data-traffic-level="unlimited"] .traffic-ring { --traffic-color: var(--accent); }

.traffic-spark-card {
  min-height: 108px;
  cursor: pointer;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 12px 14px 10px;
}

.traffic-spark-card canvas {
  width: 100%;
  height: 58px;
  display: block;
  margin-top: 4px;
}

.traffic-spark-card .client-control-head {
  margin-bottom: 0;
}

.traffic-spark-card .muted {
  display: none;
}

.traffic-spark-card:focus-visible {
  outline: 3px solid rgba(186, 135, 81, 0.28);
  outline-offset: 3px;
}

.traffic-chart-modal-card {
  width: min(980px, 100%);
}

.traffic-chart-modal-card canvas {
  width: 100%;
  height: min(420px, 60vh);
  display: block;
  margin-top: 14px;
}

.traffic-alert-strip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(181, 74, 58, 0.22);
  border-radius: 18px;
  background: rgba(181, 74, 58, 0.08);
  color: var(--danger);
}

.traffic-alert-strip strong {
  flex: 0 0 auto;
  font-size: 0.98rem;
}

.traffic-alert-strip span {
  flex: 1;
  color: var(--text);
  line-height: 1.6;
}

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

.alert-body {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.alert-summary {
  padding: 16px;
  border-radius: 18px;
  background: rgba(181, 74, 58, 0.08);
  border: 1px solid rgba(181, 74, 58, 0.16);
}

.alert-summary strong {
  display: block;
  color: var(--danger);
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.alert-summary p {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

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

.alert-stats span {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--border);
  color: var(--muted);
}

.alert-stats strong {
  color: var(--text);
}

.alert-note {
  display: grid;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  outline: none;
}

textarea:focus {
  border-color: rgba(141, 94, 43, 0.45);
  box-shadow: 0 0 0 4px rgba(186, 135, 81, 0.12);
}

.alert-request-card {
  align-items: stretch;
}

.alert-request-card textarea {
  margin-top: 10px;
}

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

.account-card {
  width: 100%;
  min-height: 260px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px 28px;
  align-items: center;
  padding: clamp(28px, 4vw, 42px);
}

.account-card .label,
.account-card strong,
.account-card .muted {
  grid-column: 1;
}

.account-card strong {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.05;
}

.account-card #renewStatus {
  max-width: 680px;
  margin: 0;
}

.account-card #renewBtn {
  grid-column: 2;
  grid-row: 1 / span 4;
  width: 100%;
  min-height: 74px;
  padding: 18px 24px;
  font-size: 1.08rem;
  box-shadow: 0 18px 38px rgba(141, 94, 43, 0.22);
}

.subscription-card {
  grid-column: auto;
}

.copy-row,
.top-actions,
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.copy-row input { flex: 1; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input { width: auto; }
.checkbox span { margin: 0; }

.message {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 90;
  min-width: min(360px, calc(100vw - 44px));
  max-width: min(420px, calc(100vw - 44px));
  min-height: 0;
  margin: 0;
  padding: 14px 18px;
  border: 1px solid rgba(100, 74, 35, 0.13);
  border-radius: 18px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(247, 240, 230, 0.96));
  box-shadow: 0 18px 48px rgba(93, 69, 38, 0.18);
  backdrop-filter: blur(14px);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px) scale(0.98);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
}

.message.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.message::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(186, 135, 81, 0.12);
}

.message.error {
  color: var(--danger);
  border-color: rgba(181, 74, 58, 0.2);
}

.message.error::before {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(181, 74, 58, 0.12);
}

.message.success {
  color: #477a44;
  border-color: rgba(71, 122, 68, 0.2);
}

.message.success::before {
  background: #477a44;
  box-shadow: 0 0 0 5px rgba(71, 122, 68, 0.12);
}

.auth-card .message {
  position: static;
  min-width: 0;
  max-width: none;
  min-height: 24px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  opacity: 1;
  transform: none;
  transition: none;
  font-weight: 700;
}

.auth-card .message::before {
  display: none;
}

.auth-card .message.error {
  color: var(--danger);
}

.auth-card .message.success {
  color: #477a44;
}

.table-wrap { overflow-x: auto; }

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

th, td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th { color: var(--muted); font-size: 0.9rem; }
td:last-child { white-space: nowrap; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.modal.hidden {
  display: none !important;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 32, 22, 0.42);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 220ms ease, backdrop-filter 220ms ease;
}

.modal.open .modal-backdrop {
  opacity: 1;
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(247, 240, 230, 0.98));
  box-shadow: 0 28px 90px rgba(42, 32, 22, 0.28);
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition:
    opacity 240ms ease,
    transform 300ms cubic-bezier(0.2, 0.9, 0.2, 1),
    width 260ms ease,
    max-height 260ms ease,
    padding 260ms ease;
}

.modal.open .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
  transition: opacity 180ms ease, transform 220ms ease, margin 220ms ease;
}

.payment-method {
  position: relative;
  justify-content: flex-start;
  gap: 14px;
  min-height: 92px;
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 36px rgba(93, 69, 38, 0.08);
  text-align: left;
  transform: translateY(0) scale(1);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 220ms ease, transform 180ms ease;
}

.payment-method:hover {
  transform: translateY(-2px);
}

.payment-method.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(250, 238, 220, 0.96));
  box-shadow: 0 18px 48px rgba(186, 135, 81, 0.2);
}

.payment-logo {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(100, 74, 35, 0.08), 0 10px 24px rgba(93, 69, 38, 0.1);
}

.payment-logo img {
  display: block;
  width: 74%;
  height: 74%;
  object-fit: contain;
}

.alipay-logo { background: rgba(22, 119, 255, 0.08); }
.wechat-logo { background: rgba(7, 193, 96, 0.08); }

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

.payment-copy strong {
  font-size: 1.08rem;
}

.payment-copy small {
  color: var(--muted);
  font-weight: 700;
}

.payment-check {
  position: absolute;
  top: 14px;
  right: 14px;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 0.9rem;
}

.payment-method.selected .payment-check {
  display: grid;
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0;
  animation: contentRise 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.pay-result {
  grid-template-columns: minmax(260px, 360px);
  justify-content: center;
}

.pay-result .pay-card {
  width: 100%;
}

.pay-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
  animation: cardStretch 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.pay-card span {
  display: block;
  margin-bottom: 12px;
  font-weight: 900;
  font-size: 1.08rem;
}

.pay-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
}

.pay-card.alipay span { color: #1677ff; }
.pay-card.wechat span { color: #07c160; }

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

#confirmPaidBtn {
  min-width: 176px;
  gap: 8px;
  transition: transform 160ms ease, background 180ms ease, box-shadow 180ms ease, min-width 180ms ease;
}

#confirmPaidBtn:active {
  transform: scale(0.96);
}

#confirmPaidBtn.is-submitting {
  background: linear-gradient(135deg, #9b7a55, var(--accent));
}

#confirmPaidBtn.is-done {
  min-width: 168px;
  background: linear-gradient(135deg, #f7f1e8, #efe3d1);
  color: var(--text);
  box-shadow: 0 14px 32px rgba(47, 122, 72, 0.14);
}

#confirmPaidBtn.is-done:disabled {
  opacity: 1;
}

.submit-check {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: visible;
  background: transparent;
  color: #fff;
  line-height: 1;
}

.submit-check img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: auto;
}

#confirmPaidBtn.is-submitting .submit-check {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.34);
  border-top-color: #fff;
  border-radius: 999px;
  background: transparent;
  animation: submitSpin 760ms linear infinite;
}

#confirmPaidBtn.is-done .submit-check {
  width: 32px;
  height: 32px;
  background: transparent;
  filter: none;
  opacity: 1;
  animation: submitPop 260ms cubic-bezier(.2,.9,.2,1);
}

#confirmPaidBtn.is-done .submit-check img {
  opacity: 1;
  filter: none;
}

@keyframes contentRise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardStretch {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes submitSpin {
  to { transform: rotate(360deg); }
}

@keyframes submitPop {
  0% { transform: scale(0.72); }
  70% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-backdrop,
  .modal-card,
  .payment-method,
  .payment-methods,
  .pay-grid,
  .pay-card,
  #confirmPaidBtn,
  #confirmPaidBtn .submit-check {
    animation: none !important;
    transition: none !important;
  }
}

.docs-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(245, 229, 204, 0.92));
}

.doc-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 13px 18px;
  color: #fffaf2;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(186, 135, 81, 0.22);
}

.docs-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.docs-topbar {
  align-items: flex-start;
}

.docs-topbar .muted {
  max-width: 760px;
  margin-bottom: 0;
}

.doc-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 8px;
  padding: 22px;
}

.doc-toc a {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.46);
}

.doc-toc a:hover {
  background: rgba(186, 135, 81, 0.12);
}

.doc-content {
  padding: 34px;
}

.doc-section {
  scroll-margin-top: 24px;
  padding: 28px 0;
  border-bottom: 1px solid rgba(100, 74, 35, 0.08);
}

.doc-section:first-child {
  padding-top: 0;
}

.doc-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.doc-section h2 {
  margin: 0 0 16px;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.doc-section p {
  color: var(--muted);
  line-height: 1.85;
}

.notice-card,
.mini-card,
.doc-step,
details {
  border: 1px solid rgba(100, 74, 35, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
}

.notice-card {
  padding: 18px 20px;
  margin: 18px 0;
}

.notice-card.compact {
  margin: 14px 0 0;
  padding: 14px 16px;
}

.notice-card.compact ol {
  margin-top: 8px;
}

.notice-card ol,
.doc-list {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  line-height: 1.85;
}

.doc-steps {
  display: grid;
  gap: 14px;
}

.doc-step {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
}

.doc-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(186, 135, 81, 0.12);
  border: 1px solid rgba(141, 94, 43, 0.2);
  font-weight: 900;
}

.doc-step h3 {
  margin: 0 0 8px;
}

.doc-step p {
  margin: 0;
}

.download-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(150px, 0.55fr) minmax(0, 1.2fr);
  gap: 14px;
  margin: 18px 0;
}

.download-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(141, 94, 43, 0.14);
  border-radius: 20px;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.86), rgba(245, 229, 204, 0.78));
  box-shadow: 0 12px 30px rgba(93, 69, 38, 0.08);
}

.download-card span {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.download-card strong {
  font-size: 1.12rem;
}

.download-card small {
  color: var(--muted);
  font-weight: 800;
}

.extract-code-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label button"
    "code button";
  align-items: center;
  gap: 4px 10px;
  padding: 16px;
  border: 1px solid rgba(141, 94, 43, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 30px rgba(93, 69, 38, 0.06);
}

.extract-code-card span {
  grid-area: label;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.extract-code-card strong {
  grid-area: code;
  color: var(--accent-strong);
  font-size: 1.22rem;
  letter-spacing: 0.08em;
}

.copy-code-btn {
  grid-area: button;
  padding: 9px 13px;
  font-size: 0.86rem;
  box-shadow: none;
}

.copy-code-btn.copied {
  background: #477a44;
}

.guide-image {
  margin: 14px 0 0;
  padding: 10px;
  border: 1px solid rgba(100, 74, 35, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 30px rgba(93, 69, 38, 0.08);
  cursor: zoom-in;
}

.guide-image img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  transition: transform 180ms ease;
}

.guide-image:hover img {
  transform: scale(1.01);
}

.viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(42, 32, 22, 0.86);
  backdrop-filter: blur(10px);
}

.image-viewer.hidden {
  display: none !important;
}

.image-viewer img {
  display: block;
  width: auto;
  height: auto;
  max-width: 98vw;
  max-height: 96vh;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(42, 32, 22, 0.42);
}

.image-viewer-close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 30px;
  line-height: 1;
  z-index: 101;
  box-shadow: 0 12px 30px rgba(42, 32, 22, 0.24);
}

.screenshot-slot {
  margin-top: 14px;
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  border: 1px dashed rgba(141, 94, 43, 0.32);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(186, 135, 81, 0.06), rgba(255, 255, 255, 0.42)),
    repeating-linear-gradient(45deg, rgba(141, 94, 43, 0.04) 0 8px, transparent 8px 16px);
}

.screenshot-slot.wide-slot {
  min-height: 190px;
  margin: 18px 0;
}

.screenshot-slot span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(141, 94, 43, 0.16);
  font-weight: 900;
}

.screenshot-slot p {
  margin: 8px 0 0;
  font-size: 0.92rem;
}

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

.mini-card {
  padding: 18px;
}

.mini-card strong {
  display: block;
  margin-bottom: 8px;
}

.mini-card p {
  margin: 0;
}

details {
  padding: 16px 18px;
  margin-bottom: 12px;
}

summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
}

details p {
  margin: 12px 0 0;
}

.guide-panel {
  margin-top: 2px;
}

.guide-head {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

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

.guide-card {
  padding: 22px;
  border: 1px solid rgba(100, 74, 35, 0.08);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(248,243,235,0.84));
}

.guide-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  color: var(--accent-strong);
  border: 1px solid rgba(141, 94, 43, 0.2);
  background: rgba(186, 135, 81, 0.1);
  font-weight: 900;
}

.guide-card h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.guide-card ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
  line-height: 1.85;
}

.guide-card li + li {
  margin-top: 6px;
}

.guide-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(100, 74, 35, 0.08);
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.92rem;
}

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

.request-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.request-card p {
  margin: 6px 0 0;
}

@media (max-width: 760px) {
  .auth-shell,
  .dashboard-shell,
  .docs-shell { padding: 18px; }
  .topbar,
  .traffic-hero,
  .docs-entry,
  .copy-row,
  .request-card { flex-direction: column; align-items: stretch; }
  .modal-card { padding: 24px; }
  .doc-layout,
  .doc-grid,
  .download-grid,
  .traffic-content,
  .traffic-metrics,
  .account-grid,
  .guide-head,
  .guide-grid,
  .grid,
  .admin-form,
  .payment-methods,
  .pay-grid { grid-template-columns: 1fr; }
  .doc-toc { position: static; }
  .doc-content { padding: 24px; }
  .traffic-alert-strip { flex-direction: column; align-items: stretch; }
  .alert-stats { grid-template-columns: 1fr; }
  .modal-actions { justify-content: stretch; }
  .modal-actions button { width: 100%; }
  .doc-step { grid-template-columns: 1fr; }
  .traffic-dashboard { padding: 22px; }
  .traffic-ring { width: min(210px, 76vw); justify-self: center; }
  .traffic-metric { min-height: auto; }
  .traffic-hero .ghost { width: 100%; }
  .account-card {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 26px;
  }
  .account-card #renewBtn {
    grid-column: 1;
    grid-row: auto;
    min-height: 58px;
  }
  .message {
    top: 14px;
    right: 14px;
    min-width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
  }
  .subscription-card { grid-column: 1 / -1; }
}



.traffic-metric.connection {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
}

.traffic-metric.connection .node-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.5;
}

.traffic-metric.connection .node-line b {
  color: var(--text);
  font-weight: 950;
}

.client-switch {
  justify-self: start;
  position: relative;
  width: 58px;
  min-width: 58px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(142, 132, 120, 0.28);
  box-shadow: inset 0 0 0 1px rgba(93, 69, 38, 0.08);
}

.client-switch i {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fffaf2;
  box-shadow: 0 6px 14px rgba(93, 69, 38, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.client-switch.is-on {
  background: linear-gradient(135deg, #2fa65a, #6fbf73);
}

.client-switch.is-on i {
  transform: translateX(26px);
}

.client-switch.is-loading {
  cursor: wait;
  opacity: 0.78;
}

.client-switch.is-loading i::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 999px;
  border: 2px solid rgba(141, 94, 43, 0.25);
  border-top-color: var(--accent-strong);
  animation: spin 720ms linear infinite;
}

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

.client-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-control-head em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 28px;
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(141, 94, 43, 0.09);
  border: 1px solid rgba(141, 94, 43, 0.1);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.traffic-metric.client-control[data-client-enabled="enabled"] .client-control-head em {
  color: #2f7a48;
  background: rgba(47, 166, 90, 0.12);
  border-color: rgba(47, 166, 90, 0.18);
}

.traffic-metric.client-control[data-client-enabled="disabled"] .client-control-head em {
  color: var(--danger);
  background: rgba(181, 74, 58, 0.1);
  border-color: rgba(181, 74, 58, 0.16);
}

.traffic-metric.client-control[data-client-enabled="unknown"] .client-control-head em {
  color: #8b7b68;
  background: rgba(141, 94, 43, 0.08);
  border-color: rgba(141, 94, 43, 0.1);
}
