/* Reports — Investigation Report V1 screen.
   NightOps tokens from the approved Case Indicators prototype
   (docs/analytics-v2/FRONTEND-ENGINEERING-HANDOFF.md §6) and Metallic
   Color Contract V1, scoped to .reports-v1 (not promoted to tokens.css).
   Metallic colour follows its metric only: Burnished Copper marks the
   "resolved" lifecycle state. Knowledge classes (observed / model /
   operator) are carried by marker shape and label, never colour alone.
   DayOps values are contrast-adjusted twins; TODO: founder review. */

.reports-v1 {
  --rv-page: #060908;
  --rv-card: #0c1110;
  --rv-card-2: #101716;
  --rv-fg: #e7efeb;
  --rv-fg-2: rgba(231, 239, 235, 0.72);
  --rv-fg-3: rgba(231, 239, 235, 0.5);
  --rv-line: rgba(231, 239, 235, 0.09);
  --rv-line-2: rgba(231, 239, 235, 0.16);
  --rv-accent: #5cff9d;
  --rv-warn: #d8bb73;
  --rv-danger: #ff9f7a;
  --rv-metric-resolved: #d58f70;
  --rv-silver: #b4c0c1;
  --rv-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --rv-radius: 16px;

  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: var(--content-max, 1480px);
  margin: 0 auto;
  padding: 8px 0 40px;
  color: var(--rv-fg);
  font-family: "IBM Plex Sans", Inter, sans-serif;
}

body[data-theme="daylight"] .reports-v1 {
  --rv-page: #f4f6f5;
  --rv-card: #ffffff;
  --rv-card-2: #f2f5f4;
  --rv-fg: #142019;
  --rv-fg-2: rgba(20, 32, 25, 0.74);
  --rv-fg-3: rgba(20, 32, 25, 0.56);
  --rv-line: rgba(20, 32, 25, 0.1);
  --rv-line-2: rgba(20, 32, 25, 0.18);
  --rv-accent: #137a45;
  --rv-warn: #8a6a1c;
  --rv-danger: #a8462a;
  --rv-metric-resolved: #9c5638;
  --rv-silver: #5d6a6b;
}

.reports-v1__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.reports-v1__eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rv-fg-3);
}

.reports-v1__title {
  margin: 4px 0 6px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}

.reports-v1__lede {
  margin: 0;
  max-width: 62ch;
  color: var(--rv-fg-2);
  font-size: 14px;
}

.reports-v1__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.reports-v1__label {
  font-size: 12px;
  color: var(--rv-fg-3);
}

.reports-v1__select,
.reports-v1__button {
  min-height: 36px;
  border: 1px solid var(--rv-line-2);
  border-radius: 10px;
  background: var(--rv-card);
  color: var(--rv-fg);
  font: inherit;
  font-size: 13px;
  padding: 0 12px;
}

.reports-v1__select {
  max-width: min(420px, 100%);
}

.reports-v1__button {
  cursor: pointer;
  transition: border-color 140ms var(--rv-ease-out);
}

.reports-v1__button:hover:not(:disabled),
.reports-v1__select:hover {
  border-color: var(--rv-accent);
}

.reports-v1__button:disabled {
  opacity: 0.4;
  cursor: default;
}

.reports-v1__button:focus-visible,
.reports-v1__select:focus-visible {
  outline: 2px solid var(--rv-accent);
  outline-offset: 2px;
}

.reports-v1__button--preview {
  border-style: dashed;
  color: var(--rv-warn);
}

.reports-v1__state {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px;
  border: 1px solid var(--rv-line);
  border-radius: var(--rv-radius);
  background: var(--rv-card);
}

.reports-v1__state span {
  color: var(--rv-fg-2);
  font-size: 14px;
}

.reports-v1__state--warn {
  border-left: 3px solid var(--rv-warn);
}

.reports-v1__state--danger {
  border-left: 3px solid var(--rv-danger);
}

.reports-v1__report {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reports-v1__report--preview {
  outline: 1px dashed var(--rv-warn);
  outline-offset: 8px;
  border-radius: var(--rv-radius);
}

.reports-v1__source {
  margin: 0;
  font-size: 12px;
  color: var(--rv-fg-3);
}

.reports-v1__source--preview {
  padding: 10px 14px;
  border: 1px dashed var(--rv-warn);
  border-radius: 10px;
  color: var(--rv-warn);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.reports-v1__overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 20px;
  padding: 20px 24px;
  border: 1px solid var(--rv-line);
  border-radius: var(--rv-radius);
  background: var(--rv-card);
}

.reports-v1__case {
  margin: 8px 0 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.reports-v1__meta {
  margin: 0;
  font-size: 12px;
  color: var(--rv-fg-3);
  overflow-wrap: anywhere;
}

.reports-v1__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--rv-line-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.reports-v1__pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}

.reports-v1__pill--open {
  color: var(--rv-silver);
}

.reports-v1__pill--resolved {
  color: var(--rv-metric-resolved);
  background: color-mix(in srgb, var(--rv-metric-resolved) 12%, transparent);
}

.reports-v1__pill--resolved::before {
  background: currentColor;
  transform: rotate(45deg);
  border-radius: 1px;
}

.reports-v1__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 20px;
  margin: 0;
}

