/* Kopffrei – Oberfläche
   Zahnarztpraxis Mensch im Mittelpunkt
   Flach, kontrastreich, schnell erfassbar. Hell als Standard, dunkel über [data-theme="dark"]
   (die Tokens im :root sind die dunklen, [data-theme="light"] überschreibt sie).
   -------------------------------------------------------------------- */

@font-face { font-family: "Inter"; src: url("fonts/Inter-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/Fraunces-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0B0F1A;               /* Fenster, Seitenleiste */
  --canvas: #0F1522;           /* Board-Fläche */
  --column: #151C2C;           /* Spalten */
  --surface: #1B2334;          /* Karten, Fenster, Popover */
  --surface-2: #222B3F;        /* Eingaben, Hover */
  --surface-3: #2A344B;        /* stärkerer Hover, Chips */
  --ring: #151C2C;
  --ink: #F3F5FA;
  --ink-2: #C7CEDD;
  --muted: #8F99B0;
  --faint: #66708A;
  --line: #242D40;
  --line-2: #33405A;
  --brand: #5B7CFA;
  --brand-hover: #6F8CFF;
  --brand-ink: #A9BBFF;
  --brand-soft: rgba(91, 124, 250, .16);
  --brand-focus: rgba(91, 124, 250, .35);
  --on-brand: #FFFFFF;
  --ok: #34D399; --ok-bg: rgba(52, 211, 153, .16); --ok-ink: #9FEBCB;
  --warn: #FBBF24; --warn-bg: rgba(251, 191, 36, .16); --warn-ink: #FDE68A;
  --bad: #F87171; --bad-bg: rgba(248, 113, 113, .16); --bad-ink: #FECACA;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 10px 30px -10px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .4);
  --shadow-3: 0 40px 100px -30px rgba(0, 0, 0, .85), 0 12px 30px -12px rgba(0, 0, 0, .6);
  --toast-bg: #F3F5FA; --toast-ink: #0B0F1A;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --topbar-h: 56px; --sidebar-w: 240px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF; --canvas: #F2F4F8; --column: #E8EBF1; --surface: #FFFFFF; --surface-2: #F3F5F9; --surface-3: #E6EAF1; --ring: #E8EBF1;
  --ink: #111827; --ink-2: #374151; --muted: #6B7280; --faint: #9CA3AF;
  --line: #DEE3EB; --line-2: #C9D1DD;
  --brand: #4F6BF0; --brand-hover: #3F5BE0; --brand-ink: #3446B8; --brand-soft: #E6EAFE; --brand-focus: rgba(79, 107, 240, .25);
  --ok: #16A34A; --ok-bg: #DCFCE7; --ok-ink: #14532D;
  --warn: #D97706; --warn-bg: #FEF3C7; --warn-ink: #92400E;
  --bad: #DC2626; --bad-bg: #FEE2E2; --bad-ink: #7F1D1D;
  --shadow-1: 0 1px 2px rgba(17, 24, 39, .06);
  --shadow-2: 0 8px 24px -12px rgba(17, 24, 39, .25), 0 2px 6px -2px rgba(17, 24, 39, .10);
  --shadow-3: 0 30px 80px -30px rgba(17, 24, 39, .4), 0 10px 30px -15px rgba(17, 24, 39, .2);
  --toast-bg: #111827; --toast-ink: #FFFFFF;
}

/* Label-Farben: --lc = Punkt, --lc-bg/--lc-ink = Chip */
.lc-sky    { --lc: #38BDF8; --lc-bg: rgba(56,189,248,.20); --lc-ink: #BAE6FD; }
.lc-blue   { --lc: #60A5FA; --lc-bg: rgba(96,165,250,.20); --lc-ink: #BFDBFE; }
.lc-violet { --lc: #A78BFA; --lc-bg: rgba(167,139,250,.20); --lc-ink: #DDD6FE; }
.lc-amber  { --lc: #FBBF24; --lc-bg: rgba(251,191,36,.20); --lc-ink: #FDE68A; }
.lc-green  { --lc: #34D399; --lc-bg: rgba(52,211,153,.20); --lc-ink: #A7F3D0; }
.lc-teal   { --lc: #2DD4BF; --lc-bg: rgba(45,212,191,.20); --lc-ink: #99F6E4; }
.lc-red    { --lc: #F87171; --lc-bg: rgba(248,113,113,.20); --lc-ink: #FECACA; }
.lc-pink   { --lc: #F472B6; --lc-bg: rgba(244,114,182,.20); --lc-ink: #FBCFE8; }
.lc-gray   { --lc: #94A3B8; --lc-bg: rgba(148,163,184,.20); --lc-ink: #E2E8F0; }
:root[data-theme="light"] .lc-sky    { --lc: #0284C7; --lc-bg: #E0F2FE; --lc-ink: #075985; }
:root[data-theme="light"] .lc-blue   { --lc: #2563EB; --lc-bg: #DBEAFE; --lc-ink: #1E3A8A; }
:root[data-theme="light"] .lc-violet { --lc: #7C3AED; --lc-bg: #EDE9FE; --lc-ink: #4C1D95; }
:root[data-theme="light"] .lc-amber  { --lc: #D97706; --lc-bg: #FEF3C7; --lc-ink: #92400E; }
:root[data-theme="light"] .lc-green  { --lc: #16A34A; --lc-bg: #DCFCE7; --lc-ink: #14532D; }
:root[data-theme="light"] .lc-teal   { --lc: #0D9488; --lc-bg: #CCFBF1; --lc-ink: #134E4A; }
:root[data-theme="light"] .lc-red    { --lc: #DC2626; --lc-bg: #FEE2E2; --lc-ink: #7F1D1D; }
:root[data-theme="light"] .lc-pink   { --lc: #DB2777; --lc-bg: #FCE7F3; --lc-ink: #831843; }
:root[data-theme="light"] .lc-gray   { --lc: #64748B; --lc-bg: #E2E8F0; --lc-ink: #1E293B; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--brand-ink); }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-focus); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- Rahmen */
.app { height: 100%; display: flex; flex-direction: column; }
.main { flex: 1; min-height: 0; display: flex; }

.topbar { height: var(--topbar-h); flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; background: var(--bg); border-bottom: 1px solid var(--line); -webkit-app-region: drag; user-select: none; position: relative; z-index: 5; }
.topbar button, .topbar input, .topbar label { -webkit-app-region: no-drag; }
body.mac-desktop .topbar { padding-left: 82px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; margin: 0 8px 0 2px; }
.brand-mark { width: 24px; height: 30px; object-fit: contain; }
.brand-name { font-weight: 700; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; }
.board-switch { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 10px; border-radius: 9px; max-width: 360px; font-weight: 650; font-size: 15px; color: var(--ink); border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; }
.board-switch:hover { background: var(--surface); }
.board-switch-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-switch .ico { color: var(--muted); width: 16px; height: 16px; }

.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); width: 230px; color: var(--muted); transition: .15s; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-focus); }
.search input { border: 0; background: none; outline: 0; width: 100%; color: var(--ink); }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; color: var(--ink-2); font-weight: 550; transition: .15s; }
.chip-btn:hover { background: var(--surface); color: var(--ink); }
.chip-btn.on { background: var(--brand-soft); color: var(--brand-ink); }
.chip-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); transition: .15s; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn.on { background: var(--brand-soft); color: var(--brand-ink); }
.badge { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }

/* Seitenleiste */
.sidebar { width: var(--sidebar-w); flex: none; background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 10px; gap: 14px; overflow-y: auto; transition: margin .18s ease, opacity .18s; }
body.sb-hidden .sidebar { margin-left: calc(-1 * var(--sidebar-w)); opacity: 0; pointer-events: none; }
.sb-section { display: flex; flex-direction: column; gap: 2px; }
.sb-section.sb-bottom { margin-top: auto; }
.sb-title { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; padding: 6px 10px 4px; }
.sb-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 550; text-align: left; transition: .12s; min-height: 38px; }
.sb-item:hover { background: var(--surface); color: var(--ink); }
.sb-item.on { background: var(--brand-soft); color: var(--brand-ink); }
.sb-item.on .ico { color: var(--brand-ink); }
.sb-item .ico { width: 17px; height: 17px; color: var(--muted); }
.sb-item .board-tone { width: 12px; height: 12px; margin: 0 2.5px; }
.sb-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-badge { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sb-badge.hot { background: var(--brand); color: var(--on-brand); }
.sb-badge.bad { background: var(--bad); color: #fff; }
.sb-add { color: var(--muted); font-weight: 500; min-height: 34px; }

/* Avatare */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em; flex: none; user-select: none;
  background: linear-gradient(135deg, hsl(var(--h) 60% 44%), hsl(calc(var(--h) + 28) 70% 58%)); box-shadow: 0 0 0 2px var(--ring); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.has-img { background: var(--surface-3); overflow: hidden; }
.avatar.s { width: 26px; height: 26px; font-size: 10px; }
.avatar.l { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 60px; height: 60px; font-size: 20px; }
.avatar.more { background: var(--surface-3); color: var(--ink-2); font-size: 10px; }
.avatar-btn { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.avatar-btn .avatar { width: 32px; height: 32px; font-size: 12px; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }
.avatars { display: flex; }
.avatars .avatar { margin-left: -7px; }
.avatars .avatar:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- Board */
.board { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: flex-start; gap: 16px; padding: 16px 18px 20px; overflow-x: auto; overflow-y: hidden; background: var(--canvas); }
.board.is-view { overflow-y: auto; display: block; }
.board-empty { margin: auto; text-align: center; color: var(--muted); max-width: 360px; }
.board-empty h2 { font-weight: 700; color: var(--ink); font-size: 22px; margin: 0 0 6px; }

/* Spalte */
.list { width: 300px; flex: none; display: flex; flex-direction: column; max-height: 100%; background: var(--column); border-radius: 14px; border: 1px solid var(--line); }
.list.dragging { opacity: .35; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 8px 14px; cursor: grab; }
.list-head:active { cursor: grabbing; }
.list-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lc); flex: none; box-shadow: 0 0 0 3px var(--lc-bg); }
.list-title { font-weight: 700; font-size: 14px; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 4px; margin-left: -4px; border-radius: 5px; flex: 1; min-width: 0; }
.list-title[contenteditable="true"] { outline: 2px solid var(--brand); outline-offset: 1px; background: var(--surface-2); }
.list-count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 9px; }
.list-btn { width: 28px; height: 28px; border-radius: 7px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.list-btn:hover { background: var(--surface-2); color: var(--ink); }
.list-btn .ico { width: 17px; height: 17px; }
.list-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.list-cards { padding: 2px 8px 8px; overflow-y: auto; min-height: 24px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.list-empty { padding: 18px 10px; text-align: center; color: var(--faint); font-size: 13px; border: 1px dashed var(--line-2); border-radius: 10px; }
.list-foot { padding: 0 8px 8px; }
.add-card-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 550; text-align: left; transition: .12s; min-height: 38px; }
.add-card-btn:hover { background: var(--surface); color: var(--ink); }
.composer textarea { width: 100%; resize: none; border: 1px solid var(--brand); border-radius: 10px; padding: 10px 12px; min-height: 68px; outline: 0; box-shadow: 0 0 0 3px var(--brand-focus); background: var(--surface); color: var(--ink); line-height: 1.4; font-size: 14px; }
.composer-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }

.add-list { width: 300px; flex: none; }
.add-list-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 14px; background: transparent; color: var(--muted); font-weight: 550; transition: .12s; border: 1px dashed var(--line-2); min-height: 46px; }
.add-list-btn:hover { background: var(--column); color: var(--ink); border-color: var(--line-2); }
.add-list .composer { background: var(--column); padding: 8px; border-radius: 14px; border: 1px solid var(--line); }
.add-list .composer input { width: 100%; border: 1px solid var(--brand); border-radius: 9px; padding: 9px 10px; outline: 0; box-shadow: 0 0 0 3px var(--brand-focus); background: var(--surface); color: var(--ink); }

/* Karte */
.card { background: var(--surface); border-radius: 11px; padding: 11px 12px 11px 12px; border: 1px solid var(--line); box-shadow: var(--shadow-1); cursor: pointer; display: flex; flex-direction: column; gap: 8px; position: relative; transition: border-color .12s, transform .12s, background .12s, box-shadow .12s; }
.card:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-1px); box-shadow: 0 8px 20px -12px rgba(0,0,0,.7); }
.card.dragging { opacity: .4; transform: rotate(1.5deg); }
.card.is-late { border-left: 3px solid var(--bad); padding-left: 10px; }
.card.is-today { border-left: 3px solid var(--warn); padding-left: 10px; }
.card.done { opacity: .62; }
.card.done .card-title { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--ink-2); }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650; background: var(--lc-bg); color: var(--lc-ink); letter-spacing: .005em; white-space: nowrap; }
.card-title { font-size: 14.5px; font-weight: 550; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.card-where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.card-meta:empty { display: none; }
.meta { display: inline-flex; align-items: center; gap: 4px; font-weight: 550; }
.meta .ico { width: 14px; height: 14px; stroke-width: 2.2; }
.meta.all-done { color: var(--ok); }
.due { padding: 2px 8px 2px 6px; border-radius: 6px; font-weight: 650; font-size: 12px; }
.due.ok { background: var(--ok-bg); color: var(--ok-ink); }
.due.soon { background: var(--warn-bg); color: var(--warn-ink); }
.due.late { background: var(--bad-bg); color: var(--bad-ink); }
.due.later { background: var(--surface-3); color: var(--ink-2); }
.card-meta .avatars { margin-left: auto; }
.card-meta .avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.card-check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: none; transition: .12s; background: var(--surface-2); }
.card-check .ico { width: 12px; height: 12px; stroke-width: 3; }
.card-check.on { background: var(--ok); border-color: var(--ok); color: #05281A; }
.card-check:hover { border-color: var(--ok); color: var(--ok); }
.card-row { display: flex; align-items: flex-start; gap: 9px; }
.card-row .card-check { margin-top: 0; }
.card-title-wrap { flex: 1; min-width: 0; }
.card-cover { margin: -11px -12px 2px; border-radius: 11px 11px 0 0; height: 120px; background-size: cover; background-position: center; }
.card.is-late .card-cover, .card.is-today .card-cover { margin-left: -10px; }

.placeholder { border-radius: 11px; background: var(--brand-soft); border: 1.5px dashed var(--brand); flex: none; }
.list-placeholder { width: 300px; flex: none; border-radius: 14px; background: var(--brand-soft); border: 1.5px dashed var(--brand); align-self: stretch; max-height: 100%; }

/* Aufgabenansicht (Meine Aufgaben, Überfällig) */
.taskview { max-width: 1100px; padding: 8px 6px 30px; }
.taskview-head h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.taskview-head p { margin: 0 0 22px; color: var(--muted); }
.taskview-empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }
.taskview-group { margin-bottom: 26px; }
.taskview-group h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 10px; text-transform: uppercase; letter-spacing: .05em; }
.taskview-group h3 small { color: var(--muted); font-weight: 600; }
.taskview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }

/* ---------------------------------------------------------------- Popover, Menü, Modal */
#layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#layer > * { pointer-events: auto; }
.scrim { position: fixed; inset: 0; background: rgba(3, 5, 12, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .15s; }
:root[data-theme="light"] .scrim { background: rgba(17,24,39,.45); }
.scrim.clear { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.pop { position: fixed; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-2); min-width: 230px; max-width: 360px; padding: 6px; animation: pop .12s; max-height: calc(100vh - 24px); overflow: auto; }
.pop-title { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; text-align: left; color: var(--ink); min-height: 38px; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--bad); }
.menu-item.on { background: var(--brand-soft); color: var(--brand-ink); }
.menu-item .ico { color: var(--muted); }
.menu-item.on .ico { color: inherit; }
.menu-item small { margin-left: auto; color: var(--muted); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; color: var(--on-brand); flex: none; background: var(--surface-2); }
.menu-check.on { background: var(--brand); border-color: var(--brand); }
.menu-check .ico { width: 12px; height: 12px; stroke-width: 3; }
.label-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--lc); flex: none; }
.label-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 7px; background: var(--lc-bg); color: var(--lc-ink); font-size: 12px; font-weight: 650; }
.label-pill .label-dot { width: 8px; height: 8px; }

.modal-wrap { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-3); width: 100%; max-width: 880px; animation: rise .18s cubic-bezier(.2,.8,.2,1); position: relative; }
.modal.narrow { max-width: 520px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); z-index: 2; }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-head { padding: 26px 64px 10px 30px; }
.modal-body { padding: 8px 30px 30px; }
.modal h2 { font-weight: 700; font-size: 22px; letter-spacing: -.01em; margin: 0; }
.modal h3 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.modal h3 .ico { width: 16px; height: 16px; color: var(--muted); }

/* Kartenfenster */
.cardm-head { padding: 26px 64px 6px 30px; display: flex; flex-direction: column; gap: 8px; }
.cardm-labels { display: flex; flex-wrap: wrap; gap: 6px; }
.cardm-title { font-weight: 700; font-size: 22px; letter-spacing: -.01em; line-height: 1.3; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; outline: 0; overflow-wrap: anywhere; }
.cardm-title:hover { background: var(--surface-2); }
.cardm-title:focus { background: var(--surface-2); box-shadow: 0 0 0 2px var(--brand); }
.cardm-title.done { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--ink-2); }
.cardm-sub { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cardm-sub b { color: var(--ink-2); font-weight: 600; }
.done-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px; border-radius: 8px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line-2); background: var(--surface-2); }
.done-toggle:hover { background: var(--surface-3); }
.done-toggle.on { background: var(--ok-bg); border-color: transparent; color: var(--ok-ink); }
.cardm-grid { display: grid; grid-template-columns: 1fr 210px; gap: 30px; padding: 10px 30px 30px; }
.cardm-main { min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.cardm-side { display: flex; flex-direction: column; gap: 6px; }
.side-label { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; margin: 8px 0 2px; }
.side-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-weight: 550; text-align: left; transition: .12s; min-height: 38px; }
.side-btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.side-btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.side-btn .ico { color: var(--muted); width: 16px; height: 16px; }
.side-btn input[type="date"] { border: 0; background: none; padding: 0; width: 100%; outline: 0; color: var(--ink); }
.side-members { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.side-members .avatar { box-shadow: 0 0 0 2px var(--surface); cursor: pointer; width: 34px; height: 34px; font-size: 12px; }

.desc-view { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); line-height: 1.55; border-radius: 9px; padding: 8px 10px; margin: 0 -10px; cursor: text; min-height: 40px; }
.desc-view:hover { background: var(--surface-2); }
.desc-view.empty { color: var(--faint); }
.desc-view ul { margin: 4px 0; padding-left: 20px; }
.desc-edit textarea { width: 100%; min-height: 120px; resize: vertical; border: 1px solid var(--brand); border-radius: 9px; padding: 10px 12px; outline: 0; box-shadow: 0 0 0 3px var(--brand-focus); background: var(--surface-2); color: var(--ink); line-height: 1.55; }
.row-actions { display: flex; gap: 6px; margin-top: 8px; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; font-weight: 600; transition: .12s; white-space: nowrap; }
.btn.primary, .btn.grad { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover, .btn.grad:hover { background: var(--brand-hover); }
.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.soft { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn.soft:hover { background: var(--surface-3); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.danger:hover { filter: brightness(1.15); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 13px; }

/* Checkliste */
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 4px 0 10px; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .25s; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 6px; border-radius: 8px; margin: 0 -6px; }
.check-item:hover { background: var(--surface-2); }
.check-item .menu-check { margin-top: 2px; cursor: pointer; }
.check-item .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 1px 4px; border-radius: 4px; outline: 0; }
.check-item .txt:focus { background: var(--surface-2); box-shadow: 0 0 0 2px var(--brand); }
.check-item.done .txt { text-decoration: line-through; color: var(--muted); }
.check-item .x { opacity: 0; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.check-item:hover .x { opacity: 1; }
.check-item .x:hover { background: var(--bad-bg); color: var(--bad); }
.check-add input { width: 100%; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 10px; outline: 0; background: var(--surface-2); color: var(--ink); }
.check-add input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-focus); }

