/*
 * View styles — Investigator preview.
 * Scoped under .v-investigations. Matches the Investigator artboard; the
 * inv-* rules further down style the live-mode DOM built by console-live.js.
 */

.v-investigations .view-main,
.v-investigations .lv-main {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.v-investigations .page-header {
  margin-bottom: 0;
}

.v-investigations .page-header__sub {
  max-width: 720px;
  color: var(--text-1);
  line-height: 1.55;
}

.v-investigations__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.v-investigations__badge {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: var(--r-1);
  background: var(--sand-soft);
  color: var(--sand-ink);
  font-family: var(--font-mono);
  font-size: var(--fz-2xs);
  white-space: nowrap;
}

.v-investigations__title-row .v-investigations__badge {
  align-self: center;
}

/* ----------------------------------------------------------------- panels */

.v-investigations__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-6);
}

.v-investigations__panel {
  min-width: 0;
  border: 1px solid var(--line-0);
  border-radius: var(--r-2);
  background: var(--paper-1);
}

.v-investigations__new {
  flex: 2 1 520px;
}

.v-investigations__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-0);
}

.v-investigations__title {
  font-size: 15px;
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}

.v-investigations__meta {
  margin-top: 2px;
  color: var(--text-2);
  font-size: var(--fz-xs);
}

/* ------------------------------------------------------------------- form */

.v-investigations__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: var(--sp-5);
}

.v-investigations__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.v-investigations__label {
  padding: 0;
  font-size: var(--fz-sm);
  font-weight: var(--fw-medium);
  color: var(--text-0);
}

.v-investigations__optional {
  color: var(--text-2);
  font-weight: var(--fw-regular);
}

.v-investigations__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-2);
  background: var(--paper-0);
  color: var(--text-0);
  font: inherit;
  font-size: var(--fz-sm);
  resize: vertical;
}

.v-investigations__input--mono {
  font-family: var(--font-mono);
}

.v-investigations__input:focus-visible {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.v-investigations__input::placeholder {
  color: var(--text-3);
}

.v-investigations__hint {
  color: var(--text-2);
  font-size: var(--fz-xs);
}

.v-investigations__fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.v-investigations__personas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: var(--sp-2);
}

.v-investigations__persona {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--sp-3);
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  background: var(--paper-0);
  cursor: pointer;
}

.v-investigations__persona:has(input:checked) {
  border-color: var(--signal-ink);
  background: #f4f7ff; /* artboard selection wash; lighter than --signal-soft */
}

.v-investigations__persona input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--signal-ink);
}

.v-investigations__persona input:checked {
  counter-increment: inv-selected;
}

.v-investigations__persona-text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.v-investigations__persona-name {
  font-size: var(--fz-sm);
  font-weight: var(--fw-semibold);
}

.v-investigations__persona-desc {
  color: var(--text-1);
  font-size: var(--fz-xs);
  line-height: 1.45;
}

.v-investigations__form {
  counter-reset: inv-selected;
}

.v-investigations__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.v-investigations__count {
  color: var(--text-2);
  font-size: var(--fz-xs);
}

.v-investigations__count-n::before {
  content: counter(inv-selected);
}

/* ---------------------------------------------------------------- budgets */

.v-investigations__budget {
  flex: 1 1 280px;
  min-width: 0;
  border-radius: var(--r-2);
  background: var(--ink-0);
  color: var(--bone-0);
}

.v-investigations__head--ink {
  border-bottom-color: var(--line-ink);
}

.v-investigations__budget .v-investigations__meta {
  color: var(--bone-2);
}

.v-investigations__limits {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0;
  padding: var(--sp-2) var(--sp-5);
  font-size: var(--fz-sm);
}

.v-investigations__limits dt,
.v-investigations__limits dd {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-ink);
}

.v-investigations__limits dt {
  color: var(--bone-1);
}

.v-investigations__limits dd {
  margin: 0;
  font-family: var(--font-mono);
  text-align: right;
}

.v-investigations__limits dt:last-of-type,
.v-investigations__limits dd:last-of-type {
  border-bottom: 0;
}

.v-investigations__budget-note {
  padding: 0 var(--sp-5) var(--sp-5);
  color: var(--bone-2);
  font-size: var(--fz-xs);
  line-height: 1.55;
}

/* ------------------------------------------------------------------ table */

.v-investigations__table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: var(--fz-sm);
  text-align: left;
}

.v-investigations__table th {
  padding: 10px var(--sp-3);
  background: var(--paper-2);
  color: var(--text-1);
  font-size: var(--fz-xs);
  font-weight: var(--fw-medium);
}

.v-investigations__table td {
  padding: var(--sp-3);
  border-top: 1px solid var(--line-0);
  color: var(--text-0);
  vertical-align: top;
}

.v-investigations__table th:first-child,
.v-investigations__table td:first-child {
  padding-left: var(--sp-5);
}

.v-investigations__table th:last-child,
.v-investigations__table td:last-child {
  padding-right: var(--sp-5);
}

.v-investigations__table tr.is-selected td {
  background: #f4f7ff; /* artboard selection wash; lighter than --signal-soft */
}

