/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --fg:        #1d1d1f;
  --fg-2:      #6e6e73;
  --fg-3:      #86868b;
  --fg-4:      #a1a1a6;
  --card-bg:   rgba(255,255,255,0.72);
  --card-solid:#ffffff;
  --card-border: rgba(255,255,255,0.65);
  --divider:   rgba(0,0,0,0.07);
  --green:     #34c759;
  --orange:    #ff9500;
  --red:       #ff3b30;
  --blue:      #0071e3;
  --shadow:    0 24px 80px -20px rgba(0,0,0,0.18),
               0 8px 24px -12px rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --radius:    28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  /* Legacy aliases for existing JS */
  --primary:   #0071e3;
  --primary-light: #42a1ff;
  --primary-dark: #0058b0;
  --text:      #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;
  --border:    rgba(0,0,0,0.07);
  --success:   #34c759;
  --warning:   #ff9500;
  --danger:    #ff3b30;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "SF Pro Text", "Helvetica Neue", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  color: var(--fg);
  background-color: #f5f5f7;
  background-image:
    radial-gradient(ellipse 60rem 40rem at 88% -8%, rgba(0, 113, 227, 0.07), transparent 60%),
    radial-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1.4px);
  background-size: 100% 100%, 22px 22px;
  background-position: 0 0, 0 0;
  background-attachment: fixed;
  background-repeat: no-repeat, repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.965); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

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

/* ===== Main Card (Apple glass) ===== */
.card {
  position: relative;
  z-index: 1;
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 40px 46px 34px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  animation: cardIn 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ===== Brand ===== */
.brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--fg);
  margin: 0;
  line-height: 1.2;
}

.brand-slug {
  font-size: 13px;
  color: var(--fg-3);
  margin: 8px 0 0;
  letter-spacing: 0.01em;
  font-weight: 400;
  line-height: 1.5;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: "SF Mono", ui-monospace, "Fira Code", "Courier New", monospace;
  color: var(--fg);
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,113,227,0.1);
}

.input-wrapper input::placeholder {
  color: var(--fg-4);
  font-family: -apple-system, "PingFang SC", sans-serif;
}

.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--fg);
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}

.text-input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,113,227,0.1);
}

.text-input::placeholder { color: var(--fg-4); }

.toggle-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--fg-3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.toggle-btn:hover {
  color: var(--blue);
  background: rgba(0,113,227,0.08);
}

.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.5;
}

/* ===== Platform Tabs ===== */
.platform-tabs {
  display: flex;
  gap: 8px;
}

.platform-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.4);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.2s;
}

.platform-tab .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-4);
  transition: background 0.2s;
}

.platform-tab:hover {
  border-color: rgba(0,113,227,0.3);
  color: var(--fg);
}

.platform-tab.active {
  border-color: var(--blue);
  background: rgba(0,113,227,0.06);
  color: var(--blue);
  font-weight: 600;
}

.platform-tab.active .dot { background: var(--blue); }

/* ===== Submit Button ===== */
.submit-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 980px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.2s, background 0.2s;
  margin-top: 4px;
}

.submit-btn:hover { background: #0062cc; }

.submit-btn:active { transform: scale(0.98); }

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-btn.small {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  margin-top: 0;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.submit-btn.loading .btn-text { opacity: 0.7; }
.submit-btn.loading .btn-spinner { display: block; }

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

/* ===== Error Message ===== */
.error-msg {
  margin-top: 14px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--red);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s, padding 0.3s;
}

.error-msg.show {
  max-height: 120px;
  padding: 10px 14px;
  background: rgba(255,59,48,0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,59,48,0.2);
}

.error-msg a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
}

/* ===== Admin Link ===== */
.admin-link-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 16px;
  background: rgba(0,113,227,0.04);
  border: 1px solid rgba(0,113,227,0.1);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg-2);
}

.admin-link-section svg { color: var(--blue); flex-shrink: 0; }

.admin-link-section a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  margin-left: auto;
  transition: opacity 0.2s;
}

.admin-link-section a:hover { opacity: 0.7; }

/* ===== Manual Section ===== */
.manual-section {
  margin-top: 20px;
  border-top: 1px solid var(--divider);
  padding-top: 16px;
}

.manual-section summary {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-3);
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.2s;
  user-select: none;
}

.manual-section summary:hover { color: var(--fg-2); }

.manual-form {
  margin-top: 16px;
}

/* ===== Footer ===== */
.foot {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--fg-4);
  letter-spacing: 0.02em;
  line-height: 1.6;
  z-index: 0;
  pointer-events: none;
}

/* ===== Result: Ring ===== */
.result-section { animation: fadeInUp 0.4s ease; }

.greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s ease;
}

.greeting-text {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.renew-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ff9500, #ff5e3a);
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(255, 94, 58, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.renew-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 94, 58, 0.45);
}

.renew-btn:active {
  transform: scale(0.97);
}

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

