:root {
  --bg: #f0eee8;
  --bg-elev: #faf9f6;
  --ink: #1a1a18;
  --muted: #5c5a54;
  --line: #d4d0c8;
  --accent: #2c2a26;
  --ok: #2f6b4f;
  --warn: #8a6a2b;
  --danger: #8b3a3a;
  --font: "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "Consolas", "SF Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.nav-mid {
  display: flex;
  gap: 18px;
  flex: 1;
  align-items: center;
}

.nav-mid a {
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}

.nav-link-soft {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 8px;
  text-decoration: none;
}

.nav-link-soft:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav-ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 6px 8px;
  font: inherit;
  cursor: pointer;
  font-size: 0.9rem;
}

.nav-ghost:hover {
  color: var(--muted);
}

.tutorial-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c5d9c0;
  background: #eef6ea;
  color: #2f6b4f;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.tutorial-link:hover {
  color: #2f6b4f;
  text-decoration: none;
  background: #e4f0df;
}

.tutorial-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.tutorial-step {
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
}

.tutorial-step strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.tutorial-step .muted {
  margin: 0;
  line-height: 1.55;
}

.tutorial-code {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f6f3;
  border: 1px solid var(--line);
  font-size: 0.88rem;
  overflow-x: auto;
}

.tutorial-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.tutorial-more .muted {
  margin: 0;
}

.chev {
  font-size: 0.7rem;
  opacity: 0.7;
}

.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 8px 0;
  z-index: 30;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-menu a,
.dropdown-menu .menu-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.dropdown-menu a:hover,
.dropdown-menu .menu-btn:hover {
  background: var(--bg);
  text-decoration: none;
}

.dropdown-menu .warn {
  padding: 8px 14px 4px;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: transparent;
  border: 0;
  overflow: visible;
  min-height: 34px;
}

.balance-battery {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 88px;
  min-height: 34px;
  padding: 0 12px;
  border: 1.5px solid #3d9a6a;
  border-radius: 5px;
  background: #f3faf6;
  overflow: hidden;
}

