/* ═══════════════════════════════════════════════════════════════════
   Steuerlupe · Projektarbeitsplatz
   Editorial-Cockpit. Steuerlupe-Cyan + DM Serif Display italic-Akzent.
   Liquid-Glass-Buttons. 48px-Grid im Login-Hero. Vanilla, kein Build.
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Steuerlupe-Tokens (übernommen aus html/wiki/wiki-style.css) ── */
  --blue:        #0097b2;
  --blue-light:  #00b8d9;
  --blue-dark:   #007a91;
  --blue-bg:     rgba(0,151,178,.04);
  --blue-bg-2:   rgba(0,151,178,.08);
  --blue-bg-3:   rgba(0,151,178,.14);

  --navy:        #0f172a;
  --ink:         #0f172a;
  --ink-sec:     #475569;
  --ink-muted:   #94a3b8;
  --ink-faint:   #cbd5e1;

  --bg:          #fafbfc;
  --bg-soft:     #f4f6f9;
  --white:       #ffffff;

  --border:      #e2e8f0;
  --border-soft: #eef2f6;

  --red:         #dc2626;
  --green:       #16a34a;
  --amber:       #d97706;

  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   22px;

  --ease:        cubic-bezier(.4, 0, .2, 1);
  --ease-out:    cubic-bezier(.16, 1, .3, 1);

  --shadow-sm:   0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .03);
  --shadow:      0 4px 14px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg:   0 16px 48px rgba(15, 23, 42, .12), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-glow: 0 0 28px rgba(0, 151, 178, .28);

  /* App-Shell-Layout */
  --topbar-h:    56px;
  --sidebar-w:   300px;
  --detail-w:    360px;
}

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-feature-settings: 'ss01' on, 'cv11' on;
  color: var(--ink);
  background-color: var(--bg);
  /* Dezentes Pünktchen-Raster (KI-Hochschule-Stil, 22px Grid, 7% Schwarz) */
  background-image: radial-gradient(circle, rgba(15, 23, 42, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
  line-height: 1.55;
  min-height: 100vh;
  overflow: hidden; /* App-Shell scrollt selbst */
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

/* Selection */
::selection { background: var(--blue-bg-3); color: var(--ink); }

/* Scrollbars (subtil, nicht aufdringlich) */
.note-list,
.detail-body,
.sidebar { scrollbar-width: thin; scrollbar-color: var(--ink-faint) transparent; }
.note-list::-webkit-scrollbar,
.detail-body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar { width: 8px; }
.note-list::-webkit-scrollbar-thumb,
.detail-body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }


/* ═══════════════════════════════════════════════════════════════════
   GATE — Login-Hero
   ═══════════════════════════════════════════════════════════════════ */

.gate {
  position: fixed; inset: 0;
  z-index: 1000;
  display: grid; place-items: center;
  padding: 32px 20px;
  background: linear-gradient(135deg, #fafbfc 0%, #eef4f6 50%, #f6fafb 100%);
  overflow: auto;
  animation: gate-fade-in .5s var(--ease-out);
}

body[data-state="ready"] .gate,
body[data-state="app"]   .gate { display: none; }

@keyframes gate-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Background-Layer 1: 48px-Grid (das Signature-Element) */
.gate-bg-grid {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(15,23,42,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,.06) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, black 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, black 30%, transparent 90%);
}

/* Background-Layer 2: subtile Vignette mit cyan-Glow */
.gate-bg-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 30%, rgba(0,151,178,.10) 0%, transparent 50%),
    radial-gradient(circle at 78% 72%, rgba(0,184,217,.08) 0%, transparent 55%);
}

/* Glass-Card */
.gate-card {
  position: relative;
  width: min(440px, 100%);
  padding: 44px 40px 32px;
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255,255,255,.86) 0%, rgba(255,255,255,.72) 100%);
  border: 1px solid rgba(255,255,255,.95);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow:
    0 24px 64px rgba(15,23,42,.10),
    0 6px 20px rgba(15,23,42,.05),
    inset 0 1px 0 rgba(255,255,255,.95);
  animation: gate-rise .6s var(--ease-out) both;
}

@keyframes gate-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.gate-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border-radius: 100px;
  background: var(--blue-bg-2);
  border: 1px solid rgba(0,151,178,.18);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--blue-dark);
  margin-bottom: 22px;
}
.gate-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,151,178,.18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: .7; } }

.gate-title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 12px;
}
.serif-italic {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--blue);
  letter-spacing: -.5px;
}

.gate-lead {
  font-size: 15px;
  color: var(--ink-sec);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 36ch;
}

.gate-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--ink-muted);
}
.field input {
  font: inherit;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 14px; color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  outline: none;
}
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,151,178,.14);
}

.gate-actions { margin-top: 8px; }

.gate-error {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
}

.gate-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}
.link-muted { color: var(--ink-muted); font-size: 12px; }
.link-muted:hover { color: var(--blue); }


