/* =============================================================
   Projekt-Dashboard — Layout & Komponenten
   Baut auf colors_and_type.css (Design-Tokens) auf.
   Hintergrund: warmes Sand. Akzente: CDP Cyan, SDC Grün.
   ============================================================= */

* { box-sizing: border-box; }

:root {
  /* Praxis-Akzente */
  --sdc:        #2E7D5A;
  --sdc-600:    #266B4D;
  --sdc-100:    #E6F2EC;
  --sdc-050:    #F2F8F5;

  /* Ampel-Töne (Tints für Badges) */
  --tone-grey:  #767676;  --tone-grey-bg:  #ECEAE5;
  --tone-blue:  #01AAD7;  --tone-blue-bg:  #E2F4FA;
  --tone-amber: #C98A00;  --tone-amber-bg: #FBF0D5;
  --tone-green: #1E8A57;  --tone-green-bg: #E2F1E9;
  --tone-red:   #C73B3B;  --tone-red-bg:   #FBE4E1;

  --drawer-w: 560px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll { overflow: hidden; }

button { font-family: inherit; }
a { color: inherit; }

/* =============================================================
   Login
   ============================================================= */
.login-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--brand-cyan-050), transparent 60%),
    radial-gradient(1000px 600px at 100% 110%, var(--sdc-050), transparent 55%),
    var(--sand);
  z-index: 100;
}
.login-card {
  width: 380px; max-width: calc(100vw - 48px);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 32px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-monogram {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-cyan) 0 50%, var(--sdc) 50% 100%);
  color: #fff; font-family: var(--font-display); font-weight: 900; font-size: 18px;
  letter-spacing: -0.04em;
}
.login-brand h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.login-brand p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; margin: 18px 0 2px; }
.login-card .cdp-field { margin-bottom: 4px; }
.login-hint { font-size: 12px; color: var(--ink-4); margin-top: 18px; line-height: 1.5; }
.login-hint b { color: var(--ink-3); font-weight: 600; }
.login-card .cdp-btn { width: 100%; margin-top: 24px; }
.who-toggle { display: flex; gap: 8px; margin-top: 6px; }
.who-toggle button {
  flex: 1; border: 1.5px solid var(--border); background: var(--white);
  border-radius: var(--radius-sm); padding: 10px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: all var(--dur-base) var(--ease-out);
}
.who-toggle button.active { border-color: var(--brand-cyan); background: var(--brand-cyan-050); color: var(--brand-cyan-700); }

/* =============================================================
   App shell + topbar
   ============================================================= */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app.hidden { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  padding: 0 28px; height: 64px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand .monogram {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-cyan) 0 50%, var(--sdc) 50% 100%);
  color: #fff; font-family: var(--font-display); font-weight: 900; font-size: 14px; letter-spacing: -0.04em;
}
.brand .brand-text strong { font-family: var(--font-display); font-weight: 800; font-size: 15px; display: block; line-height: 1.1; white-space: nowrap; }
.brand .brand-text span { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; }

