/* unplane – Stylesheet der Weboberfläche
   Ein Stylesheet, keine Build-Pipeline, keine Inline-Styles (die CSP erlaubt nur dieses). Farben/Abstände nur über die Tokens unten.
   Statusfarben, Prioritätsbalken und Avatare hängen an data-Attributen,
   damit der Server keine Farben berechnen muss. */

/* ---------- Fonts (selbst gehostet, kein Google-CDN) ---------- */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --bg: #F5F5F2;            /* Seitenhintergrund */
  --surface: #FFFFFF;       /* Tabelle, Header, Panel */
  --surface-2: #FAFAF7;     /* Tabellenkopf, Panel-Footer, Zeilen-Hover */
  --seg-bg: #E9E9E4;        /* Hintergrund Segment-Schalter */
  --hover: #ECEDEA;         /* Icon-Button-Hover */

  --ink: #1B1D1F;           /* Haupttext */
  --ink-2: #30353A;         /* Labels, Zellen */
  --ink-3: #4A5056;         /* inaktive Segmente */
  --muted: #5C6166;         /* Sekundärtext (4.5:1 auf Weiß) */

  --border: #E3E3DE;        /* Rahmen Karten/Header */
  --border-row: #E8E8E3;    /* Zeilentrenner */
  --border-ctl: #C9CDD1;    /* Eingabefelder */

  --accent: #1F5F99;
  --accent-hover: #174A75;
  --focus: #1F5F99;
  --focus-halo: rgba(31, 95, 153, 0.18);
  --danger: #B3261E;
  --danger-hover: #8F1E18;
  --danger-bg: #FBEAE8;
  --warn-bg: #FFF4D6;
  --warn-fg: #6B4A00;
  --indent: 20px;
  --flash: #FFF7E0;         /* kurzes Aufleuchten geänderter Zeilen */
  --live: #1F5F99;          /* Markierung „liest gerade“ */
  --live-bg: #E3EDF8;

  /* Status */
  --st-open-bg: #EEF0F2;  --st-open-fg: #353A40;  --st-open-bd: #D3D8DD;  --st-open-dot: #8A939C;
  --st-prog-bg: #E3EDF8;  --st-prog-fg: #174A75;  --st-prog-bd: #B5CDE6;  --st-prog-dot: #2F74B5;
  --st-done-bg: #E4F1E8;  --st-done-fg: #22502F;  --st-done-bd: #BCDAC5;  --st-done-dot: #3B8754;

  /* Priorität */
  --prio-bar: #3A3F45;
  --prio-bar-off: #D7DADE;
  --prio-urgent: #C2410C;      /* Balken */
  --prio-urgent-text: #A63D0E; /* Text */

  /* Personen */
  --p1-bg: #DCE6EF; --p1-fg: #1D3F5E;   /* Steffen */
  --p2-bg: #F1E4D3; --p2-fg: #6A3E10;   /* Markus */

  --toast-bg: #1F2328;
  --toast-action: #9CC7F0;
  --overlay: rgba(20, 22, 25, 0.32);

  --radius-sm: 6px;
  --radius-md: 8px;
  --row-pad: 12px;          /* .density-compact setzt 6px */
  --max-width: 1240px;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--font-mono); }
.density-compact { --row-pad: 6px; }

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 32px; }

