/* =============================================================================
   tarefas.css — Página «As minhas tarefas» (tarefas.html)
   Spec: docs/superpowers/specs/2026-09-24-tarefas-v2-design.md (§3.3)
   Esboço: docs/superpowers/mockups/tarefas-v2.html
   ============================================================================= */

:root {
  --nav-bg:        #0a1520;
  --card-bg:       #16212e;
  --card-hover:    #1f2d3f;
  --input-bg:      #0d1926;
  --accent:        #F59E0B;
  --accent-dark:   #D97706;
  --accent-soft:   rgba(245,158,11,0.14);
  --accent-glow:   rgba(245,158,11,0.22);
  --border:        rgba(245,158,11,0.18);
  --line:          rgba(255,255,255,0.08);
  --line-2:        rgba(255,255,255,0.14);
  --text:          #e2e8f0;
  --text-dim:      #94a3b8;
  --text-muted:    #64748b;
  --red:           #fca5a5;
  --yellow:        #fcd34d;
  --blue:          #93c5fd;
  --green:         #34d399;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--nav-bg);
  color: var(--text);
  min-height: 100vh;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.tf-i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }

.page { max-width: 1120px; margin: 0 auto; padding: 100px 2rem 5rem; }
.page-header { margin-bottom: 1.4rem; }
.page-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.3rem; }
.page-title span { color: var(--accent); }
.page-subtitle { font-size: 0.92rem; color: var(--text-dim); }

.notice {
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25);
  border-radius: 10px; padding: 0.85rem 1.2rem; font-size: 0.875rem; color: #FCD34D;
  margin-bottom: 1.5rem; display: flex; align-items: flex-start; gap: 0.6rem;
}
.notice-icon { flex-shrink: 0; }
.notice-body { flex: 1; line-height: 1.55; }

/* ── Botões ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s; text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible, .tf-kpi:focus-visible, select:focus-visible, input:focus-visible,
textarea:focus-visible, summary:focus-visible, .tf-menu-lista button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: #111; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--accent); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(248,113,113,0.45); }
.btn-danger:hover { background: rgba(248,113,113,0.12); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; border-radius: 9px; }
.btn-xs { padding: 0.22rem 0.55rem; font-size: 0.75rem; border-radius: 7px; }

/* ── Estados (sessão, permissões, erro) ───────────────────────────────────── */
.session-required-state { text-align: center; padding: 5rem 2rem; max-width: 480px; margin: 0 auto; }
.session-required-icon { font-size: 3.5rem; margin-bottom: 1.25rem; }
.session-required-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.75rem; letter-spacing: -0.02em; }
.session-required-desc { font-size: 0.95rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 2rem; }
.session-required-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Indicadores (filtram) ────────────────────────────────────────────────── */
.tf-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.tf-kpi {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.7rem 0.5rem; text-align: center; cursor: pointer; font: inherit; color: inherit;
}
.tf-kpi:hover { border-color: var(--line-2); }
.tf-kpi b { display: block; font-size: 1.5rem; line-height: 1.1; }
.tf-kpi small { display: block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
                letter-spacing: 0.06em; color: var(--text-muted); margin-top: 0.15rem; }
