/* Entity overview page (docs/entities.html). Consumes --h-* tokens only.
   Certainty semantics follow the badge palette of base.css: auto-marked mentions in
   Olivgruen (the measured, trusted layer), review candidates in Ocker (worklist).
   Entity category icons reuse the viewer legend colours: person Preussischblau,
   organisation Olivgruen, work Ziegelrot; the glyph shape carries the distinction on
   its own, the colour only reinforces it. */

.eo-main {
  max-width: 66rem;
  margin: 0 auto;
  padding: var(--h-space-6, 2rem) var(--h-space-4, 1rem) 4rem;
}

.eo-intro h1 {
  font-family: var(--h-font-heading);
  color: var(--h-heading);
  font-size: 1.6rem;
  margin: 0 0 0.8rem;
}

.eo-intro h1 .badge {
  vertical-align: 0.25em;
  margin-left: 0.5rem;
}

/* Corpus bar: the totals live on the same stacked bar the document rows use;
   its labels double as the legend. No stat cards, no intro copy (operator rule). */
.eo-corpus { margin-bottom: 1.4rem; }

.eo-corpus__bar {
  display: flex;
  height: 0.9rem;
  border-radius: 4px;
  overflow: hidden;
  background: var(--h-bg-alt);
}

.eo-corpus__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  align-items: center;
  margin-top: 0.4rem;
  font-size: var(--h-sm);
  color: var(--h-text-secondary);
}

.eo-corpus__labels .badge { margin-left: auto; }

.eo-corpus__total {
  font-family: var(--h-font-heading);
  color: var(--h-text);
  font-weight: 500;
}

/* Adjudicated evidence: one strip under the corpus bar, never a stat card.
   Every item names its sample size next to its rate. */
.eo-quality {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  align-items: center;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--h-border);
  font-size: var(--h-sm);
  color: var(--h-text-secondary);
}

.eo-quality__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: help;
}

.eo-quality__item:focus-visible,
.eo-legend__chip:focus-visible,
.eo-corpus__total:focus-visible,
.eo-chip:focus-visible,
.eo-corpus__labels .badge:focus-visible {
  outline: 2px solid var(--h-preussischblau);
  outline-offset: 2px;
  border-radius: var(--h-radius-sm);
}

/* Icons: sized to the text, drawn in currentColor, never the sole carrier. */
.eo-icon {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  display: inline-block;
  vertical-align: -0.16em;
}

.eo-icon--person { color: var(--h-preussischblau); }
.eo-icon--organisation { color: var(--h-olivgruen); }
.eo-icon--work { color: var(--h-ziegelrot); }
.eo-legend__chip--auto .eo-icon { color: var(--h-olivgruen); }
.eo-legend__chip--review .eo-icon { color: var(--h-ocker); }

/* Controls */
.eo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.eo-controls .input { max-width: 18rem; }

.eo-count {
  font-size: var(--h-sm);
  color: var(--h-text-muted);
  margin-left: auto;
}

/* Legend */
.eo-legend__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* View toggle: two pressed-state buttons, active carries the accent */
.eo-view { display: inline-flex; gap: 0; }

.eo-view .btn { border-radius: 0; }
.eo-view .btn:first-child { border-radius: 4px 0 0 4px; }
.eo-view .btn:last-child { border-radius: 0 4px 4px 0; margin-left: -1px; }

.eo-view .btn[aria-pressed="true"] {
  background: var(--h-anthrazit);
  border-color: var(--h-anthrazit);
  color: var(--h-text-inverse);
}

/* Result list */
.eo-list { display: flex; flex-direction: column; gap: 0.45rem; }

.eo-doc {
  background: var(--h-surface);
  border: 1px solid var(--h-border);
  border-radius: 6px;
}

.eo-doc[open] { border-color: var(--h-border-emphasis); }

.eo-doc__summary {
  display: grid;
  grid-template-columns: 3.2rem minmax(10rem, 1fr) auto minmax(6rem, 11rem);
  gap: 0.8rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  list-style: none;
}

