/* Esteira — identidade visual própria (provisória).
   Papel quente + tinta escura + âmbar. Faixas (listas) com régua superior colorida. */
:root {
  --paper: #f3efe6;
  --paper-2: #e9e3d6;
  --lane: #fbf9f4;
  --card: #ffffff;
  --ink: #1f2b36;
  --ink-2: #4a5663;
  --ink-3: #7b8591;
  --line: #ddd5c4;
  --accent: #e08a1e;
  --accent-ink: #7a4300;
  --teal: #0f6e6a;
  --danger: #b42318;
  --warn: #b26a00;
  --ok: #1d7a46;
  --focus: #2f6fdb;
  --shadow: 0 1px 0 rgba(31, 43, 54, .08), 0 1px 3px rgba(31, 43, 54, .10);
  --shadow-lift: 0 10px 28px rgba(31, 43, 54, .25);
  --radius: 10px;
  --slot: 76px;            /* altura do cartão + espaço (fixa, usada na virtualização) */
  --card-h: 68px;
  --lane-w: 284px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151b21; --paper-2: #1b232b; --lane: #1e272f; --card: #26313b;
    --ink: #eef1f4; --ink-2: #c3cad2; --ink-3: #8e99a5; --line: #33404c;
    --accent: #f2a43a; --accent-ink: #ffd9a3; --teal: #3fb6ad;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.4 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); background: var(--lane); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; font-size: 20px; }
.brand img { width: 28px; height: 28px; }
.login p.hint { color: var(--ink-3); margin: 6px 0 20px; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.accent { background: var(--accent); color: #1b1206; border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.error-text { color: var(--danger); min-height: 1.4em; margin: 0 0 10px; }

/* ---------- topo ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #1f2b36; color: #f6efe2; border-bottom: 3px solid var(--accent); }
.top .brand { font-size: 16px; color: #f6efe2; }
.top .board-name { font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.search { position: relative; width: min(420px, 40vw); }
.search input { width: 100%; padding: 8px 12px 8px 32px; border-radius: 999px; border: 1px solid #3a4755; background: #2a3846; color: #f6efe2; }
.search input::placeholder { color: #aab4be; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .7; pointer-events: none; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 70vh; overflow: auto; background: var(--lane); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lift); padding: 6px; }
.results button { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 8px; }
.results button:hover, .results button.active { background: var(--paper-2); }
.results .meta { grid-column: 2; font-size: 12px; color: var(--ink-3); }
.results .empty { padding: 10px; color: var(--ink-3); }
.top .user { font-size: 13px; opacity: .85; }
.top .btn { background: transparent; color: #f6efe2; border-color: #4a5a6a; }
.top .btn:hover { border-color: #f6efe2; }
.top .btn { white-space: nowrap; }
.top .btn.accent { background: var(--accent); color: #1b1206; border-color: var(--accent); }
.btn.primary { color: var(--paper); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.role { background: #2a3846; }
.net { padding: 6px 16px; background: var(--danger); color: #fff; font-weight: 600; display: none; }
.net.show { display: block; }

/* ---------- quadro ---------- */
.board { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 24px; overflow-x: auto; height: calc(100vh - 56px); overscroll-behavior-x: contain; }
.lane { flex: 0 0 var(--lane-w); max-height: 100%; display: flex; flex-direction: column; background: var(--lane); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); position: relative; }
.lane::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; border-radius: 14px 14px 0 0; background: var(--lane-color, var(--accent)); }
.lane header { display: flex; align-items: baseline; gap: 8px; padding: 14px 12px 8px; }
.lane h2 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; flex: 1; }
.lane .count { font: 600 12px var(--mono); color: var(--ink-3); }
.lane .scroller { position: relative; overflow-y: auto; overflow-x: hidden; padding: 0 8px 8px; flex: 1 1 auto; min-height: 40px; contain: content; }
.lane .spacer { position: relative; width: 100%; }
.lane .loader { position: absolute; left: 0; right: 0; text-align: center; color: var(--ink-3); font-size: 12px; padding: 6px; }
.lane .empty { color: var(--ink-3); font-size: 12px; padding: 8px 4px 12px; }