.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  color: var(--ink-3); padding: 9px 14px; border-radius: var(--radius-full);
  display: flex; align-items: center; gap: 8px;
  transition: all var(--dur-base) var(--ease-out);
}
.nav button:hover { color: var(--ink); background: var(--sand-dark); }
.nav button.active { color: var(--brand-cyan-700); background: var(--brand-cyan-100); }
.nav .pill {
  font-family: var(--font-body); font-weight: 700; font-size: 11px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--tone-amber-bg); color: var(--tone-amber);
}
.nav button.active .pill { background: var(--white); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.today { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.user-chip {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 5px 6px 5px 5px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--white);
  transition: border-color var(--dur-base) var(--ease-out);
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip .name { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-right: 4px; }

/* Avatare */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 11px; color: #fff;
  letter-spacing: -0.02em;
}
.avatar.melanie { background: #B5654D; }
.avatar.doc     { background: var(--ink); }
.avatar.beide   { background: linear-gradient(135deg, #B5654D 0 50%, var(--ink) 50% 100%); }
.avatar.klinik  { background: var(--sdc); }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }

/* =============================================================
   View container
   ============================================================= */
.view { flex: 1; padding: 28px; max-width: 1340px; width: 100%; margin: 0 auto; }
.view-head { margin-bottom: 22px; }
.view-head .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-cyan); }
.view-head h2 { margin: 4px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.015em; }
.view-head p { margin: 6px 0 0; color: var(--ink-3); font-size: 15px; }

/* =============================================================
   Overview — single practice, project groups
   ============================================================= */
.overview-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

/* practice switcher */
.practice-switch { display: inline-flex; gap: 8px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 5px; box-shadow: var(--shadow-sm); align-self: flex-start; }
.practice-switch button {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  border: 0; background: transparent; border-radius: var(--radius-full);
  padding: 8px 18px 8px 10px; color: var(--ink-3);
  transition: all var(--dur-base) var(--ease-out);
}
.practice-switch button .ps-kuerzel {
  font-family: var(--font-display); font-weight: 900; font-size: 12px; letter-spacing: -0.02em;
  background: var(--sand-dark); color: var(--ink-3);
  width: 34px; height: 26px; border-radius: var(--radius-sm);
  display: grid; place-items: center; transition: all var(--dur-base) var(--ease-out);
}
.practice-switch button .ps-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.practice-switch button:hover { color: var(--ink); }
.practice-switch button.active { color: var(--ink); }
.practice-switch button.active.cdp { background: var(--brand-cyan-100); }
.practice-switch button.active.sdc { background: var(--sdc-100); }
.practice-switch button.active.cdp .ps-kuerzel { background: var(--brand-cyan); color: #fff; }
.practice-switch button.active.sdc .ps-kuerzel { background: var(--sdc); color: #fff; }

/* practice banner */
.practice-panel { display: flex; flex-direction: column; gap: 20px; }
.practice-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--white);
  position: relative; box-shadow: var(--shadow-sm);
}
.practice-banner::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.practice-panel.cdp .practice-banner::before { background: var(--brand-cyan); }
.practice-panel.sdc .practice-banner::before { background: var(--sdc); }
.praxis-badge {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff;
  font-family: var(--font-display); font-weight: 900; font-size: 15px; letter-spacing: -0.02em;
}
.practice-panel.cdp .praxis-badge { background: var(--brand-cyan); }
.practice-panel.sdc .praxis-badge { background: var(--sdc); }
.praxis-title h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.praxis-title span { font-size: 12.5px; color: var(--ink-3); }
.praxis-stats { margin-left: auto; display: flex; gap: 24px; }
.praxis-stat { text-align: right; }
.praxis-stat b { font-family: var(--font-display); font-weight: 800; font-size: 22px; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.praxis-stat span { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.praxis-stat.alert b { color: var(--tone-red); }

/* project groups */
.projects { display: flex; flex-direction: column; gap: 14px; }
.project-group { display: flex; flex-direction: column; }
.project-head {
  display: flex; align-items: center; gap: 13px; cursor: pointer;
  padding: 4px 4px 14px;
}
.pg-toggle {
  width: 26px; height: 26px; flex: none; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  display: grid; place-items: center;
}
.pg-toggle .chev { transition: transform var(--dur-base) var(--ease-out); }
.project-group.collapsed .pg-toggle .chev { transform: rotate(-90deg); }
.pg-title { display: flex; flex-direction: column; }
.pg-title h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.pg-tagline { font-size: 12px; color: var(--ink-4); }
.pg-area-count {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 3px 11px;
}
.pg-stats { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.pg-stat { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--ink); display: inline-flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.pg-stat small { font-family: var(--font-body); font-weight: 500; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.pg-stat.muted { color: var(--ink-4); }
.pg-stat.alert { color: var(--tone-amber); }
.pg-stat.alert small { color: var(--tone-amber); }

.tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(284px, 1fr)); gap: 12px;
}
.project-group.collapsed .tiles { display: none; }

.tile {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--white); padding: 15px 15px 13px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 9px;
  transition: box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.tile:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tile h4 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.25; letter-spacing: -0.01em; }
.tile p { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.tile-counts { margin-left: auto; display: flex; gap: 9px; font-size: 11.5px; color: var(--ink-4); }
.tile-counts span { display: inline-flex; align-items: center; gap: 3px; }
.tile-counts span.warn { color: var(--tone-amber); font-weight: 600; }

/* Fortschrittsbalken */
.progress { display: flex; align-items: center; gap: 9px; }
.progress-track { flex: 1; height: 6px; border-radius: 3px; background: var(--sand-dark); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width var(--dur-slow) var(--ease-out); }
.practice-panel.cdp .progress-fill { background: var(--brand-cyan); }
.practice-panel.sdc .progress-fill { background: var(--sdc); }
.progress-pct { font-size: 11.5px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

/* =============================================================
   Badges (Status, Priorität)
   ============================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-weight: 600; font-size: 11.5px;
  padding: 3px 9px 3px 8px; border-radius: var(--radius-full);
  white-space: nowrap; letter-spacing: 0.01em;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.badge.grey  { background: var(--tone-grey-bg);  color: var(--tone-grey); }  .badge.grey .dot  { background: var(--tone-grey); }
.badge.blue  { background: var(--tone-blue-bg);  color: #0784a4; }            .badge.blue .dot  { background: var(--tone-blue); }
.badge.amber { background: var(--tone-amber-bg); color: var(--tone-amber); }  .badge.amber .dot { background: var(--tone-amber); }
.badge.green { background: var(--tone-green-bg); color: var(--tone-green); }  .badge.green .dot { background: var(--tone-green); }
.badge.red   { background: var(--tone-red-bg);   color: var(--tone-red); }    .badge.red .dot   { background: var(--tone-red); }

.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.prio .bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.prio .bars i { width: 3px; border-radius: 1px; background: currentColor; opacity: 0.25; }
.prio .bars i:nth-child(1) { height: 5px; }
.prio .bars i:nth-child(2) { height: 8px; }
.prio .bars i:nth-child(3) { height: 11px; }
.prio.grey  { color: var(--tone-grey); }  .prio.grey  .bars i:nth-child(-n+1) { opacity: 1; }
.prio.blue  { color: var(--tone-blue); }  .prio.blue  .bars i:nth-child(-n+1) { opacity: 1; }
.prio.amber { color: var(--tone-amber); } .prio.amber .bars i:nth-child(-n+2) { opacity: 1; }
.prio.red   { color: var(--tone-red); }   .prio.red   .bars i { opacity: 1; }

/* =============================================================
   Detail-Drawer
   ============================================================= */
.scrim {
  position: fixed; inset: 0; background: rgba(20,20,20,0.35); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-out);
}
.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--drawer-w); max-width: 94vw;
  background: var(--sand); z-index: 60;
  box-shadow: var(--shadow-xl);
  transform: translateX(100%); transition: transform var(--dur-base) var(--ease-out);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head { background: var(--white); border-bottom: 1px solid var(--border); padding: 20px 24px 0; flex: none; }
.drawer-head .dh-top { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head .praxis-tag {
  font-family: var(--font-display); font-weight: 800; font-size: 11px; color: #fff;
  padding: 3px 8px; border-radius: var(--radius-xs); letter-spacing: 0.02em;
}
.drawer-head .praxis-tag.cdp { background: var(--brand-cyan); }
.drawer-head .praxis-tag.sdc { background: var(--sdc); }
.drawer-head .breadcrumb { font-size: 12px; font-weight: 600; color: var(--ink-4); padding-top: 3px; letter-spacing: 0.02em; }
.drawer-head h2 { margin: 10px 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.drawer-head .desc { font-size: 13.5px; color: var(--ink-3); line-height: 1.5; margin: 0 0 14px; }
.drawer-close {
  margin-left: auto; flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white); cursor: pointer;
  display: grid; place-items: center; color: var(--ink-3);
  transition: all var(--dur-base) var(--ease-out);
}
.drawer-close:hover { background: var(--sand); color: var(--ink); border-color: var(--border-strong); }
.drawer-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.drawer-meta .progress { width: 150px; }

.tabs { display: flex; gap: 2px; }
.tab {
  border: 0; background: transparent; cursor: pointer; position: relative;
  font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--ink-3);
  padding: 12px 14px 14px; display: flex; align-items: center; gap: 7px;
  transition: color var(--dur-base) var(--ease-out);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-cyan-700); }
.tab.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2.5px; background: var(--brand-cyan); border-radius: 2px 2px 0 0; }
.tab .count { font-family: var(--font-body); font-weight: 700; font-size: 11px; color: var(--ink-4); }
.tab.active .count { color: var(--brand-cyan); }

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