.v-investigations__table tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--signal);
}

.v-investigations__mono,
.v-investigations__table .v-investigations__mono {
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
}

.v-investigations__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.v-investigations__when {
  display: block;
  color: var(--text-2);
  font-size: var(--fz-2xs);
}

.v-investigations__sub,
.v-investigations__table .v-investigations__sub {
  color: var(--text-2);
  font-size: var(--fz-xs);
}

td.v-investigations__sub {
  font-size: var(--fz-sm);
}

.v-investigations__chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--r-1);
  font-family: var(--font-mono);
  font-size: var(--fz-2xs);
  white-space: nowrap;
}

.v-investigations__chip--ok { background: var(--ok-soft); color: var(--ok); }
.v-investigations__chip--signal { background: var(--signal-soft); color: var(--signal-soft-ink); }
.v-investigations__chip--bad { background: var(--bad-soft); color: var(--bad); }
.v-investigations__chip--warn { background: var(--warn-soft); color: var(--warn); }

/* --------------------------------------------------------------- findings */

.v-investigations__findings {
  margin: 0;
  padding: 0;
  list-style: none;
}

.v-investigations__finding {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 14px var(--sp-5);
  border-bottom: 1px solid var(--line-0);
}

.v-investigations__rank {
  padding-top: 2px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
}

.v-investigations__finding-title {
  font-size: var(--fz-md);
  font-weight: var(--fw-medium);
}

.v-investigations__finding-who {
  margin-top: 3px;
  color: var(--text-2);
  font-size: var(--fz-xs);
}

.v-investigations__foot {
  padding: var(--sp-3) var(--sp-5);
  color: var(--text-2);
  font-size: var(--fz-xs);
}

@media (max-width: 640px) {
  .v-investigations__head,
  .v-investigations__form {
    padding: var(--sp-4);
  }

  .v-investigations__finding {
    grid-template-columns: 24px minmax(0, 1fr);
    padding: var(--sp-3) var(--sp-4);
  }

  .v-investigations__finding .v-investigations__chip {
    grid-column: 2;
    justify-self: start;
  }

  .v-investigations__limits,
  .v-investigations__budget-note {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
}

/* -------------------------------------------- live mode: artboard layout */

.v-investigations .inv-live.inv-layout {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--sp-6);
  margin-top: 0;
}

.v-investigations .inv-live > .inv-col {
  display: contents;
}

.v-investigations .inv-live > .inv-col:first-child > .lv-card:first-child {
  grid-column: 1;
}

.v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  border-color: var(--ink-0);
  background: var(--ink-0);
  color: var(--bone-0);
}

.v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) .lv-card-title,
.v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) .inv-budget-item strong {
  color: var(--bone-0);
}

.v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) .inv-budget-item {
  border-color: var(--line-ink);
  background: transparent;
}

.v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) .inv-budget-item span,
.v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) .inv-budget-item small {
  color: var(--bone-2);
}

.v-investigations .inv-live > .inv-col--wide > .lv-card {
  grid-column: 1 / -1;
}

@media (max-width: 1080px) {
  .v-investigations .inv-live.inv-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .v-investigations .inv-live > .inv-col:first-child > .lv-card:nth-child(2) {
    grid-column: 1;
    grid-row: auto;
  }
}


.v-investigations .inv-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: var(--sp-4);
  align-items: start;
}

.v-investigations .inv-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.v-investigations .inv-col--wide {
  min-width: 0;
}

/* --------------------------------------------------------------- form */

.v-investigations .inv-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.v-investigations .inv-fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: var(--sp-3);
  border: 1px solid var(--line-0);
  border-radius: var(--r-2);
}

.v-investigations .inv-fieldset .field__label {
  padding: 0 var(--sp-1);
}

.v-investigations .inv-check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  color: var(--text-1);
  font-size: var(--fz-sm);
  line-height: 1.45;
}

.v-investigations .inv-check input {
  margin-top: 2px;
  accent-color: var(--signal);
}

.v-investigations .inv-check span,
.v-investigations .inv-check label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.v-investigations .inv-check small,
.v-investigations .inv-check label small {
  color: var(--text-3);
  font-size: var(--fz-2xs);
  line-height: 1.4;
}

.v-investigations .inv-optional {
  color: var(--text-3);
  font-weight: var(--fw-regular);
}

.v-investigations .inv-submit {
  align-self: flex-start;
}

.v-investigations .inv-form-note,
.v-investigations .inv-budget-note,
.v-investigations .inv-muted {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.55;
}

.v-investigations .inv-form-note {
  margin: 0;
}

.v-investigations .inv-budget-note {
  margin: var(--sp-3) 0 0;
}

.v-investigations .inv-budget-note code {
  color: var(--text-1);
}

/* ------------------------------------------------------------- budgets */

.v-investigations .inv-budget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.v-investigations .inv-budget-item {
  padding: var(--sp-3);
  border: 1px solid var(--line-0);
  background: var(--paper-2);
}

.v-investigations .inv-budget-item span {
  display: block;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tr-mono);
}

