/* Memory explorer (T20): the /try/ demo's look inside the dashboard. A manila tag says where a
   memory came from; red tape and a broken red line mean stale, and nothing else. */
.mx {
  --mx-manila: #e3b860;
  --mx-manila-edge: #c99d45;
  --mx-tag-ink: #3d2c08;
  --mx-tag-label: #6b4e14;
  --mx-red: #c4122f;
  --mx-red-text: #a00f27;
  --mx-ring-ink: var(--ink);
}
@media (prefers-color-scheme: dark) {
  .mx { --mx-red: #e5334f; --mx-red-text: #ff7a8e; }
}
@supports (color: light-dark(white, black)) {
  .mx { --mx-red: light-dark(#c4122f, #e5334f); --mx-red-text: light-dark(#a00f27, #ff7a8e); }
}
.mx * { min-width: 0; }

.mx-controls { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; margin-top: 10px; }
.mx-field { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); flex: 0 1 220px; }
.mx-field select, .mx-field input { width: 100%; font: inherit; font-size: 13.5px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); }
.mx-search { flex: 1 1 240px; }
.mx-status { margin: 12px 0 10px; min-height: 1.55em; font-size: 13px; color: var(--muted); }
.mx-status.error { color: var(--danger); }
.mx-muted { color: var(--muted); font-size: 13.5px; margin: 0; }

.mx-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .mx-layout { grid-template-columns: minmax(0, 1fr); } }

/* The list scrolls inside itself on wide screens, so loading 500 more never moves the page. */
.mx-list-wrap { display: grid; gap: 10px; }
.mx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 70vh; overflow-y: auto; overscroll-behavior: contain; contain: content; }
@media (max-width: 860px) { .mx-list { max-height: 55vh; } }
.mx-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; width: 100%; text-align: left; white-space: normal; align-items: baseline; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.mx-row.selected { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }
.mx-row.stale { box-shadow: inset 3px 0 0 var(--mx-red); }
.mx-row.stale.selected { border-color: var(--mx-red); }
.mx-row-title { font-weight: 600; overflow-wrap: anywhere; }
.mx-row.superseded .mx-row-title, .mx-row.retracted .mx-row-title { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
.mx-row-meta { grid-column: 2; font-size: 12.5px; color: var(--faint); overflow-wrap: anywhere; }
.mx-chip { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 3px; background: var(--mx-manila); color: var(--mx-tag-ink); white-space: nowrap; }
.mx-chip.stale { background: var(--mx-red); color: #fff; }
.mx-chip.superseded, .mx-chip.retracted { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.mx-chip.contested, .mx-chip.quarantined { background: var(--amber-bg); color: var(--amber); }
.mx-more { justify-self: start; }

/* Detail: the manila tag, then the chain of custody. */
.mx-detail { border: 1px solid var(--line); border-radius: 4px; padding: 18px 18px 14px; background: var(--bg); min-height: 240px; position: sticky; top: 16px; }
@media (max-width: 860px) { .mx-detail { position: static; min-height: 0; scroll-margin-top: 12px; } }
.mx-tag { position: relative; overflow: hidden; background: var(--mx-manila); color: var(--mx-tag-ink); border-radius: 4px 14px 14px 4px; padding: 14px 16px 14px 36px; }
.mx-tag::before { content: ""; position: absolute; left: 11px; top: 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--mx-manila-edge); }
.mx-tag h3 { font-size: 20px; line-height: 1.15; font-weight: 800; margin: 0 0 10px; overflow-wrap: anywhere; }
.mx-tag dl { margin: 0; display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 3px 10px; font-size: 13.5px; line-height: 1.4; }
.mx-tag dt { color: var(--mx-tag-label); }
.mx-tag dd { margin: 0; overflow-wrap: anywhere; }
.mx-tag.superseded h3, .mx-tag.retracted h3 { opacity: .75; }
.mx-tag.superseded h3, .mx-tag.retracted h3 { text-decoration: line-through; text-decoration-thickness: 2px; }
.mx-tag .mx-note { display: block; margin-top: 10px; font-weight: 700; font-size: 13.5px; }
.mx-tape { display: block; margin: 12px -16px -2px -36px; padding: 6px 20px; background: var(--mx-red); color: #fff; transform: rotate(-2deg); font-weight: 800; font-size: 15px; text-align: center; }
.mx-link { display: inline; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: .18em; white-space: normal; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.mx-link:hover { background: none; opacity: .8; }
.mx-tag .mx-link { color: var(--mx-tag-ink); }

.mx-h { font-size: 15px; font-weight: 800; margin: 20px 0 10px; }
.mx-chain { list-style: none; margin: 0; padding: 0; }
.mx-chain li { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 0 12px; padding: 0 0 12px; font-size: 13.5px; overflow-wrap: anywhere; }
.mx-chain li::before { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 3px; background: var(--mx-ring-ink); }
.mx-chain li:last-child::before { display: none; }
.mx-chain li.broken::before { background: repeating-linear-gradient(180deg, var(--mx-red) 0 6px, transparent 6px 11px); }
.mx-ring { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--mx-ring-ink); background: var(--bg); margin-top: 2px; }
.mx-ring.tagged { background: var(--mx-manila); }
.mx-ring.stale { border-color: var(--mx-red); background: var(--mx-red); }
.mx-when { display: block; font-size: 12px; color: var(--faint); }
.mx-relations { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.mx-rel-kind { display: inline-block; min-width: 8.5em; color: var(--muted); }
.mx-stale-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 10px 0; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--mx-red); background: color-mix(in srgb, var(--mx-red) 10%, transparent); font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) { .mx-detail-body { animation: mx-drop .3s ease-out; } }
@keyframes mx-drop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