.card { position: absolute; left: 0; right: 0; height: var(--card-h); display: grid; grid-template-rows: auto 1fr; gap: 4px; padding: 8px 10px 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: grab; user-select: none; touch-action: pan-y; overflow: hidden; will-change: transform; }
.card:hover { border-color: var(--ink-3); }
.card.urgent { box-shadow: inset 3px 0 0 var(--danger), var(--shadow); }
.card .row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card .num { font: 600 11px var(--mono); color: var(--ink-3); }
.card .labels { display: flex; gap: 3px; flex: 1; min-width: 0; }
.card .lbl { width: 22px; height: 6px; border-radius: 3px; background: var(--ink-3); }
.card .due { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }
.card .due.late { background: #fde4e1; color: var(--danger); }
.card .due.soon { background: #fdf0d9; color: var(--warn); }
.card .title { font-size: 13px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.card .badges { font-size: 11px; color: var(--ink-3); }
.card.is-ghost-src { opacity: .25; }
.card.is-saving { outline: 2px dashed var(--accent); outline-offset: -2px; }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent), var(--shadow); } 100% { box-shadow: 0 0 0 0 transparent, var(--shadow); } }
.drop-indicator { position: absolute; left: 4px; right: 4px; height: 4px; border-radius: 2px; background: var(--teal); pointer-events: none; z-index: 2; }
.drag-ghost { position: fixed; top: 0; left: 0; z-index: 100; pointer-events: none; width: calc(var(--lane-w) - 18px); box-shadow: var(--shadow-lift); transform-origin: 0 0; cursor: grabbing; }
body.dragging, body.dragging * { cursor: grabbing !important; }

