/* ============================================================
 *  TASK DETAIL MODAL v3 — compacto, single-scroll
 *  DNA: Nova Tarefa (white, thin borders, mono labels)
 *  Referência: screenshot enviado pelo usuário
 * ============================================================ */

/* tokens locais */
.task-detail-v2 {
  --tv-bg: #ffffff;
  --tv-ink: oklch(0.22 0.02 260);
  --tv-ink-soft: oklch(0.45 0.01 260);
  --tv-ink-mut: oklch(0.60 0.01 260);
  --tv-line: oklch(0.92 0.005 260);
  --tv-line-2: oklch(0.95 0.005 260);
  --tv-surface-2: oklch(0.985 0.003 260);
  --tv-radius: 14px;
  --tv-radius-sm: 8px;
  --tv-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --tv-font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  background: rgba(15, 18, 25, 0.42);
  backdrop-filter: blur(6px) saturate(1.05);
  -webkit-backdrop-filter: blur(6px) saturate(1.05);
  animation: tvFadeIn 140ms ease-out;
}
@keyframes tvFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== shell ===== */
.tv-modal {
  width: min(560px, 94vw);
  max-height: min(92vh, 820px);
  background: var(--tv-bg);
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius);
  box-shadow: 0 24px 72px -24px rgba(10, 15, 30, 0.35), 0 2px 8px rgba(10, 15, 30, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--tv-ink);
  font-family: var(--tv-font-display);
  animation: tvSlideUp 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes tvSlideUp { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ===== HEADER ===== */
.tv-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--tv-line-2);
}
.tv-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.tv-head-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.tv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-family: var(--tv-font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
}
.tv-chip--tipo {
  background: oklch(0.95 0.06 85);
  color: oklch(0.42 0.14 60);
}
.tv-chip--tipo-audiencia { background: oklch(0.94 0.07 25);  color: oklch(0.42 0.16 25); }
.tv-chip--tipo-peticao   { background: oklch(0.94 0.07 60);  color: oklch(0.42 0.15 60); }
.tv-chip--tipo-prazo     { background: oklch(0.94 0.06 15);  color: oklch(0.42 0.18 15); }
.tv-chip--tipo-reuniao   { background: oklch(0.94 0.06 240); color: oklch(0.42 0.14 240); }
.tv-chip--tipo-email     { background: oklch(0.94 0.05 200); color: oklch(0.42 0.12 200); }
.tv-chip--tipo-ligacao   { background: oklch(0.94 0.05 165); color: oklch(0.42 0.12 165); }
.tv-chip--tipo-documento { background: oklch(0.95 0.03 280); color: oklch(0.42 0.10 280); }
.tv-chip--tipo-outro     { background: oklch(0.95 0.01 260); color: oklch(0.42 0.02 260); }
.tv-chip--rec {
  background: oklch(0.96 0.02 260);
  color: oklch(0.45 0.04 260);
}

/* Priority dot */
.tv-priodot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tv-ink-soft);
  font-family: var(--tv-font-display);
  text-transform: none;
}
.tv-priodot__d {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: oklch(0.60 0.02 260);
  flex-shrink: 0;
}
.tv-priodot--urgente .tv-priodot__d,
.tv-priodot--critica .tv-priodot__d { background: oklch(0.58 0.22 25); }
.tv-priodot--alta    .tv-priodot__d { background: oklch(0.65 0.18 50); }
.tv-priodot--media   .tv-priodot__d { background: oklch(0.70 0.14 85); }
.tv-priodot--baixa   .tv-priodot__d { background: oklch(0.62 0.10 200); }
.tv-priodot--urgente,
.tv-priodot--critica { color: oklch(0.48 0.18 25); }
.tv-priodot--alta    { color: oklch(0.50 0.14 50); }

.tv-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--tv-ink-mut);
  cursor: pointer;
  transition: all 120ms;
  flex-shrink: 0;
}
.tv-close:hover { background: var(--tv-surface-2); color: var(--tv-ink); }

.tv-title {
  margin: 0;
  font-family: var(--tv-font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--tv-ink);
}

