/* ============================================================
   Boardly, Kanban-Demo (v0.9.4 Beta)
   Palette: Pflaume als Primärfarbe, Ocker als Akzent.
   ============================================================ */

:root {
  --accent: #59395c;
  --accent-600: #462c49;
  --accent-100: #ece2ee;
  --accent-50: #f6f1f7;
  --accent-border: #d8c8db;

  --ochre: #d9a648;
  --ochre-deep: #7a5410;
  --ochre-bg: #faf1dc;
  --ochre-border: #e3c684;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --column-bg: #f1f2f5;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Bewusster Radius-Mix: Spalten kantiger als Karten, Buttons nochmal anders. */
  --radius: 8px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.1);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.16);

  --font:
    -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------
   App-Shell
   ------------------------------------------------------------ */

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */

.sidebar {
  width: 264px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-size: 12px;
  color: var(--muted);
}

.sidebar-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px;
}

.sidebar-heading {
  margin: 8px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.board-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.board-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-sm);
}

.board-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  text-align: left;
  font-weight: 500;
  color: var(--text);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.board-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--faint);
  transition: color 0.15s ease;
}

.board-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-link:hover {
  background: var(--bg);
}

.board-item.is-active .board-link {
  background: var(--accent-50);
  color: var(--accent-600);
  font-weight: 600;
}

.board-item.is-active .board-link svg {
  color: var(--accent);
}

.btn-new-board {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  font-weight: 500;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
}

.btn-new-board svg {
  width: 15px;
  height: 15px;
}

.btn-new-board:hover {
  border-color: var(--accent);
  color: var(--accent-600);
  background: var(--accent-50);
}

.sidebar-footer {
  /* Unten Platz lassen, damit die fixe Demo-Ribbon nichts verdeckt. */
  padding: 14px 16px 56px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-notice {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--faint);
}

.demo-badge {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}

.demo-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--faint);
}

.beta-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 7px 2px;
  border: 1px solid var(--ochre-border);
  border-radius: 5px;
  background: var(--ochre-bg);
  color: var(--ochre-deep);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: 2px;
  white-space: nowrap;
}

.roadmap-note {
  margin: 0;
  padding: 9px 11px 10px;
  border: 1px dashed var(--ochre-border);
  border-radius: 6px;
  background: #fdf8ec;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.roadmap-title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ochre-deep);
}

.roadmap-note ul {
  margin: 0;
  padding-left: 16px;
}

.roadmap-note li {
  margin: 1px 0;
}

/* ------------------------------------------------------------
   Buttons (allgemein)
   ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  font-weight: 600;
  font-size: 13.5px;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease;
}

.btn:hover {
  background: var(--bg);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

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

.btn-outline {
  color: var(--muted);
}

.btn-outline:hover {
  color: var(--text);
}

.btn-danger-ghost {
  border-color: transparent;
  background: none;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: rgba(17, 24, 39, 0.06);
  color: var(--text);
}

.link-btn {
  border: none;
  background: none;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--accent-600);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: background-color 0.15s ease;
}

.link-btn:hover {
  background: var(--accent-50);
}

/* ------------------------------------------------------------
   Topbar & Filterleiste
   ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 6px;
  background: var(--surface);
}

.hamburger {
  display: none;
}

.topbar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.board-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.progress-track {
  width: 160px;
  max-width: 38vw;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--ochre);
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.filterbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 24px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search-wrap {
  position: relative;
  flex-shrink: 0;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}

.search-wrap input {
  width: 230px;
  max-width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-100);
}

.search-wrap input::placeholder {
  color: var(--faint);
}

.chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lbl-fg, var(--faint));
}

.chip:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.chip.is-active {
  background: var(--lbl-bg);
  border-color: var(--lbl-fg);
  color: var(--lbl-fg);
  font-weight: 600;
}

/* ------------------------------------------------------------
   Label-Farben (gedeckte Palette)
   ------------------------------------------------------------ */

