/*
 * Lebensplaner styles.
 *
 * Phone layout first; everything for screens from 900 px up is in the
 * "Desktop" part at the end (same breakpoints as in js/app.js).
 *
 * Naming: "block__part" is a part of a block, "block--variant" a variant,
 * "is-…" a state set from JavaScript.
 *
 * Contents
 *    1. Colours and base
 *    2. Text helpers
 *    3. Common pieces (rows, bars, buttons …)
 *    4. Navigation
 *    5. Heute
 *    6. Woche and Monat
 *    7. Jahr
 *    8. Listen
 *    9. Einstellungen
 *   10. Dialogs (and the assistant)
 *   11. Desktop
 */

/* ---------- 1. Colours and base ---------- */

/* The chosen paper and accent overwrite these from JavaScript (applyColors in js/app.js).
   The values here are the "Warm" paper with the green accent. */
:root {
  --paper: #F3EEE4;   /* page background */
  --sheet: #F8F5EF;   /* dialogs */
  --side: #ECE6DA;    /* sidebar, selected rows */
  --ink: #2A2622;     /* main text */
  --soft: #4A443C;    /* secondary text */
  --pencil: #6A6258;  /* labels, hints */
  --line: #D9D1C3;    /* rules between rows */
  --line2: #E3DCCF;   /* fainter rules */
  --future: #EAE4D9;  /* days that have not happened yet */
  --was: #CFC6B6;     /* past, inactive */
  --on-acc: #F8F5EF;  /* text on the accent colour */
  --acc: #3F5E4C;     /* accent: ticks, links, buttons */
  --rust: #8A5A2E;    /* overdue, delete */
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--side);
  color: var(--ink);
  font: 400 16px Newsreader, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
}

main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: calc(12px + env(safe-area-inset-top)) 22px 24px;
}

/* Buttons and fields start without any browser styling. */
button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  resize: none;
  color-scheme: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--pencil);
}

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

[data-action] {
  cursor: pointer;
}

/* Scrollbars: thin, rounded, in a quiet colour of the current paper, no track.
   Chrome and Safari take the ::-webkit rules (they allow the rounded shape);
   Firefox has no such rules and takes the two standard properties instead. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  /* The transparent border makes the visible thumb 4 px wide with space around it. */
  border: 3px solid transparent;
  border-radius: 5px;
  background: var(--was);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--pencil);
}
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--was) transparent;
  }
}

/* ---------- 2. Text helpers ---------- */

/* Small monospace text for labels and numbers. */
.label {
  font: 400 10px 'IBM Plex Mono', monospace;
  line-height: 1.3;
  color: var(--pencil);
}
.label--l { font-size: 11px; }
.label--m { font-size: 12px; }
.label--xl { font-size: 13px; }

.caps { letter-spacing: .06em; }
.nowrap { white-space: nowrap; }

/* Colours. They come after .label so they win over its grey. */
.muted { color: var(--pencil); }
.soft { color: var(--soft); }
.ink { color: var(--ink); }
.faint { color: var(--was); }
.accent { color: var(--acc); }
.overdue { color: var(--rust); }

.underlined {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-title {
  margin: 0;
  font: 400 32px/1.1 Newsreader;
}

.section-title {
  font: italic 400 15px Newsreader;
  color: var(--pencil);
}

.hint {
  margin-top: 6px;
  font: italic 400 13px Newsreader;
  color: var(--acc);
}

.footnote {
  margin-top: 12px;
  line-height: 1.6;
}

.small-number {
  font-size: 14px;
}

/* ---------- 3. Common pieces ---------- */

/* Two things on one line: one left, one right. */
.spread {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.page-head {
  gap: 12px;
}

.back-link {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--acc);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 26px;
  padding-bottom: 4px;
}

/* A row of a list: 44 px high, a rule above. */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border-top: 1px solid var(--line);
}
.row--plain { border-top: none; }
.row--last { border-bottom: 1px solid var(--line); }

/* The part of a row that reacts to a click (ticks, counts). */
.row__main {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: inherit;
}

.row__title {
  flex: 1;
  min-width: 0;
}

.row__check {
  display: flex;
  align-items: center;
  align-self: stretch;
  flex: none;
}

/* The "⋯" that opens the edit dialog. Where there is a mouse it only shows
   while the pointer is over its row (or over a .hover-host). */
.edit-button {
  flex: none;
  width: 28px;
  height: 22px;
  text-align: center;
  font-size: 18px;
  line-height: 22px;
  color: var(--pencil);
}
@media (hover: hover) {
  .edit-button { opacity: 0; }
  .row:hover .edit-button,
  .hover-host:hover .edit-button,
  .edit-button:focus-visible { opacity: 1; }
}

/* Line for adding an entry: "+" and an input. */
.add-line input {
  font-size: 17px;
}
.add-line__plus {
  flex: none;
  width: 18px;
  text-align: center;
  font: 300 20px/1 Newsreader;
  color: var(--acc);
}

.empty-note {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

/* Thin progress bar. The inner <i> gets its width from JavaScript. */
.bar {
  height: 2px;
  background: var(--line2);
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--acc);
}

.checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--pencil);
  color: var(--on-acc);
  font: 500 11px 'IBM Plex Mono', monospace;
}
.checkbox.is-on {
  background: var(--acc);
  border-color: var(--acc);
}

.radio {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--pencil);
  border-radius: 50%;
}
.is-on > .radio { border-color: var(--acc); }
.is-on > .radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acc);
}

/* Text buttons where one is selected (underlined). */
.option {
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  color: var(--pencil);
  white-space: nowrap;
}
.option.is-on {
  border-color: var(--acc);
  color: var(--ink);
}
.option-group {
  display: flex;
  gap: 14px;
  font-size: 15px;
}
.option-group--wrap {
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* Outlined button. */
.button {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--pencil);
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
}
.button--danger {
  border-color: var(--rust);
  color: var(--rust);
}
.button-group {
  display: flex;
  gap: 8px;
}

/* Filled button at the bottom of a dialog. */
.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  height: 50px;
  margin-top: 20px;
  border-radius: 4px;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 17px;
}
.primary-button[disabled] { opacity: .4; }

/* Coloured dot for a category. */
.dot {
  display: block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.dot--m {
  width: 7px;
  height: 7px;
}
.dot--outline { border: 1px solid var(--ink); }

/* ‹ heute › */
.pager {
  display: inline-flex;
  align-items: center;
  color: var(--acc);
}
.pager button {
  min-width: 32px;
  height: 32px;
  text-align: center;
  font-size: 22px;
  line-height: 30px;
}
.pager .pager__today {
  padding: 0 6px;
  font-size: 14px;
}

/* Small square with a coloured frame: "on a trip". */
.trip-box {
  flex: none;
  width: 12px;
  height: 12px;
  border: 2px solid;
}

/* One line of an agenda. */
.agenda-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.agenda-row__when {
  flex: none;
  width: 52px;
}
.agenda-row__title {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.agenda-row__trip {
  font: italic 500 13px Newsreader;
}

/* A slider that looks like the thin progress bar: the filled part comes from
   --fill (set in the markup and updated while dragging), the knob only shows
   when the pointer is near. Its box is taller than the visible line so it is
   easy to grab; the negative margin takes that extra height back out of the layout. */
.slider {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  height: 12px;
  margin: -5px 0;
  background: linear-gradient(to right, var(--fill-color, var(--acc)) var(--fill), var(--line2) var(--fill)) center / 100% 2px no-repeat;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fill-color, var(--acc));
  opacity: 0;
}
.slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--fill-color, var(--acc));
  opacity: 0;
}
.slider::-moz-range-track { background: transparent; }
.progress-row:hover .slider::-webkit-slider-thumb,
.slider:focus-visible::-webkit-slider-thumb { opacity: 1; }
.progress-row:hover .slider::-moz-range-thumb,
.slider:focus-visible::-moz-range-thumb { opacity: 1; }

/* Title, percentage and bar: sources and goals of a theme. */
.progress-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 0 8px;
  border-top: 1px solid var(--line);
}
.progress-row__title {
  font-size: 15px;
}

.todo[draggable=true] { cursor: grab; }

/* Where a dragged todo or widget would land. */
[data-drop].is-drop-target {
  outline: 1px solid var(--acc);
  outline-offset: 4px;
}

/* ---------- 4. Navigation ---------- */

/* Phone: a bar at the bottom. */
nav {
  display: flex;
  justify-content: space-around;
  flex: none;
  height: calc(62px + env(safe-area-inset-bottom));
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
nav button {
  height: 22px;
  color: var(--pencil);
}
nav button.is-on { color: var(--ink); }
nav button.is-on span {
  padding-bottom: 1px;
  border-bottom: 1.5px solid var(--acc);
}

/* The round "+" and, beside it, the assistant */
nav .nav__new,
nav .nav__assistant {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: -5px;
  border: 1px solid var(--acc);
  border-radius: 50%;
  color: var(--acc);
  font: 300 20px/1 Newsreader;
}

/* ---------- 5. Heute ---------- */

.today-theme__label { margin-top: 18px; }
.today-theme__name {
  margin-top: 4px;
  font: italic 400 48px/1 Newsreader;
}
.today-theme__sources { margin-top: 12px; }

.theme-question {
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.4;
  color: var(--soft);
  text-wrap: pretty;
}

/* The month's goals as three small tiles below the week's goals. */
.goal-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.goal-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.goal-tile__value { font-size: 20px; }

/* "Tagesplan  6 Einträge ›" */
.today-link {
  margin-top: 22px;
}
.today-link button { font-size: 13px; }

.today-journal {
  margin-top: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  line-height: 25px;
}

.settings-link {
  display: block;
  margin-top: 28px;
  font-size: 15px;
}

/* Habits: a square per day. */
.habit-days {
  display: flex;
  flex: none;
  gap: 5px;
}
.habit-days--tight { gap: 4px; }
.habit-day {
  display: block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line);
}
@media (hover: hover) {
  .habit-day:hover { border-color: var(--pencil); }
}
.habit-day.is-done {
  background: var(--was);
  border-color: var(--was);
}
.habit-day--today { border-color: var(--pencil); }
.habit-day--today.is-on {
  background: var(--acc);
  border-color: var(--acc);
}

