:root {
  --bg-canvas: #f5f5f7;
  --bg-sheet: #ffffff;
  --bg-well: #ebebf0;
  --bg-well-hover: #e2e2e8;
  --bg-glass: rgba(245, 245, 247, 0.78);
  --bg-tooltip: rgba(255, 255, 255, 0.94);
  --border-hairline: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.04);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  --accent-gemini: #0071e3;
  --accent-gemini-soft: rgba(0, 113, 227, 0.42);
  --accent-gemini-deep: #0051a8;
  --accent-claude: #ff9500;
  --accent-claude-soft: rgba(255, 149, 0, 0.42);
  --accent-claude-deep: #c96f00;
  --accent-green: #34c759;

  --track-ring: rgba(0, 0, 0, 0.07);
  --grid-line: rgba(0, 0, 0, 0.06);

  --radius-sheet: 20px;
  --radius-inner: 14px;
  --radius-pill: 999px;
}

[data-theme="dark"] {
  --bg-canvas: #000000;
  --bg-sheet: #1c1c1e;
  --bg-well: #2c2c2e;
  --bg-well-hover: #3a3a3c;
  --bg-glass: rgba(28, 28, 30, 0.78);
  --bg-tooltip: rgba(44, 44, 46, 0.94);
  --border-hairline: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);

  --text-primary: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #636366;

  --accent-gemini: #0a84ff;
  --accent-gemini-soft: rgba(10, 132, 255, 0.48);
  --accent-gemini-deep: #409cff;
  --accent-claude: #ff9f0a;
  --accent-claude-soft: rgba(255, 159, 10, 0.48);
  --accent-claude-deep: #ffb340;
  --accent-green: #30d158;

  --track-ring: rgba(255, 255, 255, 0.1);
  --grid-line: rgba(255, 255, 255, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.num {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent-gemini);
  outline-offset: 2px;
}

/* Top Frosted Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-hairline);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-sheet);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dot-gemini {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-gemini);
  display: inline-block;
  flex-shrink: 0;
}

.dot-claude {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-claude);
  display: inline-block;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.plan-pill {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-well);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(52, 199, 89, 0.12);
  color: var(--accent-green);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.sync-pill.is-snapshot {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent-gemini);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Apple Segmented Control */
.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-well);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: var(--bg-sheet);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: var(--bg-sheet);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.icon-btn:hover {
  background: var(--bg-well);
}

.icon-btn.spinning svg {
  animation: spin 0.7s linear infinite;
}

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

.pill-btn {
  border: 1px solid var(--border-hairline);
  background: var(--bg-sheet);
  color: var(--text-primary);
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  background: var(--bg-well);
}

.pill-btn-primary {
  background: var(--accent-gemini);
  border-color: transparent;
  color: #ffffff;
}

.pill-btn-primary:hover {
  background: var(--accent-gemini);
  opacity: 0.9;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--accent-gemini);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.text-btn:hover {
  background: var(--bg-well);
}

/* Main Container */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Online Snapshot Hint Banner */
.hint-banner {
  background: var(--bg-sheet);
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 13px 18px;
  box-shadow: var(--shadow-sheet);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hint-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.hint-banner-text strong {
  color: var(--text-primary);
  font-size: 13px;
}

.hint-banner-text code {
  background: var(--bg-well);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-primary);
}

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

.sheet {
  background: var(--bg-sheet);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-sheet);
  padding: 26px 28px;
}

/* Hero Sheet */
.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.subtle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.status-auto {
  background: rgba(52, 199, 89, 0.14);
  color: var(--accent-green);
}

.hero-number-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-number {
  font-size: clamp(38px, 5vw, 54px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.hero-unit {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hero-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.hero-secondary {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}

.stat-pair {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-val {
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Storage Bar */
.storage-block {
  margin-top: 22px;
}

.storage-bar-wrap {
  width: 100%;
}

.storage-legend {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.swatch-gemini {
  background: var(--accent-gemini);
}

.swatch-claude {
  background: var(--accent-claude);
}

.legend-name {
  color: var(--text-secondary);
}

.legend-val {
  font-weight: 600;
  color: var(--text-primary);
}

.legend-note {
  font-size: 12.5px;
  color: var(--text-tertiary);
}

/* Hero Footer Strip */
.hero-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-metrics {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.footer-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-k {
  font-size: 12px;
  color: var(--text-tertiary);
}

.metric-v {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Provider Grid */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

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

.provider-title {
  display: flex;
  align-items: center;
  gap: 11px;
}

.provider-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.provider-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.provider-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.ring-slot {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.provider-main-num {
  margin-top: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.provider-big {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.provider-cost {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.breakdown-bars {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.micro-row {
  display: grid;
  grid-template-columns: 64px 1fr 78px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.micro-label {
  color: var(--text-secondary);
}

.micro-track {
  height: 7px;
  background: var(--bg-well);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.micro-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.fill-gemini {
  background: var(--accent-gemini);
}
.fill-gemini-soft {
  background: var(--accent-gemini-soft);
}
.fill-gemini-deep {
  background: var(--accent-gemini-deep);
}
.fill-claude {
  background: var(--accent-claude);
}
.fill-claude-soft {
  background: var(--accent-claude-soft);
}
.fill-claude-deep {
  background: var(--accent-claude-deep);
}

.micro-num {
  text-align: right;
  font-weight: 500;
  color: var(--text-primary);
}

.provider-meta-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Chart Sheet */
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.sheet-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.chart-legend-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.inline-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-key i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}

.trend-chart-wrap {
  width: 100%;
  min-height: 230px;
}

/* Inset Lists */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.inset-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  border-radius: var(--radius-inner);
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-sheet);
}

.list-row + .list-row {
  border-top: 1px solid var(--border-hairline);
}

.list-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.list-badge {
  width: 8px;
  height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
}

.badge-gemini {
  background: var(--accent-gemini);
}

.badge-claude {
  background: var(--accent-claude);
}

.badge-other {
  background: var(--text-tertiary);
}

.list-titles {
  min-width: 0;
}

.list-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-right {
  text-align: right;
  flex-shrink: 0;
}

.list-val {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
}

.list-subval {
  font-size: 12px;
  color: var(--text-secondary);
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Footer */
.page-footer {
  padding: 6px 4px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.55;
}

.page-footer p {
  margin: 0;
}

/* Drag & Drop Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 113, 227, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.drop-card {
  background: var(--bg-sheet);
  border: 2px dashed var(--accent-gemini);
  border-radius: 22px;
  padding: 32px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
}

.drop-card strong {
  font-size: 17px;
}

.drop-card span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Frosted Tooltip */
.chart-tooltip {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  background: var(--bg-tooltip);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  padding: 10px 13px;
  font-size: 12.5px;
  color: var(--text-primary);
  min-width: 170px;
}

.tt-title {
  font-weight: 650;
  margin-bottom: 5px;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.5;
}

.tt-row span:first-child {
  color: var(--text-secondary);
}

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

@media (max-width: 640px) {
  .topbar-inner {
    padding: 12px 16px;
  }
  .container {
    padding: 16px 16px 40px;
  }
  .sheet {
    padding: 18px;
  }
  .hero-secondary {
    gap: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
