/* ────────────────────────────────────────────────────────────────
 * Matter "Authorities" — Phase 4+
 * ────────────────────────────────────────────────────────────────
 * Sits below #matter-consistency-panel. Two-state lifecycle:
 * pinned (lawyer endorsed) and suggested (Sonnet+websearch proposed).
 */

#matter-authorities-panel {
  margin-bottom: 0.85rem;
}
#matter-authorities-panel:empty { display: none; }

.authorities-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.7rem 0.9rem 0.75rem;
}

.authorities-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.authorities-title {
  font-family: var(--font-serif, 'EB Garamond', serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.authorities-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.authorities-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.authorities-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-muted);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.btn-authority {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn-authority:hover:not(:disabled) {
  background: var(--bg-muted);
}
.btn-authority.primary {
  background: var(--gold, #d9a541);
  border-color: var(--gold, #d9a541);
  color: var(--text);
}
.btn-authority.primary:hover:not(:disabled) {
  background: var(--gold-dark, #b88a1f);
  color: var(--white);
}
.btn-authority.subtle {
  color: var(--text-muted);
  border-color: transparent;
}
.btn-authority.subtle:hover:not(:disabled) {
  color: var(--text);
}
.btn-authority:disabled { opacity: 0.6; cursor: progress; }

.authorities-loading,
.authorities-empty,
.authorities-running {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}
.authorities-running {
  display: flex; align-items: center; gap: 0.5rem;
}

/* ── Type groups ── */
.authorities-section { margin-top: 0.5rem; }
.authorities-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.authorities-type-group { margin-bottom: 0.6rem; }
.authorities-type-label {
  font-family: var(--font-serif, 'EB Garamond', serif);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.authorities-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.authority-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 6px);
  background: var(--white);
}
.authority-row.pinned {
  background: linear-gradient(0deg, rgba(58, 145, 90, 0.04), rgba(58, 145, 90, 0.04)), var(--white);
  border-color: rgba(58, 145, 90, 0.20);
}
.authority-row.suggested {
  border-style: dashed;
}

.authority-main { flex: 1; min-width: 0; }
.authority-cite {
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.authority-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
}
.authority-link:hover {
  color: var(--gold-dark, #8a6b1f);
  border-bottom-color: var(--gold, #d9a541);
}
.authority-relevance {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.authority-conf {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.authority-conf.conf-high { background: rgba(58, 145, 90, 0.12); color: #2f6b46; }
.authority-conf.conf-med  { background: rgba(217, 165, 65, 0.16); color: #8a5a1f; }
.authority-conf.conf-low  { background: rgba(200, 40, 40, 0.10); color: #8a2828; }

.authority-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.3rem;
}
.authority-section-tag {
  font-size: 0.62rem;
  background: var(--bg-muted);
  color: var(--text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.authority-section-tag-more {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-style: italic;
}

.authority-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-end;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .authority-row { flex-direction: column; }
  .authority-actions { flex-direction: row; align-self: stretch; justify-content: flex-end; }
}