/* Lists as tiles: a row that scrolls sideways. */
.tiles {
  display: flex;
  overflow-x: auto;
  margin: 4px -22px 0;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tiles button {
  flex: none;
  width: 112px;
  margin-right: 12px;
  padding: 10px 12px 10px 0;
  border-right: 1px solid var(--line2);
}
.tile__number {
  font-size: 24px;
  line-height: 1.1;
}
.tile__name {
  font-size: 13px;
  color: var(--soft);
}

/* Day plan: one row per hour, entries placed on top by their time. */
.plan-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}
.plan-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.plan-page__timeline {
  margin-top: 14px;
  border-top: 1px solid var(--ink);
}

.timeline {
  position: relative;
  height: 612px;   /* 18 hours × 34 px, see HOUR_HEIGHT_PX in js/config.js */
}
.timeline__hour {
  height: 34px;
  line-height: 34px;
  border-bottom: 1px solid var(--line2);
}
.timeline__now {
  position: absolute;
  left: 30px;
  right: 0;
  height: 1.5px;
  background: var(--acc);
}

.plan-entry {
  position: absolute;   /* top, height, left and width are set per entry in js/view-today.js */
  overflow: hidden;
  display: flex;
  gap: 10px;
  border: 1px solid transparent;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;   /* dragging must not scroll the page */
}
/* An entry whose time overlaps with another one. */
.plan-entry.is-conflict {
  background: color-mix(in srgb, var(--rust) 12%, var(--paper));
  border-color: color-mix(in srgb, var(--rust) 45%, transparent);
}
.plan-entry.is-conflict .plan-entry__time { color: var(--rust); }
.plan-entry.is-selected {
  z-index: 2;
  border-color: var(--acc);
}
.plan-entry.is-dragging {
  z-index: 3;
  background: var(--sheet);
  border-color: var(--acc);
}
/* Invisible strip along the lower edge: dragging it changes the duration. */
.plan-entry__resize {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  cursor: ns-resize;
}
/* An entry that shares its row with others has little room: no time label
   (its position shows the time) and no "⋯" (double-click edits); the title may wrap. */
.plan-entry.is-narrow .plan-entry__time,
.plan-entry.is-narrow .edit-button { display: none; }
.plan-entry.is-narrow .plan-entry__text {
  align-items: flex-start;
  height: auto;
  padding: 5px 4px 0 0;
  white-space: normal;
}
.plan-entry.is-narrow .dot { margin-top: 6px; }
.plan-entry.is-narrow .plan-entry__title {
  overflow: visible;
  line-height: 1.2;
}
.plan-entry__duration {
  flex: none;
  width: 2px;
}
.plan-entry__text {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  height: 28px;
  overflow: hidden;
  white-space: nowrap;
}
.plan-entry__title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
}
.plan-entry .edit-button { margin-top: 3px; }

/* Journal */
.journal-page { margin-top: 26px; }
.journal {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.journal__text {
  margin-top: 8px;
  margin-bottom: 6px;
  font-size: 17px;
  line-height: 25px;
}
.journal__head { padding-bottom: 4px; }
.journal__number { width: 14px; }
.journal .row input { font-size: 17px; }
.journal__learning-head {
  padding: 14px 0 8px;
  border-top: 1px solid var(--line);
}
.journal__learning-head .option-group { font-size: 14px; }
.journal__learning {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  line-height: 25px;
}

/* ---------- 6. Woche and Monat ---------- */

/* Phone: the week's todos, the seven days and the pool below one another. */
.week-box > .section-head:first-child { margin-top: 18px; }
.week-days {
  display: flex;
  flex-direction: column;
  margin-top: 26px;
}
.week-day {
  padding: 10px 0 6px;
  border-top: 1px solid var(--ink);
}
/* The day's heading; a click on it starts a new event on that day. */
.week-day__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding-bottom: 6px;
}
.week-day__number { font-size: 20px; }
.week-day.is-today .week-day__number,
.week-day.is-today .week-day__head .label { color: var(--acc); }
.week-day__trip {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: italic 500 13px Newsreader;
}
.week-event {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  font-size: 14px;
  line-height: 1.3;
}
.week-pool__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 34px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
.week-pool .section-head { margin-top: 16px; }


.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Phone: the theme as one line above the calendar. */
.month-theme-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.month-theme-line__name {
  flex: 1;
  font: italic 400 22px Newsreader;
}

/* The calendar is a grid: a narrow column for the week number, then seven days. */
.calendar {
  margin: 16px -12px 0;
}
.cal-row {
  display: grid;
  grid-template-columns: 18px repeat(7, minmax(0, 1fr));
}
.cal-head {
  padding-bottom: 6px;
}
.cal-head > :first-child { font-size: 8px; }
.cal-head__day { padding-left: 5px; }
.cal-body { border-bottom: 1px solid var(--line); }

.cal-week {
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font: 400 8px 'IBM Plex Mono', monospace;
  color: var(--pencil);
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  height: 62px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}
.cal-day__top { padding-left: 3px; }

.cal-num {
  display: inline-block;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  text-align: center;
  font: 400 15px/22px Newsreader;
}
.cal-num.is-today {
  background: var(--ink);
  color: var(--paper);
}

