.tokens-page { max-width: 1280px; }

.tokens-stats-host {
  margin-bottom: 24px;
  max-width: 1280px;
}

.tokens-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 380px);
  gap: 16px;
  align-items: start;
}

.tokens-main { min-width: 0; }

.tokens-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
  align-self: start;
  min-width: 0;
}

.tokens-guide-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 16px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
}

.tokens-stats-host.hidden {
  display: none;
}

.tokens-stats-banner {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 16px;
  width: 100%;
  margin-bottom: 0;
  padding: 18px 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tokens-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 13px;
}
.tokens-stat em {
  font-style: normal;
  color: var(--text-muted);
  font-size: 12px;
}
.tokens-stat strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary, #ea7a00);
  line-height: 1.2;
}

.tokens-unified-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.tokens-guide-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 12px;
}
.tokens-guide-auth,
.tokens-guide-endpoints {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-sub);
}
.tokens-guide-auth { margin-bottom: 12px; }
.tokens-guide-lead {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--text-main);
}
.tokens-guide-auth p { margin: 0 0 8px; }
.tokens-auth-pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}
.tokens-auth-pre code { font-size: 12px; }
.tokens-api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tokens-api-table th,
.tokens-api-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}
.tokens-api-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
}
.tokens-api-table tr:last-child td { border-bottom: none; }
.tokens-api-table code {
  font-size: 11px;
  background: #fafafa;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  word-break: break-all;
}
.tokens-method {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.tokens-code-tabs {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
}
.tokens-code-tablist {
  display: flex;
  gap: 0;
  padding: 4px;
  background: #f3f4f6;
  border-bottom: 1px solid var(--border);
}
.tokens-code-tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tokens-code-tab.is-active {
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.tokens-code-panels { padding: 0; }
.tokens-code-panel {
  display: none;
  padding: 10px;
}
.tokens-code-panel.is-active { display: block; }
.tokens-code-panel pre {
  margin: 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}
.tokens-code-panel code {
  font-size: 11px;
  line-height: 1.55;
  white-space: pre;
}
.tokens-guide-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.tokens-packages-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tokens-packages-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.tokens-packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.tokens-package-desc,
.tokens-package-unit {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.tokens-package-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px 14px;
  background: #fafafa;
  overflow: hidden;
}
.tokens-package-card.is-recommended {
  background: #fff;
  border-color: rgba(234,122,0,0.45);
  box-shadow: 0 0 0 3px rgba(234,122,0,0.08);
}
.tokens-package-ribbon {
  position: absolute;
  top: 10px;
  right: -28px;
  width: 96px;
  text-align: center;
  background: var(--primary, #ea7a00);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 0;
  transform: rotate(35deg);
}
.tokens-package-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.tokens-package-head strong { font-size: 14px; padding-right: 24px; }
.tokens-package-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary, #ea7a00);
}
.tokens-package-meta {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.tokens-package-buy { width: 100%; margin-top: 4px; }
.tokens-package-buy.is-ghost {
  background: #fff;
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.tokens-package-buy.is-ghost:hover {
  background: var(--primary-soft, #fff7ed);
  color: var(--primary, #ea7a00);
  border-color: rgba(234,122,0,0.35);
}
.tokens-package-buy:disabled { opacity: 0.55; cursor: not-allowed; }

.pay-modal-content { max-width: 400px; }
.pay-modal-body { text-align: center; padding: 20px 24px 24px; }
.pay-modal-desc { margin: 0 0 16px; font-size: 14px; color: var(--text-sub); }

.pay-provider-body { padding: 8px 20px 24px; }
.pay-provider-options {
  display: flex;
  flex-direction: row;
  gap: 12px;
}
.pay-provider-option {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding: 18px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.pay-provider-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft, #fff7ed);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}
.pay-provider-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.pay-provider-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.pay-provider-text strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}
.pay-provider-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-muted);
}
.pay-qr-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  min-width: 224px;
  min-height: 224px;
}
.pay-qr-box {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pay-qr-box #pay-qr-img {
  display: block;
  width: 200px;
  height: 200px;
}
.pay-qr-brand {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  padding: 5px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 8px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  box-shadow: 0 0 0 3px #fff;
}
.pay-qr-brand.hidden { display: none; }
.pay-qr-frame {
  width: 200px;
  height: 200px;
  border: 0;
  overflow: hidden;
  background: #fff;
}
.pay-qr-frame.hidden,
#pay-qr-img.hidden {
  display: none;
}
.pay-modal-status { margin: 14px 0 0; font-size: 13px; color: var(--text-muted); }
.pay-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.pay-modal-actions .primary-btn {
  min-width: 160px;
}

.tokens-manage-section {
  margin-bottom: 8px;
  padding-bottom: 8px;
}
.tokens-manage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.tokens-manage-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.tokens-table { display: flex; flex-direction: column; gap: 0; }
.tokens-empty { padding: 20px 0; }
.tokens-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.tokens-row:last-child { border-bottom: none; }
.tokens-row-name {
  font-weight: 700;
  font-size: 14px;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tokens-row-value {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tokens-value-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  background: #f8f8f8;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}
.token-icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
}
.token-icon-btn:hover { background: var(--primary-soft, #fff7ed); color: var(--primary, #ea7a00); border-color: rgba(234,122,0,0.3); }
.token-icon-btn .icon { width: 16px; height: 16px; }
.token-copy-icon { width: 16px; height: 16px; }
.token-delete-btn:hover { color: var(--red, #dc2626); background: #fef2f2; border-color: #fecaca; }
.tokens-rename-input {
  width: 100%;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--primary, #ea7a00);
  border-radius: 6px;
  padding: 4px 8px;
}

.tokens-logs-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.tokens-logs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tokens-logs-head h3 { font-size: 15px; font-weight: 800; margin: 0; }
.tokens-logs-filters { display: flex; align-items: center; gap: 8px; }
.tokens-logs-filters input[type="date"] {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}
.tokens-logs-table { display: flex; flex-direction: column; }
.tokens-log-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.2fr) minmax(100px, 140px) 70px 90px;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.tokens-log-row:last-child { border-bottom: none; }
.tokens-log-row.head { font-weight: 700; color: var(--text-muted); font-size: 12px; }
.tokens-log-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tokens-logs-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tokens-logs-page-info { font-size: 12px; color: var(--text-muted); }

@media (max-width: 1020px) {
  .tokens-page-layout { grid-template-columns: 1fr; }
  .tokens-sidebar { position: static; }
  .tokens-packages-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tokens-stats-banner { flex-direction: column; align-items: stretch; }
  .tokens-stat { flex-direction: row; justify-content: space-between; align-items: baseline; }
  .tokens-stat strong { font-size: 18px; }
  .tokens-row { grid-template-columns: 1fr; gap: 8px; }
  .tokens-log-row { grid-template-columns: 1fr 1fr; }
  .tokens-log-row.head { display: none; }
}
