/* F.O.C.O: badges, alertas, progresso, KPIs, tabelas, código e diff. Carregado depois do arquivo anterior em index.html (a ordem da cascata importa). */

/* ------------------------------------------------------------------ badges, tags, alertas */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-sm);
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge--success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.badge--danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.badge--warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.badge--info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info);
}

.badge--brand {
  background: var(--brand-badge-bg);
  border-color: var(--brand-badge-border);
  color: var(--brand-badge);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.tag {
  display: inline-flex;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-12);
}

/* Alerta: ícone do tom à esquerda, texto alinhado ao ícone, borda uniforme. Os ícones são máscaras em currentColor. */
.alert {
  --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
  --alert-tone: var(--info);
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 26px);
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 450;
  line-height: 1.5;
}

.alert::before {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--sp-4);
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background: var(--alert-tone);
  -webkit-mask: var(--alert-ic) center / contain no-repeat;
  mask: var(--alert-ic) center / contain no-repeat;
}

.alert > span:not(.alert__cta) {
  flex: 1 1 260px;
  min-width: 0;
}

.alert .strong {
  font-weight: 600;
}

.alert--danger {
  --alert-tone: var(--danger);
  --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E");
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.alert--warning {
  --alert-tone: var(--warning);
  --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E");
  border-color: var(--warning-border);
  background: var(--warning-bg);
}

.alert--info {
  --alert-tone: var(--info);
}

/* Limite do plano: não é erro. Cor da marca, cadeado e botão para o plano. */
.alert--plan {
  --alert-tone: var(--accent);
  --alert-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
  border-color: var(--info-border);
  background: var(--info-bg);
}

.alert__cta {
  flex: none;
  margin-left: auto;
}

.alert--action {
  justify-content: space-between;
}

.callout {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--foco-blue);
  background: var(--info-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.callout--neutral {
  border-left-color: var(--border-strong);
  background: var(--surface-2);
}

.callout__label {
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 8px);
  background: var(--bg-elevated, var(--surface));
}

.empty--page {
  max-width: 640px;
  margin: var(--sp-6) 0;
  gap: var(--sp-3);
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--fs-18);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}

.empty__text {
  max-width: var(--measure);
  color: var(--text-2);
}

/* ------------------------------------------------------------------ progresso e checklist */

.progress {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.progress__track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress__fill {
  display: block;
  height: 100%;
  background: var(--foco-blue);
  transition: width 0.4s ease;
}

.progress__msg {
  font-size: var(--fs-13);
  color: var(--text-2);
}

.progress__clock {
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text-muted);
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.checklist__item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--divider);
}

.checklist__item:last-child {
  border-bottom: 0;
}

.checklist__mark {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}

.checklist__item--ok .checklist__mark {
  background: var(--success);
  border-color: var(--success);
}

.checklist__item--fix .checklist__mark {
  background: var(--foco-blue);
  border-color: var(--foco-blue);
}

.checklist__item--wait .checklist__mark {
  border-color: var(--foco-blue);
  border-top-color: transparent;
  animation: foco-spin 0.9s linear infinite;
}

.checklist__item--fail .checklist__mark {
  background: var(--danger);
  border-color: var(--danger);
}

.checklist__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.checklist__label {
  font-weight: 700;
  color: var(--text);
}

.checklist__detail {
  font-size: var(--fs-13);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.checklist__status {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--text-muted);
}

.checklist__item--ok .checklist__status {
  color: var(--success);
}

.checklist__item--fail .checklist__status {
  color: var(--danger);
}

.checklist__item--wait .checklist__status,
.checklist__item--fix .checklist__status {
  color: var(--info);
}

@keyframes foco-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .checklist__item--wait .checklist__mark,
  .spinner {
    animation: none;
  }
  .progress__fill {
    transition: none;
  }
}

.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.steps__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding-left: var(--sp-6);
  counter-increment: step;
}

.steps__item::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--foco-navy);
  color: var(--foco-navy);
  font-size: var(--fs-12);
  font-weight: 700;
}