/* cores das etiquetas (nomes do Trello mantidos para facilitar a migração) */
.c-green{background:#4bce97}.c-green_dark{background:#1f845a}.c-yellow{background:#e2b203}.c-yellow_dark{background:#946f00}
.c-orange{background:#faa53d}.c-red{background:#f87462}.c-red_dark{background:#ae2e24}.c-purple{background:#9f8fef}
.c-purple_dark{background:#6e5dc6}.c-purple_light{background:#dfd8fd}.c-blue{background:#579dff}.c-blue_dark{background:#0c66e4}
.c-blue_light{background:#cce0ff}.c-sky{background:#6cc3e0}.c-lime{background:#94c748}.c-pink{background:#e774bb}
.c-pink_dark{background:#ae4787}.c-black{background:#626f86}.c-black_light{background:#dcdfe4}

/* ---------- modal do cartão ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 22, 29, .55); z-index: 50; display: grid; place-items: start center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { width: min(820px, 100%); background: var(--lane); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lift); }
.modal header { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 10px; border-bottom: 1px solid var(--line); }
.modal h1 { margin: 0; font-size: 19px; line-height: 1.3; flex: 1; }
.modal .sub { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.modal .body { display: grid; grid-template-columns: 1fr 260px; gap: 18px; padding: 16px 20px 20px; }
.modal section h3 { margin: 14px 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.modal section h3:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #172b4d; }
.sugg { border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; }
.timeline li { display: grid; gap: 2px; }
.timeline time { color: var(--ink-3); font-size: 11.5px; }
.side .btn { width: 100%; margin-bottom: 8px; text-align: left; }
.side .move { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.done-banner { margin: 12px 20px 0; padding: 8px 12px; border-radius: 8px; background: #dff3e6; color: var(--ok); font-weight: 600; }
.proto { font-size: 11px; color: var(--warn); }

/* ---------- painel de concluídos ---------- */
.drawer { position: fixed; top: 56px; right: 0; bottom: 0; width: min(420px, 100%); background: var(--lane); border-left: 1px solid var(--line); box-shadow: var(--shadow-lift); z-index: 30; display: flex; flex-direction: column; }
.drawer header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer h2 { margin: 0; font-size: 14px; flex: 1; }
.drawer ul { list-style: none; margin: 0; padding: 8px; overflow: auto; display: grid; gap: 6px; }
.drawer li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.drawer small { color: var(--ink-3); grid-column: 1; }

/* ---------- avisos ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(520px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: #1f2b36; color: #f6efe2; border: 1px solid #3a4755; box-shadow: var(--shadow-lift); font-size: 13px; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: #7a4300; color: #fff; }
.toast .msg { flex: 1; }
.toast button { background: rgba(255,255,255,.15); border: 0; color: inherit; border-radius: 6px; padding: 4px 8px; font-weight: 700; }

/* ---------- Fase 1: formulários, filtros, anexos, folha de mover ---------- */
.lane-add { border: 0; background: transparent; color: var(--ink-2); font-size: 18px; line-height: 1; width: 26px; height: 26px; border-radius: 6px; }
.lane-add:hover { background: var(--paper-2); color: var(--ink); }
.card .who { font: 700 10px var(--font); background: var(--teal); color: #fff; border-radius: 999px; padding: 2px 5px; }
.quick-move { display: none; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); border-radius: 6px; font-size: 13px; line-height: 1; padding: 3px 6px; margin-left: auto; }
@media (pointer: coarse), (max-width: 720px) { .quick-move { display: inline-block; } }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.filters.active { box-shadow: inset 0 -3px 0 var(--teal); }
.filters .f-title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.filters select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); max-width: 190px; }
.filters .chk { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.filters .f-status { font-size: 12px; font-weight: 700; color: var(--teal); }
.board { height: calc(100vh - 100px); }

.form header { display: flex; align-items: center; padding: 16px 20px 8px; border-bottom: 1px solid var(--line); }
.form h1 { flex: 1; font-size: 18px; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; padding: 14px 20px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form .field label { display: grid; gap: 4px; }
.form .field input, .form .field select, .form .field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 14px; color: var(--ink); width: 100%; }
.form .field.inline label { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 14px; }
.form footer { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 20px 18px; }
.form footer .error-text { flex: 1; margin: 0; }
.lbl-title { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.chips.pick label { cursor: pointer; text-transform: none; letter-spacing: 0; }
.chips.pick input { margin: 0 4px 0 0; }

.pre { white-space: pre-wrap; word-break: break-word; }
.modal .body > div > section + section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal .body > div > section h3 { margin-top: 0; }
.comment-form { display: grid; gap: 6px; margin-bottom: 10px; }
.comment-form textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.comment-form .btn { justify-self: end; }
.files { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 13px; }
.files li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.files a { font-weight: 600; color: var(--teal); word-break: break-all; }
.link { border: 0; background: none; color: var(--teal); padding: 0; font-weight: 600; font-size: 12.5px; }
.link.left { text-align: left; font-size: 13px; color: var(--ink); font-weight: 400; }
ul.sugg { list-style: none; padding: 8px 10px; margin: 0; border: 1px dashed var(--accent); border-radius: 10px; display: grid; gap: 6px; font-size: 13px; }
ul.sugg li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
.sugg-actions { display: inline-flex; gap: 10px; }
.done-banner.warn { background: #fdf0d9; color: var(--warn); }
.pad { padding: 8px 10px; }
.drawer input[type=search] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }

.sheet-backdrop { place-items: end center; padding: 0; }
.sheet { width: min(520px, 100%); background: var(--lane); border-radius: 16px 16px 0 0; padding: 12px 16px 20px; max-height: 80vh; overflow: auto; box-shadow: var(--shadow-lift); }
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet-where { margin: 6px 0 10px; font-size: 13px; }
.sheet-lists { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sheet-lists .btn { width: 100%; text-align: left; padding: 12px; }
.sheet-lists .btn.current { opacity: .55; }

/* ---------- celular ---------- */
@media (max-width: 720px) {
  :root { --lane-w: 86vw; }
  .top { flex-wrap: wrap; padding: 8px 12px; }
  .top .board-name, .top .user { display: none; }
  .search { order: 5; width: 100%; }
  .board { height: calc(100vh - 150px); scroll-snap-type: x mandatory; padding: 12px; }
  .top .btn { padding: 6px 8px; font-size: 13px; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding: 6px 12px; }
  .filters select { max-width: 150px; }
  .form-grid { grid-template-columns: 1fr; }
  .lane { scroll-snap-align: center; }
  .modal .body { grid-template-columns: 1fr; }
  .backdrop { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
}
