:root {
  --bg: #000000;
  --card: #1c1c1e;
  --card-hover: #232325;
  --primary: rgba(0,0,0,0.8);
  --primary-light: #1c1c1e;
  --accent: #0a84ff;
  --accent-contrast: #ffffff;
  --accent-hover: #3296ff;
  --text: #f5f5f7;
  --muted: #98989d;
  --border: rgba(255,255,255,0.09);
  --danger: #ff453a;
  --success: #30d158;
  --warn: #ff9f0a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
  position: relative;
}

.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;
}

/* Soft, ruhender Glasfaser-Hintergrund. Kein SVG-Weichzeichner-Filter mehr
   auf der animierten Linie (feGaussianBlur wird bei jedem Animationsframe
   neu berechnet und war - dauerhaft auf jedem Tab aktiv - ein spuerbarer
   Performance-Faktor). "contain: paint" isoliert das Layer zusaetzlich,
   damit seine Animation den Rest der Seite nicht mit neu einplant. */
#bg-mesh {
  position: fixed;
  inset: -10vh -10vw;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  contain: paint;
  transition: transform 0.15s ease-out;
  will-change: transform;
  background: radial-gradient(ellipse 900px 500px at 50% 0%, rgba(10,132,255,0.07), transparent 65%);
}
#fiber-svg { width: 100%; height: 100%; display: block; }
.fiber-base {
  fill: none;
  stroke: url(#fiberBase);
  stroke-width: 1;
  opacity: 0.22;
}
.fiber-light {
  fill: none;
  stroke: url(#fiberPulse);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 70 900;
  opacity: 0.5;
  animation-name: fiberTravel;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes fiberTravel {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -970; }
}
@media (prefers-reduced-motion: reduce) {
  .fiber-light { animation: none; }
  #bg-mesh { transition: none; }
}

/* Subtle macOS-style overlay scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); background-clip: padding-box; }

header {
  background: rgba(8,8,9,0.97);
  color: var(--text);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.app-logo { height: 34px; width: auto; display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4)); }
header h1 { font-size: 1.15rem; margin: 0; font-weight: 600; letter-spacing: -0.02em; }
#header-date { color: var(--muted) !important; font-size: 0.82rem; }

nav {
  display: flex;
  gap: 4px;
  padding: 10px 24px;
  background: rgba(20,20,22,0.97);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 19;
  border-bottom: 1px solid var(--border);
}
nav button {
  background: transparent;
  border: none;
  color: rgba(245,245,247,0.55);
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 980px;
  flex-shrink: 0;
  transition: color 0.2s ease, background-color 0.2s ease;
}
nav button:hover { color: rgba(245,245,247,0.85); background: rgba(255,255,255,0.06); }
nav button.active {
  color: var(--accent-contrast);
  background: var(--accent);
  font-weight: 600;
  animation: navPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes navPop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.tab-fade-in { animation: riseIn 0.35s ease both; }

main { padding: 32px 24px 64px; max-width: 1100px; margin: 0 auto; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: rgba(27,27,29,0.96);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 24px 48px -28px rgba(0,0,0,0.6);
  animation: riseIn 0.4s ease both;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { background: rgba(34,34,37,0.98); }
.card h2 { margin-top: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; flex: 1; min-width: 160px; }
.field label { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

input, select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  width: 100%;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 40px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 4px rgba(10,132,255,0.22);
}

button { font-family: inherit; }
button.primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  padding: 10px 20px;
  border-radius: 980px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
button.primary:hover { background: var(--accent-hover); }
button.primary:active { transform: scale(0.97); }
button.secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 15px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}
button.secondary:hover { background: rgba(255,255,255,0.12); }
button.danger {
  color: var(--danger);
  border-color: rgba(255,69,58,0.4);
  background: rgba(255,69,58,0.08);
  border: 1px solid rgba(255,69,58,0.4);
  padding: 6px 13px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}
button.danger:hover { background: rgba(255,69,58,0.16); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr { transition: background-color 0.15s ease; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 980px; font-size: 0.72rem; font-weight: 600; background: rgba(48,209,88,0.16); color: var(--success); }
.badge.archived { background: rgba(255,159,10,0.16); color: var(--warn); }

.timer-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(155deg, rgba(30,30,32,0.98) 0%, rgba(18,18,20,0.98) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 24px 48px -28px rgba(0,0,0,0.6);
  animation: riseIn 0.4s ease both;
  transition: box-shadow 0.3s ease;
}
.timer-display { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--text); transition: color 0.3s ease; }
.timer-running .timer-display { color: var(--success); }
.timer-running { box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 0 0 1px rgba(48,209,88,0.35), 0 24px 48px -28px rgba(0,0,0,0.6); }

.timer-pulse-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
  vertical-align: middle;
  transition: background-color 0.3s ease;
}
.timer-running .timer-pulse-dot {
  background: var(--success);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(48,209,88,0.55); }
  50% { box-shadow: 0 0 0 6px rgba(48,209,88,0); }
}
.muted { color: var(--muted); font-size: 0.85rem; }
.actions { display: flex; gap: 6px; }
.empty { color: var(--muted); font-style: italic; padding: 12px 0; }
.empty-celebrate {
  font-style: normal;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  padding: 20px 0;
  text-align: center;
  animation: celebratePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes celebratePop {
  0% { opacity: 0; transform: scale(0.9) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.edit-row-time { display: flex; gap: 6px; }
.edit-row-time input { width: auto; flex: 1; }

.card-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-heading-row h2 { margin: 0; }

.task-group {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.task-group:last-child { margin-bottom: 0; }
.task-group:hover { border-color: rgba(255,255,255,0.16); }
.task-group { overflow: visible; }
.task-group-title { border-radius: 14px 14px 0 0; }
.task-group-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  position: relative;
}
.task-group-title[data-tooltip]:hover::after,
.site-group-title[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 16px;
  top: 100%;
  margin-top: 8px;
  background: rgba(28,28,30,0.92);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 12px 28px -8px rgba(0,0,0,0.6);
  opacity: 0;
  animation: tooltipIn 0.18s ease forwards;
  pointer-events: none;
  z-index: 30;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.task-group-client { font-weight: 500; font-size: 0.8rem; color: var(--muted); }
.task-group-body { padding: 0 16px; }
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.task-group-body > .task-node:first-child > .task-row { border-top: none; }
.task-row input[type="checkbox"] {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.task-row input[type="checkbox"]:checked,
.checkbox-inline input[type="checkbox"]:checked {
  animation: checkPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes checkPop {
  0% { transform: scale(0.75); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.task-row input:not([type="checkbox"]) {
  flex: 1;
  min-width: 120px;
  width: auto;
}
.task-row-title {
  flex: 1;
  min-width: 120px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  background: none;
  border: none;
  padding: 2px 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: inherit;
}
.task-row-title:hover { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); text-underline-offset: 3px; }
.task-row-title-sub { font-weight: 450; color: rgba(245,245,247,0.82); font-size: 0.9rem; }
.task-done-text { text-decoration: line-through; color: var(--muted); }
.task-row button { flex-shrink: 0; }
.task-row.is-editing { gap: 8px; }

/* Verschachtelte Unteraufgaben: jede Ebene rückt ein und hat eine Linie links */
.task-children {
  margin-left: 22px;
  padding-left: 12px;
  border-left: 2px solid rgba(255,255,255,0.08);
}
.task-node.is-highlight > .task-row { background: rgba(10,132,255,0.12); border-radius: 8px; transition: background-color 0.6s ease; }

.task-check-locked { opacity: 0.45; }
.task-badges { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-actions { display: inline-flex; align-items: center; gap: 6px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 980px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-waiting { background: rgba(255,159,10,0.16); color: var(--warn); }
.status-blocked { background: rgba(255,69,58,0.14); color: #ff6961; }
.status-progress { background: rgba(255,255,255,0.08); color: var(--muted); }
.task-node.task-status-waiting > .task-row .task-row-title { color: #ffd59e; }
.task-waiting-note {
  margin: -4px 0 8px 52px;
  font-size: 0.8rem;
  color: var(--warn);
  opacity: 0.9;
}
.icon-btn.has-count { width: auto; padding: 0 7px; gap: 3px; }
.icon-count { font-size: 0.72rem; font-weight: 700; color: var(--accent); }

.subtask-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.subtask-input-row input { flex: 1; min-width: 120px; }

/* Detailbereich einer Aufgabe: Abhängigkeiten, Warten, Kommentare */
.task-detail {
  margin: 2px 0 12px 30px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: riseIn 0.25s ease both;
}
.task-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.task-detail-actions label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.task-detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dep-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 980px;
  background: rgba(255,69,58,0.1);
  border: 1px solid rgba(255,69,58,0.25);
  font-size: 0.8rem;
}
.dep-chip.dep-done { background: rgba(48,209,88,0.1); border-color: rgba(48,209,88,0.25); }
.dep-chip.dep-readonly { background: rgba(255,255,255,0.05); border-color: var(--border); padding-right: 10px; cursor: pointer; }
.dep-chip small { color: var(--muted); }
.dep-chip button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0 4px; border-radius: 50%;
}
.dep-chip button:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.dep-select { width: auto; max-width: 100%; font-size: 0.85rem; padding: 6px 10px; }
.waiting-box {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,159,10,0.1); border: 1px solid rgba(255,159,10,0.25);
  color: #ffd59e; font-size: 0.88rem;
}
.waiting-box .waiting-text { flex: 1; min-width: 160px; }
.waiting-form textarea, .comment-compose textarea { min-height: 54px; font-size: 15px; }
.waiting-form .actions { margin-top: 8px; }

.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.comment {
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
}
.comment-meta { font-size: 0.75rem; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-bottom: 3px; }
.comment-meta strong { color: var(--text); font-weight: 600; }
.comment-meta .comment-delete { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; }
.comment-meta .comment-delete:hover { color: var(--danger); }
.comment-body { font-size: 0.9rem; white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.comment-status {
  background: none;
  padding: 2px 12px;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}
.comment-status .comment-meta { display: inline; font-style: normal; margin-right: 4px; }
.comment-compose { display: flex; gap: 8px; align-items: flex-end; }
.comment-compose textarea { flex: 1; }

.task-summary { font-size: 0.82rem; color: var(--muted); }
.task-summary b { color: var(--text); font-weight: 600; }

/* Startseite: Diese Woche */
.week-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-top: 1px solid var(--border); cursor: pointer;
}
.week-item:first-child { border-top: none; }
.week-item:hover .week-item-title { text-decoration: underline; text-underline-offset: 3px; }
.week-item-title { font-weight: 600; flex: 1; min-width: 140px; }
.week-item-project { font-size: 0.8rem; color: var(--muted); }
.task-move {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
}
.task-move button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  line-height: 1.4;
  padding: 0 4px;
}
.task-move button:hover { color: var(--text); }

.icon-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); transform: scale(1.1) rotate(-4deg); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn-danger { color: var(--danger); border-color: rgba(255,69,58,0.35); }
.icon-btn-danger:hover { background: rgba(255,69,58,0.14); }

.week-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  flex-shrink: 0;
}
.week-badge-current {
  background: rgba(48,209,88,0.18);
  color: var(--success);
}
.week-badge-empty {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
}
.week-inline-select {
  width: auto;
  min-width: 190px;
  flex-shrink: 0;
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.plan-row:last-child { border-bottom: none; }
.plan-row-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 160px; }
.plan-row select { width: auto; min-width: 210px; }
.plan-row-sub { margin-left: 26px; }
.plan-row-sub .plan-row-info span:first-child { color: var(--muted); }

