/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ai.css — Evident AI Hub styles
   Scene Analyzer · Violation Engine · Multi-Cam Sync
   Real-Time Alerts · AI Assistant · Search
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ── Shared Layout ─────────────────────────────────────── */

.ai-hub {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: calc(100vh - 6rem);
}

.ai-nav {
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ai-nav__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-text-muted);
  padding: 0 1.25rem;
  margin-bottom: 0.75rem;
}

.ai-nav__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  color: var(--app-text-muted);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.ai-nav__item:hover { background: var(--app-surface-2); color: var(--app-text); }
.ai-nav__item--active {
  background: var(--app-surface-2);
  color: var(--app-text);
  border-left-color: var(--app-accent);
  font-weight: 600;
}

.ai-nav__icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.ai-nav__badge {
  margin-left: auto;
  background: var(--app-error);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.ai-content {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 6rem);
}

.ai-panel { display: none; }
.ai-panel--active { display: block; }

.ai-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--app-text);
  margin: 0 0 1rem;
}

/* ── Cards ─────────────────────────────────────────────── */

.ai-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.ai-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.ai-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-text);
  margin: 0;
}

.ai-card__badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-card__badge--locked { background: var(--app-surface-2); color: var(--app-text-muted); }
.ai-card__badge--active { background: var(--app-accent); color: #fff; }

/* ── Alert Severity Tags ───────────────────────────────── */

.severity-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.severity-tag--critical { background: #5c0011; color: #ff6b6b; }
.severity-tag--high     { background: #5c2600; color: #ffa94d; }
.severity-tag--medium   { background: #5c4300; color: #ffe066; }
.severity-tag--low      { background: #0a4d28; color: #69db7c; }
.severity-tag--info     { background: #003052; color: #74c0fc; }

/* ── Alerts Dashboard ──────────────────────────────────── */

.alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.alert-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 4px solid transparent;
  transition: border-color 0.2s;
}

.alert-card--critical { border-left-color: var(--app-error); }
.alert-card--high     { border-left-color: var(--app-warning); }
.alert-card--medium   { border-left-color: #ffe066; }
.alert-card--low      { border-left-color: var(--app-success); }

.alert-card__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
}

.alert-card__meta {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.alert-card__detail {
  font-size: 0.8rem;
  color: var(--app-text);
  line-height: 1.5;
}

.alert-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.alert-stat {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem;
  text-align: center;
}

.alert-stat__number {
  font-size: 1.75rem;
  font-weight: 800;
  display: block;
}

.alert-stat__label {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Scene Analysis ────────────────────────────────────── */

.scene-timeline {
  position: relative;
  padding-left: 2rem;
}

.scene-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--app-border);
}

.scene-event {
  position: relative;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.scene-event::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 1rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--app-accent);
  border: 2px solid var(--app-surface);
}

.scene-event--action::before { background: var(--app-warning); }
.scene-event--violation::before { background: var(--app-error); }

.scene-event__time {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--app-accent-hover);
  text-transform: uppercase;
}

.scene-event__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-text);
}

.scene-event__detail {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  margin-top: 0.25rem;
}

.scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.scene-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  border: 1px solid var(--app-border);
}

.scene-tag--active { background: var(--app-accent); color: #fff; border-color: var(--app-accent); }

/* ── Violation Report ──────────────────────────────────── */

.violation-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.violation-item {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--app-error);
}

.violation-item--low { border-left-color: var(--app-warning); }
.violation-item--medium { border-left-color: #ffe066; }
.violation-item--high { border-left-color: var(--app-error); }

.violation-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.violation-item__amendment {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--app-surface-2);
  color: var(--app-accent-hover);
}

.violation-item__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
}

.violation-item__detail {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  line-height: 1.5;
}

.violation-item__citations {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--app-accent-hover);
}

.violation-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.violation-summary__card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem;
  text-align: center;
}

/* ── Multi-Cam Sync ────────────────────────────────────── */

.sync-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 1.5rem;
}

.sync-camera {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  align-items: center;
  gap: 1rem;
}

.sync-camera__name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-text);
}

.sync-camera__bar {
  height: 8px;
  border-radius: 4px;
  background: var(--app-accent);
  position: relative;
}

.sync-camera__bar--ref { background: var(--app-success); }

.sync-camera__offset {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--app-text-muted);
  min-width: 80px;
  text-align: right;
}

.sync-quality {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
}

