/* done. – Oberfläche
   Dichte Arbeitsansicht: ruhige Umgebung, Farbe trägt ausschließlich Status. */

:root {
  --paper: #F1F2EF;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --ink: #16191C;
  --muted: #646C75;
  --line: #E0E2DD;
  --line-strong: #C9CCC5;
  --accent: #1F5D4C;
  --accent-ink: #123B30;
  --accent-soft: #E4EEE9;
  --danger: #B33A28;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 25, 22, .06), 0 8px 24px -16px rgba(20, 25, 22, .25);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none; flex: none;
}
.wordmark span { color: var(--accent); }
.topnav { display: flex; gap: 2px; flex: none; }
.topnav a {
  padding: 6px 10px; border-radius: var(--radius); color: var(--muted); font-weight: 500;
}
.topnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.topnav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.topbar form.search { flex: 1 1 auto; max-width: 420px; }
.topbar .spacer { flex: 1 1 auto; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff; background: var(--accent);
  letter-spacing: .01em;
}
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.avatar.empty { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }

/* ---------- Formularelemente ---------- */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  font: inherit; color: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  width: 100%;
}
textarea { resize: vertical; min-height: 80px; }
select { padding-right: 24px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 600;
  padding: 7px 13px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: #E6C8C1; }
.btn.small { padding: 4px 9px; font-size: 13px; }

.chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); letter-spacing: -.02em; }
.muted { color: var(--muted); }
.overdue { color: var(--danger); font-weight: 600; }
.duesoon { color: #9A6212; font-weight: 600; }

/* ---------- Seitenrahmen ---------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 18px 20px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card + .card { margin-top: 16px; }
.card .card-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.card .card-body { padding: 16px; }

/* ---------- Board / Gruppen ---------- */
.group { margin-bottom: 26px; }
.group-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 8px;
}
.group-head h2 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.group-head .count { color: var(--muted); font-size: 13px; }
.group.archive .group-head h2 { color: var(--muted); font-weight: 600; }

.rows {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.rows.empty-target { min-height: 46px; }

.row-head, .row {
  display: grid;
  grid-template-columns: 22px 62px minmax(220px, 3fr) minmax(120px, 1.2fr) 46px minmax(140px, 1.6fr) 104px 168px 52px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}
.row-head {
  height: 34px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.row {
  min-height: 46px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.rows .row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-2); }
.row.done-row .title a { color: var(--muted); }
.handle { cursor: grab; color: var(--line-strong); font-size: 15px; line-height: 1; }
.handle:active { cursor: grabbing; }
.row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row .title a { color: var(--ink); }
.row .meta-icons { display: flex; gap: 8px; color: var(--muted); font-size: 12px; justify-content: flex-end; }
.sortable-ghost { opacity: .35; }
.sortable-drag { box-shadow: var(--shadow); }

.inline-input {
  border: 1px solid transparent; background: transparent; padding: 4px 6px;
  border-radius: var(--radius); width: 100%; font: inherit; color: inherit;
}
.inline-input:hover { border-color: var(--line); }
.inline-input:focus { border-color: var(--accent); background: var(--surface); }
.inline-input.saved, .status-select.saved { box-shadow: 0 0 0 2px var(--accent-soft); }
.status-select {
  appearance: none; border: none; cursor: pointer; width: 100%;
  padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; text-align: center;
}
.status-select.empty { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); }

.quick-add {
  display: flex; gap: 8px; align-items: center; padding: 8px 12px;
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.quick-add input { border-color: transparent; background: transparent; }
.quick-add input:focus { background: var(--surface); border-color: var(--line-strong); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 20px; }
.kcol { flex: 0 0 272px; background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 10px; }
.kcol h3 { margin: 0; padding: 10px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.kcol .kdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.kcol .kbody { padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  cursor: grab;
}
.kcard:active { cursor: grabbing; }
.kcard .kt { font-weight: 500; margin-bottom: 6px; }
.kcard .kmeta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* ---------- Detailseite ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.detail h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -.02em; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment .chead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment .cbody { white-space: pre-wrap; word-break: break-word; }
.checkline { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.checkline input[type=checkbox] { width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.checkline.is-done span { text-decoration: line-through; color: var(--muted); }
.progressbar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin: 6px 0 10px; }
.progressbar > div { height: 100%; background: var(--accent); }
.filelist a { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.activity-line { font-size: 12.5px; color: var(--muted); padding: 4px 0; }

table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.simple th { font-size: 12px; color: var(--muted); }

.flash {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid #C8DED5;
}
.flash.error { background: #FBEAE6; border-color: #EFCDC5; color: #8C2E1F; }

.empty-state { padding: 34px 16px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px; box-shadow: var(--shadow); }
.login-card .wordmark { font-size: 26px; display: block; margin-bottom: 4px; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .row-head { display: none; }
  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title status"
      "meta  meta";
    padding: 10px 12px; gap: 6px;
  }
  .row .handle, .row .c-client, .row .c-next { display: none; }
  .row .title { grid-area: title; }
  .row .c-status { grid-area: status; width: 150px; }
  .row .c-number, .row .c-owner, .row .c-due, .row .c-icons {
    grid-area: meta; display: inline-flex; align-items: center; gap: 6px; margin-right: 12px;
  }
  .row .c-due { width: auto; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .topbar form.search { order: 3; max-width: none; flex-basis: 100%; }
  .wrap { padding: 14px 12px 70px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ---------- Dropbox ---------- */
.dbx-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
}
.dbx-file { display: block; color: inherit; }
.dbx-file:hover { text-decoration: none; }
.dbx-file:hover .dbx-thumb { border-color: var(--accent); }
.dbx-thumb {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 4 / 3; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.dbx-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dbx-ext { position: absolute; font-size: 22px; opacity: 1; z-index: 0; }
.dbx-thumb img[src] { position: relative; z-index: 1; background: var(--surface); }
.dbx-name {
  display: block; margin-top: 6px; font-size: 12px; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 25, 22, .45);
  display: grid; place-items: center; z-index: 100; padding: 16px;
}
.modal {
  background: var(--surface); border-radius: 12px; width: min(560px, 100%);
  max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.modal .crumbs { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: 1; word-break: break-all; }
.modal .body { overflow: auto; padding: 6px 0; flex: 1; }
.modal .row-item {
  display: flex; gap: 10px; align-items: center; padding: 9px 16px; cursor: pointer; border: none;
  background: none; width: 100%; text-align: left; font: inherit; color: inherit;
}
.modal .row-item:hover { background: var(--surface-2); }
.modal footer { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.suggestion { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 13px; }
.suggestion code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