/* ---------- Header ---------- */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.app-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.app-header__left { display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand__name { font-family: var(--font-mono); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 17px 2px 15px; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.app-header__user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.app-header__user .divider { width: 1px; height: 16px; background: #DADAD5; }
.app-header__user .name { color: var(--ink); font-weight: 500; }
.sign-out { display: flex; margin: 0 0 0 4px; }
.sign-out .link-btn { color: var(--muted); padding: 8px 2px; }
.sign-out .link-btn:hover { color: var(--ink); }

/* ---------- Seitenkopf ---------- */
.page { padding-top: 28px; padding-bottom: 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.page-head .summary { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 600;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn--primary { background: var(--accent); color: #FFFFFF; }
.btn--primary:hover { background: var(--accent-hover); color: #FFFFFF; }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--border-ctl); }
.btn--secondary:hover { background: #F2F2EF; }
.btn--danger { background: var(--surface); color: var(--danger); border-color: #E5B5B1; }
.btn--danger:hover { background: var(--danger-bg); color: var(--danger-hover); }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary:disabled:hover { background: var(--accent); }
.btn--secondary:disabled:hover, .btn--secondary.is-disabled:hover { background: var(--surface); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.link-btn { all: unset; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.problem { margin: 4px 0 0; color: var(--danger); font-size: 13px; font-weight: 500; }
.badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--seg-bg); color: var(--ink-3); font-size: 11.5px; font-weight: 600; vertical-align: 1px;
}
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 6px 2px 10px;
  border-radius: 999px; background: var(--seg-bg); font-size: 12.5px; color: var(--ink-2);
}
.chip a { text-decoration: none; padding: 0 4px; font-weight: 600; }
.chip-status {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--st-open-bg); color: var(--st-open-fg); border: 1px solid var(--st-open-bd);
}
.chip-status[data-status="in_progress"] { background: var(--st-prog-bg); color: var(--st-prog-fg); border-color: var(--st-prog-bd); }
.chip-status[data-status="done"] { background: var(--st-done-bg); color: var(--st-done-fg); border-color: var(--st-done-bd); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.btn:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible, .item-title:focus-visible, .key-link:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

/* ---------- Formularfelder ---------- */
.ctl {
  width: 100%; height: 40px; padding: 0 11px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-ctl); border-radius: var(--radius-sm);
}
textarea.ctl { height: auto; min-height: 120px; padding: 10px 11px; line-height: 1.45; resize: vertical; }
select.ctl { padding-right: 8px; cursor: pointer; }
.ctl:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-halo); }
.ctl[aria-invalid="true"] { border-color: var(--danger); }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field-error { margin: 6px 0 0; font-size: 13px; color: var(--danger); }
.field-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
select.ctl:disabled { background: #F2F2EF; color: var(--muted); cursor: not-allowed; }

/* ---------- Filterleiste ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; margin: 0 0 14px; }
.filters__row { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.filters__more { border-top: 1px solid var(--border); padding-top: 10px; }
.filters__more > summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; width: fit-content; }
.filters__more > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.filters__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; margin-top: 12px; align-items: end; }
.filters__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filters__grid .ctl { width: 100%; }
.filters__check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); min-height: 38px; }
.filters__actions { display: flex; align-items: center; gap: 16px; }
.filters .ctl.ctl--search { width: 280px; }
.filters__group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; min-width: 0; }
.filters__label { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; float: left; }
.filters .ctl { width: 200px; height: 38px; }

/* Segment-Schalter aus Radio-Buttons: Formular schickt immer den aktuellen Status mit */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--seg-bg); border-radius: var(--radius-md); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg__opt {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--ink-3); cursor: pointer;
}
.seg__opt:hover { color: var(--ink); }
.seg input:checked + .seg__opt { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 22, 25, 0.12); }
.seg input:focus-visible + .seg__opt { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.seg--links a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--ink-3); text-decoration: none;
}
.seg--links a:hover { color: var(--ink); }
.seg--links a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 22, 25, 0.12); }
.seg--links a:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.list-toolbar__page { font-size: 13px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.pager__label { font-size: 13px; color: var(--muted); }

/* ---------- Item-Tabelle ---------- */
.item-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.item-row {
  display: grid;
  grid-template-columns: 80px minmax(220px, 1fr) 120px 150px 110px 120px 150px 76px;
  column-gap: 16px; align-items: center;
  padding: var(--row-pad) 16px;
  border-bottom: 1px solid var(--border-row);
}
.item-row:last-child { border-bottom: 0; }
.item-row--head {
  background: var(--surface-2); padding-top: 10px; padding-bottom: 10px;
  font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em;
}
.item-row:not(.item-row--head):hover { background: var(--surface-2); }
.item-row.is-flash { animation: flash 2.6s ease-out; }
@keyframes flash { 0%, 40% { background: var(--flash); } 100% { background: transparent; } }

.cell-key { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--muted); }
.cell-title { min-width: 0; }
.item-title {
  all: unset; cursor: pointer; display: block; max-width: 100%;
  font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.item-row[data-status="done"] .item-title { color: var(--muted); }
.item-desc { margin-top: 2px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-project { font-size: 13.5px; color: var(--ink-2); }
a.item-title { text-decoration: none; }
.key-link { color: var(--muted); text-decoration: none; }
.key-link:hover { color: var(--accent); text-decoration: underline; }
.item-trail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 1px; }
.cell-due { font-size: 13px; color: var(--ink-2); }
.is-overdue, .cell-due.is-overdue { color: var(--danger); font-weight: 600; }
.item-row[data-depth="1"] .cell-title { padding-left: calc(var(--indent) * 1); }
.item-row[data-depth="2"] .cell-title { padding-left: calc(var(--indent) * 2); }
.item-row[data-depth="3"] .cell-title { padding-left: calc(var(--indent) * 3); }
.item-row[data-depth="4"] .cell-title { padding-left: calc(var(--indent) * 4); }
.item-row[data-depth="5"] .cell-title { padding-left: calc(var(--indent) * 5); }
.item-row[data-depth="6"] .cell-title { padding-left: calc(var(--indent) * 6); }
.item-row[data-depth="7"] .cell-title { padding-left: calc(var(--indent) * 7); }
.item-row[data-depth="8"] .cell-title { padding-left: calc(var(--indent) * 8); }

/* Status-Pille: natives <select>, Farbe über data-status am Wrapper */
.status { position: relative; display: inline-flex; align-items: center; }
.status::before {
  content: ""; position: absolute; left: 11px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot); pointer-events: none;
}
.status svg { position: absolute; right: 9px; top: calc(50% - 6px); color: var(--fg); pointer-events: none; }
.status select {
  appearance: none; -webkit-appearance: none;
  height: 32px; padding: 0 28px 0 25px;
  font: inherit; font-size: 13px; font-weight: 500;
  background: var(--bg-c); color: var(--fg); border: 1px solid var(--bd); border-radius: 999px; cursor: pointer;
}
.status select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.status[data-status="open"]        { --bg-c: var(--st-open-bg); --fg: var(--st-open-fg); --bd: var(--st-open-bd); --dot: var(--st-open-dot); }
.status[data-status="in_progress"] { --bg-c: var(--st-prog-bg); --fg: var(--st-prog-fg); --bd: var(--st-prog-bd); --dot: var(--st-prog-dot); }
.status[data-status="done"]        { --bg-c: var(--st-done-bg); --fg: var(--st-done-fg); --bd: var(--st-done-bd); --dot: var(--st-done-dot); }
.status.is-pending select { opacity: 0.6; }
/* Epic: Status abgeleitet, nicht änderbar – gestrichelter Rand, kein Pfeil */
.status--static > span {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px 0 25px;
  font-size: 13px; font-weight: 500;
  background: var(--bg-c); color: var(--fg); border: 1px dashed var(--bd); border-radius: 999px; cursor: default;
}