.sync-quality--excellent { background: #0a4d28; color: #69db7c; }
.sync-quality--good      { background: #0a3d48; color: #74c0fc; }
.sync-quality--fair      { background: #5c4300; color: #ffe066; }
.sync-quality--poor      { background: #5c0011; color: #ff6b6b; }

/* ── Chat / Assistant ──────────────────────────────────── */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 10rem);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
  background: var(--app-surface-2);
}

.chat-header__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
}

.chat-header__counter {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-msg {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: var(--app-radius);
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--app-accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-msg--assistant {
  align-self: flex-start;
  background: var(--app-surface-2);
  color: var(--app-text);
  border-bottom-left-radius: 2px;
}

.chat-msg--system {
  align-self: center;
  font-size: 0.75rem;
  color: var(--app-text-muted);
  font-style: italic;
}

.chat-msg__time {
  font-size: 0.65rem;
  color: inherit;
  opacity: 0.6;
  margin-top: 0.3rem;
  display: block;
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--app-border);
  background: var(--app-surface-2);
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--app-bg);
  color: var(--app-text);
  min-height: 40px;
  max-height: 120px;
}

.chat-input:focus { outline: 2px solid var(--app-accent); border-color: transparent; }

.chat-send {
  border: none;
  background: var(--app-accent);
  color: #fff;
  border-radius: var(--app-radius);
  padding: 0.6rem 1rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.chat-send:hover { background: var(--app-accent-hover); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-sessions {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
}

.chat-session-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  border: 1px solid var(--app-border);
  background: var(--app-bg);
  color: var(--app-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.chat-session-btn--active { background: var(--app-accent); color: #fff; border-color: var(--app-accent); }

/* ── Search ────────────────────────────────────────────── */

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.search-input {
  flex: 1;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: inherit;
}

.search-input:focus { outline: 2px solid var(--app-accent); border-color: transparent; }

.search-btn {
  border: none;
  background: var(--app-accent);
  color: #fff;
  border-radius: var(--app-radius);
  padding: 0.65rem 1.25rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
}

.search-btn:hover { background: var(--app-accent-hover); }

.search-facets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-facet {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--app-border);
  background: var(--app-bg);
  color: var(--app-text-muted);
  cursor: pointer;
}

.search-facet--active { background: var(--app-accent); color: #fff; border-color: var(--app-accent); }

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.search-result:hover { border-color: var(--app-accent); }

.search-result__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
}

.search-result__meta {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  margin-top: 0.25rem;
}

.search-result__snippet {
  font-size: 0.8rem;
  color: var(--app-text);
  margin-top: 0.4rem;
  line-height: 1.5;
}

.search-result__tags {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

/* ── Empty / Loading States ────────────────────────────── */

.ai-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--app-text-muted);
}

.ai-empty svg { margin-bottom: 1rem; opacity: 0.4; }

.ai-empty__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 0.5rem;
}

.ai-loading {
  text-align: center;
  padding: 2rem;
}

.ai-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--app-border);
  border-top-color: var(--app-accent);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

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

/* ── Tier Lock Overlay ─────────────────────────────────── */

.ai-locked {
  position: relative;
  pointer-events: none;
  opacity: 0.5;
  filter: blur(1px);
}

.ai-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  border-radius: inherit;
  pointer-events: auto;
  z-index: 10;
}

.ai-lock-overlay__text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.75rem;
}

.ai-lock-overlay__btn {
  margin-top: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: var(--app-accent);
  color: #fff;
  border: none;
  border-radius: var(--app-radius);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .ai-hub { grid-template-columns: 1fr; }

  .ai-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--app-border);
    padding: 0.5rem;
    gap: 0;
  }

  .ai-nav__title { display: none; }

  .ai-nav__item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }

  .ai-nav__item--active { border-bottom-color: var(--app-accent); border-left-color: transparent; }

  .ai-content { padding: 1rem; }

  .alert-stats { grid-template-columns: repeat(2, 1fr); }
  .violation-summary { grid-template-columns: 1fr; }

  .chat-msg { max-width: 92%; }
}

@media (max-width: 480px) {
  .alert-stats { grid-template-columns: 1fr; }
  .alerts-grid { grid-template-columns: 1fr; }
  .sync-camera { grid-template-columns: 100px 1fr auto; }
}

/* ── Panel Description ─────────────────────────────────── */

.ai-panel__desc {
  font-size: 0.85rem;
  color: var(--app-text-muted);
  line-height: 1.6;
  margin: -0.5rem 0 1.25rem;
}

/* ── Discovery Findings ────────────────────────────────── */

.discovery-finding {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--app-accent);
}

.discovery-finding--critical { border-left-color: var(--app-error); }
.discovery-finding--high     { border-left-color: var(--app-warning); }
.discovery-finding--medium   { border-left-color: #ffe066; }
.discovery-finding--low      { border-left-color: var(--app-success); }
.discovery-finding--info     { border-left-color: var(--app-accent); }

.discovery-finding__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.discovery-finding__category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-accent-hover);
}