/* ═══════════════════════════════════════════════════════════════════
   LIQUID-GLASS BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.btn-glass-accent {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 22px;
  border: 1.5px solid rgba(0,151,178,.55);
  border-radius: 100px;
  background: linear-gradient(145deg,
    rgba(0,151,178,.96) 0%,
    rgba(0,151,178,.88) 50%,
    rgba(0,184,217,.92) 100%);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  color: white;
  font-weight: 600; font-size: 14px;
  letter-spacing: .1px;
  box-shadow:
    0 0 24px rgba(0,151,178,.32),
    0 12px 36px rgba(15,23,42,.10),
    0 4px 14px rgba(15,23,42,.06),
    inset 0 1px 0 rgba(255,255,255,.4),
    inset 0 -1px 0 rgba(0,0,0,.04);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn-glass-accent:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 32px rgba(0,151,178,.44),
    0 16px 48px rgba(15,23,42,.14),
    0 6px 20px rgba(15,23,42,.08),
    inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-glass-accent:active { transform: translateY(0); }
.btn-glass-accent:disabled { opacity: .55; cursor: progress; transform: none; }


/* ═══════════════════════════════════════════════════════════════════
   APP-SHELL — Drei-Spalten + Top-Bar
   ═══════════════════════════════════════════════════════════════════ */

.app {
  display: grid;
  grid-template-areas:
    "topbar  topbar    topbar"
    "sidebar canvas    detail";
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: var(--sidebar-w) 1fr 0;
  height: 100vh;
  overflow: hidden;
  opacity: 0;
  transition: opacity .35s var(--ease-out);
}
.app[data-detail-open="true"] { grid-template-columns: var(--sidebar-w) 1fr var(--detail-w); }
body[data-state="app"] .app { opacity: 1; }
body[data-state="app"] #gate { display: none; }


/* ── TOPBAR ───────────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  position: relative;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  flex-shrink: 0;
  padding: 4px 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  background: var(--blue);
  border-radius: 7px;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,151,178,.28);
}
.brand-text {
  font-family: 'DM Serif Display', serif;
  font-size: 16px;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.brand-sep { margin: 0 8px; color: var(--ink-faint); font-style: normal; }
.brand-italic {
  font-style: italic;
  color: var(--blue);
  font-weight: 400;
}

.topbar-search {
  flex: 1;
  max-width: 460px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg);
  color: var(--ink-muted);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.topbar-search:focus-within {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,151,178,.10);
}
.topbar-search input {
  flex: 1;
  border: none; background: none; outline: none;
  font: inherit; font-size: 13px; color: var(--ink);
  min-width: 0;
}
.topbar-search input::placeholder { color: var(--ink-muted); }
.kbd {
  font-family: inherit;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; position: relative; }

.stats {
  font-size: 12px; color: var(--ink-muted);
  white-space: nowrap;
}
.stats-num { font-weight: 700; color: var(--ink); }
.stats-sep { margin: 0 6px; opacity: .4; }

.countdown {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(217,119,6,.08);
  border: 1px solid rgba(217,119,6,.22);
  color: var(--amber);
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.countdown-label { font-weight: 500; opacity: .8; }

.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--white);
  color: var(--ink);
  font-size: 12px; font-weight: 600;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.user-pill:hover { border-color: var(--blue); background: var(--blue-bg); }
.user-avatar {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  background: var(--blue);
  color: white;
  border-radius: 50%;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
}
.user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  animation: menu-pop .16s var(--ease-out);
}
@keyframes menu-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.user-menu-row {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-sec);
  display: flex; flex-direction: column; gap: 2px;
}
.user-menu-row strong { color: var(--ink); font-size: 13px; }
.user-menu-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-muted); }

.user-menu-others-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-sec);
  padding: 2px 0;
}
.user-menu-others-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.user-menu-others-item.stale .dot { background: var(--ink-faint); }

.user-menu-action {
  width: 100%;
  padding: 9px 12px;
  margin-top: 4px;
  background: none; border: none;
  border-top: 1px solid var(--border-soft);
  text-align: left;
  font-size: 13px; font-weight: 600;
  color: var(--ink);
  border-radius: 6px;
  transition: background .15s var(--ease);
}
.user-menu-action:hover { background: var(--blue-bg); color: var(--blue); }


/* ── SIDEBAR ──────────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

.sidebar-head {
  padding: 18px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  letter-spacing: -.3px;
  font-weight: 400;
}

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink-sec);
  transition: all .15s var(--ease);
}
.icon-btn:hover { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }

.filter-tabs {
  display: flex; gap: 4px;
  padding: 0 20px 14px;
  flex-shrink: 0;
}
.tab {
  flex: 1;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-sec);
  transition: all .15s var(--ease);
}
.tab:hover { background: var(--bg-soft); color: var(--ink); }
.tab.active {
  background: var(--blue-bg-2);
  border-color: rgba(0,151,178,.22);
  color: var(--blue-dark);
}

.note-add {
  margin: 0 16px 12px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.note-add textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit; font-size: 13px;
  background: var(--white);
  resize: vertical;
  min-height: 50px;
  outline: none;
}
.note-add textarea:focus { border-color: var(--blue); }
.note-add-row {
  display: flex; gap: 6px;
  margin-top: 8px;
}
.note-add-row select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  font: inherit; font-size: 11px;
  color: var(--ink-sec);
  outline: none;
}
.note-add-actions {
  display: flex; justify-content: flex-end; gap: 6px;
  margin-top: 8px;
}

.btn-ghost {
  background: none; border: none;
  padding: 6px 10px; font-size: 12px; font-weight: 600;
  color: var(--ink-muted);
  border-radius: 6px;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.btn-ghost:hover { color: var(--ink); background: var(--bg-soft); }

.btn-solid {
  background: var(--blue); color: white;
  border: none;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  border-radius: 6px;
  transition: background .15s var(--ease);
}
.btn-solid:hover { background: var(--blue-dark); }

.btn-mini {
  background: none;
  border: 1px dashed var(--border);
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--ink-sec);
  border-radius: 6px;
  transition: all .15s var(--ease);
}
.btn-mini:hover { border-style: solid; border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }

.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 16px;
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}

.note-card {
  position: relative;
  padding: 10px 12px 10px 32px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
  cursor: pointer;
}
.note-card:hover { border-color: rgba(0,151,178,.4); box-shadow: var(--shadow-sm); }
.note-card.note-done { opacity: .55; }
.note-card.note-done .note-text { text-decoration: line-through; color: var(--ink-muted); }

.note-card.note-highlight {
  animation: note-flash 1.4s var(--ease-out);
}
@keyframes note-flash {
  0% { background: var(--blue-bg-2); border-color: var(--blue); }
  100% { background: var(--white); }
}

.note-checkbox {
  position: absolute; left: 10px; top: 11px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 4px;
  background: var(--white);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.note-checkbox:hover { border-color: var(--blue); }
.note-checkbox[aria-checked="true"] {
  background: var(--blue);
  border-color: var(--blue);
}
.note-checkbox[aria-checked="true"]::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(0, -1px);
}

.note-text {
  font-size: 13px; line-height: 1.45;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.note-card.note-expanded .note-text { -webkit-line-clamp: unset; }

.note-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  flex-wrap: wrap;
}
.note-prio {
  padding: 1px 6px;
  border-radius: 100px;
  font-weight: 700;
  letter-spacing: .3px;
}
.note-prio-p1 { background: #fee2e2; color: var(--red); }
.note-prio-p2 { background: rgba(217,119,6,.12); color: var(--amber); }
.note-prio-p3 { background: var(--bg-soft); color: var(--ink-muted); }

.note-path {
  color: var(--ink-muted);
  font-weight: 500;
  cursor: pointer;
  transition: color .15s var(--ease);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 160px;
}
.note-path:hover { color: var(--blue); }
.note-path .sep { opacity: .4; margin: 0 3px; }

.note-assignee {
  margin-left: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink-faint);
  color: white;
  font-size: 9px; font-weight: 700;
  display: grid; place-items: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

.note-empty {
  padding: 24px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
}


/* ── CANVAS ───────────────────────────────────────────────────────── */
.canvas-wrap {
  grid-area: canvas;
  position: relative;
  background:
    radial-gradient(circle at 30% 25%, rgba(0,151,178,.04) 0%, transparent 40%),
    radial-gradient(circle at 75% 80%, rgba(0,184,217,.03) 0%, transparent 50%),
    var(--bg);
  overflow: hidden;
}