/* =============================================================
   Aufgaben-Liste (im Drawer + global)
   ============================================================= */
.task {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 13px 14px; margin-bottom: 10px;
  display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.task:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.task.done { opacity: 0.62; }
.task-check {
  width: 20px; height: 20px; border-radius: 6px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--border-strong); background: var(--white); cursor: pointer;
  display: grid; place-items: center; color: #fff;
  transition: all var(--dur-base) var(--ease-out);
}
.task-check:hover { border-color: var(--brand-cyan); }
.task.done .task-check { background: var(--tone-green); border-color: var(--tone-green); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.35; }
.task.done .task-title { text-decoration: line-through; text-decoration-color: var(--ink-4); }
.task-title[contenteditable] { outline: none; border-radius: 4px; padding: 1px 3px; margin: -1px -3px; }
.task-title[contenteditable]:focus { background: var(--brand-cyan-050); box-shadow: 0 0 0 2px var(--brand-cyan-100); }
.task-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; margin-top: 3px; }
.task-foot { display: flex; align-items: center; gap: 10px; margin-top: 9px; flex-wrap: wrap; }
.task-foot .who { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.status-btn {
  border: 0; cursor: pointer; background: none; padding: 0;
}
.status-btn .badge { cursor: pointer; transition: filter var(--dur-base) var(--ease-out); }
.status-btn:hover .badge { filter: brightness(0.96); }
.task .bereich-ref { margin-left: auto; font-size: 11.5px; color: var(--ink-4); display: inline-flex; align-items: center; gap: 6px; }
.task .bereich-ref .pdot { width: 7px; height: 7px; border-radius: 50%; }

.add-row { display: flex; gap: 10px; margin-top: 4px; }
.add-row input { flex: 1; }
.empty { text-align: center; color: var(--ink-4); font-size: 13.5px; padding: 32px 0; }

/* =============================================================
   Fragen
   ============================================================= */
.frage {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 15px 16px; margin-bottom: 12px;
}
.frage.beantwortet { border-left: 3px solid var(--tone-green); }
.frage .q-head { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.frage .q-head .meta { font-size: 11.5px; color: var(--ink-4); margin-left: auto; }
.frage .q-text { font-size: 14px; color: var(--ink); line-height: 1.5; font-weight: 500; }
.frage .a-block { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.frage .a-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-4); margin-bottom: 5px; }
.frage .a-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; background: var(--sand); padding: 10px 12px; border-radius: var(--radius-sm); }
.frage .a-input { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.frage textarea {
  width: 100%; resize: vertical; min-height: 60px; font-family: var(--font-body); font-size: 13.5px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--ink);
  background: var(--white); transition: border-color var(--dur-base) var(--ease-out);
}
.frage textarea:focus { outline: 0; border-color: var(--brand-cyan); }
.frage .a-actions { display: flex; gap: 8px; align-items: center; }