/* Phone: multi-day event as a line, single events as dots, trip name at the bottom. */
.cal-day__line { height: 3px; }
.cal-day__dots {
  display: flex;
  gap: 3px;
  padding-left: 6px;
}
.cal-day__place {
  position: absolute;
  left: 5px;
  bottom: 4px;
  z-index: 1;
  white-space: nowrap;
  font: italic 500 12px Newsreader;
}

.category-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 12px;
}
.category-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Trips of the month ("Unterwegs") */
.trip-swatch {
  flex: none;
  width: 16px;
  height: 16px;
  border-left: 3px solid;
}
.trip-name {
  flex: 1;
  font: italic 400 18px Newsreader;
}
.trip-days {
  width: 58px;
  text-align: right;
  font-size: 15px;
}

/* ---------- 7. Jahr ---------- */

/* Shared: legend of the heat colours, weekend ticks, trip table */
.ramp-legend {
  display: flex;
  flex: none;
  gap: 2px;
}
.ramp-legend i {
  width: 12px;
  height: 12px;
}

.weekend-ticks {
  display: flex;
  gap: 2px;
}
.weekend-ticks i {
  flex: 1;
  height: 8px;
  border: 1px solid var(--acc);
}
.weekend-ticks i.is-past {
  background: var(--pencil);
  border-color: var(--pencil);
}

.trip-table { margin-top: 22px; }
.trip-table__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 40px 44px;
  align-items: center;
  gap: 8px;
  height: 40px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.trip-table__head {
  height: auto;
  padding-bottom: 6px;
  border-top: none;
  font-size: 9px;
  letter-spacing: .04em;
}
.trip-table__home { border-top-color: var(--ink); }
.trip-table__name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.trip-table__name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: italic 400 17px Newsreader;
}
.trip-table__number { text-align: right; }

/* Phone */
.year-phone-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}
.year-phone-head__pager { margin-left: auto; }

.legend-button {
  width: 22px;
  height: 22px;
  border: 1px solid var(--pencil);
  border-radius: 50%;
  text-align: center;
  color: var(--soft);
  font: italic 500 13px/20px Newsreader;
}
.legend-button.is-on {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--on-acc);
}
.legend-popover {
  position: absolute;
  left: 0;
  top: 42px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 300px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--soft);
  font-size: 14px;
  line-height: 1.4;
}
.legend-popover div {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* "TAGE  320 vergangen · 45 übrig" with a bar below */
.count-line {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.count-line .bar { height: 3px; }

.phone-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 14px;
  border-top: 1px solid var(--ink);
}
.phone-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0 12px;
}
.phone-metrics__value {
  font-size: 26px;
  line-height: 1;
}