.label-design {
  --lbl-bg: #ccfbf1;
  --lbl-fg: #0f766e;
}
.label-entwicklung {
  --lbl-bg: #dbeafe;
  --lbl-fg: #1d4ed8;
}
.label-marketing {
  --lbl-bg: #fef3c7;
  --lbl-fg: #b45309;
}
.label-bug {
  --lbl-bg: #fee2e2;
  --lbl-fg: #b91c1c;
}
.label-idee {
  --lbl-bg: #dcfce7;
  --lbl-fg: #15803d;
}
.label-none {
  --lbl-bg: #f3f4f6;
  --lbl-fg: #4b5563;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--lbl-bg);
  color: var(--lbl-fg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Board-Bereich & Spalten
   ------------------------------------------------------------ */

.board-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  /* Unten Platz für die fixe Demo-Ribbon reservieren. */
  padding: 20px 24px 56px;
  overflow-x: auto;
  overflow-y: hidden;
}

.column {
  display: flex;
  flex-direction: column;
  width: 296px;
  max-height: 100%;
  flex-shrink: 0;
  background: var(--column-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.column.is-drop-target {
  background: var(--accent-50);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-100);
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 8px 16px;
}

.column-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-count {
  flex-shrink: 0;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.07);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 56px;
  padding: 4px 10px 8px;
  overflow-y: auto;
}

.list-empty {
  padding: 14px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

.add-card-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 10px 10px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.add-card-btn svg {
  width: 14px;
  height: 14px;
}

.add-card-btn:hover {
  background: rgba(89, 57, 92, 0.08);
  color: var(--accent-600);
}

.add-column-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 232px;
  flex-shrink: 0;
  padding: 13px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
}

.add-column-btn svg {
  width: 15px;
  height: 15px;
}

.add-column-btn:hover {
  border-color: var(--accent);
  color: var(--accent-600);
  background: var(--accent-50);
}

/* ------------------------------------------------------------
   Karten
   ------------------------------------------------------------ */

.card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  /* Die abgeschnittene Ecke unten links ist Absicht (kleiner Beta-Tick). */
  border-radius: 12px 12px 12px 4px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card:active {
  cursor: grabbing;
}

.card.is-overdue {
  border-color: var(--danger-border);
}

.card.is-dragging {
  opacity: 0.55;
  transform: rotate(2.5deg) scale(0.98);
  border-style: dashed;
  border-color: var(--accent);
  box-shadow: none;
}

.card-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.due-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--bg);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.due-badge svg {
  width: 12px;
  height: 12px;
}

.due-badge.is-overdue {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.desc-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: var(--faint);
}

.desc-indicator svg {
  width: 14px;
  height: 14px;
}

/* Einfüge-Indikator beim Drag & Drop */
.drop-indicator {
  position: relative;
  flex-shrink: 0;
  height: 3px;
  margin: 0 4px 0 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-100);
}

.drop-indicator::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  transform: translateY(-50%);
}

/* ------------------------------------------------------------
   Kontextmenü (⋯)
   ------------------------------------------------------------ */

.menu {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-weight: 500;
  font-size: 13.5px;
  transition: background-color 0.12s ease;
}

.menu-item:hover {
  background: var(--bg);
}

.menu-item.is-danger {
  color: var(--danger);
}

.menu-item.is-danger:hover {
  background: var(--danger-bg);
}

/* ------------------------------------------------------------
   Dialoge
   ------------------------------------------------------------ */

.dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  overflow-y: auto;
}

