:root {
  --bg: #07110f;
  --surface: #0d1b18;
  --surface-2: #13241f;
  --surface-raised: #172a24;
  --line: rgba(213, 235, 226, 0.12);
  --text: #f3f8f5;
  --muted: #9db0a8;
  --green: #5fe0a3;
  --green-dark: #174f3d;
  --yellow: #f2c66d;
  --red: #ff857e;
  --blue: #7fb6ff;
  --purple: #bd91ff;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(34, 121, 86, 0.28), transparent 34rem),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid rgba(127, 182, 255, 0.95);
  outline-offset: 3px;
}

.shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.login-view {
  width: min(100%, 430px);
  min-height: calc(100vh - 52px);
  min-height: calc(100dvh - 52px);
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid rgba(95, 224, 163, 0.35);
  border-radius: 19px;
  color: #06100d;
  background: var(--green);
  font-weight: 900;
  letter-spacing: -0.05em;
  box-shadow: 0 12px 45px rgba(95, 224, 163, 0.18);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 9vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 0;
  font-size: 1.12rem;
  letter-spacing: -0.025em;
}

h4 {
  margin: 0;
  font-size: 0.9rem;
}

.lead {
  max-width: 38rem;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.login-card,
.source-card,
.history-card,
.analytics-card,
.kpi-card,
.profile-pulse-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(19, 36, 31, 0.94), rgba(10, 24, 20, 0.96));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.login-card {
  padding: 22px;
}

.login-card label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid rgba(213, 235, 226, 0.2);
  border-radius: 14px;
  outline: none;
  color: var(--text);
  background: rgba(3, 12, 9, 0.55);
}

.login-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(95, 224, 163, 0.14);
}

.login-card button {
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  color: #06100d;
  background: var(--green);
  font-weight: 850;
}

.login-card button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-error {
  min-height: 1.35em;
  margin: 12px 2px 0;
  color: var(--red);
  font-size: 0.85rem;
}

.form-status {
  min-height: 1.35em;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.form-status:empty {
  display: none;
}

.form-status + .form-error {
  margin-top: 4px;
}

.dashboard-view {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 2px 24px;
}

.topbar h1 {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

.topbar h1:focus,
.login-view h1:focus {
  outline: none;
}

.icon-button,
.text-button,
.filter,
.range-switch button {
  min-height: 46px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(19, 36, 31, 0.72);
}

.icon-button {
  min-width: 46px;
  border-radius: 50%;
  font-size: 1.25rem;
}

.freshness-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(14, 29, 25, 0.84);
}

.freshness-banner strong,
.freshness-banner span {
  display: block;
}

.freshness-banner strong {
  margin-bottom: 2px;
  font-size: 0.92rem;
}

.freshness-banner div > span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(157, 176, 168, 0.1);
}

.freshness-fresh .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(95, 224, 163, 0.12);
}

.freshness-warning .status-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 5px rgba(242, 198, 109, 0.12);
}

.freshness-stale {
  border-color: rgba(255, 133, 126, 0.32);
  background: rgba(82, 30, 27, 0.34);
}

.freshness-stale .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 133, 126, 0.12);
}

.text-button {
  padding: 0 13px;
  border-radius: 12px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
}

.dashboard-tabs {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7, 17, 15, 0.92);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px);
}

.dashboard-tabs button {
  min-width: 0;
  min-height: 46px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 850;
}

.dashboard-tabs button[aria-selected="true"] {
  color: #06100d;
  background: var(--green);
  box-shadow: 0 8px 24px rgba(95, 224, 163, 0.14);
}

.scope-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 27, 24, 0.74);
}

.scope-field {
  min-width: 0;
}

.scope-label {
  display: block;
  margin: 0 0 7px 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scope-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 38px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 750;
}

.dashboard-panel {
  min-width: 0;
}

.dashboard-panel:focus-visible {
  border-radius: var(--radius);
}

.filters {
  display: flex;
  gap: 8px;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  flex: 0 0 auto;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 750;
}

.filter.is-active,
.range-switch button.is-active {
  border-color: var(--green);
  color: #06100d;
  background: var(--green);
}

.cockpit-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 2px 15px;
}

.section-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.coverage-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(157, 176, 168, 0.08);
  font-size: 0.66rem;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.coverage-complete {
  border-color: rgba(95, 224, 163, 0.25);
  color: var(--green);
  background: rgba(95, 224, 163, 0.09);
}