.reports-v1__facts--stacked {
  grid-template-columns: 1fr;
}

.reports-v1__facts dt {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rv-fg-3);
}

.reports-v1__facts dd {
  margin: 4px 0 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.reports-v1__facts small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--rv-fg-3);
}

.reports-v1__grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.reports-v1__column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.reports-v1__card {
  min-width: 0;
  padding: 20px 24px;
  border: 1px solid var(--rv-line);
  border-radius: var(--rv-radius);
  background: var(--rv-card);
}

.reports-v1__card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.reports-v1__card-header p {
  margin: 4px 0 16px;
  font-size: 12px;
  color: var(--rv-fg-3);
}

.reports-v1__subhead {
  margin: 20px 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rv-fg-2);
}

.reports-v1__empty {
  margin: 0;
  font-size: 13px;
  color: var(--rv-fg-3);
}

.reports-v1__ref {
  display: inline-block;
  margin-top: 6px;
  padding: 1px 6px;
  border: 1px solid var(--rv-line);
  border-radius: 6px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--rv-fg-3);
  overflow-wrap: anywhere;
}

.reports-v1__refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Timeline */

.reports-v1__timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.reports-v1__timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--rv-line-2);
}

.reports-v1__event {
  position: relative;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 14px;
  padding: 0 0 16px;
}

.reports-v1__marker {
  position: relative;
  margin-top: 4px;
  width: 11px;
  height: 11px;
  background: var(--rv-card);
  border: 1.5px solid var(--rv-silver);
}

.reports-v1__event--observed .reports-v1__marker {
  border-radius: 50%;
}

.reports-v1__event--model .reports-v1__marker {
  transform: rotate(45deg) scale(0.9);
  border-color: var(--rv-fg-2);
  border-style: dashed;
}

.reports-v1__event--operator .reports-v1__marker {
  border-radius: 2px;
  background: var(--rv-fg-2);
  border-color: var(--rv-fg-2);
}

.reports-v1__event-head,
.reports-v1__action-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}

.reports-v1__event-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--rv-fg-2);
}

.reports-v1__event--model .reports-v1__event-label {
  font-style: italic;
}

.reports-v1__event time,
.reports-v1__action-head time {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--rv-fg-3);
}

.reports-v1__event p {
  margin: 4px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Model hypotheses */

.reports-v1__hypothesis {
  padding: 12px 14px;
  border: 1px dashed var(--rv-line-2);
  border-radius: 12px;
  background: var(--rv-card-2);
}

.reports-v1__hypothesis + .reports-v1__hypothesis {
  margin-top: 10px;
}

.reports-v1__hypothesis header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 13px;
}

.reports-v1__hypothesis header span {
  font-size: 11px;
  color: var(--rv-fg-3);
}

.reports-v1__hypothesis dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 14px;
  margin: 10px 0 0;
}

.reports-v1__hypothesis dt {
  font-size: 11px;
  color: var(--rv-fg-3);
}

.reports-v1__hypothesis dd {
  margin: 2px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Actions, judgments, uncertainties, unknowns, evidence */

.reports-v1__actions,
.reports-v1__judgments,
.reports-v1__uncertainties,
.reports-v1__unknowns,
.reports-v1__evidence {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reports-v1__actions li,
.reports-v1__judgments li,
.reports-v1__uncertainties li,
.reports-v1__unknowns li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--rv-line);
  font-size: 13px;
}

.reports-v1__actions li:first-child,
.reports-v1__judgments li:first-child,
.reports-v1__uncertainties li:first-child,
.reports-v1__unknowns li:first-child {
  border-top: 0;
  padding-top: 0;
}

.reports-v1__actions span,
.reports-v1__judgments span,
.reports-v1__uncertainties span,
.reports-v1__unknowns span {
  color: var(--rv-fg-2);
  overflow-wrap: anywhere;
}

.reports-v1__judgments q {
  overflow-wrap: anywhere;
}

.reports-v1__unknowns strong::before {
  content: "? ";
  color: var(--rv-warn);
}

.reports-v1__evidence {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.reports-v1__evidence-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--rv-line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--rv-fg-2);
}

.reports-v1__evidence-item .reports-v1__ref {
  margin-top: 0;
  align-self: flex-start;
}

.reports-v1__evidence-item--partial {
  border-style: dashed;
  border-color: var(--rv-warn);
}

.reports-v1__evidence-item--unavailable {
  opacity: 0.7;
  border-style: dotted;
}

