/* ═══════════════════════════════════════════════════════════════
   RAVEN AI FUSION — Triage Inbox styles (E1)
   frontend/css/triage_inbox.css  ?v=20260611p1

   Phase 3 — PRD Epic E1. Styles for the TriageInbox PanelShell panel.

   Conventions (CLAUDE.md + tokens.css):
   - All font sizes >= --rv-fs-xs (0.78rem / ~11px floor — F-19).
   - No hardcoded z-indexes — the panel itself is positioned by PanelShell;
     any in-panel layering references --rv-z-* tokens.
   - Animations use transform / opacity only (GPU-composited).
   - Military dark theme — consumes tokens.css custom properties with
     sane fallbacks so the panel renders even before tokens.css loads.
   ═══════════════════════════════════════════════════════════════ */

/* ── Panel shell ───────────────────────────────────────────────── */

.rv-triage-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-size: var(--rv-fs-sm, 0.85rem);
  color: var(--rv-color-text-primary, #d4dde6);
}

/* ── Toolbar ───────────────────────────────────────────────────── */

.rv-triage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rv-space-2, 8px);
  padding: var(--rv-space-2, 8px) var(--rv-space-3, 12px);
  border-bottom: 1px solid var(--rv-color-border, rgba(120, 160, 200, 0.18));
  background: var(--rv-color-bg-card, rgba(16, 24, 34, 0.7));
  flex: 0 0 auto;
}

.rv-triage-summary {
  font-size: var(--rv-fs-xs, 0.78rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--rv-color-text-muted, #8aa0b4);
  font-weight: 600;
}

.rv-triage-toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--rv-space-2, 8px);
}

