/* Zielregister – Gestaltung
   Desktop/Beamer zuerst, mobil nutzbar. Größen in rem, damit der
   Präsentationsmodus (html.present) alles gemeinsam vergrößert. */

* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --line: #e4e7ee;
  --line-strong: #d3d8e2;
  --text: #0f172a;
  --text-2: #3b4658;
  --muted: #6b7486;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #4f46e514;
  --accent-line: #4f46e559;
  --link: #3f51e0;
  --error: #dc2626;
  --success: #15803d;

  --green: #15803d;
  --green-dot: #22c55e;
  --green-soft: #22c55e1f;
  --amber: #b45309;
  --amber-dot: #f59e0b;
  --amber-soft: #f59e0b24;
  --red: #b91c1c;
  --red-dot: #ef4444;
  --red-soft: #ef44441a;
  --grey-dot: #cbd2dd;
  --grey-soft: #94a3b81a;
  --done: #2563eb;
  --done-dot: #2563eb;
  --done-soft: #2563eb17;
  --today: #e11d48;

  --radius: 14px;
  --shadow-sm: 0 1px 2px #0f172a0d, 0 1px 1px #0f172a08;
  --shadow-md: 0 4px 14px #0f172a14;
  --shadow-lg: 0 18px 48px #0f172a24;
  --appbar-h: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d13;
    --surface: #151922;
    --surface-2: #1b202b;
    --line: #262c39;
    --line-strong: #343b4b;
    --text: #e9ecf3;
    --text-2: #c0c7d4;
    --muted: #8c94a6;
    --accent: #8b87ff;
    --accent-strong: #a5a2ff;
    --accent-soft: #8b87ff1f;
    --accent-line: #8b87ff66;
    --link: #a5a2ff;
    --error: #f87171;
    --success: #4ade80;
    --green: #4ade80;
    --green-dot: #22c55e;
    --green-soft: #22c55e24;
    --amber: #fbbf24;
    --amber-dot: #fbbf24;
    --amber-soft: #fbbf2424;
    --red: #f87171;
    --red-dot: #ef4444;
    --red-soft: #ef444429;
    --grey-dot: #3d4556;
    --grey-soft: #94a3b81a;
    --done: #60a5fa;
    --done-dot: #3b82f6;
    --done-soft: #3b82f626;
    --today: #fb7185;
    --shadow-sm: 0 1px 2px #0000004d;
    --shadow-md: 0 6px 18px #00000059;
    --shadow-lg: 0 22px 60px #00000080;
  }
}