/* Twelve small month grids, three per row. */
.mini-months {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  row-gap: 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.mini-month__head {
  padding-left: 12px;
  font-size: 14px;
}
.mini-month__weeks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 5px;
}
.mini-month__week {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mini-month__kw {
  width: 10px;
  font-size: 7px;
}
.mini-month__day {
  display: block;
  width: 11px;
  height: 11px;
  border: 2px solid transparent;
}
.mini-month__trips {
  min-height: 14px;
  margin-top: 4px;
  padding-left: 12px;
}
.mini-month__trip {
  white-space: nowrap;
  font: italic 500 11px/14px Newsreader;
}

/* ---------- 8. Listen ---------- */

/* Phone: areas as tabs that scroll sideways. */
.area-tabs {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  margin: 0 -22px;
  padding: 0 22px;
  font-size: 15px;
  scrollbar-width: none;
}
.area-tabs .option {
  flex: none;
  padding: 10px 0 3px;
}

.list-overview__title { margin-top: 22px; }
.list-overview__count { margin-top: 4px; }
.list-overview__rows { margin-top: 14px; }
.list-overview__rows > .row {
  height: 48px;
  border-bottom: 1px solid var(--line);
}

/* A list in the overview: name ····· number, below it caption, bar, type. */
.list-row {
  display: block;
  width: 100%;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.list-row__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.list-row__name,
.list-row__number {
  font-size: 20px;
}
.dotted-line {
  flex: 1;
  border-bottom: 1px solid var(--line2);
  transform: translateY(-5px);
}
.list-row__bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.list-row__bottom .caps { font-size: 9px; }
.list-row__bar { flex: 1; }

/* The open list */
.list-detail__number {
  font-size: 26px;
  line-height: 1;
}
.list-detail__meta {
  gap: 12px;
  margin-top: 6px;
}
.list-detail__hint { margin-top: 8px; }
.list-detail__rows {
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}
.list-detail__rows .add-line { height: 52px; }

.item {
  min-height: 52px;
  padding: 8px 0;
}
.item__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.item__title {
  font-size: 17px;
  line-height: 1.3;
}
.item__bar { margin-top: 4px; }
.item__date {
  flex: none;
  width: 62px;
}
/* The colour classes are on the same element as .label here, so they need the extra weight. */
.item__date.ink { color: var(--ink); }
.item__date.overdue { color: var(--rust); }
.item__stars {
  display: flex;
  flex: none;
}
.star {
  width: 28px;
  text-align: center;
  font-size: 17px;
  line-height: 36px;
  color: var(--was);
}
.star.is-on { color: var(--ink); }

/* Termine */
.appointments__head { margin-top: 22px; }
.task {
  min-height: 54px;
  padding: 8px 0;
}
.task__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.task__due {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 15px;
}
.task__due .label { color: inherit; }
.task__weekdays {
  display: flex;
  gap: 4px;
}
.task__weekdays span {
  width: 14px;
  text-align: center;
}

/* ---------- 9. Einstellungen ---------- */

.settings__title { margin-bottom: 28px; }
.settings {
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 720px;
}

/* Heading of a settings block and of a desktop widget. */
.widget-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex: none;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
.widget-head h2 {
  margin: 0;
  font: 400 22px Newsreader;
}
.widget-head__link { font: 400 15px Newsreader; }

/* Description left, control right. */
.setting-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.setting-line > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.setting-line__title { font-size: 18px; }

/* One palette of the year grid: radio, name, swatches. */
.setting-choice {
  min-height: 56px;
  border-top: none;
  border-bottom: 1px solid var(--line);
}
.setting-choice__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.swatches {
  display: flex;
  flex: none;
  gap: 3px;
}
.swatches i {
  width: 22px;
  height: 22px;
}

/* Accent and paper: a few boxes to choose from. */
.picker {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
/* As many accent tiles per row as fit. */
.picker--accents { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.picker--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.picker > * {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 14px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 15px;
}
.picker > .is-on { border-color: var(--ink); }
.picker__circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
/* The browser's colour field, shaped like the circles beside it. */
.picker__color {
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 50%;
  cursor: pointer;
}
.picker__color::-webkit-color-swatch-wrapper { padding: 0; }
.picker__color::-webkit-color-swatch { border: none; }
.picker__color::-moz-color-swatch { border: none; }
.picker > label { cursor: pointer; }
.picker .picker__paper {
  align-items: stretch;
  gap: 0;
  padding: 0;
}
.picker__sample {
  display: flex;
  align-items: flex-end;
  height: 64px;
  padding: 10px 12px;
  font: italic 400 24px Newsreader;
}
.picker__name {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
}

/* ---------- 10. Dialogs ---------- */

/* Dimmed background; a click on it closes the dialog. */
.scrim {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: rgba(20, 18, 16, .3);
}

/* Phone: a sheet that comes up from the bottom. */
.dialog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-height: 92%;
  overflow-y: auto;
  padding: 10px 22px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  background: var(--sheet);
}
.dialog__grip {
  align-self: center;
  flex: none;
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}
.dialog__head { margin-top: 14px; }
.dialog__title { font-size: 28px; }
.dialog__cancel {
  font-size: 14px;
  color: var(--pencil);
}
.dialog__delete {
  font-size: 14px;
  color: var(--rust);
}
.dialog__types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
}
.dialog__title-input {
  margin-top: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
  font-size: 22px;
}
.dialog__title-input.is-invalid { border-color: var(--rust); }
.dialog__fields { margin-top: 8px; }

/* Small heading inside a dialog. */
.dialog__label {
  margin-top: 20px;
  padding-bottom: 4px;
}
.dialog__label--ruled {
  margin-top: 16px;
  padding: 10px 0 8px;
  border-top: 1px solid var(--line2);
}
.dialog__label--underlined {
  margin-top: 22px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line2);
}

/* A form line: label left, value right. */
.field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border-bottom: 1px solid var(--line2);
}
.field input,
.field select {
  width: auto;
  max-width: 70%;
  text-align: right;
}
.field__trip { font: italic 500 15px Newsreader; }

/* Categories as coloured circles. */
.category-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line2);
  font-size: 14px;
}
.category-picker__circles {
  display: flex;
  justify-content: space-between;
}
.category-picker__circles button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid transparent;
  border-radius: 50%;
}
.category-picker__circles button.is-on { border-color: var(--ink); }
.category-picker__circles i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

/* "Neue Liste": the four list types, and the preview of the new list. */
.type-choice { border-color: var(--line2); }
.type-choice__name {
  flex: 1;
  color: var(--soft);
}
.type-choice.is-on .type-choice__name { color: var(--ink); }
.list-preview {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.list-preview .label { margin-top: 4px; }

/* Theme dialog: question, then rows of title + percent + remove. */
.theme-dialog__question {
  margin-top: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line2);
  font-size: 17px;
  line-height: 25px;
}
.field .theme-row__title {
  flex: 1;
  max-width: none;
  text-align: left;
}
.field .theme-row__percent { width: 56px; }
.theme-row__remove {
  width: 24px;
  text-align: center;
  color: var(--pencil);
}

