/* Funil da Brain0ps — mesma identidade do quadro (papel claro, tinta azul-escura, Archivo). */
:root {
  --paper: #EFEFEC; --surface: #FFFFFF; --ink: #16162B; --muted: #5d5d73; --line: #dcdce3;
  --brand: #2F2E7A; --brand-soft: #e6e5f5;
  --red: #D2382F; --red-soft: #fbe5e3; --amber: #B87A00; --amber-soft: #fbf0d9; --green: #0C7F4E; --green-soft: #ddf2e8;
  --shadow: 0 1px 2px rgba(22,22,43,.08), 0 6px 20px rgba(22,22,43,.06);
  --shadow-lg: 0 14px 48px rgba(22,22,43,.20);
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Open Sans", "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111116; --surface: #1C1C23; --ink: #EDEDF4; --muted: #a2a2b8; --line: #2e2e39;
    --brand: #A9A7F2; --brand-soft: #2a2950;
    --red: #F0736A; --red-soft: #3b1d1b; --amber: #DFA53A; --amber-soft: #3a2c10; --green: #4BC389; --green-soft: #143023;
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 14px 48px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111116; --surface: #1C1C23; --ink: #EDEDF4; --muted: #a2a2b8; --line: #2e2e39;
  --brand: #A9A7F2; --brand-soft: #2a2950;
  --red: #F0736A; --red-soft: #3b1d1b; --amber: #DFA53A; --amber-soft: #3a2c10; --green: #4BC389; --green-soft: #143023;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 14px 48px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.marca { font: 800 15px var(--display); letter-spacing: .06em; }
.marca b { color: var(--brand); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn.primario { background: var(--brand); color: var(--surface); border-color: var(--brand); }
.btn.pequeno { padding: 6px 11px; font-size: 13px; }
.btn.fantasma { background: transparent; }
.btn.ok { color: var(--green); border-color: var(--green); }
.btn.perigo { color: var(--red); border-color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }

/* entrada */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-caixa { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; width: min(420px, 100%); display: grid; gap: 12px; box-shadow: var(--shadow); }
.login-caixa h1 { font: 800 30px var(--display); margin: 0; }
.login-caixa p { margin: 0; color: var(--muted); }
#form-login { display: grid; gap: 8px; }
#form-login input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.aviso { color: var(--ink) !important; background: var(--brand-soft); padding: 10px 12px; border-radius: 8px; }

/* topo */
.topo { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 16px; display: grid; gap: 10px; }
.topo-linha { display: flex; align-items: center; gap: 14px; min-width: 0; }
.abas { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.abas button { white-space: nowrap; border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.abas button[aria-current="true"] { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.abas .cont { font: 600 11px var(--mono); margin-left: 6px; color: var(--muted); }
.abas .cont.alerta { color: var(--red); }
.ferramentas { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.ferramentas input[type="search"] { flex: 1 1 220px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.alternar { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }

.estado { padding: 32px 16px; color: var(--muted); text-align: center; }

/* quadro em colunas */
.quadro { display: flex; gap: 12px; padding: 14px 16px 40px; overflow-x: auto; align-items: flex-start; min-height: calc(100vh - 120px); }
.coluna { flex: 0 0 286px; background: color-mix(in srgb, var(--surface) 55%, var(--paper)); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.coluna.alvo { outline: 2px dashed var(--brand); outline-offset: -4px; }
.coluna-topo { padding: 10px 12px 8px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); }
.coluna-topo h2 { font: 700 14px var(--display); margin: 0; flex: 1; min-width: 0; }
.coluna-topo .n { font: 600 12px var(--mono); color: var(--muted); }
.coluna-topo .relogio { font: 600 11px var(--mono); color: var(--amber); }
.cartoes { padding: 8px; display: grid; gap: 8px; overflow-y: auto; }
.vazio { font-size: 13px; color: var(--muted); padding: 6px 4px; }

.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; display: grid; gap: 6px; cursor: pointer; box-shadow: var(--shadow); text-align: left; width: 100%; }
.cartao:hover { border-color: var(--brand); }
.cartao.arrastando { opacity: .4; }
.cartao.parado { border-left: 4px solid var(--red); }
.cartao h3 { font: 600 14px/1.3 var(--body); margin: 0; overflow-wrap: anywhere; }
.cartao .sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.cartao .acao { font-size: 12.5px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font: 600 11px var(--mono); padding: 2px 7px; border-radius: 999px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.vermelho { color: var(--red); background: var(--red-soft); border-color: transparent; }
.chip.ambar { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.chip.verde { color: var(--green); background: var(--green-soft); border-color: transparent; }
.chip.marca { color: var(--brand); background: var(--brand-soft); border-color: transparent; }

/* hoje */
.hoje { padding: 16px; display: grid; gap: 18px; max-width: 980px; margin: 0 auto; }
.hoje h2 { font: 700 18px var(--display); margin: 0 0 6px; }
.hoje .grupo { display: grid; gap: 8px; }
.hoje .item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; text-align: left; width: 100%; }
.hoje .item:hover { border-color: var(--brand); }
.hoje .item .t { font-weight: 600; overflow-wrap: anywhere; }
.hoje .item .s { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.hoje .nada { color: var(--muted); font-size: 14px; }

/* detalhe */
.detalhe-fundo { position: fixed; inset: 0; background: rgba(10,10,20,.35); z-index: 9; }
.detalhe { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); z-index: 10; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.det-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.det-funil { font: 600 12px var(--mono); color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.det-corpo { padding: 14px 16px 40px; overflow-y: auto; display: grid; gap: 14px; }
.det-titulo { font: 700 20px var(--display); border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; margin-left: -6px; background: transparent; width: 100%; }
.det-titulo:hover, .det-titulo:focus { border-color: var(--line); }
.det-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.det-linha label { font-size: 13px; color: var(--muted); }
.det-linha select, .det-linha input[type="date"] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); min-width: 0; max-width: 100%; }
.det-botoes { display: flex; gap: 8px; }
.bloco { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.bloco h3, .bloco summary { font: 700 14px var(--display); margin: 0; cursor: default; }
.bloco summary { cursor: pointer; }
.bloco textarea, .form-linha input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); resize: vertical; min-width: 0; }
.form-linha { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#form-tarefa { grid-template-columns: 1fr auto auto; }
.lista { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.lista li { background: var(--paper); border-radius: 8px; padding: 8px 10px; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.lista .quando { display: block; font: 500 11px var(--mono); color: var(--muted); margin-bottom: 2px; white-space: normal; }
.lista .tarefa { display: flex; gap: 8px; align-items: flex-start; white-space: normal; }
.lista .tarefa.feita span { text-decoration: line-through; color: var(--muted); }
.linha-do-tempo li { background: transparent; border-left: 2px solid var(--line); border-radius: 0; padding: 2px 0 2px 10px; }
.contato { display: grid; gap: 4px; font-size: 14px; overflow-wrap: anywhere; }
.contato a { color: var(--brand); }
.campos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 0; margin: 0; font-size: 13px; }
.campos dt { font: 600 11px var(--mono); color: var(--muted); margin-top: 6px; }
.campos dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; z-index: 20; font-size: 14px; max-width: calc(100% - 32px); }
.toast.erro { background: var(--red); }

@media (max-width: 640px) {
  .coluna { flex-basis: 84vw; }
  .ferramentas .alternar { font-size: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .cartao, .btn, .abas button { transition: border-color .15s, background .15s; }
}