/* Anhänge */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.att { border-radius: 10px; border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; }
.att:hover { border-color: var(--line-2); }
.att-thumb { height: 92px; background: var(--surface-3) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .05em; }
.att-thumb .ico { width: 26px; height: 26px; }
.att-name { padding: 7px 9px 2px; font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-info { padding: 0 9px 8px; font-size: 11.5px; color: var(--muted); }
.att-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 6px; background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; opacity: 0; }
.att:hover .att-x { opacity: 1; }
.att-x:hover { background: var(--bad-bg); color: var(--bad); }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.modal.file-over::after { content: "Datei hier ablegen"; position: absolute; inset: 0; border-radius: 18px; background: var(--brand-soft); backdrop-filter: blur(3px); border: 2px dashed var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--brand-ink); font-size: 18px; z-index: 3; }

/* Kommentare */
.comment-box { display: flex; gap: 10px; align-items: flex-start; position: relative; }
.comment-box textarea { flex: 1; resize: vertical; min-height: 44px; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; outline: 0; line-height: 1.45; background: var(--surface-2); color: var(--ink); }
.comment-box textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-focus); min-height: 80px; }
.comment-hint { font-size: 12px; color: var(--faint); margin: 6px 0 0 38px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); }
.comment-head b { color: var(--ink); font-weight: 600; }
.comment-text { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 8px 12px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.comment-text .mention { color: var(--brand-ink); background: var(--brand-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.comment .x { font-size: 12px; color: var(--faint); margin-left: 8px; }
.comment .x:hover { color: var(--bad); }
.mention-pop { position: absolute; z-index: 5; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-2); padding: 4px; min-width: 220px; }
.mention-pop .menu-item { padding: 6px 8px; min-height: 34px; }
.mention-pop .menu-item.sel { background: var(--brand-soft); }

.activity { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--muted); }
.activity .act { display: flex; gap: 8px; align-items: center; }
.activity b { color: var(--ink-2); font-weight: 600; }
.activity time { margin-left: auto; white-space: nowrap; color: var(--faint); }
.linkish { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }

/* Benachrichtigungen */
.notes { width: 380px; max-width: calc(100vw - 24px); padding: 0; }
.notes-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.notes-head b { font-size: 14px; }
.notes-list { max-height: 60vh; overflow: auto; padding: 0 6px 6px; }
.note { display: flex; gap: 10px; padding: 9px 8px; border-radius: 9px; cursor: pointer; align-items: flex-start; }
.note:hover { background: var(--surface-2); }
.note.unread { background: var(--brand-soft); }
.note.unread:hover { background: var(--brand-focus); }
.note-body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; }
.note-body small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.note-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 6px; }
.notes-empty { padding: 30px 16px; text-align: center; color: var(--muted); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; outline: 0; background: var(--surface-2); color: var(--ink); width: 100%; min-height: 38px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-focus); }
.field .hint { font-size: 12px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.err { color: var(--bad); font-size: 13px; font-weight: 500; margin: -6px 0 12px; }

/* Mitglieder-Verwaltung */
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-row .who { flex: 1; min-width: 0; }
.member-row .who b { display: block; font-weight: 600; }
.member-row .who small { color: var(--muted); }
.member-row .who .tag { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-ink); margin-left: 6px; vertical-align: 1px; }
.member-row .who .tag.off { background: var(--surface-3); color: var(--muted); }
.member-row.off { opacity: .55; }
.hue-row { display: flex; gap: 6px; flex-wrap: wrap; }
.hue-dot { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; background: linear-gradient(135deg, hsl(var(--h) 60% 44%), hsl(calc(var(--h) + 28) 70% 58%)); }
.hue-dot.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }

/* Labels bearbeiten */
.label-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.label-edit input { flex: 1; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; outline: 0; background: var(--surface-2); color: var(--ink); }
.label-edit input:focus { border-color: var(--brand); }
.color-row { display: flex; gap: 4px; }
.color-row button { width: 20px; height: 20px; border-radius: 6px; background: var(--lc); border: 2px solid transparent; }
.color-row button.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }

/* Archiv */
.arch-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.arch-row:last-child { border-bottom: 0; }
.arch-row .t { flex: 1; min-width: 0; }
.arch-row .t b { font-weight: 550; display: block; overflow-wrap: anywhere; }
.arch-row .t small { color: var(--muted); }

/* Boards */
.board-tone { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.tone-blue { background: #5B7CFA; } .tone-teal { background: #2DD4BF; } .tone-violet { background: #A78BFA; } .tone-amber { background: #FBBF24; }
.tone-rose { background: #FB7185; } .tone-green { background: #34D399; } .tone-slate { background: #94A3B8; }
.tone-row { display: flex; gap: 8px; }
.tone-row button { width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; }
.tone-row button.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }

/* ---------------------------------------------------------------- Anmeldung */
.login { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 22px; padding: 24px; overflow-y: auto; background: var(--canvas); -webkit-app-region: drag; }
.login * { -webkit-app-region: no-drag; }
.login-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow-3); padding: 34px 36px 30px; width: 100%; max-width: 580px; flex: none; text-align: center; animation: rise .3s cubic-bezier(.2,.8,.2,1); }
.login-mark { height: 84px; width: 84px; margin-bottom: 12px; border-radius: 20px; box-shadow: 0 16px 40px -16px rgba(0,0,0,.7); }
.login-title { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0; letter-spacing: -.015em; font-variation-settings: "SOFT" 50, "opsz" 36; }
.login-sub { color: var(--muted); margin: 4px 0 24px; }
.login-foot { color: var(--muted); font-size: 12.5px; margin: 0; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; text-align: center; }
.login-card .login-user, .login-card .field, .login-card .btn.grad { max-width: 400px; margin-left: auto; margin-right: auto; }
.login-card .field { margin-bottom: 14px; }
.login-card .err { max-width: 400px; margin-left: auto; margin-right: auto; }
.user-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); transition: .12s; }
.user-tile:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.user-tile b { font-weight: 650; font-size: 13px; line-height: 1.2; color: var(--ink); }
.user-tile small { color: var(--muted); font-size: 11.5px; line-height: 1.25; }
.login-user { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 18px; }
.login-user b { display: block; }
.login-user small { color: var(--muted); }
.login-back { margin-left: auto; }
.login-body-server { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; }
.login-body-server summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.login-body-server .field { margin: 10px 0 0; }
.login .field { text-align: left; }
.status-line { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.status-line.bad { color: var(--bad); }

/* Toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-ink); padding: 10px 16px; border-radius: 10px; font-weight: 550; box-shadow: var(--shadow-2); animation: rise .2s; font-size: 13.5px; max-width: 480px; }
.toast.bad { background: var(--bad); color: #fff; }

.offline-bar { position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 6; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; font-weight: 550; text-align: center; padding: 6px; backdrop-filter: blur(8px); }

/* ---------------------------------------------------------------- Kleine Bildschirme */
@media (max-width: 900px) {
  .sidebar { position: absolute; top: var(--topbar-h); bottom: 0; left: 0; z-index: 4; box-shadow: var(--shadow-2); }
  .search { width: 150px; }
  .chip-btn .t { display: none; }
}
@media (max-width: 720px) {
  .cardm-grid { grid-template-columns: 1fr; }
  .cardm-side { flex-direction: row; flex-wrap: wrap; }
  .side-label { width: 100%; }
  .side-btn { width: auto; }
  .modal-wrap { padding: 12px 8px; }
  .cardm-head, .cardm-grid, .modal-head, .modal-body { padding-left: 18px; padding-right: 18px; }
  .board-switch { font-size: 14px; max-width: 160px; }
  .brand-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Zugriffsrechte je Board -------------------------------------------------- */
.sb-item.locked { color: var(--faint); }
.sb-item.locked:hover { background: var(--surface); color: var(--muted); }
.sb-item.locked .board-tone { opacity: .45; }
.sb-lock, .menu-lock { width: 15px; height: 15px; color: var(--faint); flex: none; }
.menu-item.locked { color: var(--faint); }
.menu-item.locked .board-tone { opacity: .45; }
.board-empty-ico { width: 30px; height: 30px; color: var(--faint); margin-bottom: 10px; }

.access-all { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); cursor: pointer; }
.access-all b { display: block; font-weight: 600; color: var(--ink); }
.access-all small { color: var(--muted); }
.access-list { margin-top: 14px; display: flex; flex-direction: column; }
.access-list.dim { opacity: .45; pointer-events: none; }
.access-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.access-row:last-child { border-bottom: 0; }
.access-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.access-row .who { flex: 1; min-width: 0; }
.access-row .who b { display: block; font-weight: 600; color: var(--ink); }
.access-row .who small { color: var(--muted); }

/* Abmelden: bewusst gross und jederzeit sichtbar --------------------------
   Die Rechner stehen am Empfang und im Behandlungszimmer; der Wechsel des
   Benutzers muss in einem Griff gehen, nicht über ein Untermenü. */
.abmelden {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  background: var(--bad-bg); color: var(--bad-ink);
  border: 1px solid transparent;
  font-weight: 650; font-size: 14px; white-space: nowrap;
  transition: .12s;
}
.abmelden:hover { background: var(--bad); color: #fff; }
.abmelden:hover .ico { color: #fff; }
.abmelden .ico { width: 18px; height: 18px; color: var(--bad); flex: none; }
.abmelden:focus-visible { outline: 2px solid var(--bad); outline-offset: 2px; }
@media (max-width: 820px) { .abmelden span { display: none; } .abmelden { padding: 0 11px; } }