html { font-size: 16px; }
html.present { font-size: 19px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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

/* ---------- Grundelemente ---------- */

button { font: inherit; color: inherit; cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--line-strong); color: var(--text); }
.btn-text { background: none; color: var(--link); padding-inline: 0.4rem; }
.btn-text:hover { text-decoration: underline; }
.btn-danger { background: none; color: var(--error); padding-inline: 0.4rem; }
.btn-danger:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.icon-btn.plain { border-color: transparent; background: none; width: 2rem; height: 2rem; }
.icon-btn.plain:hover { background: var(--surface-2); }
.icon-btn.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.icon-btn.accent:hover { background: var(--accent); color: #fff; }

.field { display: block; margin-bottom: 0.9rem; }
.field > span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.actions.split { justify-content: space-between; }

.message { margin: 0.5rem 0 0; font-size: 0.88rem; }
.message:empty { display: none; }
.message.error { color: var(--error); }
.message.success { color: var(--success); }

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(60rem 30rem at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(50rem 30rem at 110% 110%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.login-card .brand { margin-bottom: 1.5rem; }
.login-card .btn { width: 100%; margin-top: 0.25rem; padding-block: 0.7rem; }
.loading { min-height: 100vh; display: grid; place-items: center; margin: 0; color: var(--muted); }

/* ---------- Kopfleiste ---------- */

.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.brand-logo { width: 2.25rem; height: 2.25rem; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1.1rem; letter-spacing: -0.01em; }
.brand-text span {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-actions { display: flex; align-items: center; gap: 0.6rem; }

.user-menu { position: relative; }
.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: 16rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 0.9rem;
  z-index: 40;
}
.popover-name { font-weight: 700; }
.popover-role { font-size: 0.85rem; color: var(--text-2); margin-top: 0.15rem; }
.popover-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.4rem; overflow-wrap: anywhere; }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 0.75rem 0 0.5rem; }
.popover .btn { width: 100%; justify-content: flex-start; padding-inline: 0.5rem; }

/* ---------- Steuerung: Themenfelder + Jahresleiste ---------- */

.controls {
  max-width: 88rem;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 0.5rem;
}

.tf-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}
.tf-chip {
  --tf: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.35rem 0.85rem 0.35rem 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.tf-chip:hover { border-color: var(--line-strong); color: var(--text); }
.tf-chip .tf-num {
  display: inline-grid;
  place-items: center;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tf) 14%, transparent);
  color: var(--tf);
  font-size: 0.78rem;
  font-weight: 800;
}
.tf-chip .tf-count { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.tf-chip.is-active {
  background: var(--tf);
  border-color: var(--tf);
  color: #fff;
}
.tf-chip.is-active .tf-num { background: #ffffff2e; color: #fff; }
.tf-chip.is-active .tf-count { color: #ffffffc0; }
.tf-chip.all { padding-left: 0.85rem; }

/* Jahresleiste */
.year-rail-wrap {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}
.year-all {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0 0.9rem;
}
.year-all.is-active { background: var(--accent); color: #fff; }
.year-rail {
  position: relative;
  flex: 1;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
.year-cell {
  position: relative;
  flex: 1 0 4.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 10px;
  background: none;
  padding: 0.45rem 0.25rem 0.5rem;
  transition: background 0.15s;
}
.year-cell:hover:not(:disabled) { background: var(--surface-2); }
.year-cell:disabled { cursor: default; }
.year-cell.is-empty { flex: 0.55 0 2.6rem; }
.year-cell .y {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.year-cell.is-empty .y { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.year-cell .dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  min-height: 9px;
  max-width: 4rem;
}
.year-cell .dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grey-dot);
}
.year-cell .dots i.gruen { background: var(--green-dot); }
.year-cell .dots i.gelb { background: var(--amber-dot); }
.year-cell .dots i.rot { background: var(--red-dot); }
.year-cell .now-tag {
  position: absolute;
  top: -0.15rem;
  right: 0.2rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--today);
}
.year-cell.is-now::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0.1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--today);
}
.year-cell.is-active { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.year-cell.is-active .y { color: var(--accent); }

/* ---------- Arbeitsfläche ---------- */

.workspace {
  max-width: 88rem;
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 3vw, 2rem) 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}
.timeline-pane { min-width: 0; max-width: 60rem; width: 100%; margin: 0 auto; }

@media (min-width: 1100px) {
  .workspace.has-detail { grid-template-columns: minmax(22rem, 5fr) minmax(28rem, 7fr); }
  .workspace.has-detail .timeline-pane { max-width: none; }
}

.app-message:empty { display: none; }
.app-message { margin: 0.5rem 0 1rem; }

.source { font-size: 0.78rem; color: var(--muted); margin-top: 2.5rem; }
html.present .source { display: none; }

/* ---------- Zeitleiste ---------- */

.year-group {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0 0.75rem;
  margin-top: 0.5rem;
}
.year-head {
  position: sticky;
  top: calc(var(--appbar-h) + 0.75rem);
  align-self: start;
  padding-top: 0.85rem;
  text-align: right;
}
.year-head .y {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.year-head .n { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 0.35rem; }

.year-rows {
  position: relative;
  margin-left: 0.6rem;
  padding: 0.5rem 0 0.5rem 1.75rem;
  border-left: 2px solid var(--line);
  min-width: 0;
}

.year-gap {
  grid-column: 2;
  margin-left: 0.6rem;
  padding: 0.6rem 0 0.6rem 1.75rem;
  border-left: 2px dashed var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.q-label {
  position: relative;
  margin: 0.9rem 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.q-label:first-child { margin-top: 0.2rem; }
.q-label::before {
  content: "";
  position: absolute;
  left: -1.85rem;
  top: 50%;
  width: 0.7rem;
  border-top: 2px solid var(--line);
}

.goal-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 1.25rem;
  width: 100%;
  margin: 0.45rem 0;
  padding: 0.85rem 1.1rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.goal-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.goal-row.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
}

/* Ampelpunkt sitzt auf der Zeitachse */
.goal-row .dot {
  --dot: var(--grey-dot);
  position: absolute;
  left: calc(-1.75rem - 1px - 0.55rem);
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: -0.55rem;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 4px var(--bg);
}
.goal-row.ampel-gruen .dot { --dot: var(--green-dot); }
.goal-row.ampel-gelb .dot { --dot: var(--amber-dot); }
.goal-row.ampel-rot .dot { --dot: var(--red-dot); }
.goal-row.ampel-none .dot { background: var(--surface); box-shadow: 0 0 0 4px var(--bg), inset 0 0 0 2.5px var(--grey-dot); }

.goal-row .main { min-width: 0; }
.goal-row .next-tag {
  display: inline-block;
  margin-bottom: 0.25rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.goal-row .title {
  display: block;
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--text);
}
.goal-row .tf-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.goal-row .tf-tag::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 3px;
  background: var(--tf, var(--accent));
}
.goal-row .due { text-align: right; white-space: nowrap; }
.goal-row .due strong { display: block; font-size: 0.92rem; font-weight: 700; color: var(--text); }
.goal-row .due small { display: block; font-size: 0.78rem; color: var(--muted); }
.goal-row .due small.overdue { color: var(--red); font-weight: 600; }

.goal-row.is-next {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent-line), var(--shadow-md);
}
.goal-row.is-next.is-selected { border-color: var(--accent); }

.today-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--today);
}
.today-line::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 1px - 0.4rem);
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--today);
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px color-mix(in srgb, var(--today) 25%, transparent);
}
.today-line::after { content: ""; flex: 1; border-top: 2px solid var(--today); opacity: 0.55; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

/* Schmale Spalte (Panel offen) und Mobil: Frist unter den Titel */
@media (max-width: 680px) {
  .goal-row { grid-template-columns: minmax(0, 1fr); }
  .goal-row .due { text-align: left; display: flex; gap: 0.5rem; align-items: baseline; }
  .goal-row .due strong, .goal-row .due small { display: inline; }
  .year-group { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .year-head .y { font-size: 1.2rem; }
}
@media (min-width: 1100px) {
  .workspace.has-detail .goal-row { grid-template-columns: minmax(0, 1fr); }
  .workspace.has-detail .goal-row .due { text-align: left; display: flex; gap: 0.5rem; align-items: baseline; }
  .workspace.has-detail .goal-row .due strong,
  .workspace.has-detail .goal-row .due small { display: inline; }
  .workspace.has-detail .year-group { grid-template-columns: 4rem minmax(0, 1fr); }
  .workspace.has-detail .year-head .y { font-size: 1.35rem; }
}

/* ---------- Detail-Panel ---------- */

.detail-panel {
  position: sticky;
  top: calc(var(--appbar-h) + 0.75rem);
  max-height: calc(100vh - var(--appbar-h) - 1.5rem);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: panel-in 0.22s ease-out;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateX(1.25rem); }
  to { opacity: 1; transform: none; }
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.panel-pos {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: 0 0.25rem;
}
.panel-hint { font-size: 0.72rem; color: var(--muted); margin-left: auto; margin-right: 0.5rem; }
.panel-hint kbd {
  font: inherit;
  font-size: 0.68rem;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.3rem;
  background: var(--surface-2);
}

.panel-body {
  overflow-y: auto;
  padding: 1.5rem 1.75rem 2rem;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .tf-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tf) 13%, transparent);
  color: var(--tf);
}
.detail-title {
  margin-top: 0.6rem;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.detail-title:focus { outline: none; }
.deadline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-2);
}
.deadline strong { color: var(--text); }
.deadline svg { width: 1rem; height: 1rem; color: var(--muted); }
.deadline .rel {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.deadline .rel.overdue { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.owner { margin-top: 0.4rem; font-size: 0.85rem; color: var(--muted); }

/* Status-Karte (Ebene 2) */
.status-hero {
  --tone: var(--grey-dot);
  --tone-soft: var(--grey-soft);
  --tone-text: var(--text-2);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.1rem;
  margin-top: 1.5rem;
  padding: 1.25rem 1.4rem;
  border-radius: 18px;
  background: var(--tone-soft);
  border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
}
.status-hero.ampel-gruen { --tone: var(--green-dot); --tone-soft: var(--green-soft); --tone-text: var(--green); }
.status-hero.ampel-gelb { --tone: var(--amber-dot); --tone-soft: var(--amber-soft); --tone-text: var(--amber); }
.status-hero.ampel-rot { --tone: var(--red-dot); --tone-soft: var(--red-soft); --tone-text: var(--red); }
.status-hero .lamp {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 22%, transparent),
              0 0 28px color-mix(in srgb, var(--tone) 55%, transparent);
}
.status-hero.ampel-none .lamp {
  background: none;
  box-shadow: inset 0 0 0 3px var(--grey-dot);
}
.status-hero .label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--tone-text);
  line-height: 1.2;
}
.status-hero .label span { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-left: 0.4rem; }
.status-hero .text {
  margin: 0.55rem 0 0;
  font-size: 1.02rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--text);
}
.status-hero .meta { margin-top: 0.6rem; font-size: 0.78rem; color: var(--muted); }