.plan-week-group { margin-bottom: 14px; }
.plan-week-group:last-child { margin-bottom: 0; }
.plan-week-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }

.plan-week-card { margin-bottom: 14px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.plan-week-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgba(0,0,0,0.55); }
.plan-week-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.map-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: 0.82rem; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.legend-dot-red { background: #ff453a; }
.legend-dot-orange { background: #ff9f0a; }
.legend-dot-yellow { background: #ffd60a; }
.legend-dot-green { background: #30d158; }

#site-map { height: 380px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }

.site-add-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
#site-add-toggle { font-size: 1.1rem; font-weight: 600; }

.site-marker-icon {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.site-marker-icon span {
  transform: rotate(45deg);
  font-size: 0.6rem;
  font-weight: 700;
  color: #0d1420;
}
.site-marker-red { background: #ff453a; }
.site-marker-orange { background: #ff9f0a; }
.site-marker-yellow { background: #ffd60a; }
.site-marker-green { background: #30d158; }

.site-tooltip { font-size: 0.8rem; line-height: 1.4; }

.site-group { margin-bottom: 18px; }
.site-group-title { position: relative; font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }

.site-row {
  background: rgba(28,28,30,0.82);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.site-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -18px rgba(0,0,0,0.55);
}
.site-row.site-row-highlight { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,132,255,0.22); }
.site-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.site-row-name { font-weight: 600; }
.site-row-address { color: var(--muted); font-size: 0.85rem; }
.site-row-clickable { display: inline-flex; align-items: baseline; gap: 8px; cursor: pointer; }
.site-row-clickable:hover .site-row-name { text-decoration: underline; }
.site-row-actions { margin-left: auto; display: flex; gap: 6px; }

.site-status-grid { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.site-status-block { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.site-status-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.checkbox-inline { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.checkbox-inline input { width: auto; accent-color: var(--accent); }
.site-week-row { display: flex; align-items: center; gap: 6px; }
.site-geocode-warning { color: var(--warn); font-size: 0.78rem; display: flex; align-items: center; gap: 6px; margin-top: 4px; }

@media (max-width: 600px) {
  header { padding: 12px 16px; }
  .app-logo { height: 28px; }
  header h1 { font-size: 1rem; }
  #header-date { display: none; }
  nav { padding: 8px 12px; }
  nav button { padding: 8px 13px; font-size: 0.85rem; }
  main { padding: 20px 12px 48px; }
  .card { padding: 16px; border-radius: 14px; }
  .row { flex-direction: column; gap: 0; }
  .row .field { min-width: 100%; }
  .timer-box { flex-direction: column; align-items: stretch; gap: 10px; }
  .timer-display { font-size: 1.6rem; text-align: center; }
  .timer-box .field { flex: none; width: 100%; }
  #timer-btn { width: 100%; }
  .actions { flex-wrap: wrap; }
  table { min-width: 560px; }
  .plan-row { flex-direction: column; align-items: stretch; }
  .plan-row select { width: 100%; min-width: 0; }
  .week-inline-select { width: 100%; min-width: 0; }
  #site-map { height: 280px; }
  .site-row-actions { margin-left: 0; width: 100%; }
  .site-status-grid { gap: 12px; }
  .task-group-title { font-size: 0.95rem; padding: 10px 12px; }
  .task-group-body { padding: 0 12px; }
  .task-children { margin-left: 8px; padding-left: 8px; }
  .task-actions { margin-left: auto; gap: 5px; }
  .task-actions .hide-mobile { display: none; }
  .task-row .icon-btn { width: 28px; height: 28px; font-size: 0.85rem; }
  .task-row .icon-btn.has-count { width: auto; }
  .task-row-title { min-width: 0; flex-basis: 40%; }
  .task-detail { margin-left: 0; padding: 12px; }
  .task-waiting-note { margin-left: 28px; }
  .comment-compose { flex-direction: column; align-items: stretch; }
}

/* ---------- Anmeldung ---------- */
body.locked header,
body.locked nav,
body.locked main { display: none; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse 700px 420px at 50% 20%, rgba(10,132,255,0.10), transparent 70%);
}
.login-screen[hidden] { display: none; }
.login-box {
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: riseIn 0.4s ease both;
}
.login-logo { height: 64px; width: auto; margin-bottom: 18px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)); }
.login-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 22px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 14px; }
.pin-dots span {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.55);
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.pin-dots span.filled { background: var(--text); border-color: var(--text); transform: scale(1.05); }
.pin-dots.shake { animation: pinShake 0.42s ease; }
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
.login-message { min-height: 1.4em; font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }
.login-message.is-error { color: #ff6961; }
.login-message.is-locked { color: var(--warn); font-variant-numeric: tabular-nums; }
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: 14px 22px;
}
.pin-pad button {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.09);
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}
.pin-pad button:hover { background: rgba(255,255,255,0.16); }
.pin-pad button:active { background: rgba(255,255,255,0.28); transform: scale(0.95); }
.pin-pad button.pin-ghost { background: transparent; cursor: default; }
.pin-pad button.pin-del { background: transparent; font-size: 1.2rem; color: var(--muted); }
.pin-pad.is-disabled button { opacity: 0.35; pointer-events: none; }

/* ---------- Benutzer oben rechts ---------- */
.header-right { display: flex; align-items: center; gap: 14px; }
.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-family: inherit; font-size: 0.85rem; font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.user-chip:hover { background: rgba(255,255,255,0.1); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.8rem;
}
.user-caret { color: var(--muted); font-size: 0.7rem; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px;
  background: rgba(30,30,32,0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,0.7);
  z-index: 50;
  display: flex; flex-direction: column;
  animation: riseIn 0.18s ease both;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown-head { padding: 8px 10px 10px; font-size: 0.78rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-dropdown-head strong { display: block; color: var(--text); font-size: 0.9rem; }
.user-dropdown button {
  text-align: left; background: none; border: none; color: var(--text);
  padding: 9px 10px; border-radius: 8px; font-family: inherit; font-size: 0.88rem; cursor: pointer;
}
.user-dropdown button:hover { background: rgba(255,255,255,0.08); }
.user-dropdown button[hidden] { display: none; }
.user-dropdown .user-dropdown-danger { color: #ff6961; }

/* ---------- Dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); animation: fadeIn 0.2s ease both; }
.modal-card {
  position: relative;
  width: 100%; max-width: 420px;
  background: #1f1f22;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.8);
  animation: riseIn 0.25s ease both;
}
.modal-card h2 { margin: 0 0 6px; font-size: 1.1rem; }
.modal-card .modal-intro { margin: 0 0 16px; }
.modal-error { min-height: 1.2em; color: #ff6961; font-size: 0.85rem; margin: 4px 0 12px; }
.modal-success { color: var(--success); }
.code-input { -webkit-text-security: disc; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.user-code-row { display: flex; gap: 8px; align-items: flex-end; padding: 10px 0; border-top: 1px solid var(--border); }
.user-code-row:first-of-type { border-top: none; }
.user-code-row .field { margin-bottom: 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Hinweis-Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(40,40,44,0.98);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,0.7);
  z-index: 120;
  animation: riseIn 0.22s ease both;
}
.toast[hidden] { display: none; }

@media (max-width: 600px) {
  .modal-card { padding: 20px; }
  .pin-pad { gap: 12px 18px; }
  .pin-pad button { width: 68px; height: 68px; font-size: 1.5rem; }
  .header-right { gap: 8px; }
}

/* =====================================================================
   Aufgaben (neues Design): Hauptaufgaben als Blöcke, Baumlinien,
   Details klappen direkt an der Aufgabe auf
   ===================================================================== */
:root { --tk-line: rgba(255,255,255,0.17); --tk-sep: rgba(84,84,88,0.5); --tk-fill: rgba(118,118,128,0.24); }

.tk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 2px 4px; }
.tk-head h2 { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.025em; }
.tk-count { color: var(--muted); font-size: 0.95rem; font-weight: 500; margin-left: 4px; }
.tk-head-actions { display: flex; align-items: center; gap: 8px; }
.tk-head-actions .task-summary { color: var(--warn); font-size: 0.82rem; margin-right: 4px; }
.tk-head-actions .task-summary b { color: var(--warn); }
.tk-pill { border: none; background: var(--tk-fill); color: var(--accent); font-size: 0.85rem; font-weight: 600; padding: 7px 14px; border-radius: 980px; cursor: pointer; font-family: inherit; }
.tk-pill:hover { background: rgba(118,118,128,0.34); }
.tk-pill-solid { background: var(--accent); color: #fff; }
.tk-pill-solid:hover { background: var(--accent-hover); }

.tk-newbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 4px; padding: 10px; border-radius: 14px; background: rgba(27,27,29,0.96); border: 1px solid var(--border); animation: riseIn 0.2s ease both; }
.tk-newbar[hidden] { display: none; }
.tk-newbar select { width: auto; max-width: 40%; }
.tk-newbar input { flex: 1; min-width: 180px; }

.tk-project { padding: 22px 4px 8px; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tk-project span { text-transform: none; font-weight: 500; opacity: 0.75; }

.tk-card { background: rgba(22,22,24,0.97); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; margin-bottom: 12px; transition: border-color 0.2s ease; animation: riseIn 0.3s ease both; }
.tk-card.has-open { border-color: rgba(10,132,255,0.5); }

.tk-row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 14px 9px 14px; border-radius: 12px; position: relative; }
.tk-row.clickable { cursor: pointer; }
.tk-row.clickable:hover { background: rgba(255,255,255,0.035); }
.tk-main { flex: 1; min-width: 0; }
.tk-title { font-size: 0.95rem; font-weight: 500; line-height: 1.3; word-break: break-word; }
.tk-task.is-done .tk-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(152,152,157,0.5); }
.tk-meta { font-size: 0.78rem; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tk-week { color: var(--muted); }
.tk-week-now { color: var(--success); }
.tk-week-late { color: #ff6961; }
.tk-progress { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.09); margin: 8px 0 2px; overflow: hidden; max-width: 280px; }
.tk-progress span { display: block; height: 100%; background: var(--success); border-radius: 2px; transition: width 0.3s ease; }
.tk-wait-line { margin-top: 5px; font-size: 0.84rem; color: #ffcf8a; line-height: 1.35; }
.tk-wait-line b { color: var(--warn); font-weight: 600; }
.tk-comments { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.tk-c { font-size: 0.83rem; color: #c7c7cc; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-c-name { font-weight: 600; }
.tk-c-more { font-size: 0.75rem; color: var(--muted); }
.tk-chev { color: #48484a; font-size: 1.2rem; line-height: 1; margin-top: 1px; }
.tk-collapse { background: var(--tk-fill); border: none; color: var(--muted); border-radius: 980px; font-size: 0.78rem; font-weight: 600; padding: 4px 10px; cursor: pointer; white-space: nowrap; font-family: inherit; flex-shrink: 0; }
.tk-collapse:hover { color: var(--text); }
.tk-sort { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.tk-sort button { background: var(--tk-fill); border: none; color: var(--text); border-radius: 6px; width: 30px; height: 20px; font-size: 9px; cursor: pointer; }
.tk-sort button:hover { background: rgba(118,118,128,0.4); }

/* Kreis zum Abhaken */
.tk-circle { flex-shrink: 0; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid #5a5a5e; background: transparent; margin-top: 1px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease; }
.tk-circle:hover { border-color: var(--accent); }
.tk-circle:active { transform: scale(0.9); }
.tk-circle.done { background: var(--accent); border-color: var(--accent); animation: checkPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tk-circle.done::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.tk-circle.locked { border-style: dashed; opacity: 0.55; }

/* Hauptaufgabe (Kopf eines Blocks) */
.tk-branch.main > .tk-task > .tk-row { padding: 14px 16px 12px; }
.tk-branch.main > .tk-task > .tk-row .tk-title { font-size: 1.07rem; font-weight: 650; letter-spacing: -0.015em; }
.tk-branch.main > .tk-task > .tk-row .tk-circle { width: 24px; height: 24px; }
.tk-branch.main > .tk-task > .tk-row .tk-circle.done::after { font-size: 14px; }
.tk-card > .tk-branch.has-kids { padding-bottom: 8px; }

/* Baumlinien: Stamm vom Kreis nach unten, Bogen in jeden Kreis darunter.
   Alles hängt an --cx/--cy (Kreismitte) und --r (Radius), damit die Linien exakt sitzen. */
.tk-branch { position: relative; }
.tk-branch.main { --cx: 28px; --cy: 27px; --r: 12px; }
.tk-children .tk-branch { --cx: 26px; --cy: 19px; --r: 10px; }
.tk-branch.has-kids > .tk-task > .tk-row::after {
  content: ""; position: absolute; z-index: 1;
  left: calc(var(--cx) - 1px); top: calc(var(--cy) + var(--r) + 2px); bottom: 0;
  border-left: 2px solid var(--tk-line);
}
.tk-branch.has-kids > .tk-task.open > .tk-expand { position: relative; }
.tk-branch.has-kids > .tk-task.open > .tk-expand::before {
  content: ""; position: absolute; z-index: 1; left: calc(var(--cx) - 1px); top: 0; bottom: 0;
  border-left: 2px solid var(--tk-line);
}
.tk-children { position: relative; margin-left: calc(var(--cx) - 1px); }
.tk-children > .tk-branch::before {
  content: ""; position: absolute; z-index: 1; left: 0; top: 0;
  width: 13px; height: var(--cy);
  border-left: 2px solid var(--tk-line); border-bottom: 2px solid var(--tk-line);
  border-bottom-left-radius: 10px;
}
.tk-children > .tk-branch:not(:last-child)::after {
  content: ""; position: absolute; z-index: 1; left: 0; top: 0; bottom: 0;
  border-left: 2px solid var(--tk-line);
}
.tk-children .tk-row { padding: 8px 14px 8px 16px; }

/* Geöffnete Aufgabe */
.tk-task.open { background: #1f1f22; border-radius: 14px; box-shadow: 0 10px 30px -14px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.06); }
.tk-branch.main > .tk-task.open { border-radius: 16px 16px 0 0; box-shadow: none; background: rgba(10,132,255,0.07); }
.tk-card > .tk-branch:not(.has-kids) > .tk-task.open { border-radius: 16px; }
.tk-children .tk-task.open { margin: 4px 10px 6px 4px; }
.tk-children .tk-task.open > .tk-row { padding: 8px 14px 4px 12px; }
.tk-task.is-highlight > .tk-row { background: rgba(10,132,255,0.16); }
.tk-title-input { width: 100%; background: none !important; border: none !important; box-shadow: none !important; color: var(--text); font-size: 1.08rem; font-weight: 600; letter-spacing: -0.015em; padding: 0 !important; border-radius: 0; }
.tk-title-input:focus { outline: none; }
.tk-where { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.tk-expand { padding: 8px 14px 14px 50px; animation: riseIn 0.22s ease both; }

.tk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tk-chip { display: inline-flex; align-items: center; gap: 5px; border: none; background: var(--tk-fill); color: var(--text); font-size: 0.82rem; font-family: inherit; padding: 6px 12px; border-radius: 980px; cursor: pointer; position: relative; }
.tk-chip:hover { background: rgba(118,118,128,0.34); }
.tk-chip.on { color: var(--success); }
.tk-chip select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; }

.tk-wait-box { background: rgba(255,159,10,0.1); border: 1px solid rgba(255,159,10,0.28); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.tk-wait-lbl { font-size: 0.72rem; font-weight: 600; color: var(--warn); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.tk-mini { background: none; border: none; color: var(--accent); font-size: 0.8rem; font-weight: 600; cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; font-family: inherit; }
.tk-w-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tk-w-item { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px; border-radius: 980px; font-size: 0.86rem; background: rgba(255,159,10,0.16); color: #ffd59e; max-width: 100%; }
.tk-w-item.link { background: rgba(255,255,255,0.08); color: var(--text); }
.tk-w-item.link.ok { color: #a5f0b9; background: rgba(48,209,88,0.12); text-decoration: line-through; text-decoration-color: rgba(165,240,185,0.5); }
.tk-w-item .go { cursor: pointer; }
.tk-w-item .go:hover { text-decoration: underline; }
.tk-w-item button { background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 0.95rem; padding: 0 3px; font-family: inherit; }
.tk-w-item button:hover { opacity: 1; }
.tk-w-input-wrap { position: relative; }
.tk-w-input { background: rgba(0,0,0,0.35) !important; border: 1px solid rgba(255,159,10,0.25) !important; font-size: 0.9rem; padding: 8px 11px !important; }
.tk-w-input:focus { border-color: var(--warn) !important; box-shadow: 0 0 0 3px rgba(255,159,10,0.18) !important; }
.tk-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #2c2c2e; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; z-index: 30; box-shadow: 0 14px 30px -10px rgba(0,0,0,0.8); }
.tk-suggest[hidden] { display: none; }
.tk-suggest div { padding: 9px 12px; font-size: 0.86rem; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.tk-suggest div + div { border-top: 1px solid var(--tk-sep); }
.tk-suggest div:hover, .tk-suggest div.hl { background: rgba(10,132,255,0.25); }
.tk-suggest small { color: var(--muted); margin-left: auto; white-space: nowrap; }

.tk-note { font-size: 0.8rem; color: var(--muted); margin: -4px 0 12px; }
.tk-note b { color: var(--text); font-weight: 500; cursor: pointer; }
.tk-note b:hover { text-decoration: underline; }
.tk-sub-add { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; padding: 4px 6px 4px 12px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.tk-sub-add > span { color: var(--accent); font-weight: 700; }
.tk-sub-add input { flex: 1; background: none !important; border: none !important; box-shadow: none !important; padding: 6px 0 !important; font-size: 0.92rem; }

.tk-section { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin: 4px 0 6px; }
.tk-thread { display: flex; flex-direction: column; gap: 5px; max-height: 340px; overflow-y: auto; padding: 2px 2px 6px; }
.tk-composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.tk-composer textarea { flex: 1; background: #000 !important; border: 1px solid #3a3a3c !important; border-radius: 18px !important; padding: 8px 14px !important; font-size: 15px; resize: none; min-height: 38px; max-height: 120px; }
.tk-send { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 17px; cursor: pointer; flex-shrink: 0; font-family: inherit; }
.tk-send:hover { background: var(--accent-hover); }
.tk-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.tk-link { background: none; border: none; cursor: pointer; font-size: 0.9rem; padding: 4px 0; font-family: inherit; }
.tk-link.red { color: var(--danger); }
.tk-link.blue { color: var(--accent); font-weight: 600; }
.tk-done-toggle { display: flex; justify-content: center; margin: 22px 0 6px; }

/* Sprechblasen (Aufgaben-Verlauf + Chat) */
.ch-sys { align-self: center; text-align: center; font-size: 0.73rem; color: var(--muted); max-width: 88%; margin: 5px 0; line-height: 1.35; background: rgba(255,255,255,0.045); padding: 4px 10px; border-radius: 8px; }
.ch-bw { display: flex; flex-direction: column; max-width: 82%; align-self: flex-start; }
.ch-bw.me { align-self: flex-end; align-items: flex-end; }
.ch-bubble { padding: 6px 11px 7px; border-radius: 15px; font-size: 0.9rem; line-height: 1.38; background: #2c2c2e; color: var(--text); word-break: break-word; }
.ch-bw:not(.me) .ch-bubble { border-top-left-radius: 4px; }
.ch-bw.me .ch-bubble { background: #0b5ed7; color: #fff; border-top-right-radius: 4px; }
.ch-author { font-size: 0.76rem; font-weight: 600; display: block; margin-bottom: 1px; }
.ch-text { white-space: pre-wrap; }
.ch-time { font-size: 0.66rem; opacity: 0.62; margin-left: 10px; float: right; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.ch-del { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.7rem; padding: 0 0 0 2px; opacity: 0.8; }
.ch-del:hover { color: var(--danger); opacity: 1; }
.ch-quote { display: block; border-left: 3px solid var(--warn); background: rgba(0,0,0,0.25); border-radius: 6px; padding: 4px 8px; margin: 2px 0 5px; font-size: 0.78rem; line-height: 1.3; cursor: pointer; color: #ffd59e; }
.ch-quote:hover { background: rgba(0,0,0,0.38); }
.ch-quote small { display: block; color: rgba(245,245,247,0.6); }

/* =====================================================================
   Reiter „Kommentare“ – eine Unterhaltung wie in WhatsApp
   ===================================================================== */
nav button { position: relative; }
.nav-badge { position: absolute; top: 1px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.nav-badge[hidden] { display: none; }

.ch-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 2px 12px; }
.ch-filter button { border: none; background: var(--tk-fill); color: var(--text); font-size: 0.82rem; padding: 6px 13px; border-radius: 980px; cursor: pointer; font-family: inherit; }
.ch-filter button.on { background: var(--text); color: #000; font-weight: 600; }
.ch-card { background: #0b141a; border-radius: 18px; border: 1px solid rgba(255,255,255,0.08); overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 420px; }
.ch-head { padding: 12px 16px; background: #1f2c34; display: flex; align-items: center; gap: 12px; }
.ch-avatars { display: flex; }
.ch-av { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.88rem; color: #000; border: 2px solid #1f2c34; }
.ch-av + .ch-av { margin-left: -10px; }
.ch-head-text { min-width: 0; }
.ch-title { font-weight: 600; font-size: 0.95rem; }
.ch-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-add { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 1px dashed rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); color: #5f6368; font-size: 1.2rem; cursor: not-allowed; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; font-family: inherit; }
.ch-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px); background-size: 18px 18px; }
.ch-body .ch-bubble { background: #202c33; }
.ch-body .ch-bw.me .ch-bubble { background: #005c4b; }
.ch-body .ch-bw { cursor: pointer; }
.ch-day { align-self: center; background: #1f2c34; color: #8696a0; font-size: 0.72rem; padding: 4px 10px; border-radius: 8px; margin: 8px 0; }
.ch-foot { padding: 8px 10px 10px; background: #1f2c34; }
.ch-foot .tk-composer { margin-top: 0; }
.ch-foot textarea { background: #2a3942 !important; border-color: transparent !important; }
.ch-reply { display: flex; align-items: center; gap: 6px; background: #0b141a; border-left: 3px solid var(--warn); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; font-size: 0.82rem; }
.ch-reply b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-reply button { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; font-family: inherit; }
.ch-hint { font-size: 0.78rem; color: var(--muted); text-align: center; padding: 6px; line-height: 1.4; }

@media (max-width: 600px) {
  .tk-head h2 { font-size: 1.4rem; }
  .tk-head-actions .task-summary { display: none; }
  .tk-newbar select { max-width: 100%; width: 100%; }
  .tk-expand { padding-left: 14px; padding-right: 12px; }
  .tk-branch.has-kids > .tk-task.open > .tk-expand::before { display: none; }
  .tk-children .tk-task.open { margin-right: 6px; }
  .tk-c { font-size: 0.8rem; }
  .ch-card { height: calc(100vh - 210px); }
  .ch-bw { max-width: 88%; }
}

/* Gesperrte Reiter (z.B. für Stefan): sichtbar, aber ausgegraut */
nav button.nav-locked { color: rgba(245,245,247,0.28); cursor: not-allowed; }
nav button.nav-locked:hover { background: transparent; color: rgba(245,245,247,0.32); }
nav button.nav-locked::after { content: "🔒"; font-size: 0.6rem; margin-left: 4px; opacity: 0.55; vertical-align: 1px; }

/* Wetter + kurze Hinweise oben */
.header-weather { font-size: 0.85rem; color: var(--muted); white-space: nowrap; cursor: default; font-variant-numeric: tabular-nums; }
.header-weather[hidden] { display: none; }
.header-hint {
  border: 1px solid rgba(10,132,255,0.3);
  background: rgba(10,132,255,0.14);
  color: #d6e9ff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 980px;
  cursor: pointer;
  white-space: nowrap;
}
.header-hint:hover { background: rgba(10,132,255,0.22); }
.header-hint[hidden] { display: none; }
.header-hint.hint-in { animation: hintIn 0.35s cubic-bezier(0.32, 0.72, 0, 1) both; }
.header-hint.hint-out { animation: hintOut 0.32s ease both; }
body.hint-visible #header-date { display: none; }
@keyframes hintIn { from { opacity: 0; transform: translateY(-6px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes hintOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-4px) scale(0.98); } }

@media (max-width: 600px) {
  /* Auf dem iPhone als kleine Mitteilung unter dem Kopf, wie bei iOS */
  .header-hint {
    position: fixed;
    top: 62px;
    left: 0; right: 0;
    margin: 0 auto;
    width: max-content;
    max-width: 92vw;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 40;
    background: rgba(32,32,36,0.98);
    border-color: rgba(255,255,255,0.14);
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.85);
    padding: 8px 15px;
    font-size: 0.85rem;
  }
}

/* Unteraufgabe anlegen: klarer Speichern-Knopf + Schließen */
.tk-sub-save { border: none; background: var(--accent); color: #fff; font-family: inherit; font-size: 0.82rem; font-weight: 600; padding: 6px 12px; border-radius: 980px; cursor: pointer; flex-shrink: 0; }
.tk-sub-save:hover { background: var(--accent-hover); }
.tk-sub-close { border: none; background: none; color: var(--muted); font-family: inherit; font-size: 1.1rem; line-height: 1; padding: 4px 6px; cursor: pointer; flex-shrink: 0; }
.tk-sub-close:hover { color: var(--text); }

/* Geerbtes Warten (eine Unteraufgabe wartet) */
.tk-wait-why { color: rgba(255,207,138,0.75); }
.tk-inherit { background: rgba(255,159,10,0.07); border: 1px dashed rgba(255,159,10,0.3); border-radius: 12px; padding: 9px 12px; margin-bottom: 12px; font-size: 0.86rem; color: #ffd59e; line-height: 1.4; }
.tk-inherit b { color: var(--warn); font-weight: 600; }
.tk-inherit .go { cursor: pointer; text-decoration: underline; text-decoration-color: rgba(255,213,158,0.4); text-underline-offset: 2px; }

/* ---------- Sicherheit (Admin) ---------- */
.sec-status { padding: 10px 12px; border-radius: 10px; margin: 4px 0 12px; font-weight: 600;
  background: rgba(52, 199, 89, 0.12); color: var(--success); }
.sec-status.is-locked { background: rgba(255, 105, 97, 0.14); color: #ff6961; }
.sec-table-wrap { max-height: 240px; overflow: auto; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px; }
.sec-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sec-table th, .sec-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sec-table tr:last-child td { border-bottom: none; }
.sec-tip { font-size: 0.85rem; }
.sec-actions { flex-wrap: wrap; }
