:root {
  --board: #f6f7f8;
  --ink: #1a1d21;
  --muted: #6b7280;
  --border: #e4e5e8;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-bg: #eef2ff;
  --accent-border: #c7d2fe;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 6px;

  /* Spaltenakzentfarben */
  --col-grau: #9ca3af;
  --col-blau: #3b82f6;
  --col-violett: #8b5cf6;
  --col-gruen: #10b981;

  /* Prioritäts-Punkt */
  --priority-hoch: #ef4444;
  --priority-mittel: #f59e0b;
  --priority-niedrig: #22c55e;

  /* Favoriten-Stern */
  --favorite: #f59e0b;
  --favorite-outline: #d1d5db;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--board);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
}

header {
  padding: 24px 28px 10px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

header small { color: var(--muted); font-size: 0.85rem; }

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

button { font-family: inherit; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.btn-ghost, .btn-primary, .btn-danger {
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: white;
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--accent-border); color: var(--accent); }

.btn-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.btn-link[hidden] { display: none; }

.btn-primary {
  border: none;
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
  border: none;
  background: none;
  color: var(--danger);
}
.btn-danger:hover { text-decoration: underline; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px 8px;
  flex-wrap: wrap;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.filter-label select {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--ink);
}

#btn-my-cards.active,
#btn-only-favorites.active,
.btn-ghost.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-border);
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  padding: 16px 28px 40px;
  max-width: 1280px;
  align-items: start;
}

.column {
  border-radius: 8px;
  padding: 6px 4px;
  min-height: 200px;
  background: transparent;
  display: flex;
  flex-direction: column;
  transition: background 0.15s;
}

.column.dragover { background: rgba(0, 0, 0, 0.03); }
.column.col-dragover { background: rgba(0, 0, 0, 0.05); }
.column.dragging-column { opacity: 0.5; }

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; }

.hint { font-size: 0.78rem; color: var(--muted); }

.col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.col-head-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}
.col-dot-clickable { cursor: pointer; }
.col-dot-clickable:hover { transform: scale(1.3); }

.col-title {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  outline: none;
  border-bottom: 1px dashed transparent;
  padding: 1px 2px;
}
.col-title:hover, .col-title:focus { border-bottom-color: var(--accent-border); }

.col-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  border: none;
  background: none;
  color: #00000055;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  border-radius: 4px;
}
.icon-btn:hover { color: var(--accent); background: #00000008; }
.icon-btn.danger:hover { color: var(--danger); }

.wip {
  font-size: 11px;
  color: var(--col-grau);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.wip.over { color: var(--danger); font-weight: 500; }

.cards { flex: 1; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: #ffffff;
  border: 0.5px solid var(--border);
  border-top: 3px solid var(--col-grau);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: grab;
  font-size: 0.85rem;
  line-height: 1.35;
  padding: 10px 12px;
}

.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.45; }
.card.no-drag { cursor: default; }
.card.done { opacity: 0.65; }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.card-top-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
  flex: 1;
}

.card .del {
  border: none;
  background: none;
  color: var(--muted);
  opacity: 0.7;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.card .del:hover { opacity: 1; color: var(--danger); }

.card .favorite-star {
  border: none;
  background: none;
  color: var(--favorite-outline);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}
.card .favorite-star:hover { color: var(--favorite); }
.card .favorite-star.active { color: var(--favorite); }

.card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.due-date { color: var(--muted); white-space: nowrap; }
.due-date.overdue {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 4px;
  padding: 1px 6px;
}

.avatar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
  margin-left: auto;
  flex-shrink: 0;
}

.add {
  margin-top: 10px;
  border: 1px dashed var(--border);
  background: none;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.add:hover { border-color: var(--accent-border); color: var(--accent); }

/* modals */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }

/* Die Löschbestätigung kann aus einem bereits geöffneten Karten- oder
   Label-Dialog heraus erscheinen und muss deshalb über diesem liegen. */
#confirm-delete-overlay { z-index: 300; }

.modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 22px 26px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.confirm-delete-modal {
  max-width: 380px;
  padding: 24px;
}

.confirm-delete-text {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.btn-delete-confirm {
  border: none;
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--danger);
  color: white;
}
.btn-delete-confirm:hover { background: #b91c1c; }

.modal h2 {
  margin: 0 0 16px;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink);
  font-size: 1.1rem;
}