.head-l { min-width: 0; }

.head-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}

.head-id {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  flex-shrink: 0;
  padding: 6px 13px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active   { background: rgba(52,199,89,0.13);  color: var(--green); }
.badge-warn     { background: rgba(255,149,0,0.13);   color: var(--orange); }
.badge-danger   { background: rgba(239,68,68,0.13);   color: #ef4444; }
.badge-archived { background: rgba(142,142,147,0.16); color: var(--fg-2); }

.ring-stage {
  position: relative;
  width: 192px;
  height: 192px;
  margin: 0 auto 8px;
}

.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(0,0,0,0.06);
  stroke-width: 18;
}

.ring-bar {
  fill: none;
  stroke: var(--green);
  stroke-width: 18;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.16,1,0.3,1), stroke 0.4s ease;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ring-num {
  font-size: 58px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--fg);
  font-feature-settings: "tnum";
  display: flex;
  align-items: baseline;
}

.ring-num .sign {
  font-size: 26px;
  font-weight: 500;
  color: var(--fg-2);
  margin-left: 4px;
  letter-spacing: -0.02em;
}

.ring-cap {
  margin-top: 10px;
  font-size: 13px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

/* ===== Stats (3 columns) ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0 16px;
  padding: 16px 0;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}

.stat { text-align: center; padding: 0 8px; }
.stat + .stat { border-left: 1px solid var(--divider); }

.stat-v {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-feature-settings: "tnum";
  line-height: 1.2;
}

.stat-v .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-3);
  margin-left: 2px;
}

.stat-l {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

/* ===== Rate Limits (5h / weekly) ===== */
.rate-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-2);
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  line-height: 1.4;
}

.live-tag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.live-tag-on {
  color: var(--green);
  background: rgba(52, 199, 89, 0.12);
}
.live-tag-on::before {
  background: var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.live-tag-off {
  color: var(--fg-3);
  background: rgba(0,0,0,0.05);
}
.live-tag-off::before {
  background: var(--fg-3);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.rate-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 26px;
  margin: 0 0 16px;
  padding: 14px 18px;
  background: rgba(0,0,0,0.03);
  border-radius: var(--radius-md);
}

.rate-row { min-width: 0; }

.rate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.rate-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
}

.rate-pct {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}

.rate-track {
  height: 4px;
  border-radius: 980px;
  background: rgba(0,0,0,0.07);
  overflow: hidden;
}

.rate-fill {
  height: 100%;
  width: 0;
  border-radius: 980px;
  transition: width 1.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.rate-reset {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--fg-3);
  letter-spacing: 0.01em;
  font-feature-settings: "tnum";
}

/* ===== Time Row ===== */
.time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(0,0,0,0.03);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 14px;
}

.time-row .label {
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

.time-row .value {
  color: var(--fg);
  font-weight: 600;
  font-feature-settings: "tnum";
}

.time-row .value.warn { color: var(--orange); }
.time-row .value.danger { color: var(--red); }

/* ===== Balance Row ===== */
.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(0,113,227,0.04);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 14px;
}

.balance-row .label {
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

.balance-row .value {
  color: var(--blue);
  font-weight: 700;
  font-feature-settings: "tnum";
  font-size: 16px;
}

/* ===== Current Key Cost Card ===== */
.key-cost-card {
  padding: 14px 18px;
  background: rgba(255,59,48,0.04);
  border: 1px solid rgba(255,59,48,0.12);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.key-cost-card.no-cost {
  background: rgba(52,199,89,0.04);
  border-color: rgba(52,199,89,0.12);
}

.key-cost-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.key-cost-title {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
}

.key-cost-value {
  font-size: 24px;
  font-weight: 700;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
}

.key-cost-value.has-cost { color: var(--red); }
.key-cost-value.no-cost-val { color: var(--green); }

.key-cost-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.key-cost-item {
  text-align: center;
}

.key-cost-item-label {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
  margin-bottom: 2px;
}

.key-cost-item-value {
  font-size: 13px;
  font-weight: 600;
  font-feature-settings: "tnum";
  color: var(--fg);
}

/* ===== Result Footer ===== */
.result-foot {
  text-align: center;
  font-size: 12px;
  color: var(--fg-4);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.result-foot .detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  background: rgba(0,113,227,0.08);
  border-radius: 980px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-top: 8px;
  border: none;
}

.result-foot .detail-toggle:hover { background: rgba(0,113,227,0.15); }
.result-foot .detail-toggle:active { transform: scale(0.97); }

/* ===== FAB Group (右上角按钮组) ===== */
.fab-group {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
  display: flex;
  gap: 10px;
}

.fab-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  transition: color 0.2s, transform 0.15s, background 0.2s;
}

.fab-btn:hover { color: var(--blue); }
.fab-btn:active { transform: scale(0.94); }

.fab-btn.refreshing svg {
  animation: spin 0.8s linear infinite;
}

/* Legacy: keep for backward compat */
.reset-fab {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  transition: color 0.2s, transform 0.15s;
}

.reset-fab:hover { color: var(--blue); }
.reset-fab:active { transform: scale(0.94); }

/* ===== Detail Panel (Side) ===== */
.detail-panel {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 5;
  width: 430px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: cardIn 0.6s cubic-bezier(0.16,1,0.3,1) both;
  animation-delay: 0.1s;
}

.detail-panel-header {
  padding: 22px 22px 0;
  border-bottom: 1px solid var(--divider);
}

.detail-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  padding-bottom: 14px;
}