.tf-kpi.is-vencida b { color: var(--red); }
.tf-kpi.is-hoje b { color: var(--yellow); }
.tf-kpi[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ── Adicionar rápido ─────────────────────────────────────────────────────── */
.tf-rapido {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem;
}
.tf-rapido:focus-within { border-color: var(--border); }
.tf-rapido-icone { color: var(--accent); margin-left: 0.35rem; }
.tf-rapido-texto {
  flex: 1 1 240px; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; padding: 0.4rem 0.45rem;
}
.tf-rapido-texto:focus { outline: none; }
.tf-rapido-texto::placeholder { color: var(--text-muted); }

/* Controlo com rótulo curto por dentro (selects e data) */
.tf-ctrl {
  display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 9px; padding: 0.2rem 0.3rem 0.2rem 0.6rem;
  background: var(--input-bg); font-size: 0.82rem; color: var(--text);
}
.tf-ctrl > span { color: var(--text-dim); white-space: nowrap; }
.tf-ctrl select, .tf-ctrl input[type="date"] {
  background: transparent; border: 0; color: var(--text); font: inherit; padding: 0.22rem 0.2rem;
  max-width: 190px; min-width: 0; color-scheme: dark;
}
.tf-ctrl select option { background: var(--input-bg); color: var(--text); }
.tf-ctrl.is-inativo { opacity: 0.45; }
.tf-ctrl-check { padding: 0.42rem 0.65rem; cursor: pointer; }
.tf-ctrl-check input { accent-color: var(--accent); }

/* ── Pesquisa, filtros e etiquetas ────────────────────────────────────────── */
.tf-toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.9rem; }
.tf-pesquisa {
  flex: 1 1 260px; display: flex; align-items: center; gap: 0.5rem; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 10px; padding: 0.42rem 0.75rem;
  background: var(--input-bg); color: var(--text-muted);
}
.tf-pesquisa input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 0.88rem; }
.tf-pesquisa input:focus { outline: none; }
.tf-pesquisa:focus-within { border-color: var(--accent); }

.tf-etiquetas { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-top: 0.7rem;
                font-size: 0.8rem; color: var(--text-dim); }
.tf-etiqueta { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--line-2);
               border-radius: 999px; padding: 0.1rem 0.25rem 0.1rem 0.6rem; color: var(--text); }
.tf-etiqueta button { background: none; border: 0; color: var(--text-muted); cursor: pointer; font: inherit;
                      padding: 0 0.3rem; border-radius: 999px; }
.tf-etiqueta button:hover { color: var(--accent); }
.tf-limpar { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 600; }

.tf-msg { font-size: 0.84rem; color: var(--red); margin-top: 0.75rem; }
.tf-msg:empty { display: none; }

/* ── Lista por grupos ─────────────────────────────────────────────────────── */
.tf-grupo { margin-top: 1.4rem; }
.tf-grupo-titulo { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
                   color: var(--text-dim); margin-bottom: 0.45rem; }
.tf-grupo-titulo .tf-n { color: var(--text-muted); font-weight: 600; }
.tf-grupo.is-vencida .tf-grupo-titulo { color: var(--red); }
.tf-grupo.is-hoje .tf-grupo-titulo { color: var(--yellow); }

.tf-lista { list-style: none; background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; }
.tf-tarefa {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 0.15rem 0.8rem;
  align-items: start; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); position: relative;
}
.tf-tarefa:first-child { border-radius: 12px 12px 0 0; }
.tf-tarefa:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.tf-tarefa:only-child { border-radius: 12px; }
.tf-tarefa:hover { background: var(--card-hover); }
.tf-caixa { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--accent); cursor: pointer; }
.tf-caixa:disabled { cursor: progress; }
.tf-corpo { min-width: 0; }
.tf-texto { display: inline; font-weight: 600; font-size: 0.92rem; line-height: 1.4; overflow-wrap: anywhere; background: none; border: 0;
            color: var(--text); font-family: inherit; text-align: left; cursor: pointer; padding: 0; }
