/* Componentes de produto (data-ui): ranking, nota, critérios, barras.
   Usados na landing (fragmentos) e no app (telas reais). */

[data-ui] {
  --line: #d3dbd7;
  --bar-high: var(--accent);
  --bar-mid: #55646c;
  --bar-low: #7b8991;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: var(--fs-small);
  line-height: 1.45;
}

.ui-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.ui-title { font-weight: 700; font-size: 1rem; min-width: 0; overflow-wrap: anywhere; }
.ui-sub { color: var(--ink-3); font-size: 0.875rem; }

/* Fit: texto + glifo, nunca só cor */
.fit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.fit::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  flex-shrink: 0;
}
.fit-alto::before { background: var(--accent); border-color: var(--accent); }
.fit-medio::before {
  border-color: var(--bar-mid);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path d='M4 0a4 4 0 0 0 0 8z' fill='%2355646c'/></svg>") center / 100% 100% no-repeat;
}
.fit-baixo::before { border-color: var(--bar-low); background: transparent; }

/* Nota */
.nota { font-weight: 700; font-size: 1.5rem; line-height: 1; letter-spacing: -0.02em; min-width: 2.2ch; text-align: right; }
.nota small { font-size: 0.8125rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }

/* Barra */
.bar { height: 8px; background: var(--surface); border-radius: 1px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; width: var(--v, 0%); background: var(--bar-high); transform-origin: left; }
.bar.mid > i { background: var(--bar-mid); }
.bar.low > i { background: var(--bar-low); }

/* Linha de candidato */
.cand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(60px, 110px) auto 104px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  border-left: 0; border-right: 0; border-top: 0;
  border-radius: 0;
  color: inherit;
  transition: background var(--t-fast);
}
.cand:last-child { border-bottom: 0; }
button.cand { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  button.cand:hover { background: #FBF8F0; }
}
button.cand:active { background: var(--surface); }
.cand-name { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.cand-meta { color: var(--ink-3); font-size: 0.875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cand-main { min-width: 0; }
.cand.is-first { padding-block: 20px; background: var(--yellow); }
.cand.is-first .nota { font-size: 2.25rem; }
.cand.is-first .cand-meta { color: #3A3A3A; }
.cand.is-first .nota small { color: #1E1E1E; }
.cand.is-first .bar { background: rgba(30,30,30,0.18); }

/* Critérios */
.crit-list { display: grid; }
.crit {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 132px minmax(0, 2fr);
  gap: 8px 16px;
  align-items: start;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}
.crit-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.crit-weight { display: block; font-weight: 500; font-size: 0.8125rem; color: var(--ink-3); }
.crit-ev { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }

.state { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }
.state svg { width: 16px; height: 16px; flex-shrink: 0; }
.state-ok { color: var(--accent-strong); }
.state-part { color: #55646c; }
.state-no { color: var(--danger); }

/* Etiquetas de texto */
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface);
  border-radius: 2px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}
.tag-elim { background: #f3dcdc; color: #7c1f1f; }

@media (max-width: 640px) {
  .cand { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; padding-inline: 16px; }
  .cand .bar { grid-column: 1 / -1; grid-row: 2; }
  .cand .fit { grid-column: 1; grid-row: 3; }
  .cand .nota { grid-column: 2; grid-row: 1; }
  .crit { grid-template-columns: minmax(0, 1fr); padding-inline: 16px; }
}

.fit-none::before { border-style: dashed; border-color: var(--ink-3); background: transparent; }
