/* AG Board – App Styles (Basis: abgenommener Mockup) */

:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #efeff2;
  --surface-3: #e7e7eb;
  --border: #e3e3e8;
  --border-strong: #d0d0d7;
  --text: #18181b;
  --text-2: #55555f;
  --text-3: #9a9aa5;
  --accent: #5b5bd6;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --danger: #e5484d;
  --warning: #e38a14;
  --success: #30a46c;
  --shadow-sm: 0 1px 2px rgb(16 16 24 / 6%);
  --shadow-md: 0 4px 14px rgb(16 16 24 / 10%), 0 1px 3px rgb(16 16 24 / 6%);
  --shadow-lg: 0 20px 50px rgb(16 16 24 / 18%);
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0e11;
  --surface: #18181c;
  --surface-2: #1d1d22;
  --surface-3: #26262d;
  --border: #2a2a31;
  --border-strong: #3a3a43;
  --text: #ededf0;
  --text-2: #a9a9b4;
  --text-3: #6c6c78;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 6px 18px rgb(0 0 0 / 45%);
  --shadow-lg: 0 24px 60px rgb(0 0 0 / 60%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Layout ---------- */
.app { position: relative; display: grid; grid-template-columns: var(--sidebar-w, 252px) 1fr; height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #5b5bd6, #12a594); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }

.nav-item, .project-item a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav-item:hover, .project-item a:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active, .project-item a.active { background: var(--surface-2); color: var(--text); }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 18px; }
.nav-count:empty { display: none; }

.nav-section { display: flex; align-items: center; justify-content: space-between; padding: 18px 10px 6px; color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.project-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.project-item .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-item .count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 16px; }
.demo-switch { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 11px; color: var(--text-3); }
.demo-switch select { padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 12px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.user-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13px; font-weight: 600; }
.user-meta small { color: var(--text-3); font-size: 11px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 22px; height: 22px; }
.icon-btn.sm .icon { width: 14px; height: 14px; }

.input, .select { height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; }
.input:focus, .select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 32px; width: 220px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); cursor: pointer; font-weight: 500; }
.chip-toggle.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 10.5px; font-weight: 650; flex-shrink: 0; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.empty { background: var(--surface-3); color: var(--text-3); }
.avatars { display: flex; }
.avatars .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.avatars .avatar:first-child { margin-left: 0; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; color: var(--tag); background: color-mix(in srgb, var(--tag) 13%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 550; color: var(--text-2); background: var(--surface-2); }
.badge .icon { width: 13px; height: 13px; }
.due.overdue { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.due.today { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.due.done { color: var(--text-3); text-decoration: line-through; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 14px; padding: 18px 28px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.page-head h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.015em; }
.page-head .dot { width: 12px; height: 12px; border-radius: 4px; }
.page-head .spacer { flex: 1; }
.readonly-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 550; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.automation-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; }
.automation-hint .icon { width: 13px; height: 13px; color: var(--warning); }

/* ---------- Board ---------- */
.board { flex: 1; display: flex; align-items: flex-start; gap: 14px; padding: 20px 28px 28px; overflow: auto; }
.column { width: 288px; flex-shrink: 0; display: flex; flex-direction: column; max-height: 100%; background: var(--surface-2); border-radius: 12px; transition: opacity .15s; }
.column.dragging { opacity: .4; }
.column.has-color { background: color-mix(in srgb, var(--col) 8%, var(--surface-2)); box-shadow: inset 0 3px 0 var(--col); }
.col-color { width: 12px; height: 12px; padding: 0; border: 0; border-radius: 4px; background: var(--col); flex-shrink: 0; }
button.col-color { cursor: pointer; transition: transform .12s; }
button.col-color:hover { transform: scale(1.25); }
.col-color.none { background: transparent; border: 1.5px dashed var(--border-strong); }
.color-pop { position: fixed; z-index: 50; display: grid; grid-template-columns: repeat(6, 24px); gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.color-pop .swatch { width: 24px; height: 24px; padding: 0; }
.swatch.none { background: linear-gradient(135deg, transparent 45%, var(--danger) 45% 55%, transparent 55%); border: 1.5px solid var(--border-strong); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 14px; }
.column-head[draggable="true"] { cursor: grab; }
.column-name { font-weight: 600; font-size: 13.5px; padding: 2px 4px; margin-left: -4px; border-radius: 5px; }
.column-name.editable:hover { background: var(--surface-3); cursor: text; }
.column-name-input { font-weight: 600; font-size: 13.5px; width: 150px; height: 26px; padding: 0 6px; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.column-count { color: var(--text-3); font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums; }
.column-head .icon-btn { margin-left: auto; width: 26px; height: 26px; }
.column-done-mark { color: var(--success); }
.cards { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 8px; min-height: 12px; overflow-y: auto; }
.add-card { display: flex; align-items: center; gap: 6px; margin: 0 10px 10px; padding: 7px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-3); cursor: pointer; font-weight: 500; text-align: left; }
.add-card:hover { background: var(--surface-3); color: var(--text-2); }
.quick-add { margin: 0 10px 10px; }
.quick-add textarea { width: 100%; min-height: 60px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); resize: none; outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.quick-add small { display: block; margin-top: 4px; color: var(--text-3); font-size: 11px; }

.add-column { width: 260px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: transparent; color: var(--text-3); cursor: pointer; font-weight: 550; }
.add-column:hover { color: var(--text-2); border-color: var(--text-3); }
.column-placeholder { width: 288px; flex-shrink: 0; align-self: stretch; border-radius: 12px; border: 2px dashed var(--accent); background: var(--accent-soft); }

.card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .35; transform: rotate(1.5deg); }
.card.completed .card-title { color: var(--text-3); text-decoration: line-through; }
.card.flash { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow-sm); } }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-title { font-weight: 550; line-height: 1.35; word-break: break-word; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta .avatar { margin-left: auto; }
.card-check { position: absolute; top: 10px; right: 10px; color: var(--success); }
.card-placeholder { height: 46px; border-radius: var(--radius); border: 2px dashed var(--accent); background: var(--accent-soft); }
.empty-col { padding: 14px 4px; color: var(--text-3); font-size: 12px; text-align: center; }

/* ---------- Drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgb(10 10 15 / 25%); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); z-index: 20; }
.drawer.open { transform: none; }
.drawer-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-top .crumb { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; font-size: 13px; }
.drawer-top .spacer { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 26px 30px; display: flex; flex-direction: column; gap: 22px; }
.title-input { width: 100%; border: 0; padding: 0; background: transparent; font-size: 21px; font-weight: 650; letter-spacing: -.015em; resize: none; outline: none; line-height: 1.3; }
.props { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; }
.prop-label { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.props .select, .props .input { height: 30px; border-color: transparent; background: transparent; padding: 0 8px; margin-left: -8px; max-width: 260px; }
.props .select:hover, .props .input:hover { background: var(--surface-2); }
.tag-editor { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tag.removable { cursor: pointer; }
.tag.removable:hover { filter: brightness(.9); text-decoration: line-through; }
.tag-add { height: 22px; padding: 0 6px; border: 1px dashed var(--border-strong); border-radius: 5px; background: transparent; color: var(--text-3); font-size: 11px; cursor: pointer; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.section-title .muted { margin-left: auto; color: var(--text-3); font-weight: 500; }
.desc { width: 100%; min-height: 110px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); resize: vertical; outline: none; line-height: 1.55; }
.progress { height: 5px; margin-bottom: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); transition: width .2s; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; }
.check-item:hover { background: var(--surface-2); }
.check-item.done .check-text { color: var(--text-3); text-decoration: line-through; }
.check-item .check-text { flex: 1; }
.check-item .icon-btn { opacity: 0; width: 24px; height: 24px; }
.check-item:hover .icon-btn { opacity: 1; }
.checkbox { appearance: none; width: 17px; height: 17px; margin: 0; border: 1.5px solid var(--border-strong); border-radius: 5px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; background: var(--surface); }
.checkbox:checked { background: var(--success); border-color: var(--success); }
.checkbox:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translate(0, -1px) rotate(-45deg); }
.checkbox.round { border-radius: 50%; }
.check-new { width: 100%; margin-top: 6px; }
.drawer-meta { color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); padding-top: 14px; }

/* ---------- Dashboard ---------- */
.dash { flex: 1; overflow-y: auto; padding: 26px 28px 40px; }
.dash-inner { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.greeting h1 { margin: 0; font-size: 24px; font-weight: 680; letter-spacing: -.02em; }
.greeting p { margin: 4px 0 0; color: var(--text-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.stat small { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; }
.stat strong { display: block; margin-top: 6px; font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat.overdue strong { color: var(--danger); }
.stat.today strong { color: var(--warning); }
.dash-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.group { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--border); font-weight: 600; cursor: pointer; user-select: none; }
.group-head .count { color: var(--text-3); font-weight: 500; }
.group-head .chev { margin-left: auto; color: var(--text-3); transition: transform .15s; }
.group.collapsed .group-head { border-bottom: 0; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .rows { display: none; }
.group.g-overdue .group-head { color: var(--danger); }
.group.g-today .group-head { color: var(--warning); }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.completed .row-title { color: var(--text-3); text-decoration: line-through; }
.row-title { flex: 1; min-width: 140px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-project { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .due { min-width: 86px; justify-content: center; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; color: var(--text-3); }
.empty-state .icon { width: 28px; height: 28px; }

/* ---------- Modal & Toast ---------- */
.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; background: rgb(10 10 15 / 35%); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 30; }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal { width: min(460px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal h2 { margin: 0; font-size: 17px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field input, .field select { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast-stack { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 40; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 10px; background: #1c1c21; color: #f2f2f5; box-shadow: var(--shadow-lg); font-size: 13px; animation: toast-in .2s ease-out; }
.toast .icon { color: #f5a623; }
.toast button { border: 0; background: rgb(255 255 255 / 10%); color: #fff; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; }
.toast button:hover { background: rgb(255 255 255 / 18%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

kbd { padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; font: 11px var(--font); color: var(--text-2); }

/* ---------- App-Ergänzungen ---------- */
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Anmeldung */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, #5b5bd6 14%, transparent), transparent), var(--bg); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 30px 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md); }
.auth-card .brand { padding: 0 0 4px; }
.auth-card h1 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.auth-card p { margin: -10px 0 0; color: var(--text-2); }
.auth-card .btn { height: 38px; justify-content: center; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; user-select: none; }
.form-error { padding: 9px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 550; font-size: 13px; }
.field-error { color: var(--danger); font-size: 12px; }
.field input.invalid { border-color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }

/* Seitenleiste: Benutzer-Aktionen */
.user-actions { display: flex; gap: 2px; }
.sidebar-empty { padding: 6px 10px; color: var(--text-3); font-size: 12.5px; }

/* Ladezustand */
.loading { flex: 1; display: grid; place-items: center; color: var(--text-3); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Übersicht (bis das Dashboard kommt) */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.project-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s; }
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.project-card .top { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.project-card small { color: var(--text-2); }
.hint { padding: 12px 16px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-2); font-size: 13px; }

/* Dialoge */
.modal p { margin: -6px 0 0; color: var(--text-2); }
.modal .danger-zone { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.btn.danger-solid { background: var(--danger); border-color: transparent; color: #fff; }
.prop-row { display: flex; align-items: center; gap: 8px; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tabs in Dialogen */
.modal.wide { width: min(560px, calc(100vw - 32px)); }
.tabs { display: flex; gap: 4px; margin: -4px 0 0; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font-weight: 550; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }

/* Tag-Verwaltung */
.tag-list { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.tag-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; margin: 0 -6px; border-radius: 8px; }
.tag-row:hover { background: var(--surface-2); }
.tag-row .col-color { width: 14px; height: 14px; }
.tag-row input { flex: 1; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; outline: none; font-weight: 550; }
.tag-row input:hover { border-color: var(--border); }
.tag-row input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-row .used { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.tag-row .icon-btn { opacity: .5; }
.tag-row:hover .icon-btn { opacity: 1; }
.tag-new { display: flex; gap: 8px; }
.tag-new input { flex: 1; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; }

/* Verwaltung: Vorlagen */
.admin-section h2 { margin: 0 0 4px; font-size: 16px; }
.admin-section > p { margin: 0 0 14px; color: var(--text-2); }
.template-list { display: flex; flex-direction: column; gap: 10px; }
.template-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.template-card .head { display: flex; align-items: center; gap: 8px; }
.template-card .head input { flex: 1; height: 32px; padding: 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 650; font-size: 15px; outline: none; }
.template-card .head input:hover { border-color: var(--border); }
.template-card .head input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.default-pill { padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.col-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.col-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 550; }
.col-chip .col-color { width: 9px; height: 9px; border-radius: 3px; }
.template-card .meta { color: var(--text-3); font-size: 12px; }
.field-stack { display: flex; flex-direction: column; gap: 16px; }
.tag-row .icon-btn.confirm { width: auto; padding: 0 10px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; opacity: 1; white-space: nowrap; }

/* Verwaltung: Personen */
#admin-body { gap: 32px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head p { margin: 4px 0 0; color: var(--text-2); }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.user-card.disabled { opacity: .6; }
.user-card > .avatar { width: 34px; height: 34px; font-size: 12px; }
.user-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.user-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-actions { display: flex; align-items: center; gap: 4px; }
.muted { color: var(--text-3); font-size: 12.5px; }
.role-pill, .status-pill { padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.role-pill.admin { background: var(--accent-soft); color: var(--accent); }
.status-pill { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.status-pill.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.col-chip small { color: var(--text-3); font-weight: 500; }

/* Freigaben (Dialog und Reiter Mitglieder) */
.grant-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.grant-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.grant-row:hover { background: var(--surface-2); }
.grant-row.disabled { opacity: .55; }
.grant-row .name { flex: 1; min-width: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grant-row .name small { color: var(--text-3); font-weight: 400; }
.grant-row select { height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }

/* Startpasswort */
.secret-box { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.secret-box small { color: var(--text-2); }
.secret-box code { font: 600 20px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; user-select: all; }

/* Automationen */
.automation-hint.link { border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.automation-hint.link:hover { background: var(--surface-2); color: var(--text-2); }
.rule-list { display: flex; flex-direction: column; gap: 4px; }
.rule-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; }
.rule-row:hover { background: var(--surface-2); }
.rule-row.paused .rule-name { color: var(--text-3); }
.rule-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 550; }
.rule-name .icon { color: var(--warning); width: 14px; height: 14px; }
.rule-row .icon-btn.confirm { width: auto; padding: 0 10px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; }
.rule-editor { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.rule-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-line strong { width: 40px; font-size: 13px; }
.rule-editor select, .rule-editor input { height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.rule-editor input[type=number] { width: 72px; }
.rule-param { display: inline-flex; align-items: center; gap: 6px; }
.switch { appearance: none; width: 32px; height: 18px; margin: 0; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--success); }
.switch:checked::after { transform: translateX(14px); }

/* Ziehgriff zwischen Seitenleiste und Inhalt */
.sidebar-resizer { position: absolute; top: 0; bottom: 0; left: calc(var(--sidebar-w, 252px) - 5px); width: 10px; z-index: 6; cursor: col-resize; touch-action: none; outline: none; }
.sidebar-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background .15s; }
.sidebar-resizer:hover::after, .sidebar-resizer.active::after, .sidebar-resizer:focus-visible::after { background: var(--accent); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none; }

/* Text-Editor (Beschreibung) */
.rich-editor { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.rich-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rich-editor.readonly { border-color: transparent; background: transparent; }
.rich-editor.readonly:focus-within { box-shadow: none; }
.rich-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.rich-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; }
.rich-btn:hover { background: var(--surface-2); color: var(--text); }
.rich-btn.on { background: var(--accent-soft); color: var(--accent); }
.rich-btn .icon { width: 15px; height: 15px; }
.rich-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border); }
.rich-linkbar { display: flex; gap: 6px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rich-linkbar input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); outline: none; }
.rich-linkbar input:focus { border-color: var(--accent); }
.rich-linkbar input.invalid { border-color: var(--danger); }
.rich-linkbar .btn { height: 30px; }
.rich { position: relative; min-height: 110px; max-height: 420px; overflow-y: auto; padding: 10px 12px; line-height: 1.55; outline: none; word-break: break-word; }
.rich-editor.readonly .rich { min-height: 0; padding: 0; max-height: none; }
.rich.is-empty::before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; position: absolute; }
.rich p { margin: 0 0 .55em; }
.rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 0 0 .55em; padding-left: 1.5em; }
.rich li { margin: .15em 0; }
.rich li > ul, .rich li > ol { margin: .15em 0 0; }
.rich a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.rich[contenteditable] a { cursor: text; }
.rich blockquote { margin: 0 0 .55em; padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