/* =============================================================
   Entscheidungen (Log)
   ============================================================= */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.decision { position: relative; margin-bottom: 16px; }
.decision::before { content: ''; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--white); border: 2.5px solid var(--brand-cyan); }
.decision .d-text { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.4; }
.decision .d-ctx { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; margin-top: 4px; }
.decision .d-meta { font-size: 11.5px; color: var(--ink-4); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.decision-lock { font-size: 11.5px; color: var(--ink-4); display: inline-flex; align-items: center; gap: 5px; }

/* =============================================================
   Reviews
   ============================================================= */
.review {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 15px 16px; margin-bottom: 12px;
}
.review .r-head { display: flex; align-items: flex-start; gap: 10px; }
.review h4 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.3; }
.review .r-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; margin: 4px 0 0; }
.review .r-flow { display: flex; align-items: center; gap: 6px; margin-top: 13px; flex-wrap: wrap; }
.flow-step {
  font-size: 11.5px; font-weight: 600; color: var(--ink-4);
  padding: 5px 11px; border-radius: var(--radius-full); border: 1.5px solid var(--border);
  background: var(--white); cursor: pointer; transition: all var(--dur-base) var(--ease-out);
  display: inline-flex; align-items: center; gap: 5px;
}
.flow-step:hover { border-color: var(--border-strong); color: var(--ink-3); }
.flow-step.active.amber { background: var(--tone-amber-bg); border-color: var(--tone-amber); color: var(--tone-amber); }
.flow-step.active.blue  { background: var(--tone-blue-bg);  border-color: var(--tone-blue);  color: #0784a4; }
.flow-step.active.green { background: var(--tone-green-bg); border-color: var(--tone-green); color: var(--tone-green); }
.flow-step.active.red   { background: var(--tone-red-bg);   border-color: var(--tone-red);   color: var(--tone-red); }
.review .r-arrow { color: var(--ink-4); font-size: 11px; }
.review .r-notes { margin-top: 11px; font-size: 12.5px; color: var(--ink-2); background: var(--sand); padding: 9px 12px; border-radius: var(--radius-sm); line-height: 1.45; }
.review .r-notes b { color: var(--ink); }
.review .reviewer { margin-left: auto; }

/* =============================================================
   Globale Ansichten — Toolbar + Filter
   ============================================================= */
.toolbar { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group > label { font-size: 12px; font-weight: 600; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; }
.seg { display: inline-flex; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer; border-radius: var(--radius-full);
  font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 6px 13px;
  transition: all var(--dur-base) var(--ease-out);
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--ink); color: #fff; }
.seg.cdp button.active { background: var(--brand-cyan); }
.seg.sdc button.active { background: var(--sdc); }
.result-count { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.result-count b { color: var(--ink); font-weight: 700; }

/* Gruppen-Header in globalen Listen */
.group { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.group-head h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.group-head .ghint { font-size: 12.5px; color: var(--ink-4); }
.group-head .gcount {
  font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-full); padding: 2px 9px;
}
.group.alert .group-head h3 { color: var(--tone-red); }

/* Aufgaben-Tabelle (global) */
.task .pdot-wrap { display: none; }
.global-list .task { cursor: default; }

/* Karten-Spalten für Reviews global */
.review-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .review-cols { grid-template-columns: 1fr; } .overview-grid { gap: 18px; } }

.fade-in { animation: fadeIn var(--dur-base) var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* kleine Buttons */
.btn-ghost-sm {
  border: 1.5px solid var(--border-strong); background: var(--white); color: var(--ink-2);
  border-radius: var(--radius-full); padding: 7px 14px; font-size: 12.5px; font-weight: 700;
  font-family: var(--font-display); cursor: pointer; transition: all var(--dur-base) var(--ease-out);
}
.btn-ghost-sm:hover { border-color: var(--brand-cyan); color: var(--brand-cyan); }

.icon { width: 16px; height: 16px; stroke-width: 2; flex: none; }
.icon-sm { width: 13px; height: 13px; stroke-width: 2; }

/* =============================================================
   Erweiterungen v2 — Suche, Erledigt-Meta, Aktivitaets-Log
   ============================================================= */

/* Suchfeld (Fragen-Ansicht) */
.search-field {
  flex: 1; min-width: 220px; max-width: 420px;
  font-family: var(--font-body); font-size: 14px;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 10px 16px;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.search-field::placeholder { color: var(--ink-4); }
.search-field:focus { outline: 0; border-color: var(--brand-cyan); box-shadow: 0 0 0 3px var(--brand-cyan-100); }

/* "completed by … · date" an erledigten Aufgaben */
.task-done-meta {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 8px; font-size: 11.5px; font-weight: 600;
  color: var(--tone-green);
}
.task-done-meta svg { width: 12px; height: 12px; }

/* Aktivitaets-Log */
.log-day { margin-bottom: 18px; }
.log-day-head {
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em;
  margin: 8px 0 10px;
}
.log-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 11px 14px; margin-bottom: 8px;
}
.log-icon {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; margin-top: 1px;
}
.log-icon svg { width: 14px; height: 14px; }
.log-icon.grey  { background: var(--tone-grey-bg);  color: var(--tone-grey); }
.log-icon.blue  { background: var(--tone-blue-bg);  color: #0784a4; }
.log-icon.amber { background: var(--tone-amber-bg); color: var(--tone-amber); }
.log-icon.green { background: var(--tone-green-bg); color: var(--tone-green); }
.log-icon.red   { background: var(--tone-red-bg);   color: var(--tone-red); }
.log-main { flex: 1; min-width: 0; }
.log-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.log-text b { color: var(--ink); font-weight: 700; }
.log-ref { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; }
.log-ref .pdot { width: 7px; height: 7px; border-radius: 50%; }
.log-time { font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; flex: none; padding-top: 4px; }

/* =============================================================
   Resources — Karten, Formular, Datei-Chips
   ============================================================= */
.icon-btn {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  border: 1px solid var(--border); background: var(--white); color: var(--ink-3);
  display: grid; place-items: center; cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.icon-btn.danger:hover { border-color: var(--tone-red); color: var(--tone-red); }

.res-list { display: flex; flex-direction: column; gap: 12px; }
.res-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 15px 16px;
  transition: box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.res-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.res-head { display: flex; align-items: flex-start; gap: 12px; }
.res-titlewrap { flex: 1; min-width: 0; }
.res-card h4 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.res-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.res-ref { font-size: 11.5px; color: var(--ink-4); display: inline-flex; align-items: center; gap: 6px; }
.res-ref .pdot { width: 7px; height: 7px; border-radius: 50%; }
.res-ref.muted { color: var(--ink-4); }
.res-by { font-size: 11.5px; color: var(--ink-4); display: inline-flex; align-items: center; gap: 6px; }
.res-actions { display: flex; gap: 6px; flex: none; }
.res-body { margin-top: 11px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; white-space: pre-wrap; max-height: 320px; overflow: auto; background: var(--sand); border-radius: var(--radius-sm); padding: 11px 13px; }
.res-linkrow { margin-top: 11px; display: flex; flex-direction: column; gap: 5px; }
.res-link { font-size: 13px; color: var(--brand-cyan-700); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; width: fit-content; }
.res-link:hover { text-decoration: underline; }
.res-filerow { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 8px; }

.file-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand-cyan-050); border: 1px solid var(--brand-cyan-100); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); text-decoration: none; max-width: 280px;
}
.file-chip:hover { border-color: var(--brand-cyan); }
.file-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip em { color: var(--ink-4); font-style: normal; font-size: 11px; flex: none; }
.file-chip.editable { background: var(--white); border-color: var(--border); }
.file-x { border: 0; background: transparent; cursor: pointer; color: var(--ink-4); display: grid; place-items: center; padding: 0; }
.file-x:hover { color: var(--tone-red); }
.file-x svg { width: 13px; height: 13px; }

/* Resource-Formular */
.res-form {
  background: var(--white); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 18px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow-sm);
}
.rf-row2 { display: flex; gap: 13px; flex-wrap: wrap; }
.rf-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; }
.rf-field > span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.rf-input, .rf-select, .rf-textarea {
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%;
  transition: border-color var(--dur-base) var(--ease-out);
}
.rf-input:focus, .rf-select:focus, .rf-textarea:focus { outline: 0; border-color: var(--brand-cyan); }
.rf-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.rf-links { min-height: 56px; }
.rf-file { font-size: 13px; color: var(--ink-2); }
.rf-existing { display: flex; flex-wrap: wrap; gap: 8px; }
.rf-actions { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.rf-hint { font-size: 12px; color: var(--ink-4); }
.rf-linknote { font-size: 12.5px; color: var(--brand-cyan-700); background: var(--brand-cyan-050); border: 1px solid var(--brand-cyan-100); border-radius: var(--radius-sm); padding: 8px 11px; display: flex; align-items: center; gap: 7px; }

/* Verknuepfte Ressourcen — Chips an Aufgaben/Fragen */
.res-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.res-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px;
  border: 1px solid var(--brand-cyan-100); background: var(--brand-cyan-050);
  color: var(--brand-cyan-700); border-radius: var(--radius-full);
  padding: 4px 11px 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
}
.res-chip:hover { border-color: var(--brand-cyan); background: var(--brand-cyan-100); }
.res-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-chip svg { width: 12px; height: 12px; flex: none; }

