/* ============================================================
   AZ Docs — debitos.css
   Componentes exclusivos da aba "Débitos técnicos": o painel de
   números do topo, o cartão-ficha de cada débito e os blocos de
   evidência tirada do código.
   Depende de base.css (tokens e tipografia).
   ============================================================ */

/* ── Painel de números ───────────────────────────────────── */

.ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  padding: 1.35rem 1.4rem;
  display: grid;
  gap: .3rem;
  align-content: start;
}
.stat__value {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-2);
  line-height: 1;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.stat__note { font-size: var(--step--1); color: var(--ink-muted); margin: 0; line-height: 1.45; }

.stat--high .stat__value { color: var(--sev-high); }
.stat--mid  .stat__value { color: var(--sev-mid); }

/* ── Cabeçalho de área ───────────────────────────────────── */

.area {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  flex-wrap: wrap;
  margin: 3rem 0 .25rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--ink);
}
.area:first-of-type { margin-top: 0; }
.area h3 {
  font-family: var(--font-serif);
  font-size: var(--step-2);
  font-weight: 600;
  margin: 0;
}
.area__count {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ── Cartão de débito ────────────────────────────────────── */

.debt {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--tone, var(--rule));
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}
.debt--high { --tone: var(--sev-high); }
.debt--mid  { --tone: var(--sev-mid); }
.debt--low  { --tone: var(--sev-low); }

.debt__head {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0 1.25rem;
  align-items: start;
  padding: 1.5rem 1.6rem 1.15rem;
  border-bottom: 1px solid var(--rule-soft);
}

.debt__id {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: var(--step-2);
  line-height: 1;
  color: var(--tone);
  font-variant-numeric: tabular-nums;
  padding-top: .1rem;
}

.debt__title {
  font-family: var(--font-sans);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
  margin: 0 0 .6rem;
  max-width: var(--measure);
}

.debt__badges { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .22rem .6rem;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge--sev { color: var(--tone); background: var(--tone-bg, transparent); }
.debt--high .badge--sev { --tone-bg: var(--sev-high-bg); }
.debt--mid  .badge--sev { --tone-bg: var(--sev-mid-bg); }
.debt--low  .badge--sev { --tone-bg: var(--sev-low-bg); }

.badge--effort {
  color: var(--ink-soft);
  border-color: var(--rule);
  background: var(--surface-alt);
}
.badge--effort b { color: var(--ink); font-weight: 600; letter-spacing: .04em; }

.debt__where {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--ink-muted);
  letter-spacing: .02em;
  word-break: break-word;
}

/* ── Ficha (problema / afeta / solução) ──────────────────── */

.debt__body { padding: .5rem 1.6rem 1.6rem; }

.field {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.field:last-child { border-bottom: none; padding-bottom: .25rem; }

.field__label {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: .3rem;
}

.field__body > :first-child { margin-top: 0; }
.field__body > :last-child { margin-bottom: 0; }
.field__body p { font-size: var(--step--1); line-height: 1.6; }
.field__body ul { margin-bottom: .5rem; }
.field__body li { font-size: var(--step--1); line-height: 1.55; }

/* ── Evidência tirada do código ──────────────────────────── */

.evidence {
  background: var(--surface-alt);
  border: 1px solid var(--rule-soft);
  border-left: 2px solid var(--ink-muted);
  padding: .85rem 1rem;
  margin: .85rem 0;
  font-family: var(--font-mono);
  font-size: .76rem;
  line-height: 1.7;
  color: var(--ink-soft);
  overflow-x: auto;
  white-space: pre;
  max-width: none;
}
.evidence b { color: var(--ink); font-weight: 500; }

.evidence__label {
  display: block;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: .3rem;
}

/* ── Passos da solução ───────────────────────────────────── */

.plan {
  list-style: none;
  margin: .5rem 0 .75rem;
  padding: 0;
  display: grid;
  gap: .55rem;
  counter-reset: plan;
}
.plan li {
  counter-increment: plan;
  position: relative;
  padding-left: 2.2rem;
  margin: 0;
  font-size: var(--step--1);
  line-height: 1.55;
  max-width: var(--measure);
}
.plan li::before {
  content: counter(plan);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  text-align: right;
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.9;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ── Aviso dentro de um débito ───────────────────────────── */

.flag {
  background: var(--sev-high-bg);
  border-left: 3px solid var(--sev-high);
  padding: .8rem 1rem;
  margin: .85rem 0;
}
.flag > :last-child { margin-bottom: 0; }
.flag p { max-width: none; color: var(--ink-soft); }
.flag__label {
  display: block;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sev-high);
  margin-bottom: .25rem;
}

@media (max-width: 46rem) {
  .field { grid-template-columns: 1fr; gap: .35rem; }
  .field__label { padding-top: 0; }
}

@media (max-width: 34rem) {
  .debt__head { grid-template-columns: 1fr; gap: .4rem; padding: 1.25rem 1.15rem 1rem; }
  .debt__id { font-size: var(--step-1); }
  .debt__body { padding: .35rem 1.15rem 1.25rem; }
}