.detail-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  cursor: pointer;
  transition: all 0.2s;
}

.detail-tab:hover {
  color: var(--fg);
  background: rgba(0,0,0,0.03);
}

.detail-tab.active {
  background: var(--blue);
  color: #fff;
}

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 20px;
}

.detail-content { display: none; animation: fadeInUp 0.3s ease; }
.detail-content.active { display: block; }

/* ===== Overview mini cards ===== */
.mini-card {
  padding: 14px 16px;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.mini-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mini-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
}

.mini-card-value {
  font-size: 20px;
  font-weight: 700;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  color: var(--fg);
}

.mini-card-sub {
  font-size: 11px;
  color: var(--fg-3);
}

/* ===== Billing table ===== */
.billing-table-wrap {
  overflow-x: auto;
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.billing-table thead th {
  text-align: right;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

.billing-table thead th:first-child { text-align: left; }

.billing-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  text-align: right;
  white-space: nowrap;
  color: var(--fg);
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
}

.billing-table tbody td.billing-key-cell {
  text-align: left;
}

.billing-table tbody tr.has-cost {
  background: rgba(255,59,48,0.02);
}

.billing-key-id { color: var(--blue); font-weight: 500; }
.billing-key-null { color: var(--fg-4); font-style: italic; }
.billing-amount.due { color: var(--red); font-weight: 700; }

.billing-table tfoot th {
  padding: 8px 10px;
  text-align: right;
  border-top: 1px solid var(--divider);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  font-family: "SF Mono", ui-monospace, monospace;
}

.billing-table tfoot th:first-child { text-align: left; }

/* ===== Monthly / Detail KV ===== */
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.data-row:last-child { border-bottom: none; }

.data-label {
  font-size: 12px;
  color: var(--fg-2);
}

.data-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  font-family: "SF Mono", ui-monospace, monospace;
}

/* ===== Raw JSON ===== */
.raw-block {
  background: #1e293b;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.raw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.raw-endpoint {
  font-size: 11px;
  font-family: "SF Mono", ui-monospace, monospace;
  color: #93c5fd;
  word-break: break-all;
}

.raw-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.raw-status.ok { background: rgba(52,199,89,0.2); color: #6ee7b7; }
.raw-status.err { background: rgba(255,59,48,0.2); color: #fca5a5; }

.raw-pre {
  padding: 12px;
  margin: 0;
  font-size: 11px;
  font-family: "SF Mono", ui-monospace, monospace;
  color: #e2e8f0;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ===== Info Banner ===== */
.info-banner {
  padding: 12px 14px;
  background: rgba(0,113,227,0.06);
  border: 1px solid rgba(0,113,227,0.1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.5;
}

/* ===== Responsive ===== */
@media (max-width: 880px) {
  body { justify-content: flex-start; padding: 20px 14px 60px; }
  .card { padding: 30px 24px 26px; border-radius: 24px; }
  .brand { margin-bottom: 22px; }
  .brand-title { font-size: 24px; }
  .detail-panel {
    position: static;
    width: 100%;
    max-width: 510px;
    margin: 14px auto 0;
    max-height: none;
  }
  .reset-fab { top: 16px; right: 16px; }
  .fab-group { top: 16px; right: 16px; }
}

@media (max-width: 480px) {
  .card { padding: 24px 20px 22px; }
  .head-id { font-size: 15px; }
  .ring-stage { width: 168px; height: 168px; }
  .ring-num { font-size: 48px; }
  .ring-num .sign { font-size: 22px; }
  .stat-v { font-size: 18px; }
  .rate-block { grid-template-columns: 1fr; gap: 12px; padding: 12px 14px; }
  .platform-tabs { flex-direction: column; }
  .key-cost-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .card, .detail-panel { animation: none; }
  .ring-bar { transition: none; }
}

/* ===== Member-only: Loading & Error states ===== */
.spinner-large {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0,113,227,0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.query-loading {
  text-align: center;
  padding: 32px 0;
  color: var(--fg-3);
  font-size: 14px;
}

.error-display {
  text-align: center;
  padding: 24px 16px;
}

.error-display .err-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(255,59,48,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  font-size: 28px;
  font-weight: 300;
}

.error-display h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}

.error-display p {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.5;
}