.coverage-partial {
  border-color: rgba(242, 198, 109, 0.28);
  color: var(--yellow);
  background: rgba(242, 198, 109, 0.09);
}

.coverage-missing {
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  min-width: 0;
  min-height: 132px;
  padding: 15px;
}

.kpi-label,
.analytics-unit {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi-value {
  display: block;
  margin-top: 15px;
  overflow-wrap: break-word;
  font-size: clamp(1.75rem, 9vw, 2.55rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.kpi-value-text {
  font-size: clamp(0.875rem, 2vw, 1.35rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.kpi-detail {
  display: block;
  margin-top: 8px;
  overflow-wrap: break-word;
  hyphens: auto;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.4;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.analytics-card,
.profile-pulse-card {
  min-width: 0;
  padding: 17px;
}

.profile-pulse-card {
  margin-top: 12px;
}

.analytics-heading,
.mix-provider-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.analytics-unit {
  max-width: 8rem;
  text-align: right;
}

.mix-groups {
  display: grid;
  gap: 17px;
  margin-top: 18px;
}

.mix-provider + .mix-provider {
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.mix-provider-head {
  align-items: center;
  margin-bottom: 12px;
}

.mix-coverage {
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.mix-coverage.is-complete {
  color: var(--green);
}

.mix-coverage.is-partial {
  color: var(--yellow);
}

.mix-list {
  display: grid;
  gap: 13px;
}

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

.mix-row.is-unreported {
  opacity: 0.82;
}

.mix-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  margin-bottom: 7px;
}

.mix-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  font-weight: 800;
}

.mix-swatch {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 3px;
}

.mix-values {
  display: grid;
  justify-items: end;
  gap: 1px;
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
}

.mix-values strong {
  font-size: 0.8rem;
}

.mix-values span {
  color: var(--muted);
}

.analytics-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(213, 235, 226, 0.08);
}

.analytics-meter-fill {
  width: 0;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  transition: width 240ms ease;
}

.analytics-empty,
.provider-empty,
.mix-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.provider-empty {
  margin-top: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  background: rgba(3, 12, 9, 0.18);
}

.mix-note {
  margin-top: 11px;
  font-size: 0.68rem;
}

.profile-pulse {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.profile-pulse > .analytics-empty {
  margin: 0;
}

.profile-pulse-row {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--text);
  background: rgba(3, 12, 9, 0.27);
  text-align: left;
}

.profile-pulse-row:hover {
  border-color: rgba(95, 224, 163, 0.35);
  background: rgba(19, 36, 31, 0.76);
}

.pulse-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.pulse-icon {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-radius: 11px;
}

.pulse-names,
.pulse-quota {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.pulse-names {
  overflow: hidden;
}

.pulse-names strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-names span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-names span,
.pulse-quota span {
  color: var(--muted);
  font-size: 0.64rem;
}

.pulse-quota {
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.pulse-quota strong {
  color: var(--green);
  font-size: 0.86rem;
}

.pulse-quota.warning strong {
  color: var(--yellow);
}

.pulse-quota.critical strong {
  color: var(--red);
}

.pulse-detail {
  min-width: 0;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 0.64rem;
}

.pulse-detail span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pulse-arrow {
  display: none;
  color: var(--green);
  font-size: 1.1rem;
}

.token-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 3px 2px 15px;
}

.token-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.token-summary-note {
  margin: 3px 0 0;
  color: #879b93;
  font-size: 0.7rem;
  line-height: 1.4;
}

.source-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.source-card {
  min-width: 0;
  padding: 19px;
}

.source-card.is-hidden {
  display: none;
}

.card-head,
.window-head,
.extra-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.provider {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  overflow: hidden;
}

.provider-identity {
  min-width: 0;
  overflow: hidden;
}

.provider-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #06100d;
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
}

.provider-icon.codex {
  background: var(--blue);
}

.provider-name {
  display: block;
  overflow: hidden;
  font-size: 1.04rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-label {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-status {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(95, 224, 163, 0.1);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  text-transform: uppercase;
}

.source-status.error {
  color: var(--red);
  background: rgba(255, 133, 126, 0.1);
}

.window-list {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.window {
  min-width: 0;
}

.window-head {
  margin-bottom: 8px;
}

.window-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.window-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 850;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(213, 235, 226, 0.08);
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 240ms ease;
}

.meter-fill.warning {
  background: var(--yellow);
}

.meter-fill.critical {
  background: var(--red);
}

.reset {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.72rem;
}

.extra-box {
  margin-top: 18px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 12, 9, 0.3);
}

.consumption-box {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.consumption-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.consumption-label,
.consumption-status {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.consumption-status {
  color: var(--green);
}

.consumption-status.warning {
  color: var(--yellow);
}

.consumption-total {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-size: clamp(1.75rem, 8vw, 2.45rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 1;
}

.consumption-period {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
}

.consumption-breakdown {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  margin: 15px 0 0;
  font-size: 0.76rem;
}

.consumption-breakdown dt {
  color: var(--muted);
}

.consumption-breakdown dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.consumption-note,
.empty-consumption {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.extra-row {
  color: var(--muted);
  font-size: 0.77rem;
}

.extra-row + .extra-row {
  margin-top: 7px;
}

.extra-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.empty-source {
  margin: 22px 0 4px;
  color: var(--muted);
  line-height: 1.45;
}

.history-card {
  margin-top: 18px;
  padding: 19px;
}

.section-heading {
  align-items: flex-start;
}

.range-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.range-switch button {
  min-width: 50px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.history-empty {
  padding: 46px 10px 32px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.history-status {
  margin: 18px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(242, 198, 109, 0.25);
  border-radius: 12px;
  color: var(--yellow);
  background: rgba(242, 198, 109, 0.08);
  font-size: 0.76rem;
  line-height: 1.45;
}

.chart-wrap {
  margin-top: 18px;
}

#history-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid-line {
  stroke: rgba(213, 235, 226, 0.12);
  stroke-width: 1;
}

.chart-grid-label {
  fill: var(--muted);
  font-size: 18px;
}

.chart-time-label {
  fill: var(--muted);
  font-size: 16px;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  margin-top: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.history-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.history-table-wrap:focus-visible {
  outline-offset: 2px;
}

.history-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.history-data-table caption {
  padding: 12px 13px;
  color: var(--muted);
  text-align: left;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-data-table th,
.history-data-table td {
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.history-data-table th:first-child,
.history-data-table td:first-child {
  text-align: left;
}

.history-data-table thead th {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 3px 8px;
  color: #879b93;
  font-size: 0.7rem;
}

noscript {
  display: block;
  padding: 20px;
  color: var(--red);
}

@media (min-width: 720px) {
  .shell {
    padding-left: 28px;
    padding-right: 28px;
  }

  .scope-toolbar {
    grid-template-columns: auto minmax(180px, 1fr) auto;
    align-items: end;
  }

  .scope-toolbar.is-history-scope {
    grid-template-columns: auto minmax(180px, 1fr);
  }

  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .analytics-grid {
    grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  }

  .profile-pulse-row {
    grid-template-columns: minmax(200px, 1.2fr) auto minmax(300px, 1.4fr) auto;
  }

  .pulse-detail {
    grid-column: auto;
  }

  .pulse-arrow {
    display: block;
  }

  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1060px) {
  .source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 470px) {
  .freshness-banner {
    grid-template-columns: auto 1fr;
  }

  .freshness-banner .text-button {
    grid-column: 2;
    justify-self: start;
    min-height: 44px;
  }

  footer {
    flex-direction: column;
  }

  .token-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .token-toolbar .range-switch {
    align-self: flex-start;
  }

  .cockpit-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .coverage-badge {
    align-self: flex-start;
  }

  .kpi-value-text {
    overflow-wrap: normal;
  }

  #kpi-top-model,
  #kpi-coverage {
    white-space: nowrap;
  }

  .mix-row-head {
    align-items: start;
  }

  .mix-values {
    max-width: 9.5rem;
  }

  .pulse-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pulse-detail span:last-child {
    grid-column: 1 / -1;
  }

  .history-table-wrap {
    overflow: visible;
    border: 0;
  }

  .chart-grid-label {
    font-size: 34px;
  }

  .chart-time-label {
    font-size: 32px;
  }

  .history-data-table,
  .history-data-table tbody,
  .history-data-table tr,
  .history-data-table th,
  .history-data-table td {
    display: block;
    width: 100%;
  }

  .history-data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .history-data-table caption {
    padding: 12px 0 8px;
  }

  .history-data-table tr {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(3, 12, 9, 0.22);
  }

  .history-data-table tr + tr {
    margin-top: 8px;
  }

  .history-data-table th,
  .history-data-table td,
  .history-data-table th:first-child,
  .history-data-table td:first-child {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: right;
    white-space: normal;
  }

  .history-data-table th::before,
  .history-data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
    text-align: left;
  }
}

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