/* kleiner Text-Button ("+ result") */
.link-btn {
  border: 0; background: transparent; cursor: pointer; padding: 2px 4px;
  font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--brand-cyan-700);
  border-radius: var(--radius-sm); transition: background var(--dur-base) var(--ease-out);
}
.link-btn:hover { background: var(--brand-cyan-050); }

/* Anhang-Felder im Antwortbereich */
.a-attach { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.a-attach .rf-input { font-size: 13px; }

/* =============================================================
   Overview-Schnellanlegen + Task-Bearbeiten
   ============================================================= */
.ov-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ov-actions { display: flex; gap: 8px; margin-left: auto; }

.ov-form {
  background: var(--white); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow-sm);
}
.ov-form h3 { margin: 0 0 2px; font-family: var(--font-display); font-weight: 800; font-size: 17px; }

/* Owner als klickbarer Button (Reassign) */
.task-foot .who {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  border-radius: var(--radius-full); padding: 2px 8px 2px 4px;
  transition: all var(--dur-base) var(--ease-out);
}
.task-foot .who:hover { border-color: var(--border-strong); background: var(--white); }

.link-btn.danger { color: var(--tone-red); }
.link-btn.danger:hover { background: var(--tone-red-bg); }

/* Task-Edit-Formular (inline) */
.task-edit {
  background: var(--white); border: 1.5px solid var(--brand-cyan); border-radius: var(--radius-md);
  padding: 15px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
}

