:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #ebe7dd;
  --ink: #1c2024;
  --muted: #646b73;
  --line: rgba(28, 32, 36, 0.14);
  --accent: #2b5fd9;
  --accent-ink: #ffffff;

  /* priority colours: high = coral, medium = amber, low = green */
  --high: #e5553f;
  --medium: #e3a008;
  --low: #2f9e5b;

  --radius: 6px;
  --shadow: 4px 4px 0 rgba(28, 32, 36, 0.1);
}

[data-theme="dark"] {
  --bg: #14171b;
  --surface: #1e2328;
  --surface-2: #272d33;
  --ink: #eef0f2;
  --muted: #9aa3ac;
  --line: rgba(238, 240, 242, 0.16);
  --accent: #6d97ff;
  --accent-ink: #10151c;
  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  line-height: 1.5;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3 { font-family: 'Familjen Grotesk', sans-serif; margin: 0; }


.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.7rem; }
.counter { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.92rem; font-weight: 500; }


.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.theme-toggle__track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.2s;
}
.theme-toggle__thumb {
  top: 2px;
  position: absolute;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.2s;
}
.theme-toggle[aria-pressed="true"] .theme-toggle__track { background: var(--accent); }
.theme-toggle[aria-pressed="true"] .theme-toggle__thumb { transform: translateX(20px); background: var(--accent-ink); }

.layout {
  display: grid;
  gap: 1.5rem;
  padding: clamp(1rem, 4vw, 2.5rem);
}
@media (min-width: 960px) {
  .layout { grid-template-columns: 300px 1fr; align-items: start; }
  .panel { position: sticky; top: 1rem; }
}


.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 1.2rem; margin-bottom: 0.9rem; }

.form, .filters { display: grid; gap: 0.9rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.filters { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.filters h2 { margin-bottom: 0; }

.field { display: grid; gap: 0.3rem; font-size: 0.88rem; font-weight: 700; }
.field span { color: var(--muted); }
.field__error { color: var(--high); font-weight: 500; }

input, textarea, select {
  width: 100%;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input.is-invalid { border-color: var(--high); }

.btn {
  font: inherit;
  font-weight: 700;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.65rem 1rem;
  cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }


.board {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;           
  align-items: start;
}
@media (min-width: 640px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* tablet and up: three columns */
}

.column {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0.9rem;
  min-height: 140px;
}
.column__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.column__head h2 { font-size: 1.05rem; }
.column__count {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.column__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
  min-height: 60px;
}
/* highlight shown while a card is dragged over a column */
.column.is-drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; }

.empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 1rem 0.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--medium);      /* colour bar = priority */
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  cursor: grab;
}
.card[data-priority="high"]   { border-left-color: var(--high); }
.card[data-priority="medium"] { border-left-color: var(--medium); }
.card[data-priority="low"]    { border-left-color: var(--low); }
.card.is-dragging { opacity: 0.4; }

.card__title { font-size: 1rem; font-weight: 700; margin: 0 0 0.2rem; overflow-wrap: anywhere; }
.card[data-status="done"] .card__title { text-decoration: line-through; color: var(--muted); }
.card__desc { margin: 0 0 0.6rem; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }

.card__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.tag {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.tag--priority { color: #fff; border-color: transparent; }
.tag--priority[data-priority="high"]   { background: var(--high); }
.tag--priority[data-priority="medium"] { background: var(--medium); color: #1c2024; }
.tag--priority[data-priority="low"]    { background: var(--low); }

.card__actions { display: flex; gap: 0.5rem; align-items: center; }
.card__move { flex: 1; font-size: 0.85rem; padding: 0.35rem 0.5rem; }
.card__delete {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--high);
  background: none;
  border: 1px solid var(--high);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.card__delete:hover { background: var(--high); color: #fff; }

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