/* ===== DEADLINE STRIP ===== */
.tv-deadline {
  margin: 14px 20px 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-surface-2);
  border: 1px solid var(--tv-line);
  font-size: 13px;
}
.tv-deadline__ico {
  display: inline-flex;
  color: var(--tv-ink-mut);
  flex-shrink: 0;
}
.tv-deadline__date {
  font-family: var(--tv-font-mono);
  font-size: 13px;
  color: var(--tv-ink);
  font-weight: 500;
  flex: 1;
}
.tv-deadline__badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-ink-soft);
  letter-spacing: 0;
}
.tv-deadline--danger {
  background: oklch(0.98 0.025 25);
  border-color: oklch(0.88 0.06 25);
  color: oklch(0.44 0.18 25);
}
.tv-deadline--danger .tv-deadline__ico,
.tv-deadline--danger .tv-deadline__badge { color: oklch(0.48 0.20 25); }
.tv-deadline--warn {
  background: oklch(0.98 0.03 50);
  border-color: oklch(0.90 0.06 50);
}
.tv-deadline--warn .tv-deadline__ico,
.tv-deadline--warn .tv-deadline__badge { color: oklch(0.50 0.15 50); }
.tv-deadline--caution {
  background: oklch(0.985 0.025 85);
  border-color: oklch(0.92 0.05 85);
}
.tv-deadline--caution .tv-deadline__badge { color: oklch(0.48 0.12 85); }
.tv-deadline--info {
  background: oklch(0.98 0.02 240);
  border-color: oklch(0.92 0.04 240);
}
.tv-deadline--info .tv-deadline__badge { color: oklch(0.48 0.12 240); }

/* ===== BODY ===== */
.tv-body {
  padding: 16px 20px 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--tv-line) transparent;
}
.tv-body::-webkit-scrollbar { width: 6px; }
.tv-body::-webkit-scrollbar-track { background: transparent; }
.tv-body::-webkit-scrollbar-thumb { background: var(--tv-line); border-radius: 3px; }

/* ===== GRID (meta cells) ===== */
.tv-grid {
  display: grid;
  gap: 14px 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tv-line-2);
}
.tv-grid--3 { grid-template-columns: repeat(3, 1fr); }
.tv-grid--2 { grid-template-columns: repeat(2, 1fr); }

.tv-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.tv-cell__lbl {
  font-family: var(--tv-font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tv-ink-mut);
}
.tv-cell__val {
  font-family: var(--tv-font-display);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tv-ink);
  line-height: 1.35;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.tv-cell__val--mono {
  font-family: var(--tv-font-mono);
  font-size: 12.5px;
  letter-spacing: -0.01em;
}
.tv-cell__val--empty { color: var(--tv-ink-mut); font-weight: 400; }
.tv-cell__val--link {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--tv-ink);
  transition: color 120ms;
}
.tv-cell__val--link:hover { color: oklch(0.35 0.14 260); }
.tv-cell__val--link svg { color: var(--tv-ink-mut); transition: transform 120ms; }
.tv-cell__val--link:hover svg { transform: translateX(2px); color: oklch(0.45 0.14 260); }

