/* Activity: your history with settle states. The row styles are shared with the portfolio's recent list. */

/* ---------- rows, shared ---------- */
:is(.pg-activity, .pg-portfolio) .ac-heads,
:is(.pg-activity, .pg-portfolio) .ac-main {
  display: grid;
  grid-template-columns: 118px 142px minmax(96px, 1fr) minmax(84px, 0.9fr) minmax(104px, 0.9fr) minmax(180px, 2.1fr) 18px;
  grid-template-areas: "t k c a s st x" ". . . . . ln x";
  column-gap: 14px;
  align-items: center;
  width: 100%;
  padding: 0 22px; /* the same left edge as the tabs and tile heads */
  text-align: left;
}
:is(.pg-activity, .pg-portfolio) .ac-heads { height: 34px; color: var(--label); font-size: var(--fs-1); grid-template-areas: none; }
:is(.pg-activity, .pg-portfolio) .ac-heads .r { text-align: right; }
:is(.pg-activity, .pg-portfolio) .ac-row { border-top: 1px solid var(--rule); }
:is(.pg-activity, .pg-portfolio) .ac-main { min-height: 44px; padding-top: 9px; padding-bottom: 9px; row-gap: 2px; }
:is(.pg-activity, .pg-portfolio) button.ac-main:hover { background: var(--hover); }
:is(.pg-activity, .pg-portfolio) .ac-t { grid-area: t; color: var(--label); font-size: var(--fs-1); font-variant-numeric: tabular-nums; white-space: nowrap; }
:is(.pg-activity, .pg-portfolio) .ac-k { grid-area: k; display: flex; align-items: center; gap: 8px; font-weight: 400; white-space: nowrap; }
/* the trade's cap: coral for a private block, steel for a public move or swap */
/* a public move or swap carries a steel cap; a private block, the usual row, carries none */
:is(.pg-activity, .pg-portfolio) .ac-k::before, .ck { content: ""; flex: none; display: inline-block; width: 3px; height: 0.95em; border-radius: 1px; background: transparent; }
:is(.pg-activity, .pg-portfolio) .ac-k.pub::before, .ck { background: var(--steel); }
:is(.pg-activity, .pg-portfolio) .ac-k.sell, :is(.pg-activity, .pg-portfolio) .ac-k.buy { color: var(--paper); }
:is(.pg-activity, .pg-portfolio) .ac-k.mv { color: var(--paper2); }
:is(.pg-activity, .pg-portfolio) .ac-c { grid-area: c; display: flex; align-items: center; gap: 8px; min-width: 0; }
:is(.pg-activity, .pg-portfolio) .ac-c b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(.pg-activity, .pg-portfolio) .ac-a { grid-area: a; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
:is(.pg-activity, .pg-portfolio) .ac-s { grid-area: s; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--paper2); }
:is(.pg-activity, .pg-portfolio) .ac-st { grid-area: st; display: flex; align-items: center; gap: 9px; min-width: 0; white-space: nowrap; }
/* the status mark: one slot, so every status word starts on the same line */
.mk { flex: none; position: relative; display: inline-block; width: 40px; height: 8px; border-radius: 1px; }
/* under way: one segment per step of the trade, done in paper, the one under way filling, the rest graphite */
.mk.run { display: inline-flex; gap: 2px; }
.mk.run b { position: relative; flex: 1; overflow: hidden; border-radius: 1px; background: var(--candle-down); }
.mk.run b.on { background: var(--paper); }
.mk.run b.now::after { content: ""; position: absolute; inset: 0; background: var(--paper); opacity: 0.55; transform-origin: 0 50%; animation: mk-fill 1.8s var(--ease) infinite; } /* lighter than a done step, so a still frame tells them apart */
@keyframes mk-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.mk.desk { height: 10px; margin-left: 0; background: transparent; }
.mk.desk::before, .mk.desk::after { content: ""; position: absolute; top: 0; bottom: 0; border-radius: 1px; }
.mk.desk::before { left: 0; width: 3px; background: var(--cap); }
.mk.desk::after { left: 4px; right: 0; background: var(--bar); }
:is(.pg-activity, .pg-portfolio) .ac-st b { font-weight: 400; color: var(--label); }
:is(.pg-activity, .pg-portfolio) .ac-st:is(.live, .warn) b { color: var(--paper); font-weight: 600; }
:is(.pg-activity, .pg-portfolio) .ac-st.good b { color: var(--paper2); }
@keyframes ac-fill { from { box-shadow: inset 0 0 0 var(--paper); } to { box-shadow: inset 24px 0 0 var(--paper); } }
:is(.pg-activity, .pg-portfolio) .ac-ln { grid-area: ln; font-size: var(--fs-1); color: var(--label); }
:is(.pg-activity, .pg-portfolio) .ac-x { grid-area: x; display: grid; place-items: center; color: var(--label); }
:is(.pg-activity, .pg-portfolio) .ac-x .icon { width: 16px; height: 16px; transition: transform var(--t1) var(--ease); }
:is(.pg-activity, .pg-portfolio) .ac-row.open .ac-x .icon { transform: rotate(180deg); }
:is(.pg-activity, .pg-portfolio) .ac-row.open .ac-main { background: var(--hover); }

/* a row's detail: the steps it went through, what it says now, and its numbers */
.pg-activity .ac-d { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 6px 22px 16px calc(22px + 118px + 14px); background: var(--hover); }
.pg-activity .ac-d > * { min-width: 0; }
.pg-activity .ac-d .steps { max-width: 560px; }
.pg-activity .ac-line { font-size: var(--fs-2); color: var(--paper2); max-width: 70ch; }
.pg-activity .ac-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 24px; font-size: var(--fs-1); max-width: 860px; }
.pg-activity .ac-facts dt { color: var(--label); }
.pg-activity .ac-facts dd { color: var(--paper2); font-variant-numeric: tabular-nums; }
.pg-activity .ac-d .link { justify-self: start; font-size: var(--fs-1); }