/* Subtiles Punkt-Grid als Canvas-Background */
.canvas-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(15,23,42,.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  opacity: .35;
  pointer-events: none;
}

.canvas-toolbar {
  position: absolute; top: 16px; left: 16px;
  z-index: 10;
  display: flex; align-items: center; gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
}

.canvas-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px;
  padding: 0 10px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--ink-sec);
  font-size: 11px; font-weight: 600;
  transition: all .15s var(--ease);
}
.canvas-btn:hover { background: var(--blue-bg); color: var(--blue); }

.canvas-zoom-readout {
  font-size: 10px; font-weight: 600;
  color: var(--ink-muted);
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: center;
}

.canvas-sep {
  width: 1px; height: 16px;
  background: var(--border);
  margin: 0 4px;
}

.canvas-svg {
  width: 100%; height: 100%;
  display: block;
  cursor: grab;
}
.canvas-svg.dragging { cursor: grabbing; }

/* D3-Knoten-Stile (auf SVG-Elementen via class-Attribut) */
.canvas-svg .link {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  transition: stroke .2s var(--ease), stroke-width .2s var(--ease);
}
.canvas-svg .link.link-highlight { stroke: var(--blue); stroke-width: 2.2; }

.canvas-svg .node-rect {
  fill: var(--white);
  stroke: var(--border);
  stroke-width: 1.2;
  transition: fill .2s var(--ease), stroke .2s var(--ease), stroke-width .2s var(--ease);
  filter: drop-shadow(0 1px 2px rgba(15,23,42,.05));
}
.canvas-svg .node:hover .node-rect {
  stroke: var(--blue);
  fill: rgba(0,151,178,.02);
  filter: drop-shadow(0 4px 12px rgba(0,151,178,.18));
}
.canvas-svg .node.selected .node-rect {
  stroke: var(--blue);
  stroke-width: 2;
  fill: var(--blue-bg);
}
.canvas-svg .node.search-match .node-rect {
  stroke: var(--amber);
  stroke-width: 2.2;
  fill: rgba(217,119,6,.08);
}

