/* ---------------------------------------------------------
   Design tokens
--------------------------------------------------------- */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #1b2430;
  --ink-soft: #5c6470;
  --ink-faint: #8b93a1;
  --border: #d8dee6;
  --border-soft: #e5e9ee;

  --accent: #3b5bdb;
  --accent-ink: #ffffff;

  --status-todo: #8a94a6;
  --status-todo-bg: #eef0f3;
  --status-progress: #e0961f;
  --status-progress-bg: #fdf2df;
  --status-done: #2f9e8f;
  --status-done-bg: #e2f5f1;

  --danger: #c14a4a;
  --danger-bg: #fbe9e9;

  --radius: 10px;
  --radius-sm: 6px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --shadow-card: 0 1px 2px rgba(27, 36, 48, 0.06), 0 1px 1px rgba(27, 36, 48, 0.04);
  --shadow-modal: 0 20px 50px rgba(27, 36, 48, 0.25);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ---------------------------------------------------------
   Top bar
--------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.topbar__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.topbar__title h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  margin: 0;
  color: var(--ink);
}

/* ---------------------------------------------------------
   Buttons
--------------------------------------------------------- */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  background: #3049b3;
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--border);
}

.btn--ghost:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: #a83d3d;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--border-soft);
}

/* ---------------------------------------------------------
   Toolbar / filter segmented control
--------------------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.filter__btn {
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

.filter__btn.is-active {
  background: var(--ink);
  color: #fff;
}

.toolbar__count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------
   Board / columns
--------------------------------------------------------- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

.column {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 120px;
}

.column__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.column__header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.column__header--todo { border-bottom-color: var(--status-todo); }
.column__header--progress { border-bottom-color: var(--status-progress); }
.column__header--done { border-bottom-color: var(--status-done); }

.column__count {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--border-soft);
  color: var(--ink-soft);
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}

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

.column__empty {
  font-size: 13px;
  color: var(--ink-faint);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

/* ---------------------------------------------------------
   Task card
--------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--status-todo);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.card:hover {
  box-shadow: 0 4px 14px rgba(27, 36, 48, 0.1);
  transform: translateY(-1px);
}

.card[data-status="IN_PROGRESS"] { border-left-color: var(--status-progress); }
.card[data-status="DONE"] { border-left-color: var(--status-done); }

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink);
  word-break: break-word;
}

.card__id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
  margin-top: 2px;
}

.card__desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card__date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.card__actions {
  display: flex;
  gap: 4px;
}

.card__actions button {
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.card__actions button:hover {
  background: var(--border-soft);
  color: var(--ink);
}

.card__actions .delete-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.status-pill--TODO { background: var(--status-todo-bg); color: var(--status-todo); }
.status-pill--IN_PROGRESS { background: var(--status-progress-bg); color: var(--status-progress); }
.status-pill--DONE { background: var(--status-done-bg); color: var(--status-done); }

/* Quick status changer, shown in card footer */
.status-select {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 3px 6px;
  color: var(--ink-soft);
  cursor: pointer;
}

/* ---------------------------------------------------------
   Empty state
--------------------------------------------------------- */
.empty-state {
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
  margin-top: 60px;
}

/* ---------------------------------------------------------
   Modal
--------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 36, 48, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-modal);
  max-height: 90vh;
  overflow-y: auto;
}

.modal--small {
  max-width: 380px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.modal__header h2 {
  font-family: var(--font-display);
  font-size: 19px;
  margin: 0;
}

.modal__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

input[type="text"],
textarea,
select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus,
select:focus,
.btn:focus-visible,
.filter__btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin: 0;
}

/* ---------------------------------------------------------
   Toast
--------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-modal);
  z-index: 60;
}

.toast[hidden] {
  display: none;
}

/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 860px) {
  .board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 20px 14px 48px;
  }

  .topbar__title h1 {
    font-size: 26px;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter {
    width: 100%;
    overflow-x: auto;
  }
}

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