.balance-battery-fill {
  position: absolute;
  inset: 2px auto 2px 2px;
  width: var(--pct, 50%);
  border-radius: 3px;
  background: linear-gradient(180deg, #7ddea8 0%, #3d9a6a 100%);
  opacity: 0.45;
  pointer-events: none;
  transition: width 0.35s ease;
}

.balance-battery-fill[data-level="low"] {
  background: linear-gradient(180deg, #f0c27a 0%, #d97706 100%);
  opacity: 0.5;
}

.balance-battery-fill[data-level="mid"] {
  background: linear-gradient(180deg, #a8e6c1 0%, #4caf7a 100%);
}

.balance-battery-cap {
  width: 4px;
  height: 14px;
  margin-left: 2px;
  margin-right: 6px;
  border-radius: 0 2px 2px 0;
  background: #3d9a6a;
  flex-shrink: 0;
}

.balance-amount {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: #1f6b45;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.balance-topup {
  border: 0;
  border-radius: 5px;
  background: #2f9d5c;
  color: #fff;
  padding: 0 12px;
  min-height: 34px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.balance-topup:hover {
  background: #278750;
}

.balance-topup:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

/* —— Top up / plans —— */
.topup-balance {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  margin-bottom: 22px;
}

.topup-balance strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.topup-h {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.topup-amounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.topup-amount {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 16px 12px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.topup-amount.is-active,
.topup-plan.is-active {
  border-color: #2f6f74;
  background: #e8f3f4;
  box-shadow: inset 0 0 0 1px #2f6f74;
}

.topup-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.topup-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 18px 16px 16px;
  font: inherit;
  cursor: pointer;
}

.topup-plan strong {
  font-size: 1rem;
}

.topup-plan em {
  font-style: normal;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.topup-plan-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1e6;
  color: #9a5b1f;
}

.topup-enterprise {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  background: #1f2422;
  color: #f4f2ec;
  margin-bottom: 22px;
}

.topup-enterprise .muted {
  color: #b7b3aa;
  margin: 4px 0 0;
}

.topup-enterprise .btn-ghost {
  border-color: #5a605c;
  color: #f4f2ec;
}

.topup-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  margin-bottom: 22px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
}

.topup-custom input {
  border: 0;
  outline: 0;
  width: 100%;
  font: inherit;
  font-weight: 600;
  background: transparent;
}

.topup-pay-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 420px;
  margin-bottom: 18px;
}

.topup-pay {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 14px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.topup-pay.is-active {
  border-color: #1677ff;
  background: #eef5ff;
  color: #1677ff;
}

.topup-pay[data-pay="wechat"].is-active {
  border-color: #07c160;
  background: #eefaf3;
  color: #07c160;
}

.topup-pay[data-pay="usdt"].is-active {
  border-color: #26a17b;
  background: #e9f7f2;
  color: #1a7a5c;
}

.topup-usdt {
  max-width: 560px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
}

.topup-usdt-nets {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

.topup-usdt-net {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}

.topup-usdt-net.is-active {
  background: #1f5a5e;
  color: #fff;
}

.topup-usdt-row,
.topup-usdt-addr {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.topup-usdt-addr code {
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.topup-submit {
  width: min(420px, 100%);
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 800;
}

@media (max-width: 900px) {
  .topup-amounts,
  .topup-plans,
  .topup-pay-methods {
    grid-template-columns: 1fr 1fr;
  }

  .topup-pay-methods {
    max-width: none;
  }

  .topup-usdt-row,
  .topup-usdt-addr {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 2px 4px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2f6f74;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.user-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar.has-image {
  background: transparent;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 650;
}

.user-role {
  font-size: 0.72rem;
  color: var(--muted);
}

.dropdown-menu-user {
  min-width: 160px;
}

.dropdown-menu-lang {
  min-width: 120px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.92;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.85rem;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

.hero-plane {
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(44, 42, 38, 0.06), transparent 55%),
    linear-gradient(180deg, #e8e4db 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}

main,
.below-hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 28px 40px;
}

.below-hero {
  padding-top: 8px;
  padding-bottom: 80px;
}

.hero {
  padding: 56px 0 64px;
}

.hero h1 {
  font-size: clamp(3.6rem, 11vw, 6rem);
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  line-height: 0.95;
}

.hero .tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  font-weight: 600;
}

.hero .sub {
  max-width: 36rem;
  color: var(--muted);
  margin: 0 0 28px;
}

.hero-bonus {
  margin: 14px 0 0;
  max-width: 28rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Guest home: lock page except lang + login */
body.page-home.is-guest {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

body.page-home.is-guest a,
body.page-home.is-guest button,
body.page-home.is-guest summary,
body.page-home.is-guest [onclick] {
  pointer-events: none;
  cursor: default;
}

body.page-home.is-guest [data-allow-interact],
body.page-home.is-guest [data-allow-interact] * {
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.works-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: baseline;
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.works-label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--ink);
}

.works-body {
  color: var(--muted);
  font-size: 0.95rem;
}

.section {
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

.section:first-of-type {
  border-top: 0;
}

.section h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.promise-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 32px;
}

.promise-item {
  padding: 0;
}

.promise-grid h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.promise-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 18rem;
}

.pricing-table {
  margin-top: 12px;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 28px 40px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

pre,
code {
  font-family: var(--mono);
  font-size: 0.86rem;
}

pre {
  background: #ebe8e1;
  border: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}

.console-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 57px);
}

.console-side {
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 16px 12px;
}

.console-side button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 2px;
}

.console-side button.is-active {
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
}

.console-main {
  padding: 28px 32px 60px;
  max-width: none;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

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

.panel-head h2 {
  margin: 0 0 10px;
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.15;
  color: var(--ink);
}

.panel-head > div > .muted {
  margin: 0;
  max-width: 44em;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.75;
  color: #3d3b35;
}

#panel-keys .panel-head h2 {
  font-size: 2rem;
  letter-spacing: 0.08em;
}

#panel-keys .panel-head > div > .muted {
  font-size: 1.05rem;
  line-height: 1.8;
}

.panel-head h3,
.split-2 h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.profile-card {
  max-width: 520px;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.profile-avatar-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: #2f6f74;
  color: #fff;
  flex-shrink: 0;
  font: inherit;
}

.profile-avatar-btn img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-letter {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 72px;
}

.profile-avatar-btn.has-image .profile-avatar-letter {
  display: none;
}

.profile-avatar-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 4px 0 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.profile-avatar-btn:hover .profile-avatar-overlay,
.profile-avatar-btn:focus-visible .profile-avatar-overlay {
  opacity: 1;
}

.profile-hero-meta {
  min-width: 0;
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-name-row strong {
  font-size: 1.2rem;
  font-weight: 700;
  word-break: break-word;
}

.profile-hero-meta > .muted {
  margin: 6px 0 0;
  font-size: 0.82rem;
}

.profile-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.profile-row:last-child {
  border-bottom: 0;
}

.profile-row strong {
  font-weight: 650;
  text-align: right;
  word-break: break-all;
}

.profile-value-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.profile-value-actions strong {
  text-align: right;
}

.profile-email-text {
  max-width: min(42vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-email-change {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 4px 10px;
  min-width: auto;
}

.profile-password-form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.bind-list {
  display: grid;
  gap: 10px;
  max-width: 560px;
  margin-top: 10px;
}

.bind-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.bind-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bind-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bind-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #111;
  color: #fff;
}

.bind-github .bind-logo {
  background: #111111;
  color: #fff;
}

.bind-telegram .bind-logo {
  background: #229ed9;
  color: #fff;
}

.bind-linuxdo .bind-logo {
  background: #fff;
  color: #111;
  border: 1px solid var(--line);
}

.bind-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.bind-cta {
  white-space: nowrap;
}

.stat {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 14px 16px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-item {
  border-top: 1px solid var(--line);
  padding: 12px 0 4px;
}

.feed-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.feed-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 4px;
}

.feed-item p {
  margin: 0;
  font-size: 0.9rem;
}

.invite-super {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #d9c38a;
  background: #fff8e8;
  border-radius: 10px;
}

.invite-super strong {
  display: block;
  margin-bottom: 6px;
}

.invite-active-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invite-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 10px;
}

.invite-card.is-dead {
  opacity: 0.55;
}

.invite-card-code {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.invite-card-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.invite-quota {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 16px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 16px;
  max-width: 640px;
}

.provider-section-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
}

.provider-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f3f3;
}

.provider-card.is-local {
  background: #eef6f0;
  border-color: #b7d4c0;
}

.provider-card.is-off {
  opacity: 0.72;
}

.provider-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.provider-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.provider-title-text {
  font-size: 0.92rem;
  font-weight: 800;
}

.provider-kind-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: #2a6b3f;
  border: 1px solid #b7d4c0;
  background: #fff;
  border-radius: 999px;
  padding: 1px 6px;
}

.provider-card:not(.is-local) .provider-kind-tag {
  color: #2a5ea8;
  border-color: #c5d6ef;
}

.provider-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.provider-card .field {
  margin: 0;
}

.provider-card .field span:first-child {
  display: block;
  margin-bottom: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
}

.provider-card input,
.provider-card select {
  border: 1px solid #d8d8d8;
  background: #fff;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.88rem;
  border-radius: 7px;
  width: 100%;
  min-height: 0;
  line-height: 1.3;
}

.provider-card .model-select-dropdown {
  min-height: 0;
  height: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.84rem;
}

.provider-card .field-hint {
  margin-top: 3px;
  font-size: 0.75rem;
  line-height: 1.35;
}

.provider-card .upstream-status {
  font-size: 0.78rem;
  font-weight: 600;
}

.secret-row .model-select-dropdown {
  flex: 1;
}

/* Visible on/off switch */
.switch-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.switch-field input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #c8c8c8;
  transition: background 0.18s ease;
  flex-shrink: 0;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.switch-field input[type="checkbox"]:checked + .switch-ui {
  background: #2f9e5b;
}

.switch-field input[type="checkbox"]:checked + .switch-ui::after {
  transform: translateX(18px);
}

.switch-state {
  min-width: 1.5em;
  color: #666;
}

.switch-field input[type="checkbox"]:checked ~ .switch-state {
  color: #1a7f4b;
}

.up-route-card {
  margin: 16px 0 24px;
  max-width: 720px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfaf7 0%, #f6f3ee 100%);
}

.up-route-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.up-route-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.up-route-row {
  display: grid;
  grid-template-columns: 88px 1fr minmax(160px, 220px);
  gap: 10px;
  align-items: center;
}

@media (max-width: 720px) {
  .up-route-row {
    grid-template-columns: 1fr;
  }
}

.up-route-row select {
  border: 1px solid var(--line);
  background: #fafafa;
  padding: 10px 12px;
  font: inherit;
  border-radius: 8px;
  width: 100%;
}

.up-rate-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.secret-row input,
.secret-row select {
  flex: 1;
  min-width: 0;
}

.secret-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 560px) {
  .field-row-2 {
    grid-template-columns: 1fr;
  }
}

.upstream-status {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.upstream-status.is-ok {
  color: #1a7f4b;
}

.upstream-status.is-need {
  color: #a15c00;
}

.upstream-user-box {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  max-width: 560px;
}

.upstream-user-box .key-detail-row {
  margin-top: 12px;
}

.rule-callout {
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin: 0 0 16px;
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 0.92rem;
}

.rule-warn {
  color: var(--danger);
  margin: 0 0 16px;
  font-size: 0.9rem;
}

.invite-code,
.invite-rate {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 4px;
  font-family: var(--mono);
}

.endpoint-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 10px 14px;
  margin-bottom: 14px;
  max-width: none;
  margin-left: 0;
}

.endpoint-bar code {
  flex: 1;
  min-width: 180px;
}

.keys-create {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal-body {
  padding: 8px 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-body .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

.modal-body .field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.modal-body input,
.modal-body select {
  border: 1px solid var(--line);
  background: #fafafa;
  padding: 10px 12px;
  font: inherit;
  border-radius: 8px;
  width: 100%;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

#panel-refund .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0 8px;
  font-size: 0.92rem;
  max-width: 420px;
}

#panel-refund .field select,
#panel-refund .field input[type="text"] {
  border: 1px solid var(--line);
  background: #fafafa;
  padding: 10px 12px;
  font: inherit;
  border-radius: 8px;
  width: 100%;
}

#panel-refund .field input[type="file"] {
  font: inherit;
  font-size: 0.88rem;
}

#panel-refund #btn-refund {
  margin-top: 12px;
}

.input-prefix {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fafafa;
  border-radius: 8px;
  padding: 0 12px;
}

.input-prefix span {
  color: var(--muted);
}

.input-prefix input {
  border: 0;
  background: transparent;
  padding: 10px 0;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-ui {
  position: absolute;
  inset: 0;
  background: #d4d0c8;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s;
}

.switch-ui::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.15s;
}

.switch input:checked + .switch-ui {
  background: #2f6f74;
}

.switch input:checked + .switch-ui::after {
  transform: translateX(18px);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 18px;
  flex: none;
  position: relative;
  z-index: 5;
  background: #fff;
  border-top: 1px solid var(--line);
}

body.modal-open {
  overflow: hidden;
}

.btn-accent {
  background: #2f6f74;
  border-color: #2f6f74;
  color: #fff;
}

.keys-toolbar select {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
  font: inherit;
}

.keys-empty {
  text-align: center;
  padding: 40px 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.keys-empty .btn {
  margin-top: 12px;
}

.keys-workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 520px);
  gap: 40px;
  align-items: start;
  width: 100%;
  min-height: 0;
  position: relative;
}

.keys-link {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}

.keys-link-line {
  stroke: #2f9e6a;
  stroke-width: 2;
  stroke-linecap: round;
}

.keys-link-dot {
  fill: #2f9e6a;
  stroke: #fff;
  stroke-width: 2;
}

.keys-link.is-hidden {
  display: none;
}

.keys-table-wrap {
  border: none;
  background: transparent;
  overflow: visible;
  max-width: none;
  width: 100%;
  border-radius: 0;
  position: relative;
  z-index: 1;
}

.table.keys-table {
  margin: 0;
  width: 100%;
  table-layout: auto;
  background: transparent;
  border-collapse: separate;
  border-spacing: 0 12px;
}

.keys-table th:nth-child(1),
.keys-table td:nth-child(1) {
  width: 1%;
  max-width: 10em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.keys-table th:nth-child(2),
.keys-table td:nth-child(2) {
  width: auto;
}

.keys-table thead th {
  padding: 2px 14px 2px 16px;
  border-bottom: none;
}

.keys-table thead th:last-child {
  padding-left: 12px;
}

.keys-table tbody td {
  padding: 16px 14px;
  vertical-align: middle;
  border-bottom: none;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.keys-table tbody td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 10px 0 0 10px;
  padding-left: 16px;
}

.keys-table tbody td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 10px 10px 0;
  padding-left: 12px;
  padding-right: 18px;
}

.keys-row {
  cursor: pointer;
}

.keys-row:hover td {
  background: #f3f1ec;
}

.keys-row.is-active td {
  background: #e8f3f4;
  border-top: 3px solid #2f6f74;
  border-bottom: 3px solid #2f6f74;
  border-left-color: transparent;
  border-right-color: transparent;
}

.keys-row.is-active td:first-child {
  box-shadow: none;
  border-left: 3px solid #2f6f74;
  padding-left: 14px;
}

.keys-row.is-active td:last-child {
  position: relative;
  border-right: none;
}

.keys-row.is-active strong {
  color: #1a3d40;
}

.keys-add-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
  padding: 15px 16px;
  border: 1.5px dashed #2f6f74;
  border-radius: 10px;
  background: #eef6f4;
  color: #1f5a5e;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.keys-add-row:hover {
  background: #e2f1ee;
  border-color: #245a5e;
  border-style: solid;
  color: #16484c;
}

.keys-add-row:focus-visible {
  outline: 2px solid #2f6f74;
  outline-offset: 2px;
}

.group-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.pill-on {
  background: #e7f6ec;
  color: #1f7a45;
}

.pill-off {
  background: #f3e8e8;
  color: #8b3a3a;
}

.pill-rate {
  background: #e7f6ec;
  color: #1f7a45;
}

.group-chat {
  background: #fff1e6;
  color: #9a5b1f;
}

.group-plus {
  background: #e8f1ff;
  color: #2a5ea8;
}

.group-mid {
  background: #eef8f0;
  color: #2a6b3f;
}

.group-pro,
.group-codex {
  background: #f3eef8;
  color: #6b3f8a;
}

.group-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(48vh, 380px);
  overflow: auto;
  margin-top: 8px;
  padding-right: 2px;
}