.canvas-svg .node-label {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
  pointer-events: none;
}
.canvas-svg .node.is-root .node-label {
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  font-weight: 400;
  font-style: italic;
  fill: var(--blue);
}
.canvas-svg .node-icon {
  font-size: 14px;
  pointer-events: none;
}
.canvas-svg .node-counter {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 700;
  fill: var(--ink-muted);
  pointer-events: none;
}

.canvas-svg .status-indicator {
  /* 4px farbiger Streifen am linken Rand der Node-Rect */
  transition: fill .2s var(--ease);
}

.canvas-svg .toggle {
  cursor: pointer;
}
.canvas-svg .toggle-circle {
  fill: var(--white);
  stroke: var(--blue);
  stroke-width: 1.5;
  transition: fill .15s var(--ease);
}
.canvas-svg .toggle:hover .toggle-circle { fill: var(--blue); }
.canvas-svg .toggle-text {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: var(--blue);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  transition: fill .15s var(--ease);
}
.canvas-svg .toggle:hover .toggle-text { fill: white; }

.canvas-svg .node-add-overlay {
  opacity: 0;
  transition: opacity .15s var(--ease);
  cursor: pointer;
}
.canvas-svg .node:hover .node-add-overlay { opacity: 1; }
.canvas-svg .node-add-overlay-circle {
  fill: var(--blue);
  filter: drop-shadow(0 2px 6px rgba(0,151,178,.45));
}
.canvas-svg .node-add-overlay-text {
  font-size: 14px; font-weight: 700;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
}

.canvas-tooltip {
  position: absolute;
  z-index: 20;
  padding: 8px 12px;
  background: var(--ink);
  color: white;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  max-width: 240px;
  box-shadow: var(--shadow-lg);
  animation: tip-pop .14s var(--ease-out);
}
@keyframes tip-pop { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.canvas-tooltip-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px;
  margin-top: 4px;
  opacity: .8;
}
.canvas-tooltip-status .dot { width: 6px; height: 6px; border-radius: 50%; }

.canvas-hint {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-muted);
  font-size: 14px;
  pointer-events: none;
}


/* ── DETAIL-PANEL ─────────────────────────────────────────────────── */
.detail {
  grid-area: detail;
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  opacity: 0;
  transition: transform .3s var(--ease-out), opacity .25s var(--ease-out);
  pointer-events: none;
  position: relative;
}
.app[data-detail-open="true"] .detail {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.detail-head {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  background: var(--white);
  position: relative; z-index: 2;
}

.detail-status-wrap { position: relative; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-sec);
  transition: all .15s var(--ease);
}
.status-pill:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
  flex-shrink: 0;
}
.status-fertig       { background: var(--green); box-shadow: 0 0 0 2px rgba(22,163,74,.18); }
.status-in-arbeit    { background: var(--blue);  box-shadow: 0 0 0 2px rgba(0,151,178,.18); }
.status-baustelle    { background: var(--amber); box-shadow: 0 0 0 2px rgba(217,119,6,.18); }
.status-unbearbeitet { background: var(--ink-muted); box-shadow: 0 0 0 2px rgba(148,163,184,.18); }

.status-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 30;
  animation: menu-pop .16s var(--ease-out);
}
.status-menu button {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: none; border: none;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--ink);
  border-radius: 6px;
  text-align: left;
  transition: background .12s var(--ease);
}
.status-menu button:hover { background: var(--bg-soft); }

.detail-close { margin-left: 8px; }

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 32px;
}

.detail-title {
  font-family: 'DM Serif Display', serif;
  font-size: 26px;
  letter-spacing: -.4px;
  line-height: 1.2;
  font-weight: 400;
  color: var(--ink);
  outline: none;
  border-radius: 6px;
  padding: 2px 4px;
  margin: 0 -4px 4px;
  transition: background .15s var(--ease);
}
.detail-title:focus { background: var(--blue-bg); }
.detail-title:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-muted);
  font-style: italic;
}

.detail-path {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 600;
  margin-bottom: 24px;
}

.detail-section {
  margin-bottom: 24px;
  padding-bottom: 4px;
}

.detail-section-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}

.detail-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-muted);
}
.count {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 4px;
  background: var(--bg-soft);
  border-radius: 100px;
  font-size: 10px;
  color: var(--ink-sec);
  letter-spacing: .3px;
}

.detail-description {
  font-size: 13.5px;
  color: var(--ink-sec);
  line-height: 1.6;
  outline: none;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0 -10px;
  min-height: 32px;
  transition: background .15s var(--ease);
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-description:focus { background: var(--blue-bg); }
.detail-description:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-muted);
  font-style: italic;
}

.detail-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--blue-bg);
  border: 1px solid rgba(0,151,178,.18);
  border-radius: var(--radius);
  font-size: 12px; font-weight: 600;
  color: var(--blue-dark);
  text-decoration: none;
  transition: all .15s var(--ease);
}
.detail-link:hover {
  background: var(--blue);
  color: white;
  text-decoration: none;
  border-color: var(--blue);
}

.detail-notes,
.detail-children {
  list-style: none;
  display: flex; flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.detail-note-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--white);
  transition: border-color .15s var(--ease);
}
.detail-note-item:hover { border-color: var(--border); }
.detail-note-item.note-done .detail-note-text { text-decoration: line-through; color: var(--ink-muted); }
.detail-note-text { flex: 1; word-break: break-word; }
.detail-note-prio {
  font-size: 9px; font-weight: 700;
  padding: 1px 5px;
  border-radius: 100px;
  flex-shrink: 0;
  margin-top: 2px;
}