.status-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 0.75rem;
}
.draft-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.draft-note::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 2px dashed var(--muted);
}

/* Abschnitte */
.section { margin-top: 1.75rem; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.section-head h3 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Referenzen */
.ref-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.ref-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.ref-item:hover { border-color: var(--line-strong); background: var(--surface-2); }
.ref-icon {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.ref-icon svg { width: 1rem; height: 1rem; }
.ref-main { flex: 1; min-width: 0; }
.ref-main a {
  display: block;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.ref-main a:hover { color: var(--link); text-decoration: underline; }
.ref-main a::after { content: " ↗"; color: var(--muted); font-weight: 400; }
.ref-host { display: block; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.ref-empty { font-size: 0.88rem; color: var(--muted); padding: 0.25rem 0; }

.inline-form {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

/* Aufklappbare Ebene 3 */
.folds { margin-top: 2rem; border-top: 1px solid var(--line); }
.fold { border-bottom: 1px solid var(--line); }
.fold > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 0.1rem;
  cursor: pointer;
  list-style: none;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--text-2);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
  margin: 0 0.2rem;
}
.fold[open] > summary::before { transform: rotate(45deg); }
.fold > summary:hover { color: var(--text); }
.fold > summary .count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.fold-body { padding: 0.25rem 0.1rem 1.25rem; }

blockquote {
  margin: 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 12px 12px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 1rem 0 0;
  font-size: 0.86rem;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--text-2); }

/* Status-Editor */
.ampel-select { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 1rem; padding: 0; border: 0; }
.ampel-select legend { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem; padding: 0; }
.ampel-option { position: relative; }
.ampel-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ampel-option span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  font-weight: 650;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ampel-option span::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--o);
}
.ampel-option.gruen { --o: var(--green-dot); --os: var(--green-soft); }
.ampel-option.gelb { --o: var(--amber-dot); --os: var(--amber-soft); }
.ampel-option.rot { --o: var(--red-dot); --os: var(--red-soft); }
.ampel-option input:checked + span { background: var(--os); border-color: var(--o); }
.ampel-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.autosave { font-size: 0.78rem; color: var(--muted); margin: -0.25rem 0 0.75rem; min-height: 1em; }