.discovery-finding__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 0.25rem;
}

.discovery-finding__detail {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  line-height: 1.5;
}

.discovery-finding__legal {
  font-size: 0.78rem;
  color: var(--app-accent-hover);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--app-border);
}

.discovery-finding__related {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  margin-top: 0.35rem;
}

/* ── Truth Synthesis ───────────────────────────────────── */

.truth-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.truth-item {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--app-border);
}

.truth-item--contradiction { border-left-color: var(--app-error); }
.truth-item--corroboration { border-left-color: var(--app-success); }
.truth-item--gap           { border-left-color: var(--app-warning); }

.truth-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.truth-item__label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
}

.truth-item__detail {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  line-height: 1.5;
}

.truth-item__sources {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

/* ── Credibility Bars ──────────────────────────────────── */

.credibility-item {
  display: grid;
  grid-template-columns: 120px 1fr 50px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--app-border);
}

.credibility-item:last-child { border-bottom: none; }

.credibility-item__name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credibility-item__bar {
  height: 8px;
  border-radius: 4px;
  background: var(--app-surface-2);
  overflow: hidden;
}

.credibility-item__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.credibility-item__score {
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
}

.credibility-item__factors {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--app-text-muted);
  padding-left: 0.5rem;
}

/* ── Evidence Graph ────────────────────────────────────── */

.evidence-graph-container {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  overflow: hidden;
  position: relative;
}

.evidence-graph-container svg {
  display: block;
}

.evidence-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.graph-legend__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.graph-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.graph-legend__dot--finding { background: var(--app-accent); }
.graph-legend__dot--entity  { background: var(--app-warning); }

.graph-legend__edge {
  width: 20px;
  height: 3px;
  display: inline-block;
  border-radius: 1px;
}

.graph-legend__edge--corroboration { background: #69db7c; }
.graph-legend__edge--contradiction { background: #ff6b6b; background-image: repeating-linear-gradient(90deg, #ff6b6b 0, #ff6b6b 4px, transparent 4px, transparent 7px); }
.graph-legend__edge--cross         { background: #74c0fc; }

/* ── PDF Analysis ──────────────────────────────────────── */

.pdf-entity-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--app-border);
}

.pdf-entity-group:last-child { border-bottom: none; }

.pdf-entity-group__type {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--app-accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 100px;
}

.pdf-entity-group__count {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.pdf-entity-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}

.pdf-page-tile {
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  position: relative;
}

.pdf-page-tile--blank {
  opacity: 0.4;
}

.pdf-page-tile--redacted {
  border-color: var(--app-error);
  background: #5c001120;
}

.pdf-page-tile__num {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--app-text);
}

.pdf-page-tile__section {
  display: block;
  font-size: 0.65rem;
  color: var(--app-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.2rem;
}

.pdf-page-tile__flag {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.65rem;
}

/* ── Responsive — new panels ───────────────────────────── */

@media (max-width: 768px) {
  .truth-stats { grid-template-columns: repeat(2, 1fr); }
  .credibility-item { grid-template-columns: 80px 1fr 40px; }
  .pdf-pages-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}

@media (max-width: 480px) {
  .truth-stats { grid-template-columns: 1fr; }
  .discovery-finding__header { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
}

/* ═══ LEGAL RESOURCE LIBRARY ═══════════════════════════════ */

.legal-resource-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--app-border);
}

.legal-resource-item:last-child { border-bottom: none; }

.legal-resource-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.legal-resource-item__citation {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-accent-hover);
}

.legal-resource-item__type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-text-muted);
  background: var(--app-surface-2);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
}

.legal-resource-item__title {
  font-size: 0.8rem;
  color: var(--app-text);
  margin-bottom: 0.3rem;
}

.legal-resource-item__summary {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.legal-resource-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

.legal-resource-item__link {
  font-size: 0.75rem;
  color: var(--app-accent);
  text-decoration: none;
}

.legal-resource-item__link:hover {
  text-decoration: underline;
}

/* ── Legal Standards ── */

.legal-standard-group {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--app-border);
}

.legal-standard-group:last-child { border-bottom: none; }

.legal-standard-group__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-text);
  margin: 0 0 0.5rem;
}

.legal-standard-group__tests {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.legal-standard-test {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: var(--app-surface-1);
  border-radius: var(--app-radius);
}

.legal-standard-test__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-accent-hover);
  min-width: 160px;
}

.legal-standard-test__case {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  font-style: italic;
}

/* ═══ FEEDBACK & LEARNING ══════════════════════════════════ */

.feedback-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.feedback-verdict-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.feedback-verdict-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.feedback-verdict-btn:hover {
  border-color: var(--app-accent);
  color: var(--app-text);
}