/* Priorität: 4 Balken, Füllung über data-priority */
.prio { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.prio__bars { display: inline-flex; align-items: flex-end; gap: 1px; height: 13px; }
.prio__bars i { display: block; width: 3px; border-radius: 0.5px; background: var(--prio-bar-off); }
.prio__bars i:nth-child(1) { height: 4px; }
.prio__bars i:nth-child(2) { height: 7px; }
.prio__bars i:nth-child(3) { height: 10px; }
.prio__bars i:nth-child(4) { height: 13px; }
.prio[data-priority="low"]    .prio__bars i:nth-child(-n+1),
.prio[data-priority="normal"] .prio__bars i:nth-child(-n+2),
.prio[data-priority="high"]   .prio__bars i:nth-child(-n+3) { background: var(--prio-bar); }
.prio[data-priority="urgent"] .prio__bars i { background: var(--prio-urgent); }
.prio[data-priority="urgent"] { color: var(--prio-urgent-text); font-weight: 600; }
.prio[data-priority="high"]   { color: var(--ink); font-weight: 500; }
.prio[data-priority="low"]    { color: var(--muted); }

/* Zuständig */
.assignee { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; }
.avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font-size: 11.5px; font-weight: 600;
  background: #E6E8EA; color: var(--ink-2);
}
.avatar--lg { width: 26px; height: 26px; font-size: 12px; }
.avatar[data-person="Steffen"] { background: var(--p1-bg); color: var(--p1-fg); }
.avatar[data-person="Markus"]  { background: var(--p2-bg); color: var(--p2-fg); }
.avatar--none { background: transparent; border: 1.5px dashed #A3AAB0; }
.assignee--none { color: var(--muted); }
.cell-actions { justify-self: end; display: flex; gap: 2px; }

/* Leerzustand */
.empty { padding: 56px 24px; text-align: center; }
.empty__title { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.empty__text { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }

/* ---------- Panel (Neu/Bearbeiten) ---------- */
.panel-host:empty { display: none; }
.panel { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; }
.panel__overlay { position: absolute; inset: 0; background: var(--overlay); }
.panel__sheet {
  position: relative; width: 480px; max-width: 100%; height: 100%;
  display: flex; flex-direction: column; background: var(--surface);
  box-shadow: -12px 0 32px rgba(20, 22, 25, 0.14);
  animation: slide-in 0.16s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 16px; border-bottom: 1px solid var(--border-row); }
.panel__key { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.panel__head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.panel__body { flex: 1; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.panel__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border-row); background: var(--surface-2); }

/* ---------- Detailseite ---------- */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current="page"] { font-family: var(--font-mono); font-size: 12.5px; }
.detail__head { align-items: flex-start; }
.detail__key { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.detail__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.detail__main, .detail__side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 20px 18px; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card__head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.prose { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 14px; margin: 0; font-size: 13.5px; align-items: center; }
.facts dt { color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; min-width: 0; }
.tree, .tree .tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { margin-left: 8px; padding-left: calc(var(--indent) - 8px); border-left: 1px solid var(--border-row); }
.tree__row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 7px 0; border-bottom: 1px solid var(--border-row); font-size: 13.5px; }
.tree__title { color: var(--ink); text-decoration: none; font-weight: 500; flex: 1 1 200px; min-width: 0; }
.tree__title:hover { text-decoration: underline; }
.tree__row[data-status="done"] .tree__title { color: var(--muted); }
.tree__row .status--static > span { height: 24px; font-size: 12px; }
.tree__row .assignee { font-size: 13px; }
.subtasks, .effort-form, .comment-form { margin-top: 16px; }
.subtasks textarea.ctl, .comment-form textarea.ctl { min-height: 72px; }
table.effort { width: 100%; border-collapse: collapse; margin: 4px 0 14px; font-size: 13.5px; }
table.effort caption { text-align: left; font-weight: 600; font-size: 13px; color: var(--ink-2); padding-bottom: 6px; }
table.effort th, table.effort td { padding: 6px 8px; border-bottom: 1px solid var(--border-row); text-align: left; }
table.effort thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.effort .num { text-align: right; font-variant-numeric: tabular-nums; }
table.effort tfoot th, table.effort tfoot td { font-weight: 600; border-bottom: 0; }
.comments, .history { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment, .history__item { padding-bottom: 10px; border-bottom: 1px solid var(--border-row); font-size: 13.5px; }
.comment:last-child, .history__item:last-child { border-bottom: 0; padding-bottom: 0; }
.comment__meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* ---------- Aufwandszeilen, Rollen-Hinweis ---------- */
.effort-rows { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.effort-rows .link-btn { align-self: flex-start; }
.effort-rows__head, .effort-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 36px; gap: 8px; align-items: center; }
.effort-rows--actual .effort-rows__head, .effort-rows--actual .effort-row { grid-template-columns: minmax(0, 1fr) 84px 150px minmax(0, 1fr) 36px; }
.effort-rows__head { font-size: 12px; color: var(--muted); font-weight: 600; }
.effort-form__choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }
.role-notice { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--warn-bg); color: var(--warn-fg); font-size: 13.5px; }
.role-notice p { margin: 0 0 10px; }
.role-notice__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Dialog ---------- */
.dialog {
  padding: 0; border: 0; border-radius: var(--radius-md); width: min(600px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 16px 40px rgba(20, 22, 25, 0.24);
}
.dialog::backdrop { background: var(--overlay); }
.dialog__card { padding: 20px 24px; }
.dialog__title { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.dialog__body { display: flex; flex-direction: column; gap: 14px; }
.dialog__body p { margin: 0; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px); }
.toast {
  display: flex; align-items: flex-start; gap: 16px; max-width: 40rem;
  background: var(--toast-bg); color: #FFFFFF; font-size: 13.5px;
  padding: 10px 10px 10px 16px; border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(20, 22, 25, 0.24);
  animation: toast-life 6s ease forwards;
}
.toast__action {
  font: inherit; font-size: 13px; font-weight: 600; background: transparent; color: var(--toast-action);
  border: 0; padding: 0 8px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
}
.toast__action:hover { background: rgba(255, 255, 255, 0.08); }
.toast__action:focus-visible { outline: 2px solid var(--toast-action); outline-offset: 1px; }
.toast:hover, .toast:focus-within { animation-play-state: paused; }
.toast--error { background: #8C1D18; }
.toast--sticky { animation: none; }
.toast__body { flex: 1; min-width: 0; padding: 6px 0; }
.toast__text { margin: 0; line-height: 1.45; }
.toast__warnings { margin: 6px 0 0; padding-left: 18px; color: #F3D98A; }
.toast__action { flex: none; text-decoration: none; display: inline-flex; align-items: center; }
.toast__close { font-size: 18px; }
@keyframes toast-life {
  0% { opacity: 0; transform: translateY(8px); }
  4%, 90% { opacity: 1; transform: none; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

/* ---------- Schmale Bildschirme: Zeilen werden Karten ---------- */
@media (max-width: 860px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .app-header__user .week, .app-header__user .divider { display: none; }
  .item-row--head { display: none; }
  .item-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "key act" "title title" "proj assg" "status prio" "due due";
    row-gap: 10px; padding-top: 14px; padding-bottom: 14px;
  }
  .cell-key { grid-area: key; } .cell-title { grid-area: title; } .cell-project { grid-area: proj; }
  .cell-status { grid-area: status; } .cell-prio { grid-area: prio; } .cell-assignee { grid-area: assg; }
  .cell-actions { grid-area: act; } .cell-due { grid-area: due; }
  .item-row[data-depth] .cell-title { padding-left: 0; }
  .detail__grid { grid-template-columns: 1fr; }
  .filters .ctl.ctl--search { width: 100%; }
  .filters__group--search { width: 100%; }
  .effort-rows--actual .effort-rows__head { display: none; }
  .effort-rows--actual .effort-row { grid-template-columns: minmax(0, 1fr) 84px 36px; }
  .item-title, .item-desc { white-space: normal; }
  .status select { height: 40px; }
  .filters .ctl { width: 100%; }
  .filters__group--project { width: 100%; }
  .panel__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .item-row.is-flash, .panel__sheet, .dialog { animation: none; }
  .toast { animation-duration: 0.01s; animation-delay: 6s; }
}

/* ---------- Anmeldung ---------- */
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login .brand { justify-content: center; margin-bottom: 20px; }
.login__card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login__card h1 { margin: 0; font-size: 18px; font-weight: 600; }
.login__card .ctl { width: 100%; }
.login__card .btn { justify-content: center; }
.login__problem { margin: 0; font-size: 13px; color: var(--danger); }
.login__note { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------- Live (11c) */
.live-ticker { flex: 1; min-width: 0; display: flex; justify-content: center; font-size: 13px; color: var(--muted); }
.live-ticker__text { max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: live-life 8s ease-out forwards; }
.live-ticker__text.is-failed { color: var(--danger); }
@keyframes live-life { 0% { opacity: 0; } 5%, 85% { opacity: 1; } 100% { opacity: 0; } }
.live-status { background: var(--warn-bg); color: var(--warn-fg); border-radius: var(--radius-sm); padding: 2px 8px; font-size: 12px; }
.live-mark { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 0 6px;
  border-radius: 999px; background: var(--live-bg); color: var(--live); font-size: 12px; font-weight: 500;
  vertical-align: middle; white-space: nowrap; }
.live-mark[data-reading="false"] { background: var(--flash); color: var(--warn-fg); }
.detail__head .live-mark { margin: 4px 0 0; }
.row-origin { display: block; font-size: 12px; color: var(--warn-fg); }
.panel__live { display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--warn-bg); color: var(--warn-fg); border-radius: var(--radius-md); padding: 8px 12px; }
.panel__live p { margin: 0; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
.stream { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.stream__entry { display: grid; grid-template-columns: 5ch 24ch 1fr auto; gap: 12px; align-items: baseline;
  padding: var(--row-pad) 16px; border-top: 1px solid var(--border-row); }
.stream__entry:first-child { border-top: 0; }
.stream__entry[data-kind="tool"] { color: var(--muted); }
.stream__entry[data-undone="true"] .stream__text { text-decoration: line-through; }
.stream__entry[data-failed="true"] .stream__flag { color: var(--danger); }
.stream__entry.is-new { animation: flash 2.6s ease-out; }
.stream__time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.stream__who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream__keys { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stream__flag { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .live-ticker { display: none; }
  .stream__entry { grid-template-columns: 5ch 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .live-ticker__text, .stream__entry.is-new { animation: none; }
}

/* ---------- Heute, Aufwand, Aktivität, Verwaltung ---------- */
.app-header__user .today { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.briefing, .admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-top: 16px; }
.briefing__main, .briefing__side, .admin-grid__main, .admin-grid__side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card__sub { margin: -6px 0 10px; font-size: 12.5px; color: var(--muted); }
.card__head .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-weight: 500; }
.card .item-table { border-radius: var(--radius-sm); }
.item-row--brief { grid-template-columns: 72px minmax(0, 1fr) 110px 100px 110px 120px; column-gap: 12px; }
.item-row--brief .item-title, .item-row--brief .item-desc, .item-row--brief .live-mark { white-space: normal; }
.notes { margin: 6px 0 0; padding-left: 18px; color: var(--warn-fg); font-size: 13px; }
.table-scroll { overflow-x: auto; }
.effort-kinds { margin: 4px 0 12px; }
.effort-periods { display: inline-flex; align-self: flex-start; margin-top: 12px; }
.effort-results { margin-top: 16px; }
table.effort--compare tbody.compare-item + tbody.compare-item tr:first-child > * { border-top: 2px solid var(--border); }
table.effort tr.compare-role th { padding-left: 24px; font-weight: 400; color: var(--ink-2); }
table.effort td.dev[data-dev="over"] { color: var(--danger); }
table.effort td.dev[data-dev="under"] { color: var(--st-done-fg); }
.stream__entry { grid-template-columns: 5ch 24ch 1fr auto auto; }
.stream__actions { display: flex; gap: 8px; align-items: baseline; justify-content: flex-end; white-space: nowrap; }
.stream__problem { grid-column: 1 / -1; margin: 4px 0 0; color: var(--danger); font-size: 13px; }
.stream__entry:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
.history__actions { margin-top: 4px; }
.history__item:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.admin__actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
table.effort tr[data-archived="true"] > th, table.effort tr[data-archived="true"] > td.num { color: var(--muted); }
.admin-form { display: grid; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-row); }
.admin-form h3 { margin: 0; }
.admin-form__grid { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; }
.admin-form .ctl { width: 100%; }
.people { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.people li { display: flex; align-items: center; gap: 8px; }
@media (max-width: 860px) {
  .briefing, .admin-grid { grid-template-columns: 1fr; }
  .app-header__user .today { display: none; }
  .admin-form__grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .stream__entry { grid-template-columns: 5ch 1fr; }
  .stream__actions { grid-column: 2; justify-content: flex-start; }
}
