/* Tafel – schlicht: eine Schrift, wenig Farbe, Linien statt Schatten. */
/* Hell/Dunkel: light-dark(hell, dunkel) wählt die Farbe passend zu color-scheme.
   "light dark" = folgt dem System. Der Umschalter im Menü setzt data-theme und
   zwingt damit eine Variante – ohne dass jede Farbe doppelt definiert werden muss. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f6f6f4, #141413);
  --panel: light-dark(#ffffff, #1d1d1b);
  --line: light-dark(#e7e6e2, #2b2b28);
  --line-strong: light-dark(#d4d3ce, #3a3a36);
  --text: light-dark(#1c1c1a, #ecebe7);
  --muted: light-dark(#7a7872, #8f8d86);
  --hover: light-dark(#efeeea, #262624);
  --accent: light-dark(#1c1c1a, #ecebe7);
  --accent-ink: light-dark(#ffffff, #141413);
  --focus: #4ade80;
  --danger: #dc2626;
  --s-todo: #a8a6a0;
  --s-doing: #2563eb;
  --s-review: #ea580c;
  --s-done: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px light-dark(rgb(0 0 0 / .04), rgb(0 0 0 / .3)),
            0 4px 16px light-dark(rgb(0 0 0 / .05), rgb(0 0 0 / .3));
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* --- Buttons & Felder --- */
.btn {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px;
  padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { opacity: .88; }
.btn.icon { padding: 3px 9px; font-size: 16px; line-height: 1.2; }
.btn.wide { width: 100%; padding: 8px; }
.btn.danger-text { border: 0; background: none; color: var(--muted); padding: 4px 0; }
.btn.danger-text:hover { color: var(--danger); }
input, select, textarea {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px; padding: 7px 10px; width: 100%;
}
textarea { resize: none; }

/* --- Avatare --- */
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 600; border: 0; flex: none; user-select: none;
}
.avatar.small { width: 24px; height: 24px; font-size: 11px; margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.avatar.tiny { width: 18px; height: 18px; font-size: 10px; }
button.avatar { cursor: pointer; }

/* --- Kopfzeile --- */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.01em; }
.logo { width: 14px; height: 14px; border-radius: 4px; background: var(--text); box-shadow: inset -6px 0 0 var(--focus); }
.top {
  position: fixed; inset: 0 0 auto 0; height: 52px; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 20;
}
.tabs { display: flex; gap: 2px; margin-left: 12px; background: var(--bg); padding: 3px; border-radius: 9px; }
.tabs a { padding: 3px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; }
.tabs a.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.online { display: flex; padding-left: 6px; }
.conn { width: 7px; height: 7px; border-radius: 50%; background: var(--s-done); }
.conn.off { background: var(--danger); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 38px; min-width: 180px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column;
}
.menu-name { padding: 6px 10px; color: var(--muted); font-size: 12px; }
.menu button { border: 0; background: none; text-align: left; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--hover); }

#view { position: fixed; inset: 52px 0 0 0; }

/* --- Status-Farben (ein Punkt reicht) --- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s); flex: none; display: inline-block; }
[data-status="todo"] { --s: var(--s-todo); }
[data-status="doing"] { --s: var(--s-doing); }
[data-status="review"] { --s: var(--s-review); }
[data-status="done"] { --s: var(--s-done); }

/* --- Kanban --- */
.kanban { display: flex; gap: 14px; padding: 18px; overflow-x: auto; align-items: flex-start; }
.col { flex: 0 0 280px; display: flex; flex-direction: column; max-height: 100%; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 600; }
.count { color: var(--muted); font-weight: 400; }
.col-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; overflow-y: auto; padding: 2px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; cursor: pointer; user-select: none;
}
.card:hover { border-color: var(--line-strong); }
.card.selected { border-color: var(--text); }
.card.dragging { opacity: .35; }
.card-title { overflow-wrap: anywhere; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; min-height: 18px; }
.placeholder { height: 44px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.quick { padding: 6px 2px; }
.quick-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; width: 100%; text-align: left; }
.quick-btn:hover { background: var(--hover); color: var(--text); }