.detail-note-add-form {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-soft);
  border-radius: 7px;
}
.detail-note-add-form textarea {
  font: inherit; font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  background: var(--white);
  outline: none;
  resize: vertical;
  min-height: 40px;
}
.detail-note-add-form textarea:focus { border-color: var(--blue); }
.detail-note-add-row { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.detail-note-add-row select { font: inherit; font-size: 11px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; outline: none; flex: 1; }

.detail-child-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s var(--ease);
  background: var(--white);
}
.detail-child-item:hover { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }
.detail-child-icon { font-size: 13px; }
.detail-child-label { flex: 1; font-weight: 500; }
.detail-child-arrow { color: var(--ink-faint); font-size: 11px; }

.detail-meta {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 6px;
}
.detail-meta-row {
  display: flex; justify-content: space-between;
  font-size: 11px;
}
.detail-meta-label { color: var(--ink-muted); }
.detail-meta-row span:last-child { color: var(--ink-sec); font-weight: 500; }

.detail-danger { margin-top: 24px; }
.btn-danger-text {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: none; border: 1px dashed transparent;
  font-size: 11px; font-weight: 600;
  color: var(--ink-muted);
  border-radius: 6px;
  transition: all .15s var(--ease);
}
.btn-danger-text:hover {
  color: var(--red);
  border-color: rgba(220,38,38,.4);
  background: #fef2f2;
}


/* ═══════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════ */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 8px;
  max-width: 360px;
  pointer-events: none;
}
.toast {
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in .25s var(--ease-out);
  display: flex; align-items: center; gap: 8px;
}
.toast.toast-error { background: var(--red); }
.toast.toast-success { background: var(--green); }
.toast.toast-leaving { animation: toast-out .18s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; }              to { opacity: 0; transform: translateY(8px); } }


.backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 40;
  animation: gate-fade-in .2s ease;
}


/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-Fallback
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "canvas";
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0;
    width: 86vw; max-width: 340px;
    height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform .3s var(--ease-out);
    z-index: 60;
    box-shadow: var(--shadow-lg);
  }
  .app[data-sidebar-open="true"] .sidebar { transform: none; }
  .detail {
    position: fixed;
    top: var(--topbar-h); right: 0;
    width: 92vw; max-width: 380px;
    height: calc(100vh - var(--topbar-h));
    transform: translateX(100%);
    z-index: 60;
    box-shadow: var(--shadow-lg);
  }
  .topbar-search { max-width: none; }
  .stats, .countdown { display: none; }
}

@media (max-width: 580px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .brand-text { font-size: 14px; }
  .user-name { display: none; }
  .gate-card { padding: 32px 24px 24px; }
  .gate-title { font-size: 32px; }
}


/* ═══════════════════════════════════════════════════════════════════
   FEATURE 1: USER-PICKER / PROFIL-WECHSELN
   ═══════════════════════════════════════════════════════════════════ */

/* Separator-Label im User-Menü */
.user-switch-label {
  display: block;
  padding: 10px 12px 4px;
}

/* Abschnitts-Container */
.user-switch-section {
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 4px 0 6px;
  margin: 2px 0;
}

/* Liste bekannter User */
.user-switch-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-switch-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  transition: background .13s var(--ease), color .13s var(--ease);
}
.user-switch-item:hover {
  background: var(--blue-bg);
  color: var(--blue-dark);
}

.user-switch-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,151,178,.18);
}

.user-switch-name {
  font-weight: 600;
  flex: 1;
}

.user-switch-time {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 400;
}

/* Inline-Input "Neuer Name" */
.user-switch-new {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  margin-top: 4px;
}
.user-switch-new input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font: inherit; font-size: 12px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.user-switch-new input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,151,178,.12);
  background: var(--white);
}
.user-switch-new input::placeholder { color: var(--ink-muted); }

.user-switch-new-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background .15s var(--ease);
}
.user-switch-new-btn:hover { background: var(--blue-dark); }


/* ═══════════════════════════════════════════════════════════════════
   FEATURE 2: PRIVACY-TOGGLE
   ═══════════════════════════════════════════════════════════════════ */

/* 2a: Checkbox im Note-Add-Form */
.note-add-private {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
  padding: 3px 4px;
  border-radius: 5px;
  transition: color .13s var(--ease), background .13s var(--ease);
}
.note-add-private:hover { color: var(--blue-dark); background: var(--blue-bg); }
.note-add-private input[type="checkbox"] { accent-color: var(--blue); width: 13px; height: 13px; cursor: pointer; }
.note-add-private-inline { display: flex; }

/* 2b: Visibility-Pill im Detail-Header */
.detail-visibility-wrap {
  position: relative;
  margin-left: 6px;
}

.visibility-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-sec);
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: all .15s var(--ease);
}
.visibility-pill:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }

.visibility-icon { font-size: 12px; line-height: 1; }
.visibility-label { white-space: nowrap; }