.modal form { display: flex; flex-direction: column; gap: 12px; }

.modal label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
}

.modal input[type="text"],
.modal input[type="date"],
.modal textarea,
.modal select,
.modal input[type="color"] {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  background: white;
}
.modal textarea { resize: vertical; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row label { min-width: 120px; }

.label-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.label-option input { margin: 0; }
.label-option.active { color: white; border-color: transparent; }

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.modal-actions .spacer { flex: 1; }

.labels-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.labels-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.labels-list .swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.labels-list .label-name { flex: 1; }

/* comments */

.comment-count { color: var(--muted); flex-shrink: 0; }

.comments-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.comments-heading {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.comment-item + .comment-item { border-top: 0.5px solid var(--border); padding-top: 12px; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-header .avatar-chip { margin-left: 0; }

.comment-author { font-size: 13px; font-weight: 500; color: var(--ink); }
.comment-deactivated { color: var(--muted); font-weight: 400; }
.comment-timestamp { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }

.comment-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.comment-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comment-input-row textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  background: white;
  resize: vertical;
}
.comment-input-row .btn-primary { align-self: flex-end; }

/* notifications (Glocke) */

.notif-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell {
  position: relative;
  border: 1px solid var(--border);
  background: white;
  color: var(--muted);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}
.notif-bell:hover { border-color: var(--accent-border); color: var(--accent); }

.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 200;
}

.notif-dropdown-header {
  padding: 12px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
}
.notif-item:hover { background: #00000006; }
.notif-item:last-child { border-bottom: none; }

.notif-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.notif-item.unseen .notif-dot { background: var(--accent); }

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.notif-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-timestamp { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.notif-toggle-seen {
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 13px;
  padding: 2px;
  flex-shrink: 0;
}
.notif-toggle-seen:hover { color: #4b5563; }

.notif-empty { padding: 16px; margin: 0; }

/* boards overview page */

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 28px 40px;
  max-width: 1280px;
}

.board-tile {
  position: relative;
  background: #ffffff;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.board-tile:hover { border-color: var(--accent-border); }

.board-tile-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.board-tile-count {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.board-tile-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
}

.board-tile-new {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  border-color: var(--accent-border);
  background: var(--accent-bg);
  min-height: 64px;
}

.board-tile-new-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

/* Personal card overview (/my-cards) */

.overview {
  padding: 16px 28px 40px;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.overview-group-header {
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 8px;
}

.overview-group-count {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 400;
}

.overview-list {
  background: #ffffff;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.overview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
}
.overview-row:last-child { border-bottom: none; }
.overview-row:hover { background: #fafafa; }

.overview-row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-badge {
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 8px;
  white-space: nowrap;
}

.overview-row .favorite-star {
  border: none;
  background: none;
  color: var(--favorite-outline);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}
.overview-row .favorite-star:hover { color: var(--favorite); }
.overview-row .favorite-star.active { color: var(--favorite); }

/* login page */

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 28px 30px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.login-card h1 { margin-bottom: 2px; }
.login-card .hint { margin: 0 0 18px; }

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.login-card input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.login-card .btn-primary { padding: 9px 14px; }

.error-text {
  color: var(--danger);
  font-size: 0.8rem;
  margin: 0;
}

/* non-blocking feedback */

.toast-container {
  position: fixed;
  z-index: 2000;
  top: 16px;
  right: 16px;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid #64748b;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  font-size: 0.85rem;
  line-height: 1.4;
  pointer-events: auto;
}

.toast-success { border-left-color: #16a34a; }
.toast-error { border-left-color: var(--danger); }
.toast-message { flex: 1; }

.toast-close {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
}

.toast-close:hover { color: var(--ink); }

/* activity log page */

.log-wrap {
  padding: 12px 28px 40px;
  max-width: 1100px;
  overflow-x: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  font-size: 0.85rem;
}

.log-table th,
.log-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.log-table td:nth-child(4),
.log-table td:nth-child(6) {
  white-space: normal;
}

.log-table th {
  background: var(--board);
  color: #4b5563;
  font-weight: 500;
  font-size: 0.78rem;
}

.log-table tbody tr:last-child td { border-bottom: none; }
.log-table tbody tr:hover { background: #fafafa; }

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.notif-load-more {
  display: block;
  width: calc(100% - 16px);
  margin: 8px;
  text-align: center;
}

.notif-load-more[hidden] { display: none; }