.group-pick-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #d9e2dc;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.group-pick-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.group-pick-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.group-pick-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  line-height: 1.3;
  max-width: 100%;
}

.group-pick-name::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.85;
}

.group-pick-desc {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #6b7280;
  padding-left: 2px;
}

.group-pick-card.is-disabled,
.group-pick-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.group-rate-badge {
  flex: none;
  align-self: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 0;
}

/* tone: orange — 0.026 / 0.05 */
.group-pick-card.tone-group-chat {
  border-color: #ecd7bf;
  background: #fffaf5;
}
.group-pick-card.tone-group-chat:hover {
  border-color: #d9b48a;
  background: #fff6ec;
}
.group-pick-card.tone-group-chat.is-active {
  border-color: #c48a45;
  box-shadow: inset 0 0 0 1px #c48a45;
}
.group-pick-name.group-chat,
.group-rate-badge.group-chat {
  background: #fff1e6;
  color: #9a5b1f;
}

/* tone: green — 0.08 / 0.12 */
.group-pick-card.tone-group-mid {
  border-color: #c9e2d1;
  background: #f7fcf8;
}
.group-pick-card.tone-group-mid:hover {
  border-color: #9dcdb0;
  background: #eef9f1;
}
.group-pick-card.tone-group-mid.is-active {
  border-color: #3d9a5f;
  box-shadow: inset 0 0 0 1px #3d9a5f;
}
.group-pick-name.group-mid,
.group-rate-badge.group-mid {
  background: #eef8f0;
  color: #2a6b3f;
}