/* Verlauf */
.history { list-style: none; margin: 0; padding: 0 0 0 0.9rem; border-left: 2px solid var(--line); }
.history-item { position: relative; padding: 0 0 1.1rem 1rem; }
.history-item:last-child { padding-bottom: 0.25rem; }
.history-item::before {
  content: "";
  position: absolute;
  left: calc(-0.9rem - 1px - 0.4rem);
  top: 0.3rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--h, var(--grey-dot));
  box-shadow: 0 0 0 3px var(--surface);
}
.history-item.gruen { --h: var(--green-dot); }
.history-item.gelb { --h: var(--amber-dot); }
.history-item.rot { --h: var(--red-dot); }
.history-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.history-head strong { font-size: 0.92rem; }
.history-head .spacer { flex: 1; }
.history-text { margin: 0.3rem 0; white-space: pre-wrap; font-size: 0.92rem; color: var(--text-2); }
.history-meta { font-size: 0.75rem; color: var(--muted); }
.tag {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Rückfrage-Dialog ---------- */

dialog.confirm {
  width: min(26rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.confirm::backdrop { background: #0f172a66; backdrop-filter: blur(2px); }
dialog.confirm form { padding: 1.5rem; }
dialog.confirm h2 { font-size: 1.15rem; }
dialog.confirm p { margin: 0.6rem 0 1.4rem; color: var(--text-2); }

/* ---------- Mobil: Panel als Vollbild ---------- */

@media (max-width: 1099px) {
  .detail-panel {
    position: fixed;
    inset: 0;
    z-index: 30;
    max-height: none;
    border-radius: 0;
    border: 0;
    animation-name: panel-in-mobile;
  }
  @keyframes panel-in-mobile {
    from { transform: translateX(100%); }
    to { transform: none; }
  }
  .panel-hint { display: none; }
  .panel-body { padding: 1.25rem 1.1rem 2.5rem; }
  .detail-title { font-size: 1.35rem; }
}

@media (max-width: 680px) {
  .brand-text span { display: none; }
  #present-button .label { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .year-rail-wrap { padding: 0.4rem; }
  .year-all { padding: 0 0.6rem; font-size: 0.78rem; max-width: 4.5rem; white-space: normal; line-height: 1.2; }
  .status-hero { gap: 0.85rem; padding: 1rem; }
  .status-hero .lamp { width: 2rem; height: 2rem; }
  .status-hero .text { font-size: 0.98rem; }
}

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


/* ---------- Ampel-Zustand „erreicht“ ---------- */

.goal-row.ampel-erreicht .dot { --dot: var(--done-dot); }
.goal-row.ampel-erreicht .dot::after,
.status-hero.ampel-erreicht .lamp::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 26%;
  height: 48%;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
.goal-row.ampel-erreicht .title { color: var(--text-2); }
.goal-row .due small.done { color: var(--done); font-weight: 700; }
.year-cell .dots i.erreicht { background: var(--done-dot); }
.status-hero .lamp { position: relative; }
.status-hero.ampel-erreicht { --tone: var(--done-dot); --tone-soft: var(--done-soft); --tone-text: var(--done); }
.ampel-option.erreicht { --o: var(--done-dot); --os: var(--done-soft); }
.history-item.erreicht { --h: var(--done-dot); }

/* ---------- Umsetzungsplan ---------- */

.plan-text { margin: 0 0 0.5rem; white-space: pre-wrap; font-size: 0.95rem; line-height: 1.55; color: var(--text-2); }
.plan-text.empty { color: var(--muted); font-style: italic; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

/* ---------- Vorhaben: Art ---------- */

.ref-art {
  display: inline-block;
  margin-right: 0.45rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.05rem 0.4rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: 0.05rem;
}
.ref-item.openproject .ref-icon { background: #0b7a8a1f; color: #0b7a8a; }

/* ---------- Bericht (Gremien) ---------- */

.report-view { max-width: 60rem; margin: 0 auto; padding: 1.25rem clamp(1rem, 3vw, 2rem) 3rem; }
.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.report-scope { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.report-scope select, .report-scope input { min-width: 14rem; padding: 0.45rem 0.6rem; }
#report-print { margin-left: auto; }

/* Der Bericht ist bewusst „Papier“: hell und nüchtern, auch im dunklen Modus. */
.report {
  --r-text: #111827;
  --r-muted: #4b5563;
  --r-line: #d1d5db;
  background: #fff;
  color: var(--r-text);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2.75rem 2rem;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 10.5pt;
  line-height: 1.45;
  color-scheme: light;
}
.report .r-kicker { font-size: 8.5pt; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--r-muted); }
.report h1 { font-size: 20pt; margin: 0.25rem 0 0.2rem; letter-spacing: -0.01em; }
.report .r-meta { font-size: 9pt; color: var(--r-muted); }
.report .r-rule { border: 0; border-top: 1.5px solid var(--r-text); margin: 0.9rem 0 1rem; }
.report h2 { font-size: 12.5pt; margin: 1.4rem 0 0.5rem; }
.report .r-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; margin-bottom: 0.4rem; }
.report .r-stat { border: 1px solid var(--r-line); border-radius: 4px; padding: 0.45rem 0.6rem; }
.report .r-stat b { display: block; font-size: 15pt; }
.report .r-stat span { font-size: 8.5pt; color: var(--r-muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.report .r-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.report .r-dot.gruen { background: #16a34a; }
.report .r-dot.gelb { background: #f59e0b; }
.report .r-dot.rot { background: #dc2626; }
.report .r-dot.erreicht { background: #2563eb; }
.report .r-decide {
  border: 1px solid #dc2626;
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.9rem;
}
.report .r-decide h3 { margin: 0 0 0.3rem; font-size: 10.5pt; color: #b91c1c; }
.report .r-decide ul { margin: 0; padding-left: 1.1rem; }
.report table { width: 100%; border-collapse: collapse; }
.report th {
  text-align: left;
  font-size: 8.5pt;
  font-weight: 700;
  color: var(--r-muted);
  border-bottom: 1.5px solid var(--r-text);
  padding: 0.3rem 0.4rem;
}
.report td { border-bottom: 1px solid var(--r-line); padding: 0.45rem 0.4rem; vertical-align: top; }
.report td.c-dot { width: 1rem; padding-top: 0.6rem; }
.report td.c-due, .report td.c-stand { white-space: nowrap; color: var(--r-muted); font-size: 9pt; width: 6.5rem; }
.report td .r-title { font-weight: 700; }
.report td .r-text { margin-top: 0.15rem; white-space: pre-wrap; }
.report td .r-sub { margin-top: 0.2rem; font-size: 8.5pt; color: var(--r-muted); }
.report tr { break-inside: avoid; }
.report .r-foot { margin-top: 1.5rem; padding-top: 0.6rem; border-top: 1px solid var(--r-line); font-size: 8.5pt; color: var(--r-muted); }

@media (max-width: 680px) {
  #report-button .label { display: none; }
  .report { padding: 1.25rem; }
  .report .r-summary { grid-template-columns: repeat(2, 1fr); }
}


/* ---------- Bericht: Konfiguration ---------- */

.report-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin: -0.25rem 0 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.report-config fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.report-config legend { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 0.45rem; padding: 0; }
.check-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.check-chip span::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 4px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
}
.check-chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.check-chip input:checked + span::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--surface);
}
.check-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.report td .r-plan { margin-top: 0.3rem; padding-left: 0.6rem; border-left: 2px solid var(--r-line); font-size: 9.5pt; color: var(--r-muted); white-space: pre-wrap; }
.report td .r-plan b { color: var(--r-text); }
@media (max-width: 680px) { .report-config { grid-template-columns: 1fr; } }

/* Umsetzungsplan: Aktionen */
.plan-actions { display: inline-flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.plan-foot { flex-wrap: wrap; }

@media print {
  @page { size: A4; margin: 16mm 15mm; }
  body.reporting { background: #fff; color-scheme: light; }
  body.reporting .appbar, body.reporting .controls, body.reporting .workspace,
  body.reporting .report-toolbar, body.reporting .report-config,
  body.reporting dialog { display: none !important; }
  body.reporting .report-view { max-width: none; padding: 0; }
  body.reporting .report { border: 0; border-radius: 0; box-shadow: none; padding: 0; }
}
