:root {
  color-scheme: light;
  --canvas: #f3f3f0;
  --surface: #ffffff;
  --ink: #181816;
  --muted: #6f706b;
  --faint: #9a9b95;
  --line: #d9d9d3;
  --line-strong: #bdbdb5;
  --accent: #bd5d3f;
  --accent-soft: #f3dfd7;
  --success: #2d705c;
  --success-soft: #dfece7;
  --danger: #a43f35;
  --danger-soft: #f5e2df;
  --shadow: 0 18px 50px rgba(24, 24, 22, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--canvas);
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 6px;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  width: 100%;
  min-height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--ink);
  border-radius: 6px;
}

.brand-mark svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.header-label {
  color: var(--muted);
  font-size: 14px;
}

.page-shell {
  width: min(760px, calc(100% - 40px));
  margin: auto;
  padding: 72px 0 56px;
}

.query-section {
  animation: enter 360ms ease-out both;
}

.title-row {
  margin-bottom: 28px;
  display: flex;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0;
}

.query-form {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.query-form > label {
  display: block;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 600;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.key-field {
  min-width: 0;
  height: 50px;
  padding: 0 8px 0 15px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  background: #fafaf8;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.key-field:focus-within {
  background: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(24, 24, 22, 0.1);
}

.key-field.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.key-field > svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.key-field input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.key-field input::placeholder {
  color: var(--faint);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: color 160ms ease, background-color 160ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: #ecece8;
}

.icon-button:active {
  background: #e3e3de;
}

.icon-button:focus-visible,
.submit-button:focus-visible,
.brand:focus-visible {
  outline: 3px solid rgba(189, 93, 63, 0.32);
  outline-offset: 2px;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.submit-button {
  height: 50px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #ffffff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-weight: 600;
  transition: transform 160ms ease, background-color 160ms ease, opacity 160ms ease;
}

.submit-button:hover:not(:disabled) {
  background: #34342f;
}

.submit-button:active:not(:disabled) {
  transform: translateY(1px);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.submit-button svg {
  width: 18px;
  height: 18px;
}

.button-spinner {
  display: none;
  animation: spin 800ms linear infinite;
}

.submit-button.is-loading .button-arrow {
  display: none;
}

.submit-button.is-loading .button-spinner {
  display: block;
}

.field-error {
  min-height: 20px;
  margin: 8px 0 -4px;
  color: var(--danger);
  font-size: 13px;
}

.result-section {
  margin-top: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: enter 280ms ease-out both;
}

.result-header {
  min-height: 70px;
  padding: 15px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

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

.status-indicator {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--success);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--success-soft);
}

.status-indicator.is-warning {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.status-indicator.is-danger {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.result-title,
.status-label,
.updated-at,
.metric-value,
.metric-caption,
.error-panel p {
  margin: 0;
}

.result-title {
  color: var(--muted);
  font-size: 12px;
}

.status-label {
  font-size: 15px;
  font-weight: 600;
}

.updated-at {
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.primary-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.metric {
  min-width: 0;
  padding: 28px 24px 26px;
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric-primary {
  background: #faf7f5;
}

.metric-heading {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.metric-heading svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.metric-value {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 42px;
  font-weight: 500;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value.is-long {
  font-size: 32px;
}

.metric-caption {
  margin-top: 8px;
  color: var(--faint);
  font-size: 12px;
}

.secondary-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.secondary-item {
  min-width: 0;
  padding: 18px 20px;
}

.secondary-item + .secondary-item {
  border-left: 1px solid var(--line);
}

.secondary-item span,
.secondary-item strong {
  display: block;
}

.secondary-item span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.secondary-item strong {
  overflow: hidden;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quota-progress {
  padding: 22px 24px 24px;
}

.progress-meta,
.progress-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.progress-meta {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e8e8e3;
  border-radius: 4px;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--accent);
  border-radius: inherit;
  transition: width 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-track span.is-danger {
  background: var(--danger);
}

.progress-details {
  margin-top: 9px;
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.error-panel {
  margin-top: 18px;
  padding: 17px 19px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #e4bbb4;
  border-radius: var(--radius);
  animation: enter 220ms ease-out both;
}

.error-panel svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.error-panel strong {
  font-size: 14px;
}

.error-panel p {
  margin-top: 2px;
  color: #784039;
  font-size: 13px;
}

footer {
  min-height: 56px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

[hidden] {
  display: none !important;
}

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

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

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

@media (min-width: 681px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    min-height: 0;
  }

  .site-header,
  footer {
    flex: 0 0 auto;
  }

  .page-shell {
    height: calc(100dvh - 120px);
    min-height: 0;
    margin: 0 auto;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
  }

  body.has-result .page-shell {
    padding: 18px 0;
  }

  body.has-result .title-row {
    margin-bottom: 14px;
  }

  body.has-result .eyebrow {
    margin-bottom: 4px;
  }

  body.has-result h1 {
    font-size: 30px;
  }

  body.has-result .query-form {
    padding: 16px 18px;
  }

  body.has-result .query-form > label {
    margin-bottom: 6px;
  }

  body.has-result .field-error {
    min-height: 16px;
    margin: 4px 0 -2px;
    font-size: 12px;
  }

  body.has-result .result-section {
    margin-top: 12px;
  }

  body.has-result .result-header {
    min-height: 56px;
    padding: 9px 20px;
  }

  body.has-result .metric {
    padding: 16px 22px;
  }

  body.has-result .metric-heading {
    margin-bottom: 8px;
  }

  body.has-result .metric-value {
    font-size: 34px;
  }

  body.has-result .metric-value.is-long {
    font-size: 28px;
  }

  body.has-result .metric-caption {
    margin-top: 4px;
  }

  body.has-result .secondary-item {
    padding: 10px 16px;
  }

  body.has-result .secondary-item span {
    margin-bottom: 2px;
  }

  body.has-result .quota-progress {
    padding: 12px 22px 14px;
  }

  body.has-result .progress-meta {
    margin-bottom: 6px;
  }

  body.has-result .progress-details {
    margin-top: 6px;
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 58px;
    padding: 0 18px;
  }

  .page-shell {
    width: min(calc(100% - 28px), 760px);
    padding: 44px 0 32px;
  }

  .title-row {
    margin-bottom: 22px;
  }

  h1 {
    font-size: 30px;
  }

  .query-form {
    padding: 18px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .submit-button {
    width: 100%;
  }

  .result-header {
    padding: 14px 18px;
  }

  .updated-at {
    display: none;
  }

  .primary-metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    padding: 24px 20px;
  }

  .metric + .metric {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric-value {
    font-size: 38px;
  }

  .metric-value.is-long {
    font-size: 28px;
  }

  .secondary-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .secondary-item:nth-child(odd) {
    border-left: 0;
  }

  .secondary-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .quota-progress {
    padding: 20px;
  }

  footer {
    padding: 0 18px;
  }
}

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