/* The assistant: the conversation above, the input below. */
.assistant__head-buttons {
  display: flex;
  gap: 16px;
}
.assistant__log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 120px;
  max-height: 46vh;
  overflow-y: auto;
  margin-top: 16px;
  padding: 4px 0 12px;
}
.assistant__intro {
  margin: 0;
  color: var(--soft);
  font-size: 15px;
  line-height: 1.5;
}
.assistant__intro--alone { margin-top: 16px; }
.assistant__example {
  margin-top: 6px;
  font-style: italic;
  color: var(--pencil);
}
/* What the user said: set off to the right. */
.assistant__entry--user {
  align-self: flex-end;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--side);
}
.assistant__entry--note { color: var(--pencil); font-style: italic; }
.assistant__entry--error { color: var(--rust); }
.assistant__text {
  line-height: 1.45;
  white-space: pre-wrap;
}
/* One line per change the assistant made. */
.assistant__change {
  padding: 3px 0;
  color: var(--acc);
  font-size: 15px;
}
.assistant__change + .assistant__text { margin-top: 6px; }
.assistant__undo {
  align-self: flex-start;
  margin-bottom: 10px;
  color: var(--rust);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.assistant__input {
  padding: 10px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line2);
  font-size: 17px;
  line-height: 25px;
}
.assistant__hint { margin-top: 6px; }
.assistant__privacy {
  padding: 12px 0;
  line-height: 1.5;
}
.setting-line__input {
  width: 260px;
  max-width: 50%;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

/* Login */
.login {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 340px;
}
.login__title { font: italic 400 34px Newsreader; }

/* After two devices saved at the same time (see sync.js). */
.sync-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid var(--rust);
  border-radius: 6px;
  line-height: 1.45;
}
.sync-notice__buttons {
  display: flex;
  gap: 8px;
}

/* Sicherungen dialog (see sync.js). */
.backups__note {
  padding: 14px 0;
  color: var(--pencil);
  line-height: 1.5;
}
.backups__group { margin: 16px 0 4px; }
.backups__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line2);
  overflow-wrap: anywhere;
}
.backups__all { align-self: flex-start; margin-top: 18px; }

/* ---------- 11. Desktop ---------- */
/* From 900 px: sidebar instead of the bottom bar, columns, the start page as
   a widget grid, dialogs centred. */