.visibility-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 180px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 35;
  animation: menu-pop .16s var(--ease-out);
}
.visibility-menu button {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: none; border: none;
  font: inherit; font-size: 12px; font-weight: 500;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  border-radius: 6px;
  text-align: left;
  transition: background .12s var(--ease);
}
.visibility-menu button:hover { background: var(--bg-soft); }

/* 2c: Lock-Icon + Toggle in Detail-Note-Item */
.note-lock-icon {
  font-size: 11px;
  flex-shrink: 0;
  opacity: .75;
  margin-top: 2px;
}

.note-vis-toggle {
  background: none; border: none;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0;
  cursor: pointer;
  color: var(--ink-muted);
  transition: opacity .15s var(--ease), background .15s var(--ease);
  margin-left: auto;
}
.detail-note-item:hover .note-vis-toggle { opacity: 1; }
.detail-note-item.note-private .note-vis-toggle { opacity: .55; }
.note-vis-toggle:hover { background: var(--blue-bg); opacity: 1; }

/* 2d: Lock-Icon in Sidebar-Note-Card */
.note-lock {
  font-size: 11px;
  flex-shrink: 0;
  opacity: .7;
  position: absolute;
  right: 10px; top: 10px;
  pointer-events: none;
}

.note-card-private {
  border-color: rgba(0,151,178,.18);
  background: var(--blue-bg);
}
.note-card-private:hover {
  border-color: rgba(0,151,178,.38);
}

/* Sicherstellen dass status-wrap und visibility-wrap beide links bleiben */
.detail-status-wrap,
.detail-visibility-wrap {
  display: inline-flex;
  align-items: center;
}

/* detail-close bleibt rechts — margin-left:auto schiebt ihn ans Ende */
.detail-head .detail-close { margin-left: auto; }


/* ═══════════════════════════════════════════════════════════════════
   COMBOBOX — Knoten-Suche im Note-Add-Form
   ═══════════════════════════════════════════════════════════════════ */

.combobox { position: relative; flex: 1; }

.combobox input[type="text"] {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit; font-size: 11px;
  color: var(--ink-sec);
  background: var(--white);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.combobox input[type="text"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,151,178,.12);
}
.combobox input[type="text"]::placeholder { color: var(--ink-muted); }

.combobox-clear {
  position: absolute; right: 5px; top: 50%;
  transform: translateY(-50%);
  border: none; background: transparent;
  color: var(--ink-muted);
  width: 20px; height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  padding: 0;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.combobox-clear:hover { background: var(--bg-soft); color: var(--ink); }

.combobox-list {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0;
  max-height: 280px; overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.10);
  z-index: 100;
  padding: 4px 0;
  list-style: none;
  margin: 0;
}

.combobox-list li {
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px; line-height: 1.4;
  transition: background .1s var(--ease);
}
.combobox-list li:hover,
.combobox-list li.cb-active { background: var(--blue-bg); }

.combobox-list .cb-label {
  display: block;
  color: var(--ink); font-weight: 500;
}
.combobox-list .cb-path {
  display: block;
  color: var(--ink-muted); font-size: 10px;
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combobox-list .cb-empty {
  color: var(--ink-muted); font-size: 11px;
  text-align: center; padding: 10px 12px;
  cursor: default;
}
.combobox-list .cb-none {
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.glass {
  /* Reusable Liquid-Glass-Surface */
  background: linear-gradient(160deg, rgba(255,255,255,.86) 0%, rgba(255,255,255,.72) 100%);
  border: 1px solid rgba(255,255,255,.95);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════
   PHASE I — Milestone-Fortschrittsbalken in der Top-Bar
   Compact-Toggle (Ring + Label) mit Drop-Down-Popover.
   Liquid-Glass-Stil, --blue-Akzent, --ease.
   ═══════════════════════════════════════════════════════════════════ */

.topbar-progress {
  position: relative;
  flex-shrink: 0;
}

.progress-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--white);
  color: var(--ink);
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
  cursor: pointer;
}
.progress-toggle:hover {
  border-color: var(--blue);
  background: var(--blue-bg);
}
.progress-toggle[aria-expanded="true"] {
  border-color: var(--blue);
  background: var(--blue-bg-2);
  box-shadow: 0 0 0 3px rgba(0,151,178,.10);
}
.progress-toggle.is-complete {
  border-color: rgba(22,163,74,.35);
  background: rgba(22,163,74,.06);
}
.progress-toggle.is-complete .progress-ring circle:last-of-type {
  stroke: var(--green);
}
.progress-toggle.is-critical-overdue {
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.06);
  animation: progress-pulse 2.4s var(--ease) infinite;
}
@keyframes progress-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.18); }
  50%      { box-shadow: 0 0 0 4px rgba(220,38,38,0); }
}

.progress-ring {
  flex-shrink: 0;
  display: block;
}
.progress-ring circle {
  transition: stroke-dashoffset .55s var(--ease-out), stroke .25s var(--ease);
}

.progress-label {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
  white-space: nowrap;
}
#progress-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.1px;
  font-variant-numeric: tabular-nums;
}
.progress-sublabel {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}

/* ── Popover ─────────────────────────────────────────────────────── */
.progress-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
  animation: progress-popover-in .18s var(--ease-out);
}
@keyframes progress-popover-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

