/* Limits – Cockpit-Oberflaeche
   Farben, Typografie und Abstaende laut docs/vertrag.md, Abschnitt
   "Oberflaeche (public/)". Kein Inline-CSS, keine externen Ressourcen. */

:root {
  color-scheme: dark;

  --bg: #0d0f12;
  --card: #16191e;
  --line: #252a31;
  --text: #e8eaed;
  --muted: #8b929c;

  --ok: #3ecf8e;
  --warn: #f5a524;
  --bad: #f2555a;

  --radius: 14px;
  --gap: 16px;
  --shell: 520px;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", "DejaVu Sans Mono", monospace;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Grundlayout */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 20px var(--gap) calc(40px + env(safe-area-inset-bottom));
}

.center {
  display: flex;
  min-height: 100dvh;
  padding: 24px var(--gap);
}

/* ------------------------------------------------------------------- Kopfbereich */

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 22px;
}

.title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin-top: 4px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
}

.stamp {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.stamp--stale {
  color: var(--warn);
}

/* ---------------------------------------------------------------------- Hinweis */

.notice {
  margin-bottom: var(--gap);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
}

/* -------------------------------------------------------------------- Engpass */

.bottleneck {
  padding: 18px var(--gap) 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bottleneck-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-top: 10px;
}

.bottleneck-name {
  font-size: 16px;
  font-weight: 500;
}

.bottleneck-pct {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.bottleneck-pct[data-level="ok"] {
  color: var(--ok);
}

.bottleneck-pct[data-level="warn"] {
  color: var(--warn);
}

.bottleneck-pct[data-level="bad"] {
  color: var(--bad);
}

.bottleneck-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------- Verlauf */

.history {
  margin-top: var(--gap);
}

.history-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.range-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.range-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.range-button[aria-pressed="true"] {
  border-color: #3a4049;
  background: #1d2127;
  color: var(--text);
}

.history-plot {
  width: 100%;
  min-height: 200px;
}

.history-svg {
  display: block;
  width: 100%;
  height: 200px;
  overflow: visible;
  touch-action: pan-y;
}

.history-empty {
  display: grid;
  min-height: 200px;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.history-series {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.series-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.series-chip[aria-pressed="true"] {
  color: var(--text);
}

.series-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.series-dot--claude { background: #d97757; }
.series-dot--codex { background: #7fb3ff; }
.series-dot--agy { background: #5eead4; }
.series-dot--other { background: var(--text); }

/* ----------------------------------------------------------------------- Karten */

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: var(--gap);
}

.card {
  padding: var(--gap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card--error .card-title {
  color: var(--muted);
}

.tag {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-error,
.card-empty {
  color: var(--muted);
  font-size: 14px;
}

.windows {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.win-label {
  font-size: 14px;
}

.win-pct {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  border-radius: 999px;
  transition: width 200ms ease;
}

.bar-fill[data-level="ok"] {
  background: var(--ok);
}

.bar-fill[data-level="warn"] {
  background: var(--warn);
}

.bar-fill[data-level="bad"] {
  background: var(--bad);
}

.win-reset {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* --------------------------------------------------------------- opencode-Info */

.info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
}

.info-note {
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------------------ Fuss */

.foot {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* ------------------------------------------------------------------- Formulare */

.panel {
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.panel .alert {
  margin-top: 16px;
}

.field {
  display: block;
  margin-bottom: var(--gap);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
}

.input:focus {
  border-color: #3a4049;
}

.input[readonly] {
  color: var(--muted);
}

.hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* -------------------------------------------------------------------- Knöpfe */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.btn:active {
  background: #1d2127;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  width: 100%;
  min-height: 48px;
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}

.btn-primary:active {
  background: #d9dce0;
}

.btn-quiet {
  background: transparent;
  color: var(--muted);
}

.alert {
  padding: 11px 13px;
  border: 1px solid var(--bad);
  border-radius: 12px;
  background: rgba(242, 85, 90, 0.08);
  color: var(--bad);
  font-size: 14px;
}

/* ------------------------------------------------------------- Bewegung */

@media (prefers-reduced-motion: reduce) {
  .bar-fill {
    transition: none;
  }
}