@media (min-width: 900px) {
  #app {
    flex-direction: row;
    max-width: 1440px;
  }

  main {
    padding: 36px 48px 56px;
  }

  .page-title {
    font-size: 44px;
    line-height: 1.05;
  }

  .section-head { margin-top: 30px; }
  .small-number { font-size: 15px; }

  /* --- sidebar --- */
  nav {
    order: -1;   /* first in the row, although it comes after <main> in the markup */
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: 220px;
    height: auto;
    overflow-y: auto;
    padding: 36px 28px;
    border-top: none;
    border-right: 1px solid var(--line);
    background: var(--side);
    font-size: 19px;
  }
  nav::before {
    content: 'Lebensplaner';
    margin-bottom: 28px;
    font: italic 400 26px Newsreader;
  }
  nav button {
    display: flex;
    align-items: center;
    height: 44px;
  }
  nav .nav__new,
  nav .nav__assistant {
    width: auto;
    height: 44px;
    border-radius: 4px;
    font: 400 17px Newsreader;
  }
  nav .nav__new { margin: 28px 0 10px; }
  nav .nav__assistant {
    margin-bottom: 28px;
    border-color: var(--line);
  }

  /* "Noch in 2026" below the navigation */
  .remaining {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
  }
  .remaining .caps { font-weight: 500; }
  .remaining b {
    display: block;
    color: var(--acc);
    font: 400 34px/1 Newsreader;
  }

  /* --- columns --- */
  .columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 36px 56px;
  }
  /* wide main column, narrower side column */
  .columns--main-side {
    grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
    gap: 36px 48px;
  }
  .columns > div { min-width: 0; }

  /* --- Heute: the widget grid --- */
  .dash-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px 32px;
    margin-bottom: 28px;
  }
  .dash-head h1 { margin-top: 6px; }
  .dash-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0 18px;
    min-height: 44px;
    color: var(--pencil);
    font: 400 11px 'IBM Plex Mono', monospace;
  }
  .dash-tools button { height: 44px; }
  .dash-tools__toggle { font: 400 15px Newsreader; }

  /* 12 columns, rows of 76 px (GRID_ROW_PX), 24 px between (GRID_GAP_PX).
     "dense" lets later widgets fill gaps left by earlier ones. */
  .grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 76px;
    grid-auto-flow: dense;
    gap: 24px;
  }
  .grid--compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }

  .widget {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  /* The part of a widget that scrolls when its content is taller than the widget. */
  .widget__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
  }
  .widget__body--rows { margin-top: -1px; }   /* the first row's rule falls on the heading's rule */
  .widget__body--padded { padding-top: 14px; }

  /* "Anordnen" mode: a faint frame, tools above, a resize handle in the corner. */
  .is-arranging .widget {
    outline: 1px solid var(--line);
    outline-offset: 9px;
  }
  .is-arranging .widget.is-drop-target { outline-color: var(--acc); }
  .widget__tools {
    position: absolute;
    top: -23px;
    right: -6px;
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--pencil);
  }
  .widget__tools > * {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
  }
  .widget__tools span { cursor: grab; }
  .widget__resize {
    position: absolute;
    right: -13px;
    bottom: -13px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    width: 20px;
    height: 20px;
    color: var(--pencil);
    cursor: nwse-resize;
    touch-action: none;
  }

  /* Theme widget: name and question, sources, goals; they wrap when the widget is narrow. */
  .theme-widget {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px 48px;
    padding-top: 16px;
    border-top: 1px solid var(--ink);
  }
  .theme-widget > div { min-width: 0; }
  .theme-widget__main { flex: 1.3 1 300px; }
  .theme-widget__sources { flex: 1 1 260px; }
  .theme-widget__goals { flex: 1 1 220px; }
  .theme-widget .section-title { padding-bottom: 6px; }
  /* Name and question are fields that look like plain text. */
  .theme-widget__name {
    display: block;
    height: 84px;
    margin-top: 2px;
    font: italic 400 72px/84px Newsreader;
  }
  .theme-widget .theme-question {
    display: block;
    max-width: 440px;
    margin-top: 0;
    font-size: 19px;
    field-sizing: content;   /* grows with the text where the browser supports it */
  }
  .theme-widget__name:hover,
  .theme-widget .theme-question:hover { background: color-mix(in srgb, var(--side) 60%, transparent); }

  /* Habits widget: weekday letters above the squares. */
  .habit-day {
    width: 16px;
    height: 16px;
  }
  .habit-head {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 28px;
  }
  .habit-head__title { flex: 1; }
  .habit-head__days {
    display: flex;
    gap: 5px;
    margin-right: 40px;   /* the width of the "⋯" button and its gap in the rows below */
  }
  .habit-head__days span {
    width: 16px;
    text-align: center;
  }

  /* Journal: two columns when there is room. */
  .journal {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px 40px;
  }
  .journal > div {
    flex: 1 1 280px;
    min-width: 0;
  }

  /* List tiles wrap instead of scrolling. */
  .tiles {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0;
    padding: 0;
    border: none;
  }
  .tiles button {
    flex: 1 1 150px;
    width: auto;
    margin: 0;
    padding: 14px 16px 14px 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .tile__number { font-size: 30px; }

  /* --- Woche: pool on the left, the week on the right --- */
  .week-board {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: start;
    gap: 0 40px;
    margin-top: 24px;
  }
  .week-pool { order: -1; }   /* first column, although it comes second in the markup */
  .week-pool__head { margin-top: 0; }
  .week-box { border-top: 1px solid var(--ink); }
  .week-box > .section-head:first-child { margin-top: 12px; }
  /* Seven columns when there is room, fewer per row on narrower screens. */
  .week-days {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 0 14px;
  }
  .week-day { min-height: 250px; }
  /* A day column is narrow: no "⋯" (double-click edits), long words may break. */
  .week-day .edit-button { display: none; }
  .week-day .row__title {
    overflow-wrap: anywhere;
    hyphens: auto;   /* German hyphenation, from lang="de" on the page */
  }
  .week-day .add-line { min-height: 30px; }
  .week-day .add-line input { font-size: 14px; }
  .week-day .add-line__plus {
    width: 14px;
    font-size: 16px;
  }

  /* --- Monat --- */
  .calendar { margin: 24px 0 0; }
  .cal-row { grid-template-columns: 36px repeat(7, minmax(0, 1fr)); }
  .cal-head {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ink);
    font-size: 11px;
    letter-spacing: .06em;
  }
  .cal-head > :first-child { font-size: 11px; }
  .cal-head__day { padding-left: 9px; }
  .cal-week {
    padding-top: 12px;
    font-size: 11px;
  }

  /* Cells grow with their content and show titles. */
  .cal-day {
    gap: 3px;
    height: auto;
    min-height: 124px;
    padding: 6px 0 8px;
    border-left: 1px solid var(--line2);
  }
  .cal-day--outside { background: color-mix(in srgb, var(--side) 60%, transparent); }
  .cal-day__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 0 8px 2px 5px;
  }
  .cal-num {
    flex: none;
    min-width: 26px;
    height: 26px;
    border-radius: 13px;
    font-size: 17px;
    line-height: 26px;
  }
  .cal-day__trip {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: italic 500 13px Newsreader;
  }
  /* A multi-day event: one bar segment per day, edge to edge, so they join into one bar. */
  .cal-bar {
    position: relative;
    z-index: 1;
    height: 20px;
    padding-left: 8px;
    color: #fff;
    font-size: 13px;
    line-height: 20px;
    white-space: nowrap;
  }
  /* The segment that carries the title lies above its neighbours, so the text can run across them. */
  .cal-bar--titled { z-index: 2; }
  .cal-event {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0 8px;
    font-size: 14px;
    line-height: 1.3;
  }
  .cal-event span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .category-legend { font-size: 11px; }

  /* The theme at the top of the right column. */
  .month-theme {
    padding-top: 12px;
    border-top: 1px solid var(--ink);
  }
  .month-theme__name {
    margin-top: 6px;
    font: italic 400 44px/1 Newsreader;
  }
  .month-theme__question {
    margin-top: 6px;
    line-height: 1.4;
    color: var(--soft);
    text-wrap: pretty;
  }

  /* --- Jahr --- */
  .year-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px 32px;
  }
  .year-head__title {
    display: flex;
    align-items: baseline;
    gap: 14px;
  }
  .year-head__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 22px;
  }
  .year-head__legend > span {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* The row of big counters. */
  .metrics {
    display: flex;
    flex-wrap: wrap;
    margin-top: 24px;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--line);
  }
  .metrics > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 130px;
    padding: 16px 12px 16px 0;
  }
  .metrics b { font: 400 34px/1 Newsreader; }

  /* The year strip: month names, the squares (a column per week), the trips.
     All three are offset by the 22 px of the weekday letters, so they share one time axis. */
  .strip-block { margin-top: 32px; }
  .strip-months {
    position: relative;
    height: 38px;
    margin-left: 22px;
    line-height: 1.1;
  }
  .strip-months > div {
    position: absolute;
    top: 0;
  }
  .strip-row {
    display: flex;
    margin-top: 6px;
  }
  .strip-weekdays {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: none;
    width: 22px;
  }
  .strip {
    display: flex;
    gap: 3px;
    flex: 1;
    min-width: 0;
  }
  .strip > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
  }
  .strip__day {
    display: block;
    aspect-ratio: 1;
    border: 2px solid transparent;
  }

  .trip-lane {
    position: relative;
    height: 76px;
    margin: 10px 0 0 22px;
    border-top: 1px solid var(--line);
  }
  .trip-lane > * { position: absolute; }
  .trip-lane__today {
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: var(--acc);
  }
  .trip-lane__today-label {
    bottom: 0;
    font-weight: 500;
  }
  .trip-lane__trip { min-width: 8px; }
  .trip-lane__bar {
    height: 10px;
    border: 2px solid;
  }
  .trip-lane__name {
    margin-top: 3px;
    white-space: nowrap;
    font: italic 500 14px/1 Newsreader;
  }

  /* The year's todos: unassigned on the left, twelve month boxes on the right. */
  .todo-board { margin-top: 36px; }
  .todo-board__head {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ink);
  }
  .todo-board__columns {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
    align-items: start;
    gap: 0 40px;
  }
  .todo-board__unassigned { padding: 10px 0 6px; }
  .todo-board__months {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 20px;
  }
  .todo-board__months > div {
    min-height: 92px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  /* Todos inside a month box or a day of the week are smaller. */
  .todo-board__months .row,
  .week-day .row {
    gap: 8px;
    min-height: 30px;
    border-top: none;
    font-size: 14px;
    line-height: 1.25;
  }
  .todo-board__months .checkbox,
  .week-day .checkbox {
    width: 14px;
    height: 14px;
    font-size: 9px;
  }

  .year-bottom { margin-top: 36px; }
  .weekend-ticks { margin-top: 8px; }
  .weekend-ticks i { height: 12px; }

  .trip-table { margin-top: 0; }
  .trip-table__row {
    grid-template-columns: minmax(0, 1fr) 110px 60px 110px;
    gap: 12px;
    height: 46px;
    border-top: none;
    border-bottom: 1px solid var(--line);
    font-size: 17px;
  }
  .trip-table__head {
    height: auto;
    padding-bottom: 8px;
    border-bottom-color: var(--ink);
    font-size: 10px;
  }
  .trip-table__home { border-bottom-color: var(--ink); }
  .trip-table__name span { font-size: 19px; }

  /* Habits per month as a small bar chart. */
  .month-bars__head { margin-top: 30px; }
  .month-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    margin-top: 10px;
    border-bottom: 1px solid var(--ink);
  }
  .month-bars__bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
  }
  .month-bars__bar i { width: 100%; }
  .month-bars__letters {
    display: flex;
    gap: 6px;
    margin-top: 6px;
  }
  .month-bars__letters span {
    flex: 1;
    text-align: center;
  }

  /* --- Listen: three panes --- */
  .panes {
    display: grid;
    grid-template-columns: 170px minmax(240px, 1fr) minmax(0, 1.9fr);
    align-items: start;
    gap: 48px;
  }
  .panes > div { min-width: 0; }
  /* "Termine" uses the space of the second and third pane. */
  .panes__wide {
    grid-column: span 2;
    max-width: 620px;
  }

  .area-list {
    display: flex;
    flex-direction: column;
  }
  .area-list__head {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ink);
  }
  .area-list button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 46px;
    border-bottom: 1px solid var(--line);
    color: var(--pencil);
    font-size: 18px;
  }
  .area-list button.is-on { color: var(--ink); }
  .area-list button.is-on span:first-child { border-bottom: 1.5px solid var(--acc); }

  .list-overview__title { margin-top: 0; }
  .list-overview__count { margin-top: 6px; }
  .list-overview__rows { border-top: 1px solid var(--ink); }
  .list-overview__rows > :first-child { border-top: none; }
  /* The open list is highlighted; the negative margin lets the highlight reach past the text. */
  .list-row.is-open {
    width: calc(100% + 24px);
    margin: 0 -12px;
    padding: 10px 12px;
    background: var(--side);
  }
  .list-row.is-open .list-row__name,
  .list-row.is-open .list-row__number:not(.overdue) { color: var(--acc); }

  .list-detail__number { font-size: 36px; }
  .list-detail__hint { display: none; }
  .list-detail__rows { border-top: 1px solid var(--ink); }
  .list-detail__rows > :first-child { border-top: none; }

  .appointments__head { margin-top: 0; }

  /* --- Einstellungen --- */
  .settings__title { margin-bottom: 28px; }

  /* --- Dialogs: centred box instead of a bottom sheet --- */
  .dialog {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 520px;
    max-height: 88%;
    padding: 24px 32px 28px;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .dialog__grip { display: none; }
  .dialog__head { margin-top: 0; }
}