.feedback-verdict-btn--active {
  background: var(--app-accent);
  color: #fff;
  border-color: var(--app-accent);
}

.feedback-verdict-btn--active[data-verdict="accurate"] {
  background: var(--app-success);
  border-color: var(--app-success);
}

.feedback-verdict-btn--active[data-verdict="inaccurate"] {
  background: var(--app-error);
  border-color: var(--app-error);
}

.feedback-verdict-btn--active[data-verdict="partially_accurate"] {
  background: var(--app-warning);
  border-color: var(--app-warning);
  color: #1a1a2e;
}

/* ── Trend Chart ── */

.feedback-trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 150px;
  padding: 0.5rem 0;
}

.feedback-trend-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.feedback-trend-bar__fill {
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.feedback-trend-bar__label {
  font-size: 0.6rem;
  color: var(--app-text-muted);
  margin-top: 0.3rem;
  white-space: nowrap;
}

/* ── Feedback History ── */

.feedback-history-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--app-border);
}

.feedback-history-item:last-child { border-bottom: none; }

.feedback-history-item__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.feedback-history-item__finding {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-text);
}

.feedback-history-item__verdict {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.feedback-history-item__status {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
}

.feedback-history-item__status--applied {
  background: #69db7c20;
  color: var(--app-success);
}

.feedback-history-item__status--rejected {
  background: #ff6b6b20;
  color: var(--app-error);
}

.feedback-history-item__status--pending {
  background: #ffe06620;
  color: #ffe066;
}

.feedback-history-item__explanation {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  line-height: 1.4;
}

.feedback-history-item__time {
  font-size: 0.7rem;
  color: var(--app-text-muted);
  margin-top: 0.2rem;
}

/* ── Responsive — legal & feedback ── */

@media (max-width: 768px) {
  .feedback-stats { grid-template-columns: repeat(2, 1fr); }
  .legal-standard-test { flex-direction: column; gap: 0.15rem; }
  .legal-standard-test__name { min-width: 0; }
  .feedback-verdict-btns { gap: 0.3rem; }
  .feedback-trend-bars { height: 100px; }
}

@media (max-width: 480px) {
  .feedback-stats { grid-template-columns: 1fr 1fr; }
  .legal-resource-item__header { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════════
   ENHANCED DISCOVERY PANEL
   ═══════════════════════════════════════════════════════════════════ */

.discovery-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.discovery-stats .ai-stat { text-align: center; }

.discovery-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: var(--app-surface-1);
  border-radius: 8px;
}

.discovery-filter {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: var(--app-surface-0);
  color: var(--app-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.discovery-filter:hover { border-color: var(--app-accent); color: var(--app-text); }
.discovery-filter--active { background: var(--app-accent); color: #fff; border-color: var(--app-accent); }

.discovery-entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.discovery-entity-card {
  background: var(--app-surface-1);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.75rem;
  transition: border-color 0.15s;
}

.discovery-entity-card:hover { border-color: var(--app-accent); }

.discovery-entity-card__type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted);
  margin-bottom: 0.3rem;
}

.discovery-entity-card__count {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--app-accent);
  line-height: 1;
}

.discovery-entity-card__items {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.discovery-defect-card {
  background: var(--app-surface-1);
  border-left: 3px solid var(--app-error);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.discovery-defect-card--high { border-left-color: var(--app-error); }
.discovery-defect-card--critical { border-left-color: #e03131; }
.discovery-defect-card--medium { border-left-color: var(--app-warning); }
.discovery-defect-card--low { border-left-color: var(--app-success); }

.discovery-defect-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.discovery-defect-card__type {
  font-weight: 600;
  font-size: 0.85rem;
}

.discovery-defect-card__detail {
  font-size: 0.8rem;
  color: var(--app-text-muted);
}

.discovery-defect-card__rule {
  font-size: 0.72rem;
  color: var(--app-accent-hover);
  margin-top: 0.2rem;
}

.discovery-defect-card__page {
  font-size: 0.72rem;
  color: var(--app-text-muted);
  margin-top: 0.1rem;
}

/* Scene context enhancements */
.discovery-scene-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.discovery-scene-action {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--app-border);
  font-size: 0.82rem;
}

.discovery-scene-action:last-child { border-bottom: none; }

.discovery-scene-action__time {
  font-size: 0.7rem;
  color: var(--app-accent);
  white-space: nowrap;
  min-width: 42px;
}

.discovery-finding__confidence {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
}

.discovery-finding__timestamp {
  font-size: 0.72rem;

/* ── Toolbar: Saved Views + Collaboration ──────────────── */

.ai-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--app-border);
  background: var(--app-surface);
  min-height: 40px;
  gap: 1rem;
}

.ai-toolbar__left,
.ai-toolbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Saved Views Dropdown */
.saved-views-dropdown {
  position: relative;
}

.saved-views-trigger {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: var(--app-text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.saved-views-trigger:hover {
  border-color: var(--app-accent);
}

.saved-views-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 100;
  padding: 0.5rem 0;
}

.saved-views-list {
  max-height: 200px;
  overflow-y: auto;
}

.saved-view-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.1s;
}

.saved-view-item:hover {
  background: var(--app-surface-2);
}

.saved-view-item--default {
  border-left: 3px solid var(--app-accent);
}

.saved-view-item__name {
  flex: 1;
  color: var(--app-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-view-item__panel {
  font-size: 0.7rem;
  color: var(--app-text-muted);
  text-transform: uppercase;
}

.saved-view-item__actions {
  display: flex;
  gap: 0.2rem;
}

.saved-view-action {
  background: none;
  border: none;
  color: var(--app-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
}

.saved-view-action:hover {
  background: var(--app-surface-2);
  color: var(--app-accent);
}

.saved-view-action--delete:hover {
  color: var(--app-error);
}

.saved-views-save {
  display: block;
  width: calc(100% - 1rem);
  margin: 0.35rem 0.5rem 0;
  padding: 0.35rem;
  border: 1px dashed var(--app-border);
  border-radius: var(--app-radius);
  background: none;
  color: var(--app-accent);
  font-size: 0.78rem;
  cursor: pointer;
  text-align: center;
}

.saved-views-save:hover {
  border-color: var(--app-accent);
  background: rgba(99, 102, 241, 0.07);
}

/* Collaboration Presence */
.collab-presence {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.collab-presence__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--app-surface);
  display: inline-block;
  animation: collab-pulse 2s ease-in-out infinite;
}

@keyframes collab-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Annotations Toggle */
.annotations-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 0.3rem 0.6rem;
  color: var(--app-text-muted);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, color 0.15s;
}

.annotations-toggle:hover {
  border-color: var(--app-accent);
  color: var(--app-accent);
}

.annotations-toggle__count {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--app-accent);
  color: #fff;
  border-radius: 50%;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Annotations Sidebar ───────────────────────────────── */

.annotations-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: var(--app-surface);
  border-left: 1px solid var(--app-border);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.2);
  z-index: 200;
  display: flex;
  flex-direction: column;
  animation: slide-in-right 0.2s ease-out;
}

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.annotations-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
}

.annotations-sidebar__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--app-text);
}