/* tone: purple — 0.2 / 0.6 */
.group-pick-card.tone-group-pro,
.group-pick-card.tone-group-codex {
  border-color: #ddd0ea;
  background: #fbf8fd;
}
.group-pick-card.tone-group-pro:hover,
.group-pick-card.tone-group-codex:hover {
  border-color: #c4aed8;
  background: #f6f0fa;
}
.group-pick-card.tone-group-pro.is-active,
.group-pick-card.tone-group-codex.is-active {
  border-color: #8a5fb0;
  box-shadow: inset 0 0 0 1px #8a5fb0;
}
.group-pick-name.group-pro,
.group-pick-name.group-codex,
.group-rate-badge.group-pro,
.group-rate-badge.group-codex {
  background: #f3eef8;
  color: #6b3f8a;
}

/* tone: blue — 1.2 */
.group-pick-card.tone-group-plus {
  border-color: #c9d8f2;
  background: #f6f9ff;
}
.group-pick-card.tone-group-plus:hover {
  border-color: #9fb6e0;
  background: #eef4ff;
}
.group-pick-card.tone-group-plus.is-active {
  border-color: #3d6fbf;
  box-shadow: inset 0 0 0 1px #3d6fbf;
}
.group-pick-name.group-plus,
.group-rate-badge.group-plus {
  background: #e8f1ff;
  color: #2a5ea8;
}