.v-investigations .inv-budget-item strong {
  display: block;
  margin-top: 2px;
  color: var(--text-0);
  font-family: var(--font-mono);
  font-size: var(--fz-xl);
  font-weight: var(--fw-medium);
  letter-spacing: -0.02em;
}

.v-investigations .inv-budget-item small {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fz-2xs);
}

/* --------------------------------------------------------------- list */

.v-investigations .inv-table td {
  vertical-align: top;
}

.v-investigations .inv-id {
  display: block;
  color: var(--text-0);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
}

.v-investigations .inv-when {
  display: block;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
}

.v-investigations .inv-target {
  overflow-wrap: anywhere;
}

.v-investigations .inv-list .card__body > .inv-muted {
  margin: 0;
}

/* ------------------------------------------------------------- detail */

.v-investigations .inv-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-4);
  margin: 0 0 var(--sp-4);
}

.v-investigations .inv-meta div {
  min-width: 0;
}

.v-investigations .inv-meta dt {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tr-mono);
}

.v-investigations .inv-meta dd {
  margin: 2px 0 0;
  color: var(--text-0);
  font-size: var(--fz-sm);
  line-height: 1.45;
}

.v-investigations .inv-findings-title {
  margin: var(--sp-4) 0 var(--sp-2);
  color: var(--text-0);
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tr-tight);
}

.v-investigations .inv-findings-title:first-child {
  margin-top: 0;
}

.v-investigations .inv-finding-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 var(--sp-3);
  padding: 0;
  list-style: none;
  border: 1px solid var(--line-0);
  background: var(--line-0);
}

.v-investigations .inv-finding {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--paper-0);
}

.v-investigations .inv-finding span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.v-investigations .inv-finding strong {
  color: var(--text-0);
  font-size: var(--fz-sm);
  font-weight: var(--fw-medium);
  line-height: 1.4;
}

.v-investigations .inv-finding small {
  color: var(--text-3);
  font-size: var(--fz-2xs);
  line-height: 1.45;
}

.v-investigations .inv-finding .chip {
  flex: 0 0 auto;
}

/* ----------------------------------------------------------- evidence */

.v-investigations .inv-evidence {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--line-0);
  background: var(--paper-2);
}

.v-investigations .inv-evidence__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
}

.v-investigations .inv-evidence__head .inv-findings-title {
  margin: 0;
}

.v-investigations .inv-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: var(--sp-2) 0 var(--sp-2);
  padding: 0;
  list-style: none;
  border: 1px solid var(--line-0);
  background: var(--line-0);
}

.v-investigations .inv-evidence-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--paper-0);
  font-size: var(--fz-xs);
}

.v-investigations .inv-evidence-list code {
  color: var(--text-1);
  font-size: var(--fz-2xs);
}

.v-investigations .inv-evidence-list .chip {
  margin-left: auto;
}

/* --------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .v-investigations .inv-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .v-investigations .inv-budget-grid,
  .v-investigations .inv-meta {
    grid-template-columns: 1fr;
  }

  .v-investigations .inv-finding,
  .v-investigations .inv-evidence-list li {
    align-items: flex-start;
  }
}

/* ------------------------------------------------- live-mode additions */

.v-investigations .inv-live {
  margin-top: var(--sp-3);
}

.v-investigations .inv-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.v-investigations .inv-live-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line-0);
  background: var(--line-0);
}

.v-investigations .inv-live-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3);
  background: var(--paper-0);
}

.v-investigations .inv-live-item.is-selected {
  background: var(--paper-2);
  box-shadow: inset 3px 0 0 var(--signal);
}

.v-investigations .inv-live-item__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  grid-column: 1 / -1;
}

.v-investigations .inv-live-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.v-investigations .inv-live-item__main .inv-target {
  color: var(--text-0);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
}

.v-investigations .inv-live-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  grid-column: 2;
  grid-row: 2;
}

.v-investigations .inv-live-findings {
  margin-top: var(--sp-3);
}

.v-investigations .inv-live-findings .lv-card-title {
  margin: var(--sp-3) 0 var(--sp-2);
  font-size: var(--fz-md);
}

.v-investigations .inv-live-findings .lv-card-title:first-child {
  margin-top: 0;
}

.v-investigations .inv-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}

/* QA bug records */
.v-investigations .bug-records-card {
  margin-top: var(--sp-4);
}

.v-investigations .bug-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.v-investigations .bug-record {
  border: 1px solid var(--line-0);
  border-radius: var(--radius-2);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.v-investigations .bug-record__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.v-investigations .bug-record__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
}

.v-investigations .bug-record__grid .bug-record__label {
  display: block;
  margin: var(--sp-1) 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.v-investigations .bug-record .lv-code {
  background: var(--ink-0);
  color: var(--bone-0);
  border-radius: var(--r-2);
}

.v-investigations .bug-record__screenshot {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border: 1px solid var(--line-0);
}

@media (max-width: 880px) {
  .v-investigations .bug-record__grid { grid-template-columns: 1fr; }
}

/* QA bug record filters */
.v-investigations .bug-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.v-investigations .bug-filters .lv-input {
  width: auto;
  min-width: 150px;
}

.v-investigations__budget .v-investigations__title {
  color: var(--bone-0);
}