.annotations-sidebar__close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--app-text-muted);
  cursor: pointer;
}

.annotations-sidebar__close:hover {
  color: var(--app-error);
}

.annotations-sidebar__filters {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
}

.annotations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.annotations-form {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--app-border);
  background: var(--app-surface-2);
}

/* Annotation Cards */
.annotation-card {
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s;
}

.annotation-card:hover {
  border-color: var(--app-accent);
}

.annotation-card--resolved {
  opacity: 0.6;
}

.annotation-card--flag {
  border-left: 3px solid var(--app-error);
}

.annotation-card--bookmark {
  border-left: 3px solid var(--app-accent);
}

.annotation-card--highlight {
  border-left: 3px solid var(--app-warning);
}

.annotation-card--correction {
  border-left: 3px solid var(--app-success);
}

.annotation-card__header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.annotation-card__icon {
  font-size: 0.85rem;
}

.annotation-card__type {
  font-weight: 600;
  color: var(--app-text);
  text-transform: capitalize;
}

.annotation-card__priority {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.annotation-card__time {
  font-size: 0.68rem;
  color: var(--app-text-muted);
}

.annotation-card__body {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--app-text);
  margin-bottom: 0.35rem;
}

.annotation-card__meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--app-text-muted);
}

.annotation-card__actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.35rem;
  justify-content: flex-end;
}

.annotation-action {
  background: none;
  border: 1px solid var(--app-border);
  border-radius: 3px;
  color: var(--app-text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.1rem 0.4rem;
}

.annotation-action:hover {
  background: var(--app-accent);
  color: #fff;
  border-color: var(--app-accent);
}

.annotation-action--delete:hover {
  background: var(--app-error);
  border-color: var(--app-error);
}

.annotation-card__resolved-tag {
  font-size: 0.68rem;
  color: var(--app-success);
  font-weight: 600;
}

/* ── Skeleton Loaders ──────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, var(--app-surface-2) 25%, var(--app-border) 50%, var(--app-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--app-radius);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 0.85rem;
  margin-bottom: 0.5rem;
  width: 80%;
}

.skeleton-text--short {
  width: 40%;
}

.skeleton-card {
  height: 80px;
  margin-bottom: 0.75rem;
}

/* ── Responsive: Toolbar + Sidebar ─────────────────────── */

@media (max-width: 768px) {
  .ai-toolbar {
    padding: 0.4rem 0.75rem;
    gap: 0.5rem;
  }

  .annotations-sidebar {
    width: 100%;
  }

  .saved-views-menu {
    min-width: 180px;
  }
}
  color: var(--app-text-muted);
  margin-top: 0.2rem;
}

