:root {
  color-scheme: dark;
  --bg: #08111d;
  --panel: rgba(19, 31, 47, 0.9);
  --panel-2: rgba(16, 26, 40, 0.96);
  --line: rgba(151, 174, 205, 0.18);
  --line-strong: rgba(163, 188, 224, 0.29);
  --text: #f2f6ff;
  --muted: #96a4b8;
  --blue: #2e83ff;
  --cyan: #2dd4cf;
  --violet: #9b5cf6;
  --green: #2ed06e;
  --orange: #ff9a31;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 760px;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.055), transparent 18%, rgba(255, 255, 255, 0.035) 31%, transparent 48%),
    radial-gradient(ellipse at 28% 14%, rgba(46, 131, 255, 0.16), transparent 28%),
    radial-gradient(ellipse at 72% 22%, rgba(45, 212, 207, 0.1), transparent 26%),
    linear-gradient(135deg, #070d17 0%, #0a1422 48%, #07111d 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  background: rgba(8, 17, 29, 0.9);
}

.sidebar {
  position: relative;
  padding: 22px 0;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(14, 28, 48, 0.98), rgba(8, 17, 29, 0.98)),
    radial-gradient(circle at 0 0, rgba(46, 131, 255, 0.18), transparent 38%);
}

.traffic-lights {
  display: flex;
  gap: 12px;
  padding: 12px 24px 30px;
}

.traffic {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.traffic.red { background: #ff5f57; }
.traffic.yellow { background: #ffbd2e; }
.traffic.green { background: #28c840; }

.nav-list {
  display: grid;
  gap: 8px;
  padding-left: 6px;
}

.nav-item {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  color: #c7d1df;
  font-size: 16px;
  font-weight: 650;
  background: transparent;
  border-left: 3px solid transparent;
  cursor: default;
}

.nav-item.active {
  color: #fff;
  border-left-color: var(--blue);
  background: linear-gradient(90deg, rgba(46, 131, 255, 0.56), rgba(46, 131, 255, 0.2));
  border-radius: 8px 8px 8px 0;
  box-shadow: inset 0 0 0 1px rgba(81, 143, 255, 0.2);
}

.side-status {
  position: absolute;
  left: 24px;
  right: 22px;
  bottom: 34px;
  display: grid;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.status-line.muted {
  color: #8593a7;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(46, 208, 110, 0.1);
}

.status-dot.loading {
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(255, 154, 49, 0.12);
}

.status-dot.error {
  background: #ff6363;
  box-shadow: 0 0 0 5px rgba(255, 99, 99, 0.12);
}

.main-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(9, 18, 31, 0.62), rgba(8, 17, 29, 0.84));
}

.topbar {
  position: relative;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px 0 92px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 17, 29, 0.52);
  backdrop-filter: blur(26px) saturate(1.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  -webkit-app-region: drag;
}

.brand,
.toolbar,
.toolbar-button,
.search-box,
.profile {
  display: flex;
  align-items: center;
}

.brand {
  gap: 13px;
  font-size: 20px;
  font-weight: 800;
}

.live-pill {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(46, 208, 110, 0.22);
  border-radius: 999px;
  color: #bcebd0;
  background: rgba(46, 208, 110, 0.09);
  font-size: 12px;
  font-weight: 700;
}

.live-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(46, 208, 110, 0.1);
}

.live-pill.loading {
  color: #ffd7a8;
  border-color: rgba(255, 154, 49, 0.25);
  background: rgba(255, 154, 49, 0.09);
}

.live-pill.loading i {
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(255, 154, 49, 0.1);
}

.live-pill.error {
  color: #ffc3c3;
  border-color: rgba(255, 99, 99, 0.25);
  background: rgba(255, 99, 99, 0.1);
}

.live-pill.error i {
  background: #ff6363;
  box-shadow: 0 0 0 5px rgba(255, 99, 99, 0.1);
}

.toolbar {
  gap: 14px;
  -webkit-app-region: no-drag;
}

.refresh-meta {
  display: grid;
  gap: 2px;
  min-width: 112px;
  color: #b9c5d6;
  font-size: 12px;
  line-height: 1.2;
}

.refresh-meta small {
  color: #7f8da3;
  font-size: 11px;
}

.toolbar-button,
.dropdown-trigger {
  height: 42px;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: #e9eef8;
  background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(13,24,38,0.68));
  backdrop-filter: blur(20px) saturate(1.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 14px 30px rgba(0, 0, 0, 0.16);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.toolbar-button.primary {
  background: linear-gradient(145deg, rgba(72, 93, 124, 0.68), rgba(28, 43, 63, 0.78));
}

.toolbar-button:hover,
.dropdown-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(179, 205, 239, 0.45);
}

.dropdown {
  position: relative;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  min-width: 104px;
  justify-content: center;
}

.toolbar-dropdown .dropdown-trigger {
  min-width: 138px;
}

.chevron {
  transition: transform 160ms ease;
}

.chevron.open {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 120;
  min-width: 132px;
  display: grid;
  gap: 4px;
  padding: 7px;
  border: 1px solid rgba(190, 215, 248, 0.24);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(30, 45, 66, 0.82), rgba(10, 20, 34, 0.78));
  backdrop-filter: blur(24px) saturate(1.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 22px 60px rgba(0, 0, 0, 0.34);
  animation: menuIn 140ms ease-out both;
}

.dropdown-menu button {
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  color: #d8e1ef;
  background: transparent;
  text-align: left;
}

.dropdown-menu button:hover,
.dropdown-menu button.selected {
  color: #fff;
  background: rgba(46, 131, 255, 0.2);
}

.profile {
  gap: 10px;
  padding: 0 4px;
  background: transparent;
}

.profile span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #7c4dff, #bc75ff);
  box-shadow: 0 8px 24px rgba(124, 77, 255, 0.32);
}

.dashboard {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 14px 18px;
  display: grid;
  grid-template-rows: 125px 295px minmax(0, 1fr);
  gap: 12px;
}

.dashboard::-webkit-scrollbar {
  width: 8px;
}

.dashboard::-webkit-scrollbar-thumb {
  background: rgba(151, 174, 205, 0.22);
  border-radius: 999px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.panel {
  position: relative;
  border: 1px solid rgba(180, 205, 240, 0.3);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.105), rgba(255,255,255,0.025) 38%, rgba(9,18,31,0.58)),
    linear-gradient(180deg, rgba(24, 38, 57, 0.76), rgba(13, 24, 38, 0.72));
  backdrop-filter: blur(28px) saturate(1.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 22px 60px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  animation: cardIn 460ms ease-out both;
}

.metric-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.16), transparent 18%, transparent 74%, rgba(255,255,255,0.06)),
    linear-gradient(270deg, transparent, rgba(255,255,255,0.045), transparent);
  opacity: 0.78;
}