.tv-cell__val--resp { gap: 8px; }
.tv-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tv-font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}
.tv-av-name { font-weight: 500; }
.tv-av-extra {
  font-family: var(--tv-font-mono);
  font-size: 10px;
  color: var(--tv-ink-mut);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.tv-statusdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== BLOCK (checklist / notes / tags / anexos) ===== */
.tv-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tv-line-2);
}
.tv-block:last-of-type { border-bottom: 0; padding-bottom: 0; }
.tv-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tv-block__lbl {
  font-family: var(--tv-font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tv-ink-mut);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tv-block__count {
  font-family: var(--tv-font-mono);
  font-size: 10px;
  color: var(--tv-ink-mut);
  font-weight: 500;
}
.tv-block__progress {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tv-progbar {
  width: 72px;
  height: 4px;
  background: var(--tv-line);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}
.tv-progbar > span {
  display: block;
  height: 100%;
  background: oklch(0.65 0.14 150);
  border-radius: 999px;
  transition: width 240ms ease;
}

/* Checklist */
.tv-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tv-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius-sm);
  background: #fff;
  cursor: pointer;
  transition: all 120ms;
  font-size: 13.5px;
}
.tv-check:hover { border-color: oklch(0.85 0.01 260); background: var(--tv-surface-2); }
.tv-check__box {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid oklch(0.75 0.01 260);
  background: #fff;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms;
}
.tv-check__box.is-checked {
  background: oklch(0.60 0.15 150);
  border-color: oklch(0.58 0.16 150);
  color: #fff;
}
.tv-check__box svg { width: 12px; height: 12px; }
.tv-check__txt { color: var(--tv-ink); line-height: 1.35; flex: 1; }
.tv-check.is-done .tv-check__txt {
  color: var(--tv-ink-mut);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* Notes */
.tv-block--notes .tv-notes {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--tv-ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Tags */
.tv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tv-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-family: var(--tv-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--tv-ink-soft);
  background: var(--tv-surface-2);
  border: 1px solid var(--tv-line);
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* Anexos */
.tv-files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tv-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius-sm);
  background: #fff;
  font-size: 13px;
  transition: border-color 120ms;
}
.tv-file:hover { border-color: oklch(0.85 0.01 260); }
.tv-file__ico {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tv-surface-2);
  border-radius: 5px;
  color: var(--tv-ink-mut);
  flex-shrink: 0;
}
.tv-file__ico svg { width: 14px; height: 14px; }
.tv-file__name {
  flex: 1;
  color: var(--tv-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-file__size {
  font-family: var(--tv-font-mono);
  font-size: 10.5px;
  color: var(--tv-ink-mut);
}
.tv-file__open {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--tv-ink-mut);
  transition: all 120ms;
}
.tv-file__open:hover { background: var(--tv-surface-2); color: var(--tv-ink); }

/* ===== FOOTER ===== */
.tv-foot {
  border-top: 1px solid var(--tv-line-2);
  background: var(--tv-surface-2);
}
.tv-foot__meta {
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--tv-font-mono);
  font-size: 10.5px;
  color: var(--tv-ink-mut);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--tv-line-2);
  flex-wrap: wrap;
}
.tv-foot__sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--tv-ink-mut);
  opacity: 0.55;
  flex-shrink: 0;
}
.tv-foot__actions {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tv-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--tv-font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 8px;
  border: 1px solid var(--tv-line);
  background: #fff;
  color: var(--tv-ink);
  cursor: pointer;
  transition: all 120ms;
  white-space: nowrap;
}
.tv-action:hover { border-color: oklch(0.75 0.01 260); background: var(--tv-surface-2); }
.tv-action:focus-visible {
  outline: 2px solid oklch(0.70 0.12 260);
  outline-offset: 2px;
}
.tv-action--success {
  color: oklch(0.38 0.14 150);
  border-color: oklch(0.82 0.08 150);
  background: oklch(0.98 0.03 150);
}
.tv-action--success:hover {
  background: oklch(0.96 0.05 150);
  border-color: oklch(0.68 0.14 150);
}
.tv-action--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--tv-ink-soft);
  margin-left: auto;
}
.tv-action--ghost:hover { background: var(--tv-line-2); color: var(--tv-ink); }
.tv-action--primary {
  background: oklch(0.22 0.02 260);
  color: #fff;
  border-color: oklch(0.22 0.02 260);
}
.tv-action--primary:hover {
  background: oklch(0.30 0.02 260);
  border-color: oklch(0.30 0.02 260);
}
.tv-action--danger-ghost {
  width: 34px;
  padding: 8px;
  justify-content: center;
  color: oklch(0.55 0.18 25);
  border-color: var(--tv-line);
}
.tv-action--danger-ghost:hover {
  background: oklch(0.97 0.04 25);
  border-color: oklch(0.82 0.10 25);
  color: oklch(0.45 0.20 25);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .tv-modal { width: 96vw; max-height: 96vh; }
  .tv-head, .tv-body, .tv-foot__meta, .tv-foot__actions { padding-left: 16px; padding-right: 16px; }
  .tv-deadline { margin-left: 16px; margin-right: 16px; }
  .tv-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .tv-title { font-size: 17px; }
  .tv-action--ghost { margin-left: 0; }
}