.progress-popover-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.progress-popover-title {
  font-family: 'DM Serif Display', serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -.2px;
  color: var(--ink);
}
.progress-popover-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-sec);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.milestone-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}
.milestone-list::-webkit-scrollbar { width: 8px; }
.milestone-list::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.milestone-empty {
  padding: 24px 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

.milestone-card {
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color .2s var(--ease), background .2s var(--ease);
  margin-bottom: 6px;
}
.milestone-card:last-child { margin-bottom: 0; }
.milestone-card:hover {
  border-color: var(--blue-bg-3);
  background: var(--blue-bg);
}
.milestone-card.is-done {
  border-color: rgba(22,163,74,.22);
  background: rgba(22,163,74,.04);
}
.milestone-card.critical {
  border-left: 3px solid var(--amber);
  padding-left: 10px;
}
.milestone-card.critical.is-overdue {
  border-left-color: var(--red);
  background: rgba(220,38,38,.03);
}

.milestone-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.milestone-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.milestone-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.milestone-target-date {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-sec);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.milestone-target-date.is-overdue { color: var(--red); }
.milestone-target-date.is-soon    { color: var(--amber); }

.milestone-critical-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: rgba(217,119,6,.10);
  color: var(--amber);
  border-radius: 100px;
}
.milestone-card.is-overdue .milestone-critical-badge {
  background: rgba(220,38,38,.10);
  color: var(--red);
}

.milestone-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.milestone-progress-bar {
  flex: 1;
  height: 5px;
  background: var(--blue-bg-2);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}
.milestone-progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 100px;
  transition: width .55s var(--ease-out), background-color .25s var(--ease);
  min-width: 0;
}
.milestone-card.is-done .milestone-progress-fill { background: var(--green); }
.milestone-card.critical:not(.is-done) .milestone-progress-fill { background: var(--amber); }
.milestone-card.is-overdue:not(.is-done) .milestone-progress-fill { background: var(--red); }

.milestone-progress-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 38px;
  text-align: right;
}

.milestone-criteria {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 3px;
}
.milestone-criteria li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-sec);
  line-height: 1.3;
}
.milestone-criteria li.is-done {
  color: var(--ink-muted);
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
}
.milestone-criteria li.is-unresolved {
  color: var(--red);
  font-style: italic;
}
.criterion-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
}
.milestone-criteria li.is-done .criterion-dot      { background: var(--green); }
.milestone-criteria li.is-progress .criterion-dot  { background: var(--blue); }
.milestone-criteria li.is-blocked  .criterion-dot  { background: var(--red); }

.milestone-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.milestone-card-link:hover { text-decoration: underline; }

/* Mobile: Popover voll-breit, kein hover-Pulse */
@media (max-width: 1024px) {
  .progress-sublabel { display: none; }
  .progress-popover {
    position: fixed;
    top: var(--topbar-h);
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100vh - var(--topbar-h) - 16px);
  }
}
@media (max-width: 720px) {
  .topbar-progress { /* bleibt sichtbar, aber ohne Sublabel */ }
}

/* ─────────────────────────────────────────────────────────────────────────
   Tab-Nav (Phase H — Mindmap ↔ Board)
   ───────────────────────────────────────────────────────────────────────── */
.topbar-nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
  align-items: center;
}
.tab-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-sec);
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
  cursor: pointer;
  user-select: none;
}
.tab-link:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.tab-link.is-active {
  background: var(--blue-bg-2);
  color: var(--blue-dark);
  font-weight: 600;
}
.tab-link-muted { opacity: .65; font-size: 12px; }
.tab-link-muted:hover { opacity: 1; }
@media (max-width: 720px) {
  .topbar-nav { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   PHASE I+ — Hide-Toggle, Show-Toggle, Milestone-Edit-Mode
   ═══════════════════════════════════════════════════════════════════ */

/* Hide-X im Popover-Head (rechts neben der Summary) */
.progress-popover-head { position: relative; }
.progress-popover-hide {
  appearance: none;
  background: none;
  border: none;
  margin-left: 4px;
  padding: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-sec);
  opacity: .55;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
  flex-shrink: 0;
}
.progress-popover-hide:hover {
  opacity: 1;
  background: var(--blue-bg-2);
  color: var(--ink);
}

/* Show-Toggle (wieder-einblenden) — dezent in der Top-Bar */
.topbar-progress-show {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--white);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: .65;
  padding: 0;
  transition: opacity .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
  margin-right: 4px;
}
.topbar-progress-show:hover {
  opacity: 1;
  background: var(--blue-bg);
  border-color: var(--blue-bg-3);
}

/* Edit-Button (✎) auf Milestone-Card */
.milestone-edit-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  opacity: .55;
  border-radius: 4px;
  transition: opacity .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.milestone-edit-btn:hover {
  opacity: 1;
  background: var(--blue-bg-2);
  color: var(--blue);
}

/* Edit-Form — kompakt, max 320px */
.milestone-edit-card {
  display: block;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--blue-bg-3);
  border-radius: var(--radius);
  background: var(--white);
  margin-bottom: 6px;
}

.ms-edit-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.ms-edit-row:last-of-type { margin-bottom: 0; }

.ms-edit-row-split {
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
}
.ms-edit-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ms-edit-col-check { flex: 0 0 auto; padding-bottom: 6px; }