.discovery-finding__caselaw {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.3rem;
}

/* ═══════════════════════════════════════════════════════════════════
   ENHANCED TRUTH SYNTHESIS PANEL
   ═══════════════════════════════════════════════════════════════════ */

.graph-tooltip {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--app-surface-0);
  border: 1px solid var(--app-accent);
  border-radius: 8px;
  padding: 0.75rem;
  max-width: 260px;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.graph-tooltip__title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  color: var(--app-text);
}

.graph-tooltip__body {
  font-size: 0.78rem;
  color: var(--app-text-muted);
  line-height: 1.4;
}

.graph-legend__dot--source {
  background: #74c0fc;
}

.truth-item__confidence {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--app-surface-2);
}

.truth-item__comparison {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--app-surface-0);
  border-radius: 6px;
}

.truth-item__source {
  flex: 1;
  font-size: 0.78rem;
}

.truth-item__source-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--app-text-muted);
  margin-bottom: 0.15rem;
}

.truth-item__source-text { color: var(--app-text); }
.truth-item__source--a { border-right: 1px solid var(--app-border); padding-right: 0.5rem; }
.truth-item__vs { font-weight: 700; font-size: 0.72rem; color: var(--app-error); }

.truth-item__legal {
  font-size: 0.75rem;
  color: var(--app-accent-hover);
  margin-top: 0.35rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--app-border);
}

.truth-item__expected {
  font-size: 0.78rem;
  margin-top: 0.25rem;
  color: var(--app-text-muted);
}

.truth-item__confidence-bar {
  margin-top: 0.35rem;
}

.truth-narrative {
  background: var(--app-surface-1);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1rem;
}

.truth-narrative__text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--app-text);
  white-space: pre-wrap;
}

.ai-card__badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 11px;
  background: var(--app-accent);
  color: #fff;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════════
   ENHANCED PDF ANALYSIS PANEL
   ═══════════════════════════════════════════════════════════════════ */

.pdf-quality-meter {
  height: 10px;
  background: var(--app-surface-2);
  border-radius: 5px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.pdf-quality-meter__fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.pdf-quality-factor {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--app-border);
}

.pdf-quality-factor:last-child { border-bottom: none; }
.pdf-quality-factor__name { color: var(--app-text-muted); }
.pdf-quality-factor__score { font-weight: 700; }

.pdf-classification__row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--app-border);
}

.pdf-classification__row:last-child { border-bottom: none; }
.pdf-classification__label { color: var(--app-text-muted); }
.pdf-classification__value { font-weight: 600; color: var(--app-text); }

.pdf-page-legend {
  display: flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--app-text-muted);
  margin-bottom: 0.5rem;
}

.pdf-page-detail {
  position: relative;
  background: var(--app-surface-0);
  border: 1px solid var(--app-accent);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pdf-page-detail__grid {
  display: grid;
  gap: 0.3rem;
}

.pdf-page-detail__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--app-border);
}

.pdf-page-detail__row:last-child { border-bottom: none; }
.pdf-page-detail__row span:first-child { color: var(--app-text-muted); }
.pdf-page-detail__row span:last-child { font-weight: 600; }

.pdf-bates-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0.5rem 0;
}

.pdf-bates-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--app-success);
  color: #fff;
  border-radius: 3px;
}

.pdf-bates-segment--gap {
  background: var(--app-error);
}

.pdf-defect-matrix {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.pdf-redaction-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--app-border);
  font-size: 0.82rem;
}

.pdf-redaction-item:last-child { border-bottom: none; }

.pdf-redaction-item__page {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--app-accent);
  min-width: 56px;
}

.pdf-redaction-item__area { flex: 1; color: var(--app-text); }

.pdf-redaction-item__reason {
  font-size: 0.72rem;
  color: var(--app-text-muted);
}

.pdf-entity-group__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

/* ── Responsive overrides for enhanced panels ── */

@media (max-width: 640px) {
  .discovery-stats { grid-template-columns: repeat(2, 1fr); }
  .discovery-entity-grid { grid-template-columns: 1fr; }
  .truth-item__comparison { flex-direction: column; }
  .truth-item__source--a { border-right: none; border-bottom: 1px solid var(--app-border); padding-right: 0; padding-bottom: 0.4rem; }
  .pdf-classification__row { font-size: 0.75rem; }
  .pdf-page-detail { padding: 0.75rem; }
}