[data-theme="dark"] .steps__item::before {
  border-color: var(--text-2);
  color: var(--text-2);
}

.steps__item--done::before {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.steps__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  color: var(--text);
}

.steps__text {
  font-size: var(--fs-13);
  line-height: var(--lh-prose);
  color: var(--text-2);
}

.steps + p,
.steps + .steps-foot {
  margin-top: var(--sp-6);
}

.steps-foot {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--divider);
  font-size: var(--fs-13);
  line-height: var(--lh-prose);
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ KPIs, tabelas, listas */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.kpi-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-5);
  border-right: 1px solid var(--divider);
  min-width: 0;
}

.kpi:last-child {
  border-right: 0;
}

.kpi__label {
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi__value {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  overflow-wrap: anywhere;
}

.kpi__value .badge {
  font-size: var(--fs-13);
  min-height: 26px;
}

.kpi__value .mono {
  font-size: var(--fs-16);
}

.kpi__of {
  font-family: var(--font-text);
  font-size: var(--fs-14);
  font-weight: 400;
  color: var(--text-muted);
}

.kpi__hint {
  font-size: var(--fs-12);
  color: var(--text-muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
}

.table th,
.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: middle;
}

.table thead th {
  background: var(--surface-2);
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tfoot th,
.table tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.table--compact th,
.table--compact td {
  padding: var(--sp-2) var(--sp-3);
}

.table--top td {
  vertical-align: top;
}

.table--fixed {
  table-layout: fixed;
}

.table--fixed td {
  overflow-wrap: anywhere;
}

.change {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
  font-size: var(--fs-13);
}

.change__row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--sp-2);
}

.change__row dt {
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 1px;
}

.change__row dd {
  color: var(--text-2);
}

.change__row--to dd {
  color: var(--text);
}

.table .num,
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table p + p {
  margin-top: 2px;
}

.subsection .table,
.section > .table-wrap .table,
.subsection > .table-wrap .table {
  background: var(--surface);
  border: 1px solid var(--border);
}

.dl {
  display: flex;
  flex-direction: column;
}

.dl__row {
  display: grid;
  grid-template-columns: minmax(120px, 40%) minmax(0, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--divider);
}

.dl__row:last-child {
  border-bottom: 0;
}

.dl__row dt {
  color: var(--text-muted);
}

.dl__row dd {
  color: var(--text);
  overflow-wrap: anywhere;
}

.list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-left: var(--sp-5);
  color: var(--text-2);
}

.prose {
  max-width: var(--measure);
  color: var(--text-2);
  line-height: var(--lh-prose);
}

.prose p + p {
  margin-top: var(--sp-3);
}

.inline-details {
  margin-top: var(--sp-2);
  font-size: var(--fs-13);
  color: var(--text-2);
}

.inline-details > summary {
  color: var(--link);
  font-weight: 500;
  cursor: pointer;
}

.inline-details > *:not(summary) {
  margin-top: var(--sp-2);
}

.disclaimer {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--divider);
  font-size: var(--fs-13);
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ código e diff */

.code {
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

.code--log,
.code--doc {
  max-height: 480px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
}

.code--doc {
  max-height: none;
  font-size: var(--fs-13);
}

.code > code {
  display: inline-block;
  min-width: 100%;
}

.code__line {
  display: block;
  min-height: 1.55em;
  padding: 0 var(--sp-2);
  margin: 0 calc(var(--sp-2) * -1);
}

.code__line--del {
  background: var(--code-del-bg);
  color: var(--code-del-fg);
}

.code__line--add {
  background: var(--code-add-bg);
  color: var(--code-add-fg);
}

.diff {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.diff__pane {
  min-width: 0;
  background: var(--code-bg);
}

.diff__pane + .diff__pane {
  border-left: 1px solid var(--border);
}

.diff__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.diff__pane--del .diff__head::before,
.diff__pane--add .diff__head::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--danger);
}

.diff__pane--add .diff__head::before {
  background: var(--success);
}

.diff__pane .code {
  border-radius: 0;
  background: transparent;
}

.diff__empty {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-muted);
  font-size: var(--fs-13);
}
