@font-face {
  font-family: "DSEG7";
  src: url("/fonts/DSEG7Classic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  color-scheme: light;
  --paper: #E9ECE6;
  --surface: #F6F7F3;
  --ink: #1C231E;
  --muted: #5E6862;
  --line: #CDD3CB;
  --lcd: #C5CDB0;
  --lcd-edge: #A9B395;
  --seg: #1F2A1F;
  --seg-off: rgba(31, 42, 31, .07);
  --action: #24402F;
  --action-ink: #F6F7F3;
  --warn: #8A5A00;
  --crit: #A4231C;
  --sys: #24402F;
  --dia: #7C8F5A;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #101411;
    --surface: #181D19;
    --ink: #E2E7E0;
    --muted: #98A39B;
    --line: #2C342E;
    --lcd: #1A2316;
    --lcd-edge: #2B3825;
    --seg: #C4DE7C;
    --seg-off: rgba(196, 222, 124, .07);
    --action: #C4DE7C;
    --action-ink: #101411;
    --warn: #E0B04F;
    --crit: #F08B80;
    --sys: #C4DE7C;
    --dia: #7D9A5E;
  }
}

*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 18px 120px;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 20px; line-height: 1.25; margin-bottom: 10px; }
h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
p { margin: 0 0 12px; }
small, .muted { color: var(--muted); font-size: 14px; }
a { color: inherit; }
section { margin-top: 28px; }

.wordmark {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.04em;
}
.topbar { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }

/* Die LCD-Anzeige */
.lcd {
  position: relative;
  background: var(--lcd);
  border: 1px solid var(--lcd-edge);
  border-radius: 22px;
  padding: 18px 20px 16px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .12);
  color: var(--seg);
}
.lcd-row { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.lcd-row + .lcd-row { margin-top: 6px; }
.lcd-label { font-size: 13px; font-weight: 700; opacity: .75; align-self: start; padding-top: 6px; }
.lcd-num { position: relative; font-family: "DSEG7", var(--font); font-weight: 700; text-align: right; line-height: 1; }
.lcd-num::before { content: attr(data-ghost); position: absolute; right: 0; color: var(--seg-off); }
.lcd-num span { position: relative; }
.lcd-big { font-size: 76px; }
.lcd-mid { font-size: 52px; }
.lcd-small { font-size: 34px; }
.lcd-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; font-weight: 600; opacity: .8; }
.lcd.empty .lcd-num span { opacity: 0; }

.verdict { margin-top: 12px; font-weight: 600; }
.verdict.warn { color: var(--warn); }
.verdict.crit { color: var(--crit); }

/* Bedienelemente */
button, .button {
  font: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 14px 18px;
  background: transparent;
  color: var(--ink);
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--dia);
  outline-offset: 2px;
}
.primary {
  display: block;
  width: 100%;
  background: var(--action);
  color: var(--action-ink);
  font-weight: 700;
  font-size: 18px;
  padding: 18px;
}
.secondary {
  display: block;
  width: 100%;
  border: 1.5px solid var(--line);
  font-weight: 600;
  margin-top: 10px;
}
.link { padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.danger { color: var(--crit); }
.actions { margin-top: 22px; }
button[disabled] { opacity: .5; cursor: default; }

label { display: block; font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
textarea { min-height: 72px; resize: vertical; }
.field { margin-top: 16px; }

.values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.values input {
  font-family: "DSEG7", var(--font);
  font-size: 30px;
  text-align: center;
  padding: 12px 4px;
  background: var(--lcd);
  color: var(--seg);
  border-color: var(--lcd-edge);
}
.values label { text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
}
.chip[aria-pressed=true] { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.chip .x { margin-left: 6px; opacity: .6; }

.photo { width: 100%; max-height: 220px; object-fit: contain; border-radius: 14px; background: var(--surface); }
.status { margin-top: 10px; font-weight: 600; }
.hint { color: var(--warn); }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 16px; overflow: hidden; }
.stat { background: var(--surface); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat small { display: block; }

.chart { width: 100%; height: auto; display: block; background: var(--surface); border-radius: 16px; }
.chart text { fill: var(--muted); font: 11px var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }

/* Verlauf */
.day { margin-top: 22px; }
.entry {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.entry .time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.entry .bp { font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.entry .bp.warn { color: var(--warn); }
.entry .bp.crit { color: var(--crit); }
.entry .meta { color: var(--muted); font-size: 14px; }
.entry .pulse { color: var(--muted); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; }

.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  line-height: 1.6;
  letter-spacing: .06em;
  background: var(--surface);
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  word-spacing: .3em;
  user-select: all;
  -webkit-user-select: all;
}
.alert {
  border-left: 4px solid var(--crit);
  background: var(--surface);
  border-radius: 0 14px 14px 0;
  padding: 16px 18px;
  margin-top: 18px;
}
.alert h2 { color: var(--crit); }
.alert ul { margin: 6px 0 10px; padding-left: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; color: var(--ink); font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--action); }

.lock { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.lock .lcd { margin: 28px 0; }

nav[hidden] { display: none; }
nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 5;
}
nav button { border-radius: 0; padding: 14px 4px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
nav button[aria-current=page] { color: var(--ink); box-shadow: inset 0 3px 0 var(--action); }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  max-width: calc(100% - 32px);
  z-index: 10;
}

.print-only { display: none; }

@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #000; --muted: #444; --line: #bbb; --sys: #000; --dia: #777; padding: 0; }
  body { font-size: 11pt; background: #fff; }
  nav, #toast, .no-print { display: none !important; }
  .print-only { display: block; }
  main { max-width: none; padding: 0; }
  section { margin-top: 16px; break-inside: avoid; }
  .chart { border: 1px solid #bbb; }
  .stats { background: #bbb; }
}

@media (prefers-reduced-motion: no-preference) {
  .lcd.fresh .lcd-num span { animation: blink .9s steps(2, jump-none) 2; }
  @keyframes blink { 50% { opacity: 0; } }
}