.ms-edit-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--ink-muted);
}

.ms-edit-input,
.ms-edit-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  padding: 5px 8px;
  border: 1px solid var(--blue-bg-3);
  border-radius: 6px;
  background: var(--white);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  box-sizing: border-box;
}
.ms-edit-input:focus,
.ms-edit-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,151,178,.14);
}
.ms-edit-textarea {
  resize: vertical;
  min-height: 48px;
  line-height: 1.4;
  font-family: inherit;
}

.ms-edit-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.ms-edit-checkbox { margin: 0; cursor: pointer; }

/* Sub-Tasks-Liste */
.ms-edit-criteria-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}
.ms-edit-criterion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 6px;
  background: var(--blue-bg);
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--ink-sec);
}
.ms-edit-criterion-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-edit-criterion-remove {
  appearance: none;
  background: none;
  border: none;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
  padding: 0;
}
.ms-edit-criterion-remove:hover {
  background: rgba(220,38,38,.10);
  color: var(--red);
}

.ms-edit-criterion-add {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.ms-edit-criterion-input { flex: 1; min-width: 0; }
.ms-edit-criterion-add-btn {
  appearance: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--blue-bg-3);
  border-radius: 6px;
  background: var(--white);
  color: var(--blue-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease);
  flex-shrink: 0;
}
.ms-edit-criterion-add-btn:hover {
  background: var(--blue-bg);
  border-color: var(--blue);
}

/* Action-Row */
.ms-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.ms-edit-cancel,
.ms-edit-save {
  appearance: none;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.ms-edit-cancel {
  background: transparent;
  color: var(--ink-sec);
  border-color: var(--border);
}
.ms-edit-cancel:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
.ms-edit-save {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.ms-edit-save:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

/* ─────────────────────────────────────────────────────────────────────────
   Phase C: Image-Preview im Detail-Panel (Logo-Designs etc.)
   ───────────────────────────────────────────────────────────────────────── */
.detail-image-wrap {
  display: block;
  border: 1px solid var(--blue-bg-3, rgba(0,151,178,.18));
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.detail-image-wrap:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -8px rgba(0,151,178,.35);
}
#detail-image {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #f8fafc;
}

/* ─────────────────────────────────────────────────────────────────────────
   Phase G: Mirror-Knoten (DAG-Support)
   - Mirror = Schatten-Referenz auf einen Master-Knoten in einem anderen Subtree
   - Visuell: gestrichelter Border, leicht reduzierte Opacity, ↪-Badge rechts oben
   - Detail-Panel: Banner "Verlinkter Knoten — Master öffnen"
   ───────────────────────────────────────────────────────────────────────── */

/* Mindmap: Mirror-Node-Styling */
.canvas-svg .node.is-mirror .node-rect {
  stroke-dasharray: 4,4;
  stroke: var(--blue);
}
.canvas-svg .node.is-mirror {
  opacity: 0.85;
}
.canvas-svg .node.is-mirror:hover {
  opacity: 1;
}
.canvas-svg .node.is-mirror.selected .node-rect {
  /* Bei Selektion: Dasharray bleibt, aber stärkere Stroke-Width */
  stroke-width: 2;
  stroke-dasharray: 4,4;
}

/* Mirror-Badge: kleines ↪-Icon rechts oben */
.canvas-svg .node-mirror-badge .node-mirror-badge-circle {
  fill: var(--blue);
  filter: drop-shadow(0 1px 2px rgba(0,151,178,.35));
}
.canvas-svg .node-mirror-badge .node-mirror-badge-text {
  font-size: 10px;
  font-weight: 700;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* Detail-Panel: Mirror-Banner */
.detail-mirror-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 14px;
  background: rgba(0,151,178,.06);
  border: 1px dashed var(--blue);
  border-radius: var(--radius);
}
.detail-mirror-banner-icon {
  font-size: 22px;
  color: var(--blue);
  font-weight: 700;
  line-height: 1;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.detail-mirror-banner-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--ink);
}
.detail-mirror-banner-body strong {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--blue-dark);
}
.detail-mirror-banner-sub {
  font-size: 11.5px;
  color: var(--ink-sec);
  line-height: 1.45;
}
.detail-mirror-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), transform .1s var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.detail-mirror-banner-btn:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}
.detail-mirror-banner-btn:active {
  transform: translateY(0);
}

/* Detail: Sub-Knoten-Section bekommt eine kleine Action-Group für mehrere Buttons */
.detail-section-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-mini-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-sec);
}
.btn-mini-ghost:hover {
  background: var(--bg-soft);
  color: var(--ink);
  border-color: var(--blue);
}

/* ─── HTML5 [hidden]-Attribut hart durchsetzen ────────────────────────
   Pre-2026-05-07-Bug: .auth-gate / .detail-mirror-banner / topbar-progress
   etc. hatten alle display:flex und ignorierten damit das HTML-hidden-
   Attribut. Konsequenz: Auth-Modal blieb nach Login sichtbar (3 Vorgänger-
   Fix-Iterationen kämpften gegen Symptom statt Ursache), Mirror-Banner
   zeigte sich auf Master-Knoten. !important schützt vor jeder Klassen-
   Spezifität — HTML-hidden bedeutet immer "weg".
   ──────────────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

