:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --ink: #1b1c20;
  --muted: #6b7280;
  --line: #d6dbe6;
  --brand: #16716f;
  --brand-strong: #0f4f4d;
  --danger-soft: #ffe6eb;
  --priority-high: #e63946;
  --priority-medium: #ef9b20;
  --priority-low: #2a9d8f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #dbe8ef, transparent 35%),
    radial-gradient(circle at bottom right, #f7e9d3, transparent 30%),
    var(--bg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.page-wrap {
  padding: 1rem;
}

.board-shell {
  max-width: 1500px;
  margin: 0 auto;
}

.board-topbar {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.board-topbar p {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
}

.filter-form {
  display: flex;
  gap: 0.4rem;
  align-items: end;
}

.filter-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
}

button {
  cursor: pointer;
}

button.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

button.primary:hover {
  background: var(--brand-strong);
}

.board-columns {
  display: grid;
  gap: 0.7rem;
}

.mobile-tabs {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

.mobile-tabs::-webkit-scrollbar {
  display: none;
}

.mobile-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  border-radius: 999px;
  background: #fff;
}

.mobile-tab.active {
  border-color: var(--brand);
  background: #e4f4f3;
  color: #0f4f4d;
}

.mobile-tab strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #e6e9f0;
  color: #2d3748;
  font-size: 0.75rem;
}

.mobile-tab.active strong {
  background: #cde9e7;
  color: #0c3f3e;
}

.mobile-hint {
  margin-top: -0.15rem;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.columns-grid {
  display: grid;
  gap: 0.8rem;
}

.kanban-column {
  display: none;
  background: #eef1f7;
  border: 1px solid #d6deeb;
  border-radius: 12px;
  padding: 0.7rem;
}

.kanban-column.mobile-active {
  display: block;
}

.kanban-column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.kanban-column header span {
  font-size: 0.82rem;
  color: var(--muted);
}

.task-list {
  min-height: 120px;
  display: grid;
  gap: 0.55rem;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--priority-medium);
  border-radius: 10px;
  padding: 0.65rem;
  display: grid;
  gap: 0.55rem;
}

.task-card.priority-alta {
  border-left-color: var(--priority-high);
}

.task-card.priority-media {
  border-left-color: var(--priority-medium);
}

.task-card.priority-baixa {
  border-left-color: var(--priority-low);
}

.task-card.overdue {
  background: var(--danger-soft);
}

.task-card h3 {
  font-size: 0.98rem;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 999px;
  padding: 0.3rem 0.52rem;
}

.badge-owner {
  background: #dde8ff;
}

.badge-owner-joao {
  background: #dde8ff;
  color: #1c3f94;
}

.badge-owner-raquel {
  background: #ffe7ef;
  color: #8c1f55;
}

.badge-priority {
  background: #ffe7c2;
}

.badge-deadline {
  background: #e6f5eb;
}

.notes {
  font-size: 0.86rem;
  color: #364152;
}

.card-actions {
  display: flex;
  gap: 0.4rem;
}

.card-actions button {
  flex: 1;
  padding: 0.42rem;
}

.move-form {
  display: grid;
  gap: 0.35rem;
}

.move-form label {
  font-size: 0.75rem;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0.3rem;
}

.modal-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.modal-root > * {
  pointer-events: auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
}

.modal-card {
  width: min(540px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 1rem;
}

.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.modal-card form {
  display: grid;
  gap: 0.7rem;
}

.modal-card label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.modal-card footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.mobile-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  box-shadow: 0 8px 18px rgba(15, 79, 77, 0.28);
  z-index: 20;
}

button.ghost {
  border: none;
  background: transparent;
}

.error {
  color: #af2235;
  font-size: 0.8rem;
}

@media (min-width: 900px) {
  .page-wrap {
    padding: 1.3rem;
  }

  .board-topbar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .mobile-hint,
  .mobile-fab {
    display: none;
  }

  .mobile-tabs {
    display: none;
  }

  .columns-grid {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    align-items: start;
  }

  .kanban-column {
    display: block;
    min-height: 65vh;
  }

  .move-form {
    display: none;
  }
}

@media (max-width: 899px) {
  .page-wrap {
    padding: 0.8rem;
  }

  .board-topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    background: rgba(242, 244, 248, 0.94);
    backdrop-filter: blur(4px);
    padding: 0.2rem 0 0.45rem;
    margin-bottom: 0.6rem;
  }

  .board-topbar h1 {
    font-size: 1.28rem;
  }

  .board-topbar p {
    font-size: 0.86rem;
  }

  .filter-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4rem;
  }

  .filter-form label {
    grid-column: 1 / -1;
  }

  .filter-form select {
    min-width: 0;
  }

  .desktop-new-task {
    display: none;
  }

  .kanban-column {
    min-height: calc(100vh - 265px);
  }

  .columns-grid {
    touch-action: pan-y;
  }

  .task-card {
    padding: 0.72rem;
  }

  .card-actions button {
    min-height: 2.25rem;
  }
}