.metric-card:hover,
.panel:hover {
  border-color: rgba(210, 230, 255, 0.42);
  transform: translateY(-1px);
  transition: transform 180ms ease, border-color 180ms ease;
}

.metric-card {
  display: grid;
  grid-template-columns: 66px 1fr;
  align-items: center;
  padding: 0 20px;
  min-width: 0;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.08);
  animation: floatGlow 3.8s ease-in-out infinite;
}

.metric-icon.blue { background: radial-gradient(circle at 35% 24%, #408dff, #123c88); }
.metric-icon.green { background: radial-gradient(circle at 35% 24%, #37d48b, #126545); }
.metric-icon.violet { background: radial-gradient(circle at 35% 24%, #a970ff, #42217b); }
.metric-icon.orange { background: radial-gradient(circle at 35% 24%, #e28b35, #6e3a0d); }

.metric-copy {
  min-width: 0;
}

.metric-label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #c3ccda;
  font-size: 14px;
  margin-bottom: 6px;
}

.metric-value {
  font-size: clamp(27px, 2.5vw, 33px);
  line-height: 1;
  font-weight: 820;
  margin-bottom: 10px;
  white-space: nowrap;
}

.metric-detail {
  display: flex;
  gap: 7px;
  color: #aab4c5;
  font-size: 14px;
}

.blue { color: var(--blue); }
.green { color: var(--green); }
.violet { color: var(--violet); }
.orange { color: var(--orange); }

.middle-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.bottom-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1.55fr 0.72fr;
  gap: 12px;
}

.panel {
  min-width: 0;
  min-height: 0;
  padding: 16px 22px;
  overflow: visible;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
  z-index: 25;
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.mini-select,
.table-title button,
.table-footer button {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #dce4ef;
  font-size: 13px;
  background: rgba(8, 17, 29, 0.35);
}

.trend-chart {
  width: 100%;
  height: calc(100% - 28px);
  min-height: 178px;
}

.grid-line {
  stroke: rgba(151, 174, 205, 0.14);
  stroke-width: 1;
}

.axis-label {
  fill: #93a0b3;
  font-size: 13px;
}

.trend-line {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: drawLine 900ms ease-out forwards;
}

.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 38px;
  color: #cdd6e4;
  font-size: 14px;
}

.legend span,
.legend-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend i,
.legend-name i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 0 10px color-mix(in srgb, currentColor 60%, transparent);
}

.share-body {
  height: calc(100% - 38px);
  display: grid;
  grid-template-columns: minmax(176px, 0.8fr) 1fr;
  align-items: center;
  gap: 18px;
}

.donut {
  width: min(185px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  justify-self: center;
  box-shadow: 0 0 34px rgba(46, 131, 255, 0.18);
  position: relative;
  animation: glassPulse 4.2s ease-in-out infinite;
}

.donut::before {
  content: "";
  position: absolute;
  width: 53%;
  height: 53%;
  border-radius: 50%;
  background: linear-gradient(145deg, #101f31, #0b1726);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.donut-center {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  text-align: center;
}

.donut-center strong {
  font-size: 25px;
}

.donut-center span {
  color: #a8b4c5;
  font-size: 14px;
}

.share-list {
  display: grid;
  gap: 17px;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 10px;
}

.share-row strong {
  font-size: 20px;
  text-align: right;
}

.share-row small {
  display: block;
  margin-left: 19px;
  margin-top: 2px;
  color: #9ca8ba;
}

.table-panel,
.insight-panel {
  padding: 0;
}

.table-title {
  height: 48px;
  margin: 0;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

th,
td {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  height: 40px;
  color: #9aa7b9;
  font-weight: 650;
  border-bottom: 1px solid var(--line);
}

td {
  height: 58px;
  color: #d4dce8;
  border-bottom: 1px solid rgba(151, 174, 205, 0.1);
}

th:first-child,
td:first-child {
  padding-left: 22px;
}

th:not(:first-child),
td:not(:first-child) {
  padding-left: 10px;
}

th:nth-child(1) { width: 150px; }
th:nth-child(6) { width: 92px; }
th:nth-child(7) { width: 38px; }

.provider-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #eef4ff;
  font-weight: 720;
}

.provider-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 850;
}

.provider-logo.claude {
  background: linear-gradient(135deg, #fb8947, #df5e2f);
}

.provider-logo.codex {
  background: #05070b;
  border: 1px solid rgba(255,255,255,0.14);
}

.provider-logo.gemini {
  background: conic-gradient(from 45deg, #3debd4, #395fff, #ffb34d, #3debd4);
}

.sparkline {
  width: 74px;
  height: 22px;
}

.sparkline polyline {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.more {
  color: #7e8aa0;
  font-size: 20px;
  text-align: center;
}

.table-footer {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  color: #9ba7b8;
  font-size: 14px;
}

.table-footer button,
.insight-panel .table-title button {
  color: #4b99ff;
  font-weight: 700;
  border: 0;
  background: transparent;
  padding: 0;
}

.insight-list {
  display: grid;
  gap: 7px;
  padding: 8px 10px 10px;
}

.insight {
  min-height: 62px;
  border: 1px solid rgba(151, 174, 205, 0.15);
  border-radius: 8px;
  padding: 9px 12px 9px 54px;
  position: relative;
  display: grid;
  gap: 4px;
  animation: slideIn 420ms ease-out both;
}

.insight.warn {
  background: linear-gradient(90deg, rgba(255, 154, 49, 0.13), rgba(255, 154, 49, 0.04));
  border-color: rgba(255,154,49,0.24);
}

.insight.good {
  background: linear-gradient(90deg, rgba(46, 208, 110, 0.13), rgba(46, 208, 110, 0.04));
  border-color: rgba(46,208,110,0.2);
}

.insight.spike,
.insight.info {
  background: linear-gradient(90deg, rgba(155, 92, 246, 0.13), rgba(155, 92, 246, 0.04));
  border-color: rgba(155,92,246,0.22);
}

.insight-icon {
  position: absolute;
  left: 14px;
  top: 12px;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--orange);
  background: rgba(255, 154, 49, 0.16);
}

.insight.good .insight-icon {
  color: var(--green);
  background: rgba(46, 208, 110, 0.14);
}

.insight.spike .insight-icon,
.insight.info .insight-icon {
  color: var(--violet);
  background: rgba(155, 92, 246, 0.14);
}

.insight-time {
  position: absolute;
  top: 13px;
  right: 12px;
  color: #94a0b3;
  font-size: 12px;
}

.insight strong {
  padding-right: 36px;
  font-size: 14px;
  line-height: 1.35;
}

.insight span {
  color: #aab5c6;
  font-size: 13px;
  line-height: 1.35;
}

.spin {
  animation: spin 0.9s linear infinite;
}

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

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes floatGlow {
  0%, 100% {
    transform: translateY(0);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-2px);
    filter: brightness(1.12);
  }
}

@keyframes glassPulse {
  0%, 100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.18) brightness(1.05);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