.eo-doc__summary--entity {
  grid-template-columns: minmax(12rem, 1fr) auto auto minmax(6rem, 11rem);
}

.eo-doc__summary::-webkit-details-marker { display: none; }

.eo-doc__summary:focus-visible {
  outline: 2px solid var(--h-preussischblau);
  outline-offset: -2px;
  border-radius: 6px;
}

.eo-doc__id {
  font-family: var(--h-font-mono);
  font-size: var(--h-sm);
  color: var(--h-text-secondary);
}

.eo-doc__title {
  font-family: var(--h-font-body);
  color: var(--h-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eo-doc__title .eo-icon { margin-right: 0.4rem; }

.eo-doc__meta {
  color: var(--h-text-muted);
  font-size: var(--h-sm);
  margin-left: 0.4rem;
}

.eo-doc__counts {
  font-size: var(--h-sm);
  color: var(--h-text-secondary);
  white-space: nowrap;
  text-align: right;
}

.eo-doc__counts strong { color: var(--h-olivgruen); font-weight: 600; }
.eo-doc__counts em { color: var(--h-ocker); font-style: normal; font-weight: 600; }

/* Stacked certainty bar */
.eo-bar {
  height: 0.5rem;
  border-radius: 3px;
  background: var(--h-bg-alt);
  overflow: hidden;
  display: flex;
}

.eo-bar__auto { background: var(--h-olivgruen); }
.eo-bar__review { background: var(--h-ocker); }

/* Detail body */
.eo-doc__body {
  border-top: 1px solid var(--h-border);
  padding: 0.8rem 0.85rem 1rem;
}

.eo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.8rem;
}

.eo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--h-xs);
  font-family: var(--h-font-heading);
  color: var(--h-text-secondary);
  background: var(--h-ocker-subtle);
  border: 1px solid var(--h-border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  cursor: help;
}

/* Facts line and ambiguity note of the entity detail body */
.eo-facts {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  font-size: var(--h-sm);
  color: var(--h-text-secondary);
}

.eo-facts .eo-doc__id { margin-left: 0.3rem; }

.eo-note {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
  padding: 0.35rem 0.55rem;
  border-left: 2px solid var(--h-ocker);
  background: var(--h-bg-alt);
  font-size: var(--h-sm);
  color: var(--h-text-secondary);
  cursor: help;
}

.eo-note .eo-icon { margin-top: 0.15em; color: var(--h-ocker); }

.eo-doc__meta--alt {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--h-ocker);
  cursor: help;
}

.eo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--h-sm);
}

.eo-table th {
  text-align: left;
  font-family: var(--h-font-heading);
  font-weight: 500;
  color: var(--h-text-muted);
  border-bottom: 1px solid var(--h-border);
  padding: 0.25rem 0.5rem 0.25rem 0;
}

.eo-table td {
  padding: 0.3rem 0.5rem 0.3rem 0;
  border-bottom: 1px solid var(--h-anthrazit-subtle);
  vertical-align: top;
}

.eo-table td.eo-num, .eo-table th.eo-num { text-align: right; width: 4rem; }

.eo-table th[title] { cursor: help; }

.eo-table td .eo-icon { margin-right: 0.4rem; }

.eo-table td .eo-chips { margin: 0; gap: 0.25rem; }

.eo-doc__actions { margin-top: 0.8rem; }

.eo-empty {
  color: var(--h-text-muted);
  padding: 1.2rem 0;
  text-align: center;
}

.eo-doc__body .eo-empty {
  padding: 0.1rem 0;
  text-align: left;
}

@media (max-width: 44rem) {
  .eo-doc__summary { grid-template-columns: 3rem 1fr auto; }
  .eo-doc__summary--entity { grid-template-columns: 1fr auto auto; }
  .eo-doc__summary .eo-bar { display: none; }
}
