/* ============================================================================
   Wiedervorlage – Gestaltung
   ----------------------------------------------------------------------------
   Für eine Sekretärin, die morgens wissen will, wem sie heute schreiben muss.
   Eine Frage pro Bildschirm, ein Hauptknopf pro Zeile, eine Signalfarbe.

   Schrift  Instrument Sans (Oberfläche) · JetBrains Mono (Zahlen)
   Farben   Tinte #14181d auf Papier #f5f5f3 · Rost #a63c17 = „wartet auf uns"
            und „überfällig" · Blau #1b4dd8 = Verweise
   ========================================================================== */

:root {
  --ink: #14181d;
  --ink-soft: #2f363f;
  --paper: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --line: #e3e3df;
  --line-soft: #eeeeea;
  --text: #14181d;
  --muted: #5f646c;     /* 5,96 auf Weiß · 5,46 auf Papier (gemessen) */
  --muted-2: #6b7078;   /* 4,98 auf Weiß · 4,57 auf Papier (gemessen) */

  --accent: #1b4dd8;
  --accent-soft: #edf1ff;
  --alarm: #a63c17;     /* 6,40 auf Weiß · 5,67 auf Rost-Fläche (gemessen) */
  --alarm-soft: #fbefe8;
  --alarm-line: #ecc9b5;
  --good: #1b6b3e;
  --good-soft: #e8f2ec;

  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;

  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shadow-1: 0 1px 2px rgba(20, 24, 29, 0.05);
  --shadow-2: 0 14px 34px -10px rgba(20, 24, 29, 0.24), 0 2px 6px rgba(20, 24, 29, 0.08);

  --z-menu: 20;
  --z-bar: 30;
  --z-flash: 40;
  --z-skip: 50;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font-family: var(--sans); font-size: 0.9375rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; }
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: #163fae; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
p { margin: 0; }

.ico { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: var(--z-skip); background: var(--surface);
  color: var(--text); padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); }
.skip:focus { left: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.soft { color: var(--muted); }

/* ============================================================================
   Kopfleiste
   ========================================================================== */

.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: var(--z-bar); }
.topbar :focus-visible { outline-color: #fff; }
.topbar-in { display: flex; align-items: center; gap: 28px; min-height: 60px; }
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 1rem; letter-spacing: -0.012em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand:hover { color: #fff; }
.mainnav { display: flex; gap: 4px; }
.navlink {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px;
  border-radius: var(--r-sm); color: rgba(255, 255, 255, 0.72); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500; transition: background-color 140ms ease, color 140ms ease;
}
.navlink:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.navlink[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.15); }
.navcount { font-family: var(--mono); font-size: 0.6875rem; font-weight: 600; line-height: 1;
  padding: 3px 6px; border-radius: 20px; background: #b44a22; color: #fff;   /* 5,33 : 1, Fläche gegen Tinte 3,35 : 1 (gemessen) */ font-variant-numeric: tabular-nums; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.tools form { margin: 0; }
.toollink, .toolbtn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 40px;
  padding: 8px 10px; border-radius: var(--r-sm); border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.66); text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}
.toollink:hover, .toolbtn:hover, .toollink[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.09); }

.demobar { background: #fbf3dc; color: #6b4d00; border-bottom: 1px solid #efe1b4; font-size: 0.8125rem; }
.demobar .wrap { padding-top: 8px; padding-bottom: 8px; }

/* ============================================================================
   Meldung
   ========================================================================== */

.flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-flash);
  max-width: calc(100vw - 32px); background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: 0.875rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.flash::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #62c08d; }

/* ============================================================================
   Seitenkopf
   ========================================================================== */

.head { padding: 34px 0 6px; }
.head-tight { padding-top: 12px; }
.eyebrow { margin: 0 0 8px; font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted-2); }
h1 { margin: 0; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem); line-height: 1.15; font-weight: 600;
  letter-spacing: -0.022em; }