@media (max-width: 480px) {
  .discovery-stats { grid-template-columns: 1fr 1fr; }
  .discovery-filters { flex-direction: column; }
  .graph-tooltip { max-width: 180px; }
}

/* ═══════════════════════════════════════════════════════════════
   PRACTICE MANAGEMENT — Shared Components
   ═══════════════════════════════════════════════════════════════ */

.ai-nav__divider {
  display: block;
  padding: 0.75rem 0.8rem 0.25rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-text-muted);
  opacity: 0.7;
}

/* Toolbar row */
.pm-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.pm-toolbar select,
.pm-toolbar input[type="text"],
.pm-toolbar input[type="search"] {
  height: 2rem;
  font-size: 0.8rem;
  padding: 0 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
  background: var(--app-surface);
  color: var(--app-text);
}

.pm-toolbar input[type="search"] { flex: 1; min-width: 140px; }

/* Stats row */
.pm-stats {
  display: flex;
  gap: 0.75rem;
  padding: 0.4rem 0;
  flex-wrap: wrap;
}

.pm-stats span {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.pm-stats strong {
  color: var(--app-text);
  margin-left: 0.25rem;
}

/* List items */
.pm-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--app-border);
  cursor: pointer;
  transition: background 0.15s;
}

.pm-list-item:hover { background: var(--app-surface); }

.pm-list-item__main { flex: 1; min-width: 0; }

.pm-list-item__name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--app-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-list-item__meta {
  display: block;
  font-size: 0.72rem;
  color: var(--app-text-muted);
  margin-top: 0.1rem;
}

.pm-list-item__right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.pm-list-item__type {
  font-size: 0.65rem;
  color: var(--app-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Badges */
.pm-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: capitalize;
}

.pm-badge--active, .pm-badge--normal, .pm-badge--paid { background: rgba(34,197,94,0.15); color: #22c55e; }
.pm-badge--prospect, .pm-badge--low { background: rgba(59,130,246,0.15); color: #3b82f6; }
.pm-badge--inactive, .pm-badge--draft { background: rgba(107,114,128,0.15); color: #6b7280; }
.pm-badge--archived, .pm-badge--cancelled { background: rgba(107,114,128,0.1); color: #9ca3af; }
.pm-badge--high, .pm-badge--overdue, .pm-badge--void { background: rgba(239,68,68,0.15); color: #ef4444; }
.pm-badge--urgent, .pm-badge--critical { background: rgba(239,68,68,0.25); color: #dc2626; }
.pm-badge--sent, .pm-badge--pending { background: rgba(234,179,8,0.15); color: #eab308; }
.pm-badge--billed, .pm-badge--partial { background: rgba(139,92,246,0.15); color: #8b5cf6; }

/* Detail drawer */
.pm-drawer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 90vw;
  background: var(--app-bg);
  border-left: 2px solid var(--app-border);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.pm-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--app-border);
}

.pm-drawer__header h3 {
  font-size: 0.95rem;
  margin: 0;
}

.pm-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

.pm-detail__section {
  margin-bottom: 1rem;
}

.pm-detail__section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted);
  margin: 0 0 0.3rem;
}

.pm-detail__section p {
  font-size: 0.82rem;
  margin: 0.15rem 0;
  line-height: 1.5;
}

/* Form overlay */
.pm-form-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-form {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1.25rem;
  width: 400px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.pm-form h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.pm-form label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--app-text-muted);
  margin-bottom: 0.2rem;
}

.pm-form input,
.pm-form select,
.pm-form textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.82rem;
  margin-bottom: 0.6rem;
}

.pm-form textarea { min-height: 3rem; resize: vertical; }

.pm-form__row { margin-bottom: 0.1rem; }

.pm-form__row--2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.pm-form__row--3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }

.pm-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Alert bar */
.pm-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.pm-alert--danger {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════════════════════════ */

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.calendar-nav button {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  color: var(--app-text);
  cursor: pointer;
  font-size: 0.8rem;
}

.calendar-nav button:hover { background: var(--app-border); }

#calendar-current-month {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 160px;
  text-align: center;
}

.calendar-grid__header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--app-text-muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--app-border);
}

.calendar-grid__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.calendar-day {
  min-height: 52px;
  padding: 0.25rem;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--app-border);
  position: relative;
}

.calendar-day:hover { background: var(--app-surface); }

.calendar-day--today {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.3);
}

.calendar-day--empty { opacity: 0.3; }

.calendar-day__number {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--app-text-muted);
}

.calendar-day--today .calendar-day__number { color: #3b82f6; }

.calendar-day__events {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 2px;
}

.calendar-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.calendar-upcoming-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--app-border);
}

