:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color: #0f172a;
  background-color: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 360px;
  background: #f1f5f9;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 48px;
  gap: 24px;
}

.app__header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.app__main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: #64748b;
  margin: 0 0 6px;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

h2 {
  margin: 0;
  font-size: 1.1rem;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.pill-group {
  display: inline-flex;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  background: #e2e8f0;
  color: #475569;
}

.pill--active {
  background: #0f172a;
  color: #ffffff;
}

.grid {
  display: grid;
  gap: 16px;
}

.two-column {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: #475569;
}

.field input,
.field select {
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  padding: 10px 12px;
  font-size: 1rem;
  color: #0f172a;
  background: #ffffff;
}

.field__label {
  color: #1e293b;
  font-weight: 600;
}

.field__help {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

.field__error {
  margin: 0;
  font-size: 0.78rem;
  color: #b91c1c;
}

.field__note {
  margin: 0;
  font-size: 0.78rem;
  color: #b45309;
}

.advanced {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}

.advanced summary {
  cursor: pointer;
  font-weight: 600;
  color: #1e293b;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: "▾";
  float: right;
  font-size: 0.9rem;
  color: #64748b;
}

.advanced[open] summary::after {
  content: "▴";
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.primary-button {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  width: 100%;
}

.secondary-button {
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  padding: 10px 14px;
  background: #ffffff;
  font-weight: 600;
  color: #1e293b;
  width: 100%;
}

.ghost-button {
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  padding: 10px 14px;
  background: #ffffff;
  font-weight: 600;
}

.status {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
}

.status--notice {
  color: #2563eb;
  font-weight: 600;
}

.status--success {
  color: #15803d;
  font-weight: 600;
}

.status-debug,
.status-endpoint {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
  overflow-wrap: anywhere;
}

.error-banner {
  margin: 0;
  font-size: 0.85rem;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 10px;
  padding: 8px 10px;
  width: 100%;
  overflow-wrap: anywhere;
}

.result-grid {
  display: grid;
  gap: 12px;
}

.result-stack {
  display: grid;
  gap: 16px;
}

.result-row {
  display: grid;
  gap: 6px;
}

.subvalue {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
  overflow-wrap: anywhere;
}

.help {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.why-line {
  margin: 0;
  font-size: 0.85rem;
  color: #475569;
  overflow-wrap: anywhere;
}

.warning-banner {
  margin: 0;
  font-size: 0.9rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  overflow-wrap: anywhere;
}

.label {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

.value {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: #475569;
  display: grid;
  gap: 6px;
}

.graph-placeholder {
  border-radius: 12px;
  background: #e2e8f0;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-weight: 600;
}

.chart {
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px;
  min-height: 200px;
  display: flex;
  align-items: stretch;
}

.chart__svg {
  width: 100%;
  height: 200px;
  display: block;
}

.chart__help {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

.chart__note {
  margin: 0;
  font-size: 0.78rem;
  color: #b45309;
  overflow-wrap: anywhere;
}

.chart__summary {
  margin: 0;
  font-size: 0.8rem;
  color: #475569;
  overflow-wrap: anywhere;
}

.chart__axis {
  stroke: #cbd5f5;
  stroke-width: 1;
}

.chart__grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.chart__line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2.5;
}

.chart__fill {
  fill: rgba(37, 99, 235, 0.15);
}

.chart__marker {
  fill: #0f172a;
  stroke: #ffffff;
  stroke-width: 2;
}

.chart__marker--secondary {
  fill: #16a34a;
}

.chart__marker--alert {
  fill: #f59e0b;
}

.chart__line--accent {
  stroke: #16a34a;
  stroke-dasharray: 4 4;
}

.chart__line--alert {
  stroke: #f59e0b;
  stroke-dasharray: 4 4;
}

.chart__area--consumed {
  fill: rgba(37, 99, 235, 0.2);
}

.chart__area--remaining {
  fill: rgba(148, 163, 184, 0.25);
}

.chart__label {
  font-size: 0.7rem;
  fill: #64748b;
}

.chart__tick {
  font-size: 0.65rem;
  fill: #64748b;
}

.chart__legend {
  font-size: 0.62rem;
  fill: #475569;
}

.chart__legend-marker {
  stroke: #ffffff;
  stroke-width: 1.5;
}

.chart__empty {
  font-size: 0.8rem;
  fill: #94a3b8;
}

.chart__note-inline {
  font-size: 0.62rem;
  fill: #b45309;
}

.stack {
  display: grid;
  gap: 12px;
}

.debug-panel {
  border: 1px solid #e2e8f0;
}

.debug-panel__summary {
  cursor: pointer;
  font-weight: 600;
  color: #1e293b;
  list-style: none;
}

.debug-panel__summary::-webkit-details-marker {
  display: none;
}

.debug-panel__summary::after {
  content: "▾";
  float: right;
  font-size: 0.9rem;
  color: #64748b;
}

.debug-panel[open] .debug-panel__summary::after {
  content: "▴";
}

.debug-panel__body {
  display: grid;
  gap: 16px;
  overflow-x: auto;
}

.debug-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.debug-panel__actions .secondary-button {
  width: auto;
}

.debug-panel__table {
  display: grid;
  gap: 12px;
  min-width: 320px;
}

.debug-panel__row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 12px;
  font-size: 0.8rem;
  color: #475569;
}

.debug-panel__key {
  font-weight: 600;
  color: #1e293b;
}

.debug-panel__value {
  margin: 0;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.debug-panel__pre {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  font-family: "SFMono-Regular", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  white-space: pre;
}

.debug-panel__details {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.debug-panel__details summary {
  cursor: pointer;
  font-weight: 600;
  color: #334155;
  list-style: none;
}

.debug-panel__details summary::-webkit-details-marker {
  display: none;
}

.debug-panel__timings {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.75rem;
  color: #475569;
}

@media (min-width: 768px) {
  .app {
    padding: 32px 48px 64px;
  }

  .app__header {
    flex-direction: row;
    align-items: center;
  }
}