.dialog-card {
  width: min(520px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

.dialog[open] {
  animation: dialog-in 0.18s ease;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 20px 24px 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.label-picker > legend {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.req {
  color: var(--danger);
}

.field input[type="text"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-100);
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.field-error {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--danger);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.label-picker {
  margin: 0;
  padding: 0;
  border: none;
}

.label-picker > legend {
  padding: 0;
  margin-bottom: 6px;
}

.label-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.label-option {
  position: relative;
  display: inline-flex;
}

.label-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.label-option .label-chip {
  padding: 6px 13px;
  font-size: 12.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.label-option .label-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.label-option input:checked + .label-chip {
  border-color: var(--lbl-fg);
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--lbl-fg);
}

.label-option input:focus-visible + .label-chip {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.spacer {
  flex: 1;
}

/* ------------------------------------------------------------
   Leerer Zustand
   ------------------------------------------------------------ */

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 24px;
  text-align: center;
}

.empty-illustration {
  width: 168px;
  height: auto;
  margin-bottom: 8px;
}

.empty-state h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.empty-state p {
  margin: 0 0 14px;
  max-width: 360px;
  color: var(--muted);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 899px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(300px, 85vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
  }

  body.sidebar-open .sidebar {
    transform: none;
    box-shadow: var(--shadow-lg);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(17, 24, 39, 0.4);
  }

  .hamburger {
    display: inline-flex;
  }

  .topbar {
    padding: 12px 16px 4px;
  }

  .filterbar {
    padding: 8px 16px 12px;
  }

  .board-scroll {
    padding: 16px 16px 56px;
    gap: 12px;
  }

  .column {
    width: 280px;
  }

  .search-wrap {
    width: 100%;
  }

  .search-wrap input {
    width: 100%;
  }

  .progress-track {
    width: 110px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .column {
    width: 256px;
  }

  .board-title {
    font-size: 18px;
  }
}

/* ------------------------------------------------------------
   WIP-Limits pro Spalte
   ------------------------------------------------------------ */

.column.is-over-wip {
  background: #fffbeb;
  border-color: #fcd34d;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.18);
}

/* Drop-Hervorhebung hat Vorrang vor der WIP-Warnfärbung */
.column.is-over-wip.is-drop-target {
  background: var(--accent-50);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-100);
}

.col-count.is-full {
  background: #fef3c7;
  color: #b45309;
}

.col-count.is-over {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ------------------------------------------------------------
   Checklisten-Fortschritt auf der Kartenfront
   ------------------------------------------------------------ */

.card-check-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.card-check-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.card-check-bar.is-complete .card-check-bar-fill {
  background: #16a34a;
}

.check-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--bg);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.check-badge svg {
  width: 12px;
  height: 12px;
}

/* Sammel-Chip auf Karten: mehr als 2 Chips werden zu "+n" (Details im title). */
.more-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.check-badge.is-complete {
  background: #dcfce7;
  color: #15803d;
  font-weight: 600;
}

/* ------------------------------------------------------------
   Filterleiste: Fälligkeits-Chips & aktive Filter
   ------------------------------------------------------------ */

.chip-sep {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: var(--border);
}

.chip-overdue {
  --lbl-bg: #fee2e2;
  --lbl-fg: #b91c1c;
}
.chip-week {
  --lbl-bg: #ffedd5;
  --lbl-fg: #c2410c;
}

.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.active-filters-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

.afilter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-50);
  color: var(--accent-600);
  font-size: 12px;
  font-weight: 600;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.afilter-chip svg {
  width: 11px;
  height: 11px;
}

.afilter-chip:hover {
  background: var(--accent-100);
  border-color: var(--accent);
}

/* ------------------------------------------------------------
   Karten-Dialog: Beschreibung (Markdown-Light), Checkliste, Aktivität
   ------------------------------------------------------------ */

.field-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.seg-group {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.seg-btn {
  padding: 3px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--accent-600);
  box-shadow: var(--shadow-sm);
}

.md-preview {
  min-height: 72px;
  padding: 9px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.md-preview.is-empty {
  color: var(--faint);
}

.md-preview p {
  margin: 0 0 8px;
}
.md-preview p:last-child {
  margin-bottom: 0;
}

.md-preview ul {
  margin: 0 0 8px;
  padding-left: 20px;
}

.md-preview ul:last-child {
  margin-bottom: 0;
}

.md-preview li {
  margin: 2px 0;
}

.field-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--faint);
}

.checklist-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.checklist-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.checklist-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.checklist-bar-fill.is-complete {
  background: #16a34a;
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
}

.checklist-item:hover {
  background: var(--bg);
}

.checklist-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13.5px;
}

.checklist-label input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.checklist-label span {
  overflow-wrap: anywhere;
}

.checklist-item.is-done .checklist-label span {
  text-decoration: line-through;
  color: var(--faint);
}

.checklist-remove {
  width: 26px;
  height: 26px;
  color: var(--faint);
}

.checklist-remove svg {
  width: 12px;
  height: 12px;
}

.checklist-remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.checklist-add {
  display: flex;
  gap: 8px;
}

.checklist-add input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.checklist-add input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-100);
}

.checklist-add .btn {
  padding: 8px 13px;
  font-size: 13px;
}

.activity-wrap {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.activity-wrap summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.activity-wrap summary:hover {
  color: var(--text);
}

.activity-count {
  font-weight: 500;
  color: var(--faint);
}

.activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
}

.activity-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
}

.activity-text {
  color: var(--text);
  overflow-wrap: anywhere;
}

.activity-text.is-empty {
  color: var(--faint);
}

.activity-time {
  flex-shrink: 0;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Verschieben-Dialog
   ------------------------------------------------------------ */

.move-card-name {
  margin: -6px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------
   Statistik-Popover
   ------------------------------------------------------------ */

.popover {
  position: fixed;
  z-index: 80;
  width: 268px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.popover-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat-section {
  margin-bottom: 14px;
}

.stat-section:last-child {
  margin-bottom: 0;
}

.stat-caption {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat-col-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 12.5px;
}

.stat-col-name {
  width: 88px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.stat-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.stat-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.stat-col-value {
  width: 22px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-overdue {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.stat-overdue.has-overdue {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-overdue-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--faint);
}

.stat-overdue.has-overdue .stat-overdue-dot {
  background: var(--danger);
}

.stat-tp-value {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 700;
}

.sparkline {
  display: block;
  width: 100%;
  height: auto;
}

/* ------------------------------------------------------------
   Undo-Snackbar
   ------------------------------------------------------------ */

.snackbar {
  position: fixed;
  left: 50%;
  bottom: 64px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(15, 18, 22, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: snackbar-in 0.2s ease;
}

@keyframes snackbar-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
}

.snackbar-text {
  overflow-wrap: anywhere;
}

.snackbar-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #e5bb63;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.snackbar-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #f0d08e;
}

/* ------------------------------------------------------------
   Demo-Ribbon (einheitliche Portfolio-Kennzeichnung)
   ------------------------------------------------------------ */

.demo-ribbon {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(15, 18, 22, 0.85);
  color: #fff;
  font:
    500 12px/1 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  padding: 9px 13px;
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: 0.01em;
  opacity: 0.85;
}

.demo-ribbon:hover,
.demo-ribbon:focus-visible {
  opacity: 1;
}

@media print {
  .demo-ribbon {
    display: none;
  }
}

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