/* --- Board --- */
.board {
  overflow: hidden; cursor: default; touch-action: none;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1.2px);
  background-size: 24px 24px;
}
.board.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.bcard {
  position: absolute; left: 0; top: 0; width: 220px; padding: 10px 12px 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: grab; user-select: none; box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}
.bcard::before { /* Statusleiste links */
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--s);
}
.bcard:hover { border-color: var(--line-strong); }
.bcard.selected { border-color: var(--text); }
.bcard.lifted { cursor: grabbing; box-shadow: var(--shadow); }
.bcard.remote { transition: transform 90ms linear; outline: 2px solid var(--by); outline-offset: 1px; }
.bcard-title { overflow-wrap: anywhere; }
.bcard-meta { display: flex; gap: 10px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.status-chip { display: inline-flex; align-items: center; gap: 6px; }
.by {
  display: none; position: absolute; top: -22px; left: -1px; padding: 1px 7px; border-radius: 6px 6px 6px 0;
  background: var(--by); color: #fff; font-size: 11px; white-space: nowrap;
}
.bcard.remote .by { display: block; }
.toolbar {
  position: absolute; left: 16px; bottom: 16px; display: flex; gap: 6px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: var(--shadow);
}
.zoom { min-width: 48px; text-align: center; color: var(--muted); font-size: 12px; }
.hint { position: absolute; right: 16px; bottom: 20px; color: var(--muted); font-size: 12px; pointer-events: none; }
.notes-count { white-space: nowrap; }

/* --- Seitenpanel --- */
.drawer {
  position: fixed; top: 52px; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 10; overflow-y: auto;
  padding: 14px 22px 22px; transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column; gap: 10px;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; }
.status-select {
  width: auto; padding: 4px 28px 4px 10px; border-radius: 99px; font-size: 13px;
  appearance: none; cursor: pointer;
  background: var(--panel) radial-gradient(circle, var(--s) 3.5px, transparent 4px) 8px 50% / 10px 10px no-repeat;
  padding-left: 26px; border-radius: 99px;
}
.title-input { border: 0; padding: 2px 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; overflow: hidden; background: none; }
.title-input:focus { outline: none; box-shadow: 0 2px 0 var(--focus); border-radius: 0; }
.drawer-meta { color: var(--muted); font-size: 12px; margin-top: -4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.notes { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.empty { color: var(--muted); margin: 0; }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.note-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .1s; }
.note:hover .note-actions { opacity: 1; }
.note-actions button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 5px; }
.note-actions button:hover { background: var(--hover); color: var(--text); }
.note > .md, .note-edit { margin: 4px 0 0 26px; }
.note-input { min-height: 84px; line-height: 1.5; }
.composer { display: flex; flex-direction: column; gap: 8px; position: sticky; bottom: -22px; background: var(--panel); padding: 10px 0 0; border-top: 1px solid var(--line); margin-top: auto; }
.row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.preview { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 84px; }
.drawer-foot { padding-top: 4px; }

/* --- Markdown-Darstellung --- */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote { margin: 0 0 .6em; }
.md h1, .md h2, .md h3, .md h4 { margin: .8em 0 .3em; line-height: 1.3; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.15em; } .md h3, .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.3em; }
.md li.check { list-style: none; margin-left: -1.3em; }
.md li.check input { width: auto; margin: 0 4px 0 0; vertical-align: -1px; }
.md a { color: var(--s-doing); text-underline-offset: 2px; }
.md code { font: 12.5px var(--mono); background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--hover); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line-strong); padding-left: 10px; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md img { max-width: 100%; border-radius: 6px; }

/* --- Login & Dialoge --- */
.login { position: fixed; inset: 0; display: grid; place-items: center; }
.login-card { width: 320px; display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card .brand { font-size: 18px; margin-bottom: 4px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.error { color: var(--danger); margin: 0; min-height: 1em; font-size: 13px; }
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .25); }
.dlg { display: flex; flex-direction: column; gap: 12px; padding: 22px; width: 380px; }
.dlg h3 { margin: 0; font-size: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--panel);
  padding: 8px 14px; border-radius: 8px; z-index: 50; font-size: 13px;
}
