html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.16);
}

:root {
  --page-bg: #f8fafc;
  --card-bg: #ffffff;
  --subtle-bg: #f8fafc;
  --border-color: #e2e8f0;
  --heading-color: #0f172a;
  --body-color: #334155;
  --muted-color: #64748b;
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #eef2ff;
  --success-color: #047857;
  --success-bg: #ecfdf5;
  --warning-color: #b45309;
  --warning-bg: #fffbeb;
  --danger-color: #be123c;
  --danger-bg: #fff1f2;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.035), transparent 28rem),
    var(--page-bg);
  color: var(--body-color);
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stealth-navigation {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  border-radius: 50%;
  background: var(--primary-color);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.04);
  opacity: 0.14;
  transition: box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.stealth-navigation:hover,
.stealth-navigation:focus-visible {
  background: var(--primary-color);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.1);
  opacity: 0.8;
  outline: none;
  transform: scale(1.2);
}

.dashboard-container {
  max-width: 1480px;
  padding: 2.5rem 2rem 1.5rem;
}

.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.75rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--primary-color);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.dashboard-heading h1 {
  margin: 0;
  color: var(--heading-color);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.dashboard-description {
  max-width: 760px;
  margin: 0.5rem 0 0;
  color: var(--muted-color);
  font-size: 0.88rem;
  line-height: 1.65;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.refresh-hint {
  color: var(--muted-color);
  font-size: 0.76rem;
}

.btn {
  min-height: 38px;
  padding: 0.48rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.btn-primary {
  border-color: var(--primary-color);
  background: var(--primary-color);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.18);
}

.btn-primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.btn-dark {
  border-color: var(--heading-color);
  background: var(--heading-color);
}

.btn-outline-secondary {
  border-color: var(--border-color);
  background: #fff;
  color: #475569;
}

.btn-outline-secondary:hover {
  border-color: #cbd5e1;
  background: var(--subtle-bg);
  color: var(--heading-color);
}

.status-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: var(--warning-bg);
  color: #92400e;
  font-size: 0.8rem;
}

.status-alert small {
  flex-basis: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.summary-card {
  min-height: 118px;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025);
}

.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted-color);
}

.summary-card span {
  font-size: 0.76rem;
  font-weight: 600;
}