.key-detail {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 20px 22px;
  min-width: 0;
  margin-left: 0;
  margin-top: 0;
  box-sizing: border-box;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(26, 26, 24, 0.08);
  z-index: 2;
}

.key-detail-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 28px 18px;
  text-align: center;
}

.key-detail-guide[hidden],
.key-detail-body[hidden] {
  display: none;
}

.key-detail-guide p {
  margin: 0;
  max-width: 16em;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.key-detail-title {
  margin: 0 0 14px;
  font-size: 1.35rem;
  font-weight: 700;
}

.key-detail-dot {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.12em;
}

.key-detail-card {
  border: 1px solid var(--line);
  background: #f3f1ec;
  border-radius: 10px;
  padding: 8px 14px 12px;
  margin-bottom: 16px;
}

.key-detail-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.key-detail-card .key-detail-row:last-of-type {
  border-bottom: 0;
}

.key-detail-row > span.muted {
  min-width: 0;
  font-size: 0.9rem;
}

.key-detail-row code {
  min-width: 0;
  word-break: break-all;
  font-size: 0.84rem;
}

.link-btn {
  border: 0;
  background: transparent;
  color: #2f6f74;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.key-usage {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.key-usage strong {
  font-size: 1.35rem;
  margin-right: 6px;
}

.key-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.key-meta em {
  font-style: normal;
  color: var(--ink);
  margin-left: 4px;
}

.key-detail-stats {
  display: none;
}

.key-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.toast-line {
  margin: 12px 0 0;
  color: var(--ok) !important;
}

@media (max-width: 900px) {
  .endpoint-bar {
    margin-left: 0;
    max-width: none;
  }

  .keys-workspace {
    grid-template-columns: 1fr;
  }

  .key-detail {
    max-width: none;
    margin-top: 0 !important;
    box-shadow: none;
  }

  .keys-link {
    display: none !important;
  }

  .key-detail-stats {
    grid-template-columns: 1fr;
  }
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar input {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
  font: inherit;
  min-width: 180px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.key-mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.online {
  border-color: var(--ok);
  color: var(--ok);
}

.badge.degraded {
  border-color: var(--warn);
  color: var(--warn);
}

.badge.offline {
  border-color: var(--danger);
  color: var(--danger);
}

.empty {
  color: var(--muted);
  padding: 24px 0;
}

/* —— Usage dashboard —— */
.usage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.usage-range {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
}

.usage-range-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.usage-range-btn.is-active {
  background: #1f5a5e;
  color: #fff;
}

.usage-logs-toggle {
  font-weight: 600;
  color: #1f5a5e;
}

.usage-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.usage-stat {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 14px 16px 10px;
  min-width: 0;
}

.usage-stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.usage-stat-value {
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.usage-stat-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.usage-spark {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 10px;
}

.usage-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.usage-card {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 16px 18px 18px;
  min-width: 0;
}

.usage-card h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.usage-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 12px;
}

.usage-bar-row:last-child {
  margin-bottom: 0;
}

.usage-bar-name {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-bar-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.usage-bar-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: #ebe7df;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f9e6b, #1f5a5e);
}

.usage-plan-row {
  margin-bottom: 16px;
}

.usage-plan-row:last-child {
  margin-bottom: 0;
}

.usage-plan-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.usage-plan-top strong {
  font-weight: 700;
}

.usage-plan-top span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}

.usage-plan-track {
  height: 10px;
  border-radius: 999px;
  background: #ebe7df;
  overflow: hidden;
}

.usage-plan-fill {
  height: 100%;
  border-radius: 999px;
  background: #2f9e6b;
}

.usage-logs-panel {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 14px 16px 8px;
}

.usage-logs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.usage-logs-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

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

.usage-table {
  min-width: 760px;
}

.usage-table .pill {
  font-size: 0.75rem;
}

@media (max-width: 1100px) {
  .usage-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .usage-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .usage-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* —— Network / channel status —— */
.net-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid #cfe5d8;
  background: #eaf6ef;
  margin-bottom: 22px;
}

.net-banner.is-warn {
  border-color: #e6d4a8;
  background: #faf3e2;
}

.net-banner.is-bad {
  border-color: #e5c8c8;
  background: #f8ecec;
}

.net-banner-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.net-banner-meta {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.net-section {
  margin-bottom: 24px;
}

.net-section h3,
.net-section-head h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

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

.net-section-head h3 {
  margin: 0;
}

.net-core-list {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 6px 16px;
}

.net-core-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 72px;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.net-core-row:last-child {
  border-bottom: 0;
}

.net-core-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
}

.net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f9e6b;
  flex-shrink: 0;
}

.net-dot.warn {
  background: #c47a2c;
}

.net-dot.bad {
  background: #8b3a3a;
}

.net-uptime-bar {
  height: 6px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    #2f9e6b 0,
    #2f9e6b 8px,
    #dfece4 8px,
    #dfece4 10px
  );
  overflow: hidden;
  position: relative;
}

.net-uptime-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0, transparent var(--fill, 99%), #e8d7a8 var(--fill, 99%));
  opacity: 0.35;
  pointer-events: none;
}

.net-uptime-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--muted);
}

.net-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.net-summary-card {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 14px 16px;
}

.net-summary-card .muted {
  font-size: 0.8rem;
  font-weight: 600;
}

.net-summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

.net-node {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 14px 16px 12px;
  min-width: 0;
}

.net-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.net-node-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.net-node-lat {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.net-node-lat span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.net-node .usage-spark {
  margin-top: 8px;
  height: 32px;
}

.net-node-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.net-node-foot strong {
  color: var(--ink);
  font-weight: 650;
}

.net-node-label {
  margin-top: 8px;
}

/* —— Auth / login page —— */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.auth-page a:not([data-allow-interact]),
.auth-page button:not([data-allow-interact]):not([data-allow-interact] *),
.auth-page summary {
  pointer-events: none;
  cursor: default;
}

/* Form controls always usable; paste into inputs must work */
.auth-page input,
.auth-page textarea,
.auth-page select,
.auth-page label.auth-field,
.auth-page label.auth-check,
.auth-page [data-allow-interact],
.auth-page [data-allow-interact] * {
  pointer-events: auto;
  cursor: auto;
}

.auth-page input,
.auth-page textarea {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.auth-page button[data-allow-interact],
.auth-page a[data-allow-interact],
.auth-page [data-allow-interact] button,
.auth-page [data-allow-interact] a {
  cursor: pointer;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}

.auth-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-back {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 34px 28px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 30px;
  align-items: stretch;
}

.auth-brand {
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 110% 80% at 0% 0%, rgba(47, 111, 116, 0.08), transparent 62%),
    var(--bg-elev);
  border-radius: 14px;
  padding: 28px 30px;
}

.auth-kicker {
  margin: 0 0 8px;
  color: #245a5e;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.auth-headline {
  margin: 0 0 14px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
}

.auth-points {
  margin: 0;
  padding-left: 18px;
  color: #245a5e;
  font-weight: 700;
}

.auth-points li {
  margin-bottom: 8px;
}

.auth-support {
  margin-top: 18px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.auth-support-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: #245a5e;
  font-weight: 700;
}

.auth-support-line {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.65;
  letter-spacing: 0.02em;
}

.auth-support-line + .auth-support-line {
  margin-top: 12px;
}

.auth-form-wrap {
  display: flex;
}

.auth-card {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 24px 24px 18px;
}

.auth-card-head h2 {
  margin: 12px 0 6px;
  font-size: 1.65rem;
  font-weight: 900;
}

.auth-product {
  letter-spacing: 0.08em;
  font-size: 0.9rem;
}

.auth-tagline {
  margin: 6px 0 0;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-field input {
  border: 1px solid var(--line);
  background: #fafafa;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}

.auth-inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.auth-inline input {
  flex: 1;
  min-width: 0;
}

.auth-inline .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.auth-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-register-only[hidden] {
  display: none !important;
}

.auth-row {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.auth-check {
  display: inline-flex;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  align-items: flex-start;
}

.auth-check input {
  margin-top: 2px;
}

.auth-submit {
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  font-weight: 800;
}

.auth-demo {
  margin: 10px 0 0;
  font-size: 0.82rem;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 14px 0 12px;
}

.auth-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px solid var(--line);
  transform: translateY(-50%);
}

.auth-divider span {
  position: relative;
  z-index: 1;
  padding: 0 10px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-oauth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-oauth-btn {
  border: 1px solid var(--line);
  background: #f7f6f2;
  border-radius: 10px;
  padding: 10px 8px;
  font: inherit;
  font-weight: 700;
  color: #37352f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-oauth-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-switch {
  margin: 14px 0 4px;
  text-align: center;
  font-size: 0.9rem;
}

.auth-footer {
  text-align: center;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

/* —— Home welfare —— */
.welfare-section h2 {
  margin-bottom: 12px;
}

.welfare-lead,
.weekly-cashback-note {
  margin: 0;
  max-width: 40rem;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.75;
  color: var(--ink);
}

.welfare-lead-gap {
  margin-top: 1.35em;
}

@media (max-width: 1100px) {
  .net-summary,
  .net-node-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand,
  .auth-card {
    padding: 20px;
  }

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

  .net-core-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .net-summary,
  .net-node-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .invite-quota {
    grid-template-columns: 1fr;
  }

  .split-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-mid {
    order: 3;
    width: 100%;
  }

  .nav-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .user-meta {
    display: none;
  }

  .promise-grid {
    grid-template-columns: 1fr;
  }

  .console-shell {
    grid-template-columns: 1fr;
  }

  .console-side {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
  }

  .console-side button {
    width: auto;
    white-space: nowrap;
  }
}