.rv-triage-toggle,
.rv-triage-markall {
  font-family: inherit;
  font-size: var(--rv-fs-xs, 0.78rem);
  padding: 4px 10px;
  border-radius: var(--rv-r-base, 4px);
  border: 1px solid var(--rv-color-border, rgba(120, 160, 200, 0.25));
  background: var(--rv-color-bg-panel, rgba(24, 34, 46, 0.6));
  color: var(--rv-color-text-primary, #d4dde6);
  cursor: pointer;
  transition: background var(--rv-dur-fast, 120ms) ease,
              border-color var(--rv-dur-fast, 120ms) ease,
              opacity var(--rv-dur-fast, 120ms) ease;
  white-space: nowrap;
}

.rv-triage-toggle:hover,
.rv-triage-markall:hover {
  background: var(--rv-color-bg-card-hover, rgba(40, 56, 74, 0.8));
  border-color: var(--rv-color-accent, #3fa7ff);
}

.rv-triage-toggle:focus-visible,
.rv-triage-markall:focus-visible {
  outline: 2px solid var(--rv-color-accent, #3fa7ff);
  outline-offset: 1px;
}

.rv-triage-toggle--on {
  background: var(--rv-color-accent-dim, rgba(63, 167, 255, 0.18));
  border-color: var(--rv-color-accent, #3fa7ff);
  color: var(--rv-color-accent, #3fa7ff);
}

.rv-triage-markall:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Body / list ───────────────────────────────────────────────── */

.rv-triage-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--rv-space-2, 8px);
  display: flex;
  flex-direction: column;
  gap: var(--rv-space-2, 8px);
}

/* ── Item ──────────────────────────────────────────────────────── */

.rv-triage-item {
  border: 1px solid var(--rv-color-border, rgba(120, 160, 200, 0.16));
  border-radius: var(--rv-r-md, 6px);
  background: var(--rv-color-bg-panel, rgba(22, 31, 42, 0.55));
  overflow: hidden;
  transition: border-color var(--rv-dur-fast, 120ms) ease,
              transform var(--rv-dur-fast, 120ms) ease;
}

.rv-triage-item--unread {
  border-left: 3px solid var(--rv-color-variant-warn, #f0a93c);
  background: var(--rv-color-bg-card, rgba(28, 38, 50, 0.7));
}

.rv-triage-item--expanded {
  border-color: var(--rv-color-accent, #3fa7ff);
}

.rv-triage-item__header {
  display: flex;
  align-items: flex-start;
  gap: var(--rv-space-2, 8px);
  width: 100%;
  padding: var(--rv-space-2, 8px) var(--rv-space-3, 12px);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}

.rv-triage-item__header:hover {
  background: var(--rv-color-bg-card-hover, rgba(40, 56, 74, 0.45));
}

.rv-triage-item__header:focus-visible {
  outline: 2px solid var(--rv-color-accent, #3fa7ff);
  outline-offset: -2px;
}

.rv-triage-item__icon {
  font-size: var(--rv-fs-md, 0.95rem);
  line-height: 1.2;
  flex: 0 0 auto;
  margin-top: 1px;
}

.rv-triage-item__main {
  flex: 1 1 auto;
  min-width: 0;
}

.rv-triage-item__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rv-space-2, 8px);
}

.rv-triage-item__title {
  font-size: var(--rv-fs-sm, 0.85rem);
  font-weight: 600;
  color: var(--rv-color-text-primary, #e3ebf2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-triage-item--unread .rv-triage-item__title {
  color: var(--text, #ffffff);
}

.rv-triage-item__sub {
  display: flex;
  align-items: center;
  gap: var(--rv-space-2, 8px);
  margin-top: 2px;
}

.rv-triage-item__kind,
.rv-triage-item__time {
  font-size: var(--rv-fs-xs, 0.78rem);
  color: var(--rv-color-text-muted, #8497a8);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.rv-triage-item__time {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
}

.rv-triage-item__chevron {
  flex: 0 0 auto;
  font-size: var(--rv-fs-xs, 0.78rem);
  color: var(--rv-color-text-muted, #8497a8);
  margin-top: 2px;
}

/* ── Confidence chip ──────────────────────────────────────────── */
/* Shape + label carry meaning (not color-only) — a11y 1.4.1 friendly. */

.rv-triage-conf {
  flex: 0 0 auto;
  font-size: var(--rv-fs-xs, 0.78rem);
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--rv-r-full, 999px);
  border: 1px solid currentColor;
  line-height: 1.4;
}

.rv-triage-conf--high { color: var(--rv-color-variant-danger, #ff5d5d); }
.rv-triage-conf--med  { color: var(--rv-color-variant-warn, #f0a93c); }
.rv-triage-conf--low  { color: var(--rv-color-green, #4fd08a); }
.rv-triage-conf--na {
  color: var(--rv-color-text-muted, #8497a8);
  border-style: dashed;
}

/* ── Detail (drivers + links) ─────────────────────────────────── */

.rv-triage-detail {
  padding: var(--rv-space-2, 8px) var(--rv-space-3, 12px) var(--rv-space-3, 12px);
  border-top: 1px dashed var(--rv-color-border, rgba(120, 160, 200, 0.2));
  background: var(--rv-color-bg-secondary, rgba(12, 18, 26, 0.6));
  animation: rv-triage-expand var(--rv-dur-normal, 220ms) ease;
}

@keyframes rv-triage-expand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rv-triage-drivers {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rv-triage-driver {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--rv-space-2, 8px);
  padding: 3px 0;
  border-bottom: 1px solid var(--rv-color-border, rgba(120, 160, 200, 0.08));
}

.rv-triage-driver:last-child { border-bottom: 0; }

.rv-triage-driver__label {
  font-size: var(--rv-fs-xs, 0.78rem);
  color: var(--rv-color-text-muted, #8aa0b4);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.rv-triage-driver__value {
  font-size: var(--rv-fs-sm, 0.85rem);
  color: var(--rv-color-text-primary, #e3ebf2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rv-triage-drivers__empty {
  font-size: var(--rv-fs-xs, 0.78rem);
  color: var(--rv-color-text-muted, #8497a8);
  font-style: italic;
  padding: 4px 0;
}

.rv-triage-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rv-space-2, 8px);
  margin-top: var(--rv-space-2, 8px);
}

.rv-triage-link-btn {
  font-family: inherit;
  font-size: var(--rv-fs-xs, 0.78rem);
  padding: 4px 10px;
  border-radius: var(--rv-r-base, 4px);
  border: 1px solid var(--rv-color-accent, #3fa7ff);
  background: var(--rv-color-accent-dim, rgba(63, 167, 255, 0.12));
  color: var(--rv-color-accent, #3fa7ff);
  cursor: pointer;
  transition: background var(--rv-dur-fast, 120ms) ease;
}

.rv-triage-link-btn:hover {
  background: var(--rv-color-accent, #3fa7ff);
  color: var(--rv-color-bg-root, #0b1118);
}

.rv-triage-link-btn:focus-visible {
  outline: 2px solid var(--rv-color-accent, #3fa7ff);
  outline-offset: 1px;
}

/* ── Loading state ────────────────────────────────────────────── */

.rv-triage-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--rv-space-5, 32px) var(--rv-space-3, 12px);
  font-size: var(--rv-fs-xs, 0.78rem);
  letter-spacing: 0.08em;
  color: var(--rv-color-text-muted, #8497a8);
}

.rv-triage-loading__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rv-color-accent, #3fa7ff);
  opacity: 0.4;
  animation: rv-triage-pulse 1s infinite ease-in-out;
}
.rv-triage-loading__dot:nth-child(2) { animation-delay: 0.15s; }
.rv-triage-loading__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes rv-triage-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* ── Error state ──────────────────────────────────────────────── */

.rv-triage-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rv-space-2, 8px);
  padding: var(--rv-space-5, 32px) var(--rv-space-3, 12px);
  text-align: center;
}

.rv-triage-error__msg {
  font-size: var(--rv-fs-sm, 0.85rem);
  color: var(--rv-color-variant-danger, #ff5d5d);
}

.rv-triage-error__retry {
  font-family: inherit;
  font-size: var(--rv-fs-xs, 0.78rem);
  padding: 5px 16px;
  border-radius: var(--rv-r-base, 4px);
  border: 1px solid var(--rv-color-variant-danger, #ff5d5d);
  background: transparent;
  color: var(--rv-color-variant-danger, #ff5d5d);
  cursor: pointer;
  letter-spacing: 0.08em;
}

.rv-triage-error__retry:hover {
  background: var(--rv-color-variant-danger, #ff5d5d);
  color: var(--rv-color-bg-root, #0b1118);
}

/* ── Empty-state holder (reuses .rv-empty-state* from onboarding) ─ */

.rv-triage-empty-holder {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: var(--rv-space-4, 24px) var(--rv-space-3, 12px);
}

/* ── Topbar badge unread accent (F-14) ────────────────────────── */
/* The base #alert-badge styles live in style.css; this only adds the
   unread emphasis used by the triage wiring without rewriting style.css. */

#alert-badge.rv-triage-badge--unread {
  font-weight: 700;
  animation: rv-triage-badge-in var(--rv-dur-normal, 220ms) ease;
}

@keyframes rv-triage-badge-in {
  from { transform: scale(0.85); opacity: 0.6; }
  to   { transform: scale(1); opacity: 1; }
}