@media (max-width: 1100px) {
  .reports-v1__grid,
  .reports-v1__overview {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .reports-v1__title {
    font-size: 24px;
  }

  .reports-v1__card,
  .reports-v1__overview,
  .reports-v1__state {
    padding: 16px;
  }

  .reports-v1__controls,
  .reports-v1__select {
    width: 100%;
  }

  .reports-v1__select {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reports-v1__button {
    transition: none;
  }
}

/* Workspace report (Reports V2). Same tokens as the case report, so
   NightOps and DayOps follow body[data-theme]. Numbers are tabular and
   right-aligned; state is carried by words, never colour alone. */
.reports-v1__section-title {
  margin: 8px 0 -6px;
  font-size: 18px;
  font-weight: 600;
  scroll-margin-top: 24px;
}

.reports-ws {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reports-ws__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.reports-ws__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.reports-ws__lede {
  margin: 4px 0 0;
  max-width: 62ch;
  font-size: 13px;
  color: var(--rv-fg-2);
}

.reports-ws__range,
.reports-ws__downloads,
.reports-ws__csv,
.reports-ws__filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.reports-ws .reports-v1__select {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

.reports-ws__tz {
  font-size: 12px;
  color: var(--rv-fg-3);
}

.reports-ws__tz strong {
  color: var(--rv-fg-2);
  font-weight: 600;
}

.reports-ws__downloads {
  padding: 12px 14px;
  border: 1px solid var(--rv-line);
  border-radius: 12px;
  background: var(--rv-card-2);
}

.reports-ws__downloads-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rv-fg-3);
}

.reports-ws__csv {
  margin-left: auto;
}

.reports-ws__primary {
  border-color: var(--rv-accent);
}

.reports-ws__status {
  flex: 1 1 100%;
  margin: 0;
  font-size: 13px;
  color: var(--rv-fg-2);
}

.reports-ws__status:empty {
  display: none;
}

.reports-ws__status--error,
.reports-ws__error {
  color: var(--rv-danger);
}

.reports-ws__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--rv-line);
}

.reports-ws__tab {
  margin-bottom: -1px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--rv-fg-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.reports-ws__tab:hover {
  color: var(--rv-fg);
}

.reports-ws__tab[aria-selected="true"] {
  border-bottom-color: var(--rv-accent);
  color: var(--rv-fg);
}

/* The app-wide DayOps button owner (operator-workstation.css
   `body[data-theme="daylight"] button`, all !important) would paint each
   tab as a porcelain chip; tabs stay underlined text in both themes. */
body[data-theme="daylight"] .reports-ws .reports-ws__tab {
  background: none !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 500 !important;
}

body[data-theme="daylight"] .reports-ws .reports-ws__tab[aria-selected="true"] {
  border-bottom-color: var(--rv-accent) !important;
  font-weight: 600 !important;
}

.reports-ws__tab:focus-visible {
  outline: 2px solid var(--rv-accent);
  outline-offset: 2px;
}

.reports-ws__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.reports-ws__scope {
  margin: 0;
  font-size: 12px;
  color: var(--rv-fg-3);
}

.reports-ws__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.reports-ws__kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--rv-line);
  border-radius: 12px;
  background: var(--rv-card-2);
}

.reports-ws__kpi-label {
  font-size: 12px;
  color: var(--rv-fg-2);
}

.reports-ws__kpi-value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.reports-ws__kpi-note {
  font-size: 11px;
  color: var(--rv-fg-3);
}

.reports-ws__note {
  margin: 0;
  font-size: 12px;
  color: var(--rv-fg-3);
}

.reports-ws__coverage {
  padding: 10px 14px;
  border: 1px solid var(--rv-warn);
  border-radius: 10px;
  font-size: 12px;
  color: var(--rv-fg-2);
}

.reports-ws__coverage strong {
  color: var(--rv-warn);
}

.reports-ws__coverage ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.reports-ws__scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--rv-line);
  border-radius: 10px;
}

.reports-ws__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.reports-ws__table th,
.reports-ws__table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--rv-line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.reports-ws__table thead th {
  position: sticky;
  top: 0;
  background: var(--rv-card-2);
  color: var(--rv-fg-2);
  font-weight: 600;
}

.reports-ws__table tbody th {
  font-weight: 500;
}

.reports-ws__table tbody tr:last-child > * {
  border-bottom: 0;
}

.reports-ws__table .num {
  text-align: right;
}

.reports-ws__table .mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11.5px;
}

.reports-ws__muted {
  color: var(--rv-fg-3);
  white-space: normal !important;
  min-width: 160px;
}

.reports-ws__title-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reports-ws__bar-cell {
  width: 90px;
  padding-left: 0 !important;
}

.reports-ws__bar {
  display: block;
  height: 8px;
  min-width: 1px;
  border-radius: 4px;
  background: var(--rv-silver);
  opacity: 0.6;
}

.reports-ws__tag {
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--rv-warn);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--rv-warn);
}

.reports-ws__state--resolved {
  color: var(--rv-metric-resolved);
  font-weight: 600;
}

.reports-ws__link {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.reports-ws__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 640px) {
  .reports-ws__csv {
    margin-left: 0;
  }

  .reports-ws .reports-v1__select {
    flex: 1 1 100%;
    width: 100%;
  }

  .reports-ws__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reports-ws__kpi-value {
    font-size: 18px;
  }
}