.calendar-upcoming-item__color {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}

.calendar-upcoming-item__info { flex: 1; min-width: 0; }

.calendar-upcoming-item__title {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-upcoming-item__meta {
  font-size: 0.7rem;
  color: var(--app-text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   KANBAN BOARD
   ═══════════════════════════════════════════════════════════════ */

.kanban-board {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  min-height: 300px;
}

.kanban-column {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.kanban-column__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--app-border);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-text-muted);
}

.kanban-column__count {
  background: var(--app-border);
  color: var(--app-text);
  border-radius: 10px;
  padding: 0.05rem 0.4rem;
  font-size: 0.65rem;
}

.kanban-column__cards {
  flex: 1;
  padding: 0.4rem;
  overflow-y: auto;
  min-height: 80px;
}

.kanban-card {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 5px;
  padding: 0.5rem;
  margin-bottom: 0.35rem;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.1s;
}

.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.kanban-card:active { cursor: grabbing; transform: scale(0.98); }

.kanban-card--urgent, .kanban-card--critical { border-left: 3px solid #ef4444; }
.kanban-card--high { border-left: 3px solid #f59e0b; }

.kanban-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.3rem;
}

.kanban-card__title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.kanban-card__meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.65rem;
  color: var(--app-text-muted);
  margin-top: 0.25rem;
}

.kanban-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.kanban-tag {
  font-size: 0.6rem;
  padding: 0.05rem 0.35rem;
  border-radius: 8px;
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
}

.kanban-empty {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  text-align: center;
  padding: 1rem 0.5rem;
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════════
   BILLING
   ═══════════════════════════════════════════════════════════════ */

.billing-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--app-border);
  margin-bottom: 0.5rem;
}

.billing-tab {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.billing-tab:hover { color: var(--app-text); }

.billing-tab--active {
  color: var(--app-accent, #3b82f6);
  border-bottom-color: var(--app-accent, #3b82f6);
}

.billing-tab-content { padding-top: 0.5rem; }

.trust-balance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timer-display {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--app-accent, #3b82f6);
  padding: 0.25rem 0.5rem;
  background: var(--app-surface);
  border-radius: 4px;
  border: 1px solid var(--app-border);
}

/* Buttons */
.search-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  cursor: pointer;
}

.search-btn--icon:hover { background: var(--app-border); }

.search-btn--outline {
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--app-border);
  background: transparent;
  color: var(--app-text);
  font-size: 0.78rem;
  cursor: pointer;
}

.search-btn--outline:hover { background: var(--app-surface); }

/* ═══════════════════════════════════════════════════════════════
   PRACTICE MANAGEMENT — Responsive
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .kanban-board { flex-direction: column; }
  .kanban-column { max-width: none; }
  .pm-form__row--2col,
  .pm-form__row--3col { grid-template-columns: 1fr; }
  .pm-drawer { width: 100%; }
  .pm-form { width: 95vw; }
  .calendar-grid__days { font-size: 0.65rem; }
  .calendar-day { min-height: 36px; }
  .billing-tabs { overflow-x: auto; }
  .billing-tab { white-space: nowrap; padding: 0.4rem 0.6rem; font-size: 0.72rem; }
  .pm-stats { gap: 0.4rem; }
}

/* ═══════════════════════════════════════════════════════════════
   DOCUMENT GENERATION
   ═══════════════════════════════════════════════════════════════ */

.doc-variables-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--app-border);
}

/* ═══════════════════════════════════════════════════════════════
   REPORTS & ANALYTICS
   ═══════════════════════════════════════════════════════════════ */

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.report-kpi-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.2s;
}

.report-kpi-card:hover { border-color: var(--app-primary); }

.report-kpi-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--app-text-muted);
  margin-bottom: 0.35rem;
}

.report-kpi-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--app-text);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.report-stat {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
}

.report-stat label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--app-text-muted);
  margin-bottom: 0.25rem;
}

.report-stat span {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--app-text);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.report-table th,
.report-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--app-border);
}

.report-table th {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--app-text-muted);
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.activity-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.4rem;
  flex-shrink: 0;
  background: var(--app-text-muted);
}

.activity-icon--filing { background: #ef4444; }
.activity-icon--document_generated { background: #3b82f6; }
.activity-icon--payment_received { background: #22c55e; }
.activity-icon--deadline_passed { background: #f59e0b; }
.activity-icon--note { background: #8b5cf6; }
.activity-icon--status_change { background: #06b6d4; }

@media (max-width: 768px) {
  .report-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: repeat(2, 1fr); }
  .report-table { font-size: 0.72rem; }
  .report-table th, .report-table td { padding: 0.35rem 0.5rem; }
}
