/* Winston V3 — Activity ledger. Evidence record + inline "why" expanders.
   Ledger is a single-surface evidence layer (no headline narrative —
   Home owns that). Day separators carry a one-line Winston summary;
   rows expand to a "why" card explaining the rule that fired. */

/* Page intro */
.act-intro { margin-bottom: var(--space-5); }
.act-intro h1 {
  font-size: var(--type-xl);
  font-weight: 700;
  margin: 0 0 var(--space-1);
  letter-spacing: -0.01em;
}
.act-intro p {
  margin: 0;
  font-size: var(--type-sm);
  color: var(--ink-muted);
}

/* Toolbar: search + range pills + export */
.act-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}
.act-search { position: relative; }
.act-search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: inherit;
  font-size: var(--type-sm);
  background: var(--surface);
  color: var(--ink);
}
.act-search input:focus { outline: none; border-color: var(--ai); }
.act-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 14px;
  pointer-events: none;
}

.act-range {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.act-range button {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.act-range button.is-active {
  background: var(--surface);
  color: var(--ai);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.act-export, .act-refresh-slot { white-space: nowrap; }

.act-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.act-chips .chip { font-size: 13px; }
.act-chips .chip .ct {
  font-family: var(--font-mono);
  font-weight: 500;
  opacity: 0.7;
  margin-left: 4px;
}

/* Day separator + Winston-line summary */
.act-day { margin-bottom: var(--space-6); }
.act-day-head {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr auto;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-2) 0 var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.act-day-label {
  font-size: var(--type-md);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.act-day-label .date {
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  color: var(--ink-muted);
  font-weight: 500;
  margin-left: 8px;
}
.act-day-winston {
  font-size: 13.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.act-day-winston .ww {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ai);
  color: white;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  flex-shrink: 0;
}
.act-day-winston strong { color: var(--ink); font-weight: 700; }
.act-day-totals {
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  color: var(--ink-muted);
}
.act-day-totals .ct {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Empty-day state */
.act-day-empty {
  padding: var(--space-4) 0;
  color: var(--ink-muted);
  font-size: var(--type-sm);
}

/* Row */
.act-row {
  display: grid;
  grid-template-columns: 64px 14px minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-3) 0 var(--space-3) 4px;
  border: none;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out);
}
.act-row:hover { background: var(--surface-2); }
.act-row.is-expanded {
  background: var(--surface-2);
  border-bottom-color: var(--border);
}
.act-row-time {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
  padding-top: 2px;
}
.act-row-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  align-self: center;
  margin-top: 1px;
  background: var(--ink-faint);
}
.act-row[data-kind="trade"]  .act-row-dot { background: var(--ai); }
.act-row[data-kind="skip"]   .act-row-dot { background: var(--warn); }
.act-row[data-kind="shield"] .act-row-dot { background: var(--sleeve-options); }
.act-row[data-kind="alert"]  .act-row-dot { background: var(--money-down); }
.act-row[data-kind="info"]   .act-row-dot { background: var(--ink-faint); }

.act-row-title {
  font-size: var(--type-sm);
  color: var(--ink-2);
  line-height: var(--leading-snug);
}
.act-row-title strong { color: var(--ink); font-weight: 600; }
.act-row-title .tkr {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px dotted transparent;
  transition: border-color var(--motion-fast) var(--ease-out);
}
.act-row-title .tkr:hover { border-bottom-color: var(--ai); color: var(--ai); }
.act-row:focus-visible {
  outline: 2px solid var(--ai);
  outline-offset: -2px;
  border-radius: 4px;
}
.act-row-title .muted { color: var(--ink-muted); }

.act-row-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.act-row-meta .val { color: var(--ink-3); }
.act-row-meta .pill {
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--ink-3);
  font-size: 11px;
  text-transform: lowercase;
}
.act-row-meta .pill.skip { background: var(--warn-soft); color: var(--warn); }
.act-row-meta .pill.shield { background: rgba(14,165,233,0.12); color: #0369A1; }
.act-row-meta .pill.failed { background: rgba(200,32,31,0.10); color: var(--money-down); }
.act-row-meta .pill.halt { background: rgba(200,32,31,0.10); color: var(--money-down); }
.act-row-meta .chev {
  color: var(--ink-faint);
  font-size: 11px;
  transition: transform 0.15s;
}
.act-row.is-expanded .act-row-meta .chev {
  transform: rotate(90deg);
  color: var(--ai);
}

/* Why panel — only renders when row is expanded */
.act-why {
  grid-column: 3 / 5;
  padding: 4px 0 var(--space-3);
}
.act-why-card {
  background: var(--surface);
  border: 1px solid var(--ai-line);
  border-left: 3px solid var(--ai);
  border-radius: 10px;
  padding: var(--space-3) var(--space-4);
  margin-top: 4px;
}
.act-why-head {
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ai);
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.act-why-head .ww {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ai);
  color: white;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.act-why-rule {
  font-size: var(--type-xs);
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 8px;
}
.act-why-body {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: var(--leading-normal);
  margin-bottom: 10px;
}
.act-why-body strong { color: var(--ink); font-weight: 700; }
.act-why-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--ink-muted);
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}
.act-why-meta .k { font-weight: 600; color: var(--ink-3); margin-right: 6px; }
.act-why-meta .v {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 700;
}

