/*
  Blackboard — escuro, baixo contraste, uma cor de destaque.
  Nada de badge vermelho, contador ou animação chamativa: a tela é pra
  trabalhar, não pra prender atenção.
*/

:root {
  --bg: #0f1115;
  --surface: #161920;
  --surface-2: #1c2029;
  --surface-3: #232833;
  --line: #262b36;
  --text: #c5ccd8;
  --text-dim: #7b8494;
  --text-faint: #565e6d;
  --accent: #7aa2f7;
  --accent-soft: rgba(122, 162, 247, 0.14);
  --radius: 8px;
  --gap: 12px;
  --col-width: 300px;
  --header-height: 52px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body {
  overscroll-behavior: none;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

a {
  color: var(--accent);
}

::selection {
  background: var(--accent-soft);
}

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

/* ---------- login ---------- */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(340px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.login-sub {
  color: var(--text-faint);
  font-size: 13px;
  margin: 0 0 12px;
}

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

.field label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: lowercase;
}

input[type='text'],
input[type='password'],
input[type='search'],
input[type='date'],
textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text);
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  color: var(--text-dim);
  padding: 6px 8px;
  border-radius: 6px;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.error {
  color: #e0808a;
  font-size: 13px;
  min-height: 18px;
}

/* ---------- header ---------- */

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--header-height);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-dim);
  flex: 0 0 auto;
}

.board-picker {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  max-width: 45vw;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spacer {
  flex: 1 1 auto;
}

.search-box {
  position: relative;
  flex: 0 1 220px;
}

.search-box input {
  padding: 6px 10px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(380px, 90vw);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  max-height: 60vh;
  overflow: auto;
  z-index: 40;
}

.search-hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border-radius: 6px;
}

.search-hit:hover {
  background: var(--surface-3);
}

.search-hit small {
  display: block;
  color: var(--text-faint);
  font-size: 12px;
}

/* ---------- board ---------- */

.board {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: var(--gap);
  overflow-x: auto;
  overflow-y: hidden;
}

.list {
  flex: 0 0 var(--col-width);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.list.over {
  border-color: var(--accent);
}

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

.list-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.list-count {
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.list-count.over-wip {
  color: #d8a657;
}

.cards {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 12px;
}

.card {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: left;
  width: 100%;
  touch-action: none;
  user-select: none;
}

.card:hover {
  border-color: var(--line);
}

.card.dragging {
  opacity: 0.35;
}

.card.ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  opacity: 0.95;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  border-color: var(--accent);
  margin: 0;
}

.card-title {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.card.done .card-title {
  color: var(--text-faint);
  text-decoration: line-through;
}

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

.label-dot {
  height: 4px;
  width: 28px;
  border-radius: 2px;
}

.card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.due.late {
  color: #d8a657;
}

.list-footer {
  padding: 4px 8px 8px;
}

.add-card {
  width: 100%;
  text-align: left;
  color: var(--text-faint);
  padding: 6px 10px;
  border-radius: 6px;
}

.add-card:hover {
  background: var(--surface-2);
  color: var(--text);
}

.composer textarea {
  resize: none;
  min-height: 58px;
}

.composer-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.add-list {
  flex: 0 0 220px;
  color: var(--text-faint);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
}

.add-list:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

/* ---------- modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 12, 0.72);
  display: grid;
  place-items: start center;
  padding: 5vh 16px;
  overflow-y: auto;
  z-index: 50;
}

.modal {
  width: min(680px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.modal-title {
  flex: 1 1 auto;
  font-size: 19px;
  font-weight: 600;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
}

.modal-title:hover {
  border-color: var(--line);
}

.modal-where {
  font-size: 12px;
  color: var(--text-faint);
  padding: 0 6px;
  margin-top: -12px;
}

.section-title {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: lowercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

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

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip.on {
  color: var(--text);
  border-color: currentColor;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.markdown {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 60px;
  overflow-wrap: anywhere;
}

.markdown:empty::before {
  content: 'sem descrição — clique para escrever';
  color: var(--text-faint);
}

.markdown h1,
.markdown h2,
.markdown h3 {
  margin: 0.6em 0 0.3em;
  font-size: 1.05em;
}

.markdown p {
  margin: 0.5em 0;
}

.markdown ul,
.markdown ol {
  margin: 0.4em 0;
  padding-left: 1.3em;
}

.markdown code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}

.markdown pre {
  background: var(--surface-3);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
}

.markdown pre code {
  background: none;
  padding: 0;
}

.markdown blockquote {
  border-left: 2px solid var(--line);
  margin: 0.5em 0;
  padding-left: 10px;
  color: var(--text-dim);
}

.desc-editor {
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
}

.check-item input {
  margin-top: 5px;
  accent-color: var(--accent);
}

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

.progress {
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 8px;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.comment {
  border-top: 1px solid var(--line);
  padding: 8px 0;
  font-size: 14px;
}

.comment header {
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}

.modal-foot {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* ---------- modo foco ---------- */

.focus .header,
.focus .board {
  display: none;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  z-index: 200;
}

.empty {
  color: var(--text-faint);
  padding: 40px 16px;
  text-align: center;
}

/* ---------- celular ---------- */

@media (max-width: 640px) {
  :root {
    --col-width: 82vw;
  }

  .header {
    gap: 6px;
    padding: 0 8px;
  }

  .brand {
    display: none;
  }

  .board-picker {
    max-width: 40vw;
  }

  .search-box {
    flex-basis: 34vw;
  }

  .board {
    scroll-snap-type: x mandatory;
  }

  .list {
    scroll-snap-align: center;
  }

  .modal {
    padding: 14px 14px 18px;
  }
}