.summary-card strong {
  display: block;
  margin: 0.5rem 0 0.3rem;
  color: var(--heading-color);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.summary-card small {
  font-size: 0.68rem;
}

.summary-card-primary {
  border-color: #c7d2fe;
  background: var(--primary-soft);
}

.summary-card-primary span,
.summary-card-primary small {
  color: #6366f1;
}

.summary-card-primary strong {
  color: #4338ca;
}

.pricing-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ranking-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ranking-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ranking-filter-heading h2 {
  margin: 0 0 0.25rem;
  color: var(--heading-color);
  font-size: 0.92rem;
  font-weight: 700;
}

.ranking-filter-heading span {
  color: var(--muted-color);
  font-size: 0.74rem;
}

.ranking-periods {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ranking-panel {
  overflow: hidden;
}

.ranking-table th:first-child,
.ranking-table td:first-child {
  width: 80px;
  text-align: center;
}

.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3) {
  width: 180px;
}

.ranking-table th:nth-child(4),
.ranking-table td:nth-child(4),
.ranking-table th:nth-child(5),
.ranking-table td:nth-child(5) {
  width: 160px;
}

.ranking-user {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.ranking-user strong {
  color: var(--heading-color);
  font-size: 0.82rem;
}

.ranking-user small,
.ranking-unit {
  color: var(--muted-color);
  font-size: 0.68rem;
}

.ranking-cost {
  color: var(--primary-dark);
  font-size: 0.9rem;
}

.ranking-unit {
  display: block;
  margin-top: 0.18rem;
}

.ranking-rank {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
}

.ranking-rank-1 {
  background: #fef3c7;
  color: #b45309;
}

.ranking-rank-2 {
  background: #e2e8f0;
  color: #475569;
}

.ranking-rank-3 {
  background: #ffedd5;
  color: #c2410c;
}

.pricing-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #c7d2fe;
  border-radius: 9px;
  background: var(--primary-soft);
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.65;
}

.pricing-notice strong {
  flex: 0 0 auto;
  color: var(--primary-dark);
}

.pricing-group-form {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto minmax(240px, auto);
  align-items: end;
  gap: 0.9rem;
}

.pricing-group-panel,
.pricing-notice,
.pricing-panel {
  font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

.pricing-group-form > .btn {
  min-height: 40px;
}

.pricing-group-current {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  color: #535d70;
  font-size: 0.8rem;
}

.pricing-group-current strong {
  overflow: hidden;
  color: var(--heading-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pricingAsyncRoot {
  min-height: 320px;
}

.pricing-loading-panel {
  min-height: 320px;
}

.pricing-loading-indicator {
  width: 24px;
  height: 24px;
  margin-bottom: 0.45rem;
  border: 2px solid #c7d2fe;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: pricing-loading-spin 0.8s linear infinite;
}

@keyframes pricing-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.filter-panel,
.accounts-panel {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.filter-panel {
  margin-bottom: 1rem;
  padding: 1rem;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) repeat(2, minmax(150px, 0.8fr)) minmax(100px, 0.45fr) auto;
  align-items: end;
  gap: 0.9rem;
}

.filter-field label {
  display: block;
  margin-bottom: 0.4rem;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
}

.filter-field .form-control,
.filter-field .form-select {
  min-height: 38px;
  border-color: var(--border-color);
  border-radius: 8px;
  background-color: #fff;
  color: var(--heading-color);
  font-size: 0.82rem;
}

.filter-field .form-control::placeholder {
  color: #94a3b8;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
}

.filter-buttons .btn {
  min-height: 40px;
  padding-inline: 1rem;
}

.accounts-panel {
  overflow: hidden;
}

.accounts-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
}

.accounts-panel-heading > div {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.accounts-panel-heading h2 {
  margin: 0;
  color: var(--heading-color);
  font-size: 0.95rem;
  font-weight: 650;
}

.accounts-panel-heading span {
  color: var(--muted-color);
  font-size: 0.72rem;
}

.accounts-table {
  min-width: 980px;
  margin: 0;
}

.accounts-table thead th {
  padding: 0.7rem 1rem;
  border-bottom-color: var(--border-color);
  background: var(--subtle-bg);
  color: #64748b;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  text-transform: none;
  white-space: nowrap;
}

.accounts-table tbody td {
  padding: 0.82rem 1rem;
  border-bottom-color: #f1f5f9;
  color: var(--body-color);
  font-size: 0.78rem;
}

.accounts-table tbody tr:last-child td {
  border-bottom: 0;
}

.accounts-table tbody tr:hover td {
  background: #f8fafc;
}

.pricing-table {
  min-width: 1540px;
}

.pricing-table thead th {
  font-size: 0.7rem;
  line-height: 1.4;
}

.pricing-table tbody td {
  padding-block: 0.78rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.model-name {
  display: block;
  max-width: 280px;
  overflow: hidden;
  color: var(--heading-color);
  font-family: "Cascadia Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-chip,
.billing-mode {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.48rem;
  border-radius: 6px;
  background: var(--primary-soft);
  color: #4f46e5;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: capitalize;
}

.platform-chip-openai {
  background: var(--success-bg);
  color: var(--success-color);
}

.platform-chip-anthropic {
  background: #f6eee7;
  color: #986446;
}

.platform-chip-grok {
  background: #eaecef;
  color: #303746;
}

.platform-chip-kimi,
.platform-chip-zhipu,
.platform-chip-deepseek {
  background: #f0effc;
  color: #6752bc;
}

.billing-mode {
  background: #f0effc;
  color: #6752bc;
  text-transform: none;
}

.channel-name {
  color: #535d70;
  font-size: 0.78rem;
}

.price-value,
.price-cny,
.price-unit {
  display: block;
  white-space: nowrap;
}

.price-value {
  color: var(--heading-color);
  font-family: "Cascadia Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.price-cny {
  margin-top: 0.16rem;
  color: var(--success-color);
  font-size: 0.68rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.price-unit {
  margin-top: 0.14rem;
  color: #94a3b8;
  font-size: 0.66rem;
  line-height: 1.4;
}

.time-pricing-cell {
  min-width: 210px;
}

.time-pricing-meta,
.time-pricing-period,
.time-pricing-default,
.time-pricing-none {
  display: block;
  white-space: nowrap;
}

.time-pricing-meta {
  margin-bottom: 0.3rem;
  color: #64748b;
  font-size: 0.66rem;
  line-height: 1.4;
}

.time-pricing-period {
  margin-top: 0.22rem;
  color: var(--warning-color);
  font-size: 0.69rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.time-pricing-period strong {
  display: inline-block;
  margin-right: 0.28rem;
  padding: 0.08rem 0.3rem;
  border-radius: 5px;
  background: var(--warning-bg);
  color: var(--warning-color);
  font-size: 0.62rem;
}

.time-pricing-default,
.time-pricing-none {
  margin-top: 0.28rem;
  color: var(--success-color);
  font-size: 0.66rem;
  line-height: 1.4;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.account-identity > div {
  min-width: 0;
}

.account-identity strong,
.account-identity small {
  display: block;
}

.account-identity strong {
  max-width: 280px;
  overflow: hidden;
  color: var(--heading-color);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity small {
  margin-top: 0.15rem;
  color: #969dab;
  font-size: 0.7rem;
}

.platform-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.64rem;
  font-weight: 700;
}

.platform-openai {
  background: #e9f8f1;
  color: #168a62;
}

.platform-anthropic {
  background: #f6eee7;
  color: #986446;
}

.platform-gemini,
.platform-antigravity {
  background: #edf2ff;
  color: #4b68c8;
}

.platform-grok {
  background: #eaecef;
  color: #303746;
}

.platform-name {
  color: var(--heading-color);
  font-size: 0.8rem;
  text-transform: capitalize;
}

.status-badge,
.runtime-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-available,
.runtime-normal {
  background: var(--success-bg);
  color: var(--success-color);
}

.status-unavailable,
.runtime-error {
  background: var(--danger-bg);
  color: var(--danger-color);
}

.runtime-warning {
  background: var(--warning-bg);
  color: var(--warning-color);
}

.runtime-muted {
  background: #f1f5f9;
  color: #64748b;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.concurrency-value strong {
  color: var(--heading-color);
  font-size: 0.9rem;
}

.concurrency-value span {
  color: #8b93a3;
  font-size: 0.72rem;
}

.concurrency-progress {
  width: 82px;
  height: 4px;
  margin-top: 0.38rem;
  background: #edf0f5;
}

.concurrency-progress .progress-bar {
  border-radius: 999px;
  background: var(--primary-color);
}

.error-message {
  display: block;
  max-width: 210px;
  margin-top: 0.38rem;
  overflow: hidden;
  color: var(--danger-color);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: flex;
  min-height: 240px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--muted-color);
}

.empty-state strong {
  color: var(--heading-color);
  font-size: 0.92rem;
}

.empty-state span {
  color: #94a3b8;
  font-size: 0.76rem;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--muted-color);
  font-size: 0.76rem;
}

.pagination-bar .btn {
  font-size: 0.76rem;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pricing-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ranking-filter-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pricing-group-form {
    grid-template-columns: minmax(260px, 1fr) auto;
  }

  .pricing-group-current {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .filter-buttons {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767px) {
  .dashboard-container {
    padding: 1.5rem 0.75rem 1rem;
  }

  .dashboard-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
  }

  .dashboard-actions {
    width: 100%;
    justify-content: space-between;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card {
    min-height: 108px;
    padding: 1rem;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .pricing-group-form {
    grid-template-columns: 1fr;
  }

  .pricing-group-current {
    grid-column: auto;
  }

  .filter-buttons {
    grid-column: auto;
  }

  .filter-buttons .btn {
    flex: 1;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .pricing-notice {
    flex-direction: column;
  }

  .ranking-periods {
    width: 100%;
  }

  .ranking-periods .btn {
    flex: 1;
  }

  .accounts-panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .accounts-panel-heading > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .stealth-navigation {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 430px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}