/* Power-mode strip */
.act-power {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-3);
  background: var(--surface-3);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}
.act-power label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  font-weight: 600;
  cursor: pointer;
}

/* Empty state for whole feed (no rows at all in range/filter) */
.act-empty {
  padding: var(--space-8) 0;
  text-align: center;
  color: var(--ink-muted);
}
.act-empty h3 {
  color: var(--ink);
  font-size: var(--type-md);
  font-weight: 700;
  margin: 0 0 6px;
}
.act-empty p { font-size: var(--type-sm); margin: 0; }
.act-empty .ww {
  display: inline-block;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ai);
  color: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 28px;
  text-align: center;
  margin-bottom: 12px;
}

/* "Expand day" for collapsed prior-day blocks */
.act-day-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--ai);
  background: none;
  border: none;
  padding: 12px 0;
  cursor: pointer;
  font-family: inherit;
}

/* ── Embedded-as-desk-sub-tab: feed renders as the shared sortable table
   (matches the Deals sub-tab). These styles dress the table rows the
   activity feed produces. ─────────────────────────────────────────── */
.act-embed { margin-top: var(--space-3); }

/* Typed pill in the Type column — colors mirror the row-dot semantics. */
.act-type-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: var(--type-xs);
  font-weight: var(--weight-semi);
  text-transform: capitalize;
  letter-spacing: 0.01em;
  background: var(--surface-3);
  color: var(--ink-muted);
}
.act-type-pill[data-kind="trade"]  { background: var(--ai-soft, rgba(99,102,241,0.12));  color: var(--ai); }
.act-type-pill[data-kind="skip"]   { background: var(--warn-soft);                        color: var(--warn); }
.act-type-pill[data-kind="shield"] { background: rgba(14,165,233,0.12);                   color: #0369A1; }
.act-type-pill[data-kind="alert"]  { background: rgba(200,32,31,0.10);                    color: var(--money-down); }

/* Rows carrying a "why" are clickable to expand. */
.sortable-table tbody tr.act-row-click { cursor: pointer; }
.act-chev {
  color: var(--ink-faint);
  font-weight: 700;
  transition: transform var(--motion-fast) var(--ease-out);
  display: inline-block;
}
.sortable-table tbody tr.act-row-click.is-expanded .act-chev { transform: rotate(90deg); color: var(--ai); }

/* Injected detail row holding the why-card, spanning the full table width. */
.act-why-row > td {
  padding: 0 var(--space-3) var(--space-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
}
.act-why-row .act-why { grid-column: auto; padding: var(--space-2) 0 0; }

/* Mobile — canonical --bp-sm */
@media (max-width: 600px) {
  .act-toolbar {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  .act-range {
    overflow-x: auto;
    overflow-y: hidden;  /* horizontal-only chip row — block the coerced vertical scrollbar */
    flex-wrap: nowrap;
  }
  .act-day-head {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .act-day-totals { justify-self: start; }
  .act-row { grid-template-columns: 52px 12px minmax(0, 1fr) auto; gap: 10px; }
  .act-row-time { font-size: 11px; }
  .act-why { grid-column: 1 / 5; }
}
