/* Farb-Tokens: helle und dunkle Werte an einer Stelle, Rest referenziert Rollen. */
:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --border:      rgba(11, 11, 11, 0.10);
  --cell-empty:  #f0efec;
  --accent:      #2a78d6;
  --highlight:   #eda100;
  --today:       #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:        #0d0d0d;
    --surface:     #1a1a19;
    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --muted:       #898781;
    --grid:        #2c2c2a;
    --border:      rgba(255, 255, 255, 0.10);
    --cell-empty:  #262624;
    --accent:      #3987e5;
    --highlight:   #eda100;
    --today:       #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface:     #1a1a19;
  --ink:         #ffffff;
  --ink-2:       #c3c2b7;
  --muted:       #898781;
  --grid:        #2c2c2a;
  --border:      rgba(255, 255, 255, 0.10);
  --cell-empty:  #262624;
  --accent:      #3987e5;
  --highlight:   #eda100;
  --today:       #e66767;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-header h1 {
  margin: 0 0 20px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

/* Eingabe */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

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

.controls input[type="date"] {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.controls input[type="date"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  color: var(--muted);
  margin: 0 0 24px;
}

/* Kennzahlen */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tile-label {
  font-size: 13px;
  color: var(--ink-2);
}

.tile-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tile-sub {
  font-size: 13px;
  color: var(--muted);
}

.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--cell-empty);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--accent);
}

.progress-label {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--muted);
}

/* Kalender */
.calendar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 860px) {
  .calendar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .calendar { grid-template-columns: 1fr; }
}

.month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 14px;
}

.month h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px; /* 2px-Fläche zwischen Zellen */
}

.weekday {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding-bottom: 4px;
}

.day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.1;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  user-select: none;
}

.day-prob {
  font-size: 9px;
  font-weight: 400;
  opacity: 0.85;
}

.day.is-empty {
  background: var(--cell-empty);
}

.day.is-preg {
  cursor: default;
  font-weight: 600;
}

.day.is-preg:hover {
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 0 2px var(--surface);
}

.day.is-preg:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.day.is-today {
  box-shadow: inset 0 0 0 4px var(--today), inset 0 0 0 5px var(--surface);
}

.day.is-special {
  box-shadow: inset 0 0 0 2px var(--highlight), inset 0 0 0 3px var(--surface);
}

/* Fällt „Heute" auf einen besonderen Tag, gewinnt der rote Heute-Rahmen. */
.day.is-special.is-today {
  box-shadow: inset 0 0 0 4px var(--today), inset 0 0 0 5px var(--surface);
}

.footnote {
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
  max-width: 72ch;
}

.site-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--grid);
  font-size: 12px;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

/* Tooltip */
#tooltip {
  position: fixed;
  z-index: 10;
  max-width: 320px;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  padding: 8px 40px 8px 12px;
  font-size: 13px;
}

@media (max-width: 600px) {
  #tooltip {
    max-width: calc(100vw - 24px);
  }
}

.tt-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.tt-close:hover,
.tt-close:focus-visible {
  background: var(--cell-empty);
  color: var(--ink);
}

#tooltip .tt-value {
  font-weight: 700;
  font-size: 14px;
}

#tooltip .tt-line {
  color: var(--ink-2);
}