/* ---------- the activity page ---------- */
.pg-activity { grid-template-columns: minmax(0, 1fr) 344px; grid-template-areas: "head head" "list side"; }
.pg-activity > .pf-head { grid-area: head; }
.pg-activity > .ac-box { grid-area: list; min-width: 0; }
.pg-activity > .ac-side { grid-area: side; }
.pg-activity .ac-bar { display: flex; align-items: center; gap: 12px; padding-right: 12px; border-bottom: 1px solid var(--hair); }
.pg-activity .ac-bar .tabs { flex: 1; min-width: 0; border-bottom: 0; padding-left: 22px; }
.pg-activity .ac-bar .segs { flex: none; }
.pg-activity .ac-bar .ghost { flex: none; height: 30px; padding: 0 12px; font-size: var(--fs-1); }
.pg-activity .ac-bar .ghost .icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pg-activity .ac-none { padding: 18px 16px; color: var(--label); }
.pg-activity .ac-side .facts h3 { margin-bottom: 4px; }
.pg-activity .ac-legend { display: grid; gap: 10px; padding: 16px 18px 18px; font-size: var(--fs-1); line-height: 1.5; }
.pg-activity .ac-legend h3 { font: var(--w-display) var(--fs-4)/1.2 var(--display); letter-spacing: -0.025em; color: var(--paper); }
.pg-activity .ac-legend dl { display: grid; gap: 9px; }
.pg-activity .ac-legend dl > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
.pg-activity .ac-legend dt { font-weight: 500; color: var(--label); }
.pg-activity .ac-legend .ac-key { gap: 12px; }
.pg-activity .ac-legend .ac-key > div { grid-template-columns: minmax(0, 1fr); gap: 3px; }
.pg-activity .ac-key dt { display: flex; align-items: center; gap: 9px; color: var(--paper); }
.pg-activity .ac-key dd { padding-left: 0; font-size: var(--fs-2); }
.pg-activity .ac-key dd b { color: var(--paper); font-weight: 500; }
.pg-activity .ac-key .ck { margin-right: 37px; }
.pg-activity .ac-key > div:has(> dt > .ck) > dd { padding-left: 49px; } /* the Public row's words under its name, like the rest */
.pg-activity .ac-legend .facts { padding: 4px 0 0; }
.pg-activity .ac-sub { display: grid; gap: 6px; margin-top: 2px; }
.pg-activity .ac-legend .ac-sub > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.pg-activity .ac-sub dt { display: flex; align-items: center; gap: 9px; color: var(--paper); font-weight: 500; }
.pg-activity .ac-sub dd { padding-left: 49px !important; } /* under the name, past the mark's slot */
.pg-activity .ac-sub dd { padding-left: 0; color: var(--paper2); }
.pg-activity .ac-legend dt.live { color: var(--paper); }
.pg-activity .ac-legend dt.good { color: var(--paper2); }
.pg-activity .ac-legend dt.warn { color: var(--paper); }
.pg-activity .ac-legend dd { color: var(--paper2); }
.pg-activity .ac-legend + .ac-legend { border-top: 1px solid var(--hair); }
.pg-activity .ac-legend p { color: var(--paper2); }

/* the rows answer the width of the tile they sit in, not the window: the portfolio shows them in a narrower column */
.pg-activity .ac-box, .pg-portfolio .pf-act { container-type: inline-size; }
@container (max-width: 860px) {
  :is(.pg-activity, .pg-portfolio) .ac-heads,
  :is(.pg-activity, .pg-portfolio) .ac-main { grid-template-columns: 110px 136px minmax(90px, 1fr) minmax(80px, 0.9fr) minmax(96px, 0.9fr) minmax(150px, 1.8fr) 18px; column-gap: 12px; }
  .pg-activity .ac-d { padding-left: calc(22px + 110px + 12px); }
}
/* the rows need about 850px beside the 344px legend; below that the legend goes under the list */
@media (max-width: 1240px) {
  .pg-activity { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "list" "side"; }
}
@container (max-width: 770px) {
  :is(.pg-activity, .pg-portfolio) .ac-heads { display: none; }
  :is(.pg-activity, .pg-portfolio) .ac-main { grid-template-columns: minmax(0, 1fr) 92px 104px; grid-template-areas: "k st st" "c a s" "t t t" "ln ln ln"; column-gap: 12px; row-gap: 5px; padding: 11px 14px; }
  :is(.pg-activity, .pg-portfolio) .ac-st { justify-content: flex-end; }
  :is(.pg-activity, .pg-portfolio) .ac-st .mk:not(.run, .desk) { display: none; }
  :is(.pg-activity, .pg-portfolio) .ac-k { font-weight: 500; }
  :is(.pg-activity, .pg-portfolio) .ac-x { display: none; }
  .pg-activity .ac-d { padding: 6px 14px 14px; }
  .pg-activity .ac-bar .tabs { padding-left: 14px; }
  .pg-activity .ac-bar { flex-wrap: wrap; padding: 0 12px 10px 0; }
  .pg-activity .ac-bar .tabs { flex-basis: 100%; }
  .pg-activity .ac-bar .segs { margin-left: 12px; }
  .pg-activity .ac-bar .ghost { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.pg-activity, .pg-portfolio) .ac-x .icon { transition: none; }
  .mk.run b.now::after { animation: none; transform: scaleX(0.5); }
}