/* =============================================================
   Datei-Viewer (Modal) + Markdown-Darstellung
   ============================================================= */
.viewer {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%) scale(0.98);
  width: min(920px, 94vw); max-height: 88vh; z-index: 70;
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.viewer.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.viewer-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); flex: none;
}
.viewer-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.viewer-name svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.viewer-acts { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.viewer-body { overflow: auto; padding: 22px 26px; }
.viewer-img { max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: var(--radius-sm); }
.viewer-frame { width: 100%; height: 74vh; border: 0; }
.code-body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--ink-2);
  background: var(--sand); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0;
}

/* Markdown */
.md-body { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.25; margin: 1.4em 0 0.5em; }
.md-body h1 { font-size: 26px; font-weight: 800; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md-body h2 { font-size: 21px; font-weight: 800; }
.md-body h3 { font-size: 17px; font-weight: 700; }
.md-body h4 { font-size: 15px; font-weight: 700; }
.md-body h1:first-child, .md-body h2:first-child, .md-body h3:first-child { margin-top: 0; }
.md-body p { margin: 0 0 0.9em; }
.md-body ul, .md-body ol { margin: 0 0 0.9em; padding-left: 1.5em; }
.md-body li { margin: 0.2em 0; }
.md-body a { color: var(--brand-cyan-700); text-decoration: underline; }
.md-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88em; background: var(--brand-cyan-050); padding: 1px 5px; border-radius: 4px; color: var(--ink); }
.md-body pre { background: var(--ink); border-radius: var(--radius-sm); padding: 14px 16px; overflow: auto; margin: 0 0 1em; }
.md-body pre code { background: none; color: #e8f6fb; font-size: 12.5px; line-height: 1.5; padding: 0; }
.md-body blockquote { border-left: 3px solid var(--brand-cyan); background: var(--brand-cyan-050); margin: 0 0 1em; padding: 8px 14px; color: var(--ink-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.md-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }
.md-body img { max-width: 100%; border-radius: var(--radius-sm); }
.md-body table { border-collapse: collapse; width: 100%; margin: 0 0 1.1em; font-size: 13.5px; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; vertical-align: top; }
.md-body thead th { background: var(--sand); font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.md-body tbody tr:nth-child(even) { background: var(--brand-cyan-050); }