.h1-count { color: var(--alarm); font-variant-numeric: tabular-nums; }
.h1-calm { color: var(--good); }
.h1-sub { font-weight: 400; color: var(--muted); letter-spacing: -0.01em; }
.lede { margin-top: 10px; max-width: 62ch; color: var(--muted); font-size: 0.9375rem; }
.lede a { display: inline-flex; align-items: center; gap: 6px; }
.lede .ico { width: 13px; height: 13px; }
.crumb { padding: 22px 0 0; font-size: 0.875rem; }
.crumb a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); text-decoration: underline; }
.crumb .ico { width: 13px; height: 13px; }
.count { font-family: var(--mono); font-size: 0.6875rem; font-weight: 500; color: var(--muted);
  background: var(--line-soft); padding: 2px 7px; border-radius: 20px; font-variant-numeric: tabular-nums;
  vertical-align: 2px; letter-spacing: 0; }

/* ============================================================================
   Wochenleiste: heute, sechs Tage, danach „Später"
   ========================================================================== */

.week { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin: 24px 0 0; }
.wday {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  text-decoration: none; color: var(--text); min-width: 0;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.wday:hover { border-color: #cfcfca; color: var(--text); }
.wday.is-weekend { background: var(--surface-2); }
.wday-name { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wday .kurz { display: none; }
.wday-date { white-space: nowrap; font-family: var(--mono); font-size: 0.6875rem; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.wday-n { margin-top: 3px; font-family: var(--mono); font-size: 0.75rem; font-weight: 600; line-height: 20px;
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; text-align: center;
  background: var(--ink); color: #fff; font-variant-numeric: tabular-nums; }
.wday-n.is-zero { visibility: hidden; }   /* keine Nullen: leer heißt nichts fällig */
.wday.is-today .wday-n:not(.is-zero) { background: var(--alarm); }
.wday.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.wday.is-on .wday-date { color: rgba(255, 255, 255, 0.66); }
.wday.is-on .wday-n { background: #fff; color: var(--ink); }


.listtitle { margin: 28px 0 12px; padding: 0 2px; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }

/* ============================================================================
   Zeilen der Tagesliste
   ========================================================================== */

.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.row { display: grid; grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "chip main" "chip act";
  border-top: 1px solid var(--line-soft); }
.row:first-child { border-top: 0; }
.row:first-child .chip { border-top-left-radius: var(--r-lg); }
.row:last-child .chip { border-bottom-left-radius: var(--r-lg); }

.chip { grid-area: chip; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 16px 6px; background: var(--surface-2); border-right: 1px solid var(--line-soft); text-align: center; }
.chip-n { font-family: var(--mono); font-size: 1.625rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em;
  color: var(--ink); font-variant-numeric: tabular-nums; }
.chip-w { font-family: var(--mono); font-size: 0.875rem; font-weight: 600; line-height: 1; color: var(--ink); }
.chip-l { font-size: 0.625rem; line-height: 1.25; color: var(--muted-2); }
.row-antwort .chip { background: var(--alarm-soft); border-right-color: var(--alarm-line); }
.row-antwort .chip-n, .row-antwort .chip-w, .row-antwort .chip-l { color: var(--alarm); }
.row.is-done .chip-n { color: var(--muted-2); }

.rowmain { grid-area: main; padding: 16px 20px 0; min-width: 0; }
.rowhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.rowname { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.014em; color: var(--text); text-decoration: none; }
.rowname:hover { color: var(--accent); text-decoration: underline; }
.rowperson { font-size: 0.875rem; color: var(--muted); }
.rowtag { font-size: 0.75rem; color: var(--muted); padding: 1px 8px; border: 1px solid var(--line); border-radius: 20px; }
.rowsum { margin-top: 4px; font-size: 0.875rem; color: var(--ink-soft); max-width: 70ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rowwhy { margin-top: 6px; font-size: 0.8125rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 0; }
.rowwhy .why { font-weight: 500; }
.row-antwort .rowwhy .why { color: var(--alarm); }
.rowwhy .due { color: var(--alarm); }
.rowwhy .due::before { content: "·"; margin: 0 8px; color: var(--muted-2); }

.row .acts { grid-area: act; padding: 12px 20px 16px; }

@media (min-width: 880px) {
  .row { grid-template-columns: 84px minmax(0, 1fr) auto; grid-template-areas: "chip main act"; }
  .rowmain { padding: 16px 12px 16px 20px; }
  .row .acts { padding: 16px 20px 16px 8px; align-self: center; flex-wrap: nowrap; }
}

/* ============================================================================
   Knöpfe und Klappmenüs
   ========================================================================== */

.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.acts form { margin: 0; }
.btn, .menu > summary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 13px;
  font: inherit; font-size: 0.8125rem; font-weight: 500; white-space: nowrap; text-decoration: none;
  color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn:hover, .menu > summary:hover { background: var(--surface-2); border-color: #cfcfca; color: var(--ink); }
.btn .ico, .menu > summary .ico { width: 14px; height: 14px; opacity: 0.7; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #262c34; border-color: #262c34; color: #fff; }
.btn-primary .ico { opacity: 0.9; }
.btn-lg { min-height: 44px; padding: 10px 18px; font-size: 0.9375rem; }
.acts-lg .btn, .acts-lg .menu > summary { min-height: 42px; padding: 9px 16px; font-size: 0.875rem; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 5px; height: 5px; margin-left: 1px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: 0.5; }
.menu[open] > summary { background: var(--ink); border-color: var(--ink); color: #fff; }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-menu); min-width: 232px;
  max-width: calc(100vw - 28px); padding: 6px; margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 1px;
}
.menu-body.flip { right: auto; left: 0; }
.menu-head { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted-2); padding: 7px 10px 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px;
  font: inherit; font-size: 0.875rem; text-align: left; background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text); cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .mi-hint { margin-left: auto; font-family: var(--mono); font-size: 0.6875rem; color: var(--muted-2); white-space: nowrap; }
.menu-item.is-good:hover { background: var(--good-soft); color: var(--good); }
.menu-item.is-strong { color: var(--accent); font-weight: 500; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 4px 2px; }
.menu-date { display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 6px; font-size: 0.8125rem; color: var(--muted); }

/* ============================================================================
   Altbestand-Hinweis
   ========================================================================== */

.backlog {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  margin: 20px 0 0; padding: 16px 20px; background: var(--surface); border: 1px dashed #cfcfca;
  border-radius: var(--r-lg); color: var(--text); text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.backlog:hover { border-color: var(--muted-2); background: var(--surface-2); color: var(--text); }
.backlog-n { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; line-height: 1; color: var(--muted); min-width: 40px; text-align: center; }
.backlog-t { font-size: 0.875rem; color: var(--muted); }
.backlog-t strong { display: block; color: var(--text); font-weight: 600; font-size: 0.9375rem; }
.backlog-go { display: inline-flex; align-items: center; gap: 4px; font-size: 0.875rem; font-weight: 500; color: var(--accent); white-space: nowrap; }
.backlog-go .ico { width: 14px; height: 14px; }

/* ============================================================================
   Leer
   ========================================================================== */

.empty { padding: 28px 24px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg);
  color: var(--muted); font-size: 0.9375rem; }
.empty-t { color: var(--text); font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.empty.is-good { border-style: solid; background: var(--good-soft); border-color: #cfe3d6; }
.empty.is-good .empty-t { color: var(--good); }
.empty.is-good p { color: #3d5a47; }

/* ============================================================================
   Alle Kontakte
   ========================================================================== */

.tablebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 24px 0 14px; }
.tablebar-note { font-size: 0.8125rem; color: var(--muted); }
.search { display: flex; gap: 6px; flex: 1 1 280px; max-width: 420px; margin: 0; }
.search input { flex: 1 1 auto; min-width: 0; }

.ktable { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; font-size: 0.875rem; }
.ktable th { text-align: left; padding: 11px 16px; font-family: var(--mono); font-size: 0.625rem; font-weight: 500;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.ktable td { padding: 13px 16px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.ktable tbody tr:first-child td { border-top: 0; }
.ktable tbody tr { cursor: pointer; transition: background-color 120ms ease; }
.ktable tbody tr:hover { background: var(--surface-2); }
.k-who { width: 26%; }
.k-who a { font-weight: 600; color: var(--text); text-decoration: none; }
.k-who a:hover { color: var(--accent); text-decoration: underline; }
.k-who span, .k-last span { display: block; font-size: 0.8125rem; color: var(--muted); }
.k-topic { color: var(--ink-soft); }
.k-topic { display: table-cell; }
.k-last { width: 15%; white-space: nowrap; }
.k-last strong { font-weight: 600; }
.k-next { width: 17%; white-space: nowrap; color: var(--muted); }
.k-next.is-due { color: var(--alarm); font-weight: 600; }
.k-next.is-closed { color: var(--good); }
tr.is-done .k-who a { color: var(--muted); }

/* ============================================================================
   Ein Kontakt
   ========================================================================== */

.stand { margin: 18px 0 0; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.stand.is-waiting { border-left-color: var(--alarm); }
.stand-topic { font-size: 1.0625rem; line-height: 1.5; color: var(--text); max-width: 70ch; }
.stand-facts { margin: 16px 0 18px; display: flex; flex-wrap: wrap; gap: 12px 36px; }
.stand-facts > div { display: flex; flex-direction: column; gap: 2px; }
.stand-facts dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); }
.stand-facts dd { margin: 0; font-size: 0.9375rem; }
.stand-facts dd.is-due { color: var(--alarm); font-weight: 600; }
.stand-facts .soft { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px;
  margin: 16px 0; box-shadow: var(--shadow-1); }
.card > h2 { margin: 0 0 14px; font-size: 0.9375rem; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.card-tool { margin: -4px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; margin-top: 22px; }
.cards > .card { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line-soft); }
.tl { position: relative; padding: 0 0 18px 16px; }
.tl:last-child { padding-bottom: 0; }
.tl::before { content: ""; position: absolute; left: -24px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted-2); }
.tl-out::before { background: var(--ink); border-color: var(--ink); }
.tl-in::before { background: var(--alarm); border-color: var(--alarm); }
.tl-notiz::before, .tl-schritt::before { width: 8px; height: 8px; left: -23px; top: 6px; }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.tl-dir { font-size: 0.8125rem; font-weight: 600; }
.tl-in .tl-dir { color: var(--alarm); }
.tl-notiz .tl-dir, .tl-schritt .tl-dir { color: var(--muted); font-weight: 500; }
.tl-date { font-family: var(--mono); font-size: 0.75rem; color: var(--muted-2); }
.tl-subject { margin-top: 2px; font-weight: 500; }
.tl-note { margin-top: 2px; color: var(--ink-soft); font-size: 0.875rem; }
.tl-more { margin-top: 4px; }
.tl-more > summary { cursor: pointer; font-size: 0.8125rem; color: var(--accent); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.tl-more > summary::-webkit-details-marker { display: none; }
.tl-more > summary::after { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.tl-more[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.tl-body { white-space: pre-wrap; margin: 8px 0 0; padding: 12px 14px; font-family: var(--sans); font-size: 0.875rem;
  line-height: 1.6; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  color: var(--ink-soft); max-height: 360px; overflow: auto; }

/* ============================================================================
   Mail schreiben
   ========================================================================== */

.write { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 18px; align-items: start; }
.write > .card { margin: 0; }
@media (min-width: 960px) { .write { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.write-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.write-alt { margin-top: 12px; font-size: 0.875rem; }
.write-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 0.8125rem; color: var(--muted); }
.write-context .tl-body { max-height: 420px; }

/* ============================================================================
   Formulare
   ========================================================================== */

.field { margin: 0 0 14px; }
.field > label, .field-label { display: block; margin: 0 0 6px; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.field-static { font-size: 0.9375rem; }
.field-row { display: flex; gap: 8px; }
.field-row > input, .field-row > select { flex: 1 1 auto; min-width: 0; }
input[type="text"], input[type="search"], input[type="password"], input[type="date"], input[type="email"], select, textarea {
  font: inherit; font-size: 0.9375rem; padding: 9px 12px; width: 100%; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
input:hover, select:hover, textarea:hover { border-color: #cfcfca; }
textarea { line-height: 1.6; resize: vertical; }
.hint { margin: 0 0 14px; color: var(--muted); font-size: 0.875rem; }
.hint code, code { font-family: var(--mono); font-size: 0.8125rem; background: var(--line-soft); padding: 1px 5px; border-radius: 4px; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px; }
.linklike:hover { color: #163fae; }
.warn { color: var(--alarm); font-weight: 500; }

.facts { margin: 0; display: grid; gap: 14px; }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); }
.facts dd { margin: 0; font-size: 0.875rem; overflow-wrap: anywhere; }
.log { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.log th { text-align: left; padding: 0 12px 7px 0; font-weight: 500; font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid var(--line); }
.log td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--muted); }
.log tr:last-child td { border-bottom: 0; }
.log td:first-child { font-family: var(--mono); font-size: 0.75rem; white-space: nowrap; color: var(--text); }

/* ============================================================================
   Fußzeile
   ========================================================================== */

.foot { margin-top: 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8125rem; }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding-top: 16px; padding-bottom: 28px; }
.livedot { width: 8px; height: 8px; border-radius: 50%; background: #3f9b6b; flex: none; }
.livedot.is-warn { background: #d08a33; }
.foot-sep { color: var(--muted-2); }

/* ============================================================================
   Anmeldung
   ========================================================================== */

.login-body { margin: 0; min-height: 100vh; padding: 24px; display: grid; place-items: center; background: var(--ink); }
.login { width: 100%; max-width: 348px; background: var(--surface); border-radius: 14px; padding: 30px 28px 26px;
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.5); }
.login-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--ink); display: grid; place-items: center; margin-bottom: 16px; }
.login-mark .ico { width: 18px; height: 18px; }
.login h1 { font-size: 1.25rem; margin: 0 0 3px; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.875rem; }
.login .btn { width: 100%; margin-top: 4px; }
.error { margin: 6px 0 0; color: var(--alarm); font-size: 0.8125rem; font-weight: 500; }

/* ============================================================================
   Schmale Bildschirme
   ========================================================================== */

@media (max-width: 719px) {
  .wrap { padding: 0 16px; }
  .topbar-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand tools" "nav nav";
    gap: 0 12px; padding-top: 6px; padding-bottom: 6px; }
  .brand { grid-area: brand; }
  .tools { grid-area: tools; }
  .mainnav { grid-area: nav; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding-top: 4px; }
  .navlink { justify-content: center; }
  .head { padding-top: 24px; }
  .week { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .week .wday:nth-child(6), .week .wday:nth-child(7) { display: none; }
  .wday { padding: 9px 2px 8px; }
  .wday-name { font-size: 0.75rem; }
  .row { grid-template-columns: 64px minmax(0, 1fr); }
  .chip { padding: 14px 4px; }
  .chip-n { font-size: 1.3125rem; }
  .chip-l { font-size: 0.5625rem; }
  .rowmain { padding: 14px 14px 0; }
  .row .acts { padding: 12px 14px 14px; }
  .btn, .menu > summary { min-height: 40px; }
  /* Menüs klappen am Handy unter der ganzen Knopfreihe auf, nie seitlich aus dem Bild */
  .row .acts, .stand .acts { position: relative; }
  .menu { position: static; }
  .menu-body, .menu-body.flip { left: 0; right: 0; min-width: 0; max-width: none; }
  .backlog { grid-template-columns: auto minmax(0, 1fr); }
  .backlog-go { grid-column: 2; }
  .stand { padding: 18px 16px; }
  .card { padding: 16px; }
  /* Tabelle wird zur Kartenliste */
  .ktable, .ktable tbody, .ktable tr, .ktable td { display: block; width: auto; }
  .ktable thead { display: none; }
  .ktable tr { padding: 12px 14px; border-top: 1px solid var(--line-soft); }
  .ktable tbody tr:first-child { border-top: 0; }
  .ktable td { padding: 0; border: 0; }
  .ktable .k-topic { margin: 3px 0 6px; font-size: 0.8125rem; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; }
  .ktable .k-last, .ktable .k-next { display: inline; font-size: 0.8125rem; }
  .ktable .k-last span { display: inline; margin-left: 4px; }
  .ktable .k-next::before { content: "·"; margin: 0 8px; color: var(--muted-2); font-weight: 400; }
}

@media (max-width: 420px) {
  .wday .lang { display: none; }
  .wday .kurz { display: inline; }
}

@media (max-width: 380px) {
  .btn, .menu > summary { padding: 7px 10px; font-size: 0.78125rem; }
  .rowname { font-size: 1rem; }
  .tools .toolbtn { padding: 8px 6px; }
}

@media (min-width: 720px) {
  .k-topic { display: table-cell; }
  .ktable td.k-topic { max-width: 0; }
  .ktable .k-topic { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------------------------------------------------------------------------
   Einrichtung: Postfach verbinden
   ------------------------------------------------------------------------ */
.setup { max-width: 560px; margin-top: 22px; }
.setup .btn-lg { min-width: 200px; justify-content: center; }
.setup-foot { max-width: 560px; margin: 14px 0 0; padding: 0 2px; font-size: 0.8125rem; color: var(--muted); }
.setup-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.field-hint { margin: 6px 0 0; font-size: 0.8125rem; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 0 10px; }
input:disabled { background: var(--surface-2); color: var(--muted-2); cursor: not-allowed; }

.notice { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); font-size: 0.875rem; }
.notice p + p, .notice p + dl, .notice dl + p { margin-top: 6px; }
.notice-t { font-weight: 600; color: var(--text); }
.notice.is-bad { background: var(--alarm-soft); border-color: var(--alarm-line); color: #6e2a10; }
.notice.is-bad .notice-t { color: var(--alarm); }
.notice.is-good { background: var(--good-soft); border-color: #cfe3d6; }
.notice.is-good .notice-t { color: var(--good); }

.setup-facts { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.setup-facts > div { display: flex; flex-direction: column; gap: 1px; }
.setup-facts dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.setup-facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

.more { margin: 2px 0 18px; }
.more > summary { cursor: pointer; font-size: 0.875rem; color: var(--accent); width: max-content; max-width: 100%; }
.more[open] > summary { margin-bottom: 12px; }

.check, .field > label.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9375rem; color: var(--text) !important;
  font-weight: 400 !important; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--ink); }
.check-follow { margin-top: 8px; }

.bar { height: 10px; margin: 14px 0 10px; background: var(--line-soft); border-radius: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 10px; transition: width 400ms ease; }
.bar.is-unbestimmt > span { width: 30% !important; animation: gleiten 1.4s ease-in-out infinite; }
@keyframes gleiten { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.stand-schritt { font-size: 1rem; font-weight: 600; }
.stand-zahl { margin: 0; font-variant-numeric: tabular-nums; }
.result-big { font-size: 1.25rem; letter-spacing: -0.01em; margin-bottom: 12px; }
.result-big strong { font-family: var(--mono); font-weight: 600; }
.setup .result-big + .setup-facts { margin-bottom: 16px; }
.demobar a { color: inherit; font-weight: 600; margin-left: 6px; }

@media (max-width: 480px) {
  .field-grid { grid-template-columns: minmax(0, 1fr) 80px; }
  .setup .btn-lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