.tf-texto:hover { color: var(--accent); }
.tf-prio { color: #f87171; font-weight: 800; margin-right: 0.3rem; }
.tf-temnotas { display: inline-flex; vertical-align: -2px; margin-left: 0.35rem; color: var(--text-muted); }
.tf-temnotas .tf-i { width: 14px; height: 14px; }
.tf-meta { grid-column: 2 / 3; display: flex; flex-wrap: wrap; gap: 0.15rem 0.8rem; font-size: 0.77rem; color: var(--text-muted); }
.tf-meta a { color: var(--blue); text-decoration: none; }
.tf-meta a:hover { text-decoration: underline; }
.tf-num { font-family: ui-monospace, monospace; color: var(--accent); margin-right: 0.3rem; }
.tf-solta { color: var(--text-dim); font-style: italic; }
.tf-prazo { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; text-align: right; padding-top: 3px; }
.tf-prazo.is-vencida { color: var(--red); font-weight: 700; }
.tf-prazo.is-hoje { color: var(--yellow); font-weight: 700; }
.tf-acoes { display: flex; gap: 0.25rem; align-items: center; }

.tf-tarefa.is-feita .tf-texto { text-decoration: line-through; color: var(--text-muted); font-weight: 500; }

/* Menus («Adiar ▾» e «⋯») */
details.tf-menu { position: relative; }
details.tf-menu > summary { list-style: none; cursor: pointer; user-select: none; }
details.tf-menu > summary::-webkit-details-marker { display: none; }
details.tf-menu[open] > summary { border-color: var(--accent); color: var(--accent); }
.tf-menu-lista {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px;
  background: var(--input-bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 0.3rem;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5); display: flex; flex-direction: column;
}
.tf-menu-lista button {
  background: none; border: 0; color: var(--text); text-align: left; font: inherit; font-size: 0.85rem;
  padding: 0.45rem 0.6rem; border-radius: 7px; cursor: pointer;
}
.tf-menu-lista button:hover { background: var(--accent-soft); }
.tf-menu-lista hr { border: 0; border-top: 1px solid var(--line); margin: 0.25rem 0; }
.tf-menu-lista .is-perigo { color: var(--red); }

.tf-vazio {
  text-align: center; padding: 2.4rem 1rem; color: var(--text-dim); font-size: 0.92rem;
  background: var(--card-bg); border: 1px dashed var(--line-2); border-radius: 12px; margin-top: 1.4rem;
}
.tf-vazio .btn { margin-top: 0.8rem; }

/* ── Vista (Lista / Semana), período das feitas e Excel ─────────────────────── */
.tf-vista { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.tf-vista button { background: none; border: 0; color: var(--text-dim); font: inherit; font-size: 0.84rem;
                   padding: 0.45rem 0.8rem; cursor: pointer; }
.tf-vista button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tf-vista button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tf-periodo { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.5rem; text-transform: none;
              letter-spacing: 0; font-weight: 600; color: var(--text-dim); }
.tf-periodo select { background: var(--input-bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 7px;
                     font: inherit; font-size: 0.78rem; padding: 0.1rem 0.3rem; color-scheme: dark; }
.tf-msg-ok { color: var(--green); }

/* ── Vista Semana ─────────────────────────────────────────────────────────── */
.tf-semana-nav { display: flex; align-items: center; gap: 0.6rem; margin-top: 1.3rem; flex-wrap: wrap; }
.tf-semana-nav b { min-width: 220px; text-align: center; font-size: 0.95rem; }
.tf-atrasadas { margin-top: 0.8rem; padding: 0.55rem 0.8rem; border-radius: 10px; background: rgba(248,113,113,0.07);
                border: 1px solid rgba(248,113,113,0.25); font-size: 0.84rem; display: flex; gap: 0.6rem; flex-wrap: wrap;
                align-items: center; color: var(--text-dim); }
.tf-atrasadas strong { color: #fecaca; }
.tf-atrasadas .tf-limpar { margin-left: auto; }
.tf-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.8rem; }
.tf-dia { background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; min-height: 240px;
          padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.tf-dia.is-hoje { border-color: var(--accent); }
.tf-dia.is-fds { opacity: 0.75; }
.tf-dia-titulo { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim);
                 display: flex; justify-content: space-between; gap: 0.3rem; font-weight: 700; }
.tf-dia.is-hoje .tf-dia-titulo { color: var(--accent); }
.tf-mini { display: block; width: 100%; text-align: left; background: var(--input-bg); border: 1px solid var(--line);
           border-left: 3px solid var(--blue); border-radius: 8px; padding: 0.35rem 0.45rem; font: inherit;
           font-size: 0.78rem; line-height: 1.3; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.tf-mini:hover { border-color: var(--line-2); }
.tf-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tf-mini.is-prio { border-left-color: #f87171; }
.tf-mini.is-feita { opacity: 0.5; text-decoration: line-through; }
.tf-mini small { display: block; color: var(--text-muted); font-size: 0.7rem; margin-top: 0.15rem; }
.tf-dia-vazio { color: var(--text-muted); font-size: 0.74rem; text-align: center; margin-top: 0.4rem; }
.tf-semana-nota { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.6rem; }

/* ── Equipa (018) ─────────────────────────────────────────────────────────── */
.tf-pessoa { color: #93c5fd; }
.tf-so-consulta .tf-texto { cursor: default; }
.tf-so-consulta .tf-texto:hover { color: var(--text); }
.tf-aviso-modo { font-size: 0.84rem; color: #93c5fd; background: rgba(96,165,250,0.08); border: 1px solid rgba(96,165,250,0.3);
                 border-radius: 9px; padding: 0.5rem 0.7rem; margin: -0.4rem 0 0.9rem; }
.tf-nota-membro { font-size: 0.88rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--input-bg);
                  border: 1px dashed var(--line-2); border-radius: 9px; padding: 0.5rem 0.65rem; }

/* ── Janelas ──────────────────────────────────────────────────────────────── */
.tf-veu {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center;
  justify-content: center; padding: 1rem; z-index: 1000;
}
.tf-janela {
  background: #1a2432; border: 1px solid var(--line-2); border-radius: 16px; width: 100%;
  max-width: 580px; max-height: calc(100vh - 2rem); overflow: auto; padding: 1.3rem 1.4rem;
}
.tf-janela-pequena { max-width: 440px; }
.tf-janela-pequena p { color: var(--text-dim); line-height: 1.55; font-size: 0.92rem; overflow-wrap: anywhere; }
.tf-janela-titulo { font-size: 1.15rem; margin-bottom: 1rem; }
.tf-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.tf-full { grid-column: 1 / -1; }
.tf-campo label { display: block; font-size: 0.76rem; font-weight: 700; color: var(--text-dim); margin-bottom: 0.25rem; }
.tf-campo input[type="text"], .tf-campo input[type="date"], .tf-campo select, .tf-campo textarea {
  width: 100%; background: var(--input-bg); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 0.5rem 0.65rem; color: var(--text); font: inherit; font-size: 0.88rem; color-scheme: dark;
}
.tf-campo textarea { resize: vertical; min-height: 88px; }
.tf-campo select:disabled { opacity: 0.55; }
.tf-campo .tf-check { display: flex; gap: 0.45rem; align-items: center; font-size: 0.88rem; font-weight: 600; color: var(--text); cursor: pointer; }
.tf-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.tf-ajuda { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.25rem; }
.tf-atalhos { display: flex; gap: 0.3rem; margin-top: 0.35rem; flex-wrap: wrap; }
.tf-rodape { display: flex; gap: 0.5rem; margin-top: 1.2rem; align-items: center; }
.tf-rodape-dir { margin-left: auto; display: flex; gap: 0.5rem; }

/* ── «Anular» ─────────────────────────────────────────────────────────────── */
.tf-anular {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 900;
  background: var(--input-bg); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 0.6rem 0.9rem; font-size: 0.88rem; display: flex; gap: 0.9rem; align-items: center;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5); max-width: calc(100vw - 2rem);
}
.tf-anular button { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }

/* ── Telemóvel ────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .page { padding: 84px 1rem 5rem; }
  .page-title { font-size: 1.5rem; }
  .tf-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tf-rapido-texto { flex-basis: 100%; }
  .tf-rapido-icone { display: none; }
  .tf-ctrl { flex: 1 1 45%; }
  .tf-ctrl select, .tf-ctrl input[type="date"] { max-width: none; flex: 1; }
  /* Texto e dados em toda a largura; prazo e botões numa linha por baixo. */
  .tf-tarefa { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .tf-corpo, .tf-meta { grid-column: 2 / 4; }
  .tf-prazo { grid-column: 2; grid-row: 3; text-align: left; padding-top: 0; align-self: center; }
  .tf-acoes { grid-column: 3; grid-row: 3; }
  .tf-form { grid-template-columns: 1fr; }
  .tf-menu-lista { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; min-width: 0; }
  .tf-dias { grid-template-columns: 1fr; }
  .tf-dia { min-height: 0; }
  .tf-dia.is-fds { opacity: 1; }
  .tf-semana-nav b { min-width: 0; flex: 1 1 100%; order: -1; text-align: left; }
}
