/* ============================================================================
   Mobile incident / response rows — "Dossier Signal & Menu" (design handover)
   Recommended combo S3 + T3:
     S3  tonal-wash saved state (.row.is-added) + filled bookmark marker
     T3  one-tap bookmark (.m-book) whose filled state IS the saved signal,
         plus a ⋯ overflow (.m-more) that opens a push-up Export / Open sheet.
   Desktop is untouched: .row-mob never renders above the phone breakpoint, and
   every reflow rule lives inside the @media block below.
   ========================================================================== */

/* Default (all widths): the mobile stack is never shown on desktop. */
.row-mob { display: none; }

@media (max-width: 640px) {

  /* ── reflow: hide the desktop zones, show the stacked mobile block ── */
  .row > .sig,
  .row > .bd,
  .row > .xr-rt,
  .row > .acts { display: none; }

  .row { display: block; padding: 20px 16px; }   /* roomier top/bottom between entries */
  .row-mob { display: block; }

  /* Minimise the page side gutter on phones — the list pages all inset their
     content with clamp(1.25rem, 4vw, 2.75rem) (≈20px+); trim it so the rows use
     more of the screen. Scoped to ≤640px, so desktop/tablet keep the wide sheet. */
  .wrap, .band-inner, .mm-inner { padding-left: 8px; padding-right: 8px; }
  .row { padding-left: 12px; padding-right: 12px; }

  /* Full-bleed the record list to the screen edge: cancel the 8px page gutter on
     the list container so the rows (and their hairlines/wash) reach the edge, with
     the row's own 12px padding as the text inset. Page-content lists only — the
     command-palette suggest list (.rows.compact) lives outside .wrap and is left
     alone so it doesn't overflow its dropdown. */
  .wrap .rows:not(.compact),
  .band-inner .rows:not(.compact) { margin-left: -8px; margin-right: -8px; }
  .rows:not(.compact) .more-row { padding-left: 12px; padding-right: 12px; }

  /* S3 — tonal wash on a saved row (slate, the system's native depth cue).
     No left-border accent stripe (design-system constraint). */
  .row.is-added { background: color-mix(in srgb, var(--color-slate-pale) 34%, #fff); }
  .row.is-added:hover { background: color-mix(in srgb, var(--color-slate-pale) 34%, #fff); }

  /* header line — type label · date + controls ── */
  .m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
  .m-type { font-family: var(--font-ui); font-size: 10px; font-weight: var(--weight-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-stone); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .m-lead { display: inline-flex; align-items: center; gap: 8px; flex: none; }
  .m-date { font-family: var(--font-mono); font-size: 11px; color: var(--color-stone); white-space: nowrap; }

  /* T3 — trailing controls: one-tap bookmark + overflow ── */
  .m-book, .m-more { width: 40px; height: 40px; margin: -6px 0; border: none; background: transparent; border-radius: var(--radius-md);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background var(--transition-base), color var(--transition-base); }
  .m-book { color: var(--color-oatmeal); font-size: 18px; }
  .m-more { color: var(--color-oatmeal); font-size: 18px; margin-right: -8px; }
  .m-book:active, .m-more:active { background: var(--color-linen); color: var(--color-navy); }
  .m-book.on { color: var(--color-navy); }            /* filled = in dossier */

  /* identity line — glyph · parsed initiator→target · marks ── */
  .m-id { display: flex; align-items: center; gap: 11px; }
  .m-glyph { position: relative; flex: none; }
  .m-glyph .gi { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 17px;
    background: color-mix(in srgb, var(--c) 13%, #fff); color: var(--c); }
  .m-glyph .gi.sq { border-radius: 0; border: var(--gw, 2px) solid var(--gcol, var(--c)); }
  .m-glyph .gi.rd { border-radius: 50%; border: 2px solid var(--c); }

  .m-parsed { font-family: var(--font-ui); font-size: 12.5px; line-height: 1.3; color: var(--color-charcoal);
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px 7px; min-width: 0; flex: 1; }
  .m-parsed .ini { font-weight: var(--weight-semibold); color: var(--color-navy); display: inline-flex; align-items: center; }
  .m-parsed .arr { color: var(--color-oatmeal); font-size: 12px; display: inline-flex; align-self: center; }
  .m-parsed .tgt { font-weight: var(--weight-semibold); color: var(--color-charcoal); }
  .m-parsed .tgt.unk { color: var(--color-stone); font-weight: var(--weight-regular); }
  .m-parsed .sct { color: var(--color-stone); display: inline-flex; align-items: center; gap: 6px; }
  .m-parsed .sct .mid { color: var(--color-oatmeal); }

  /* state stack (issuer ISOs) inside the parsed line */
  .m-parsed .sstack { display: inline-flex; align-items: center; vertical-align: middle; }
  .m-parsed .iso { font-family: var(--font-mono); font-size: 10px; font-weight: var(--weight-semibold); color: var(--color-stone);
    background: var(--color-linen); border: 1px solid var(--hair-2); border-radius: 3px; padding: 2px 5px; letter-spacing: 0.04em; margin-right: 5px; }
  .m-parsed .iso2 { width: 21px; height: 21px; border-radius: 50%; background: var(--color-linen); border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px var(--hair-2); margin-left: -7px; font-family: var(--font-mono); font-size: 8px; font-weight: 600;
    color: var(--color-navy); display: flex; align-items: center; justify-content: center; }
  .m-parsed .iso2:first-child { margin-left: 0; }
  .m-parsed .iso2.more { color: var(--color-stone); background: var(--color-ecru); }
  .m-parsed .statelabel { font-weight: var(--weight-semibold); color: var(--color-navy); margin-left: 6px; white-space: nowrap; }

  /* marks — attribution dots (incident) / weight squares (response) ── */
  .m-marks { flex: none; margin-left: auto; }
  .m-marks .att { display: inline-flex; align-items: center; }
  .m-marks .att .d { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--color-oatmeal); background: transparent; box-sizing: border-box; }
  .m-marks .att .d.on { background: var(--color-stone); border-color: var(--color-stone); }
  .m-marks .att .lnk { width: 6px; height: 1.5px; background: var(--color-oatmeal); }
  .m-marks .att.both .d.on { background: var(--color-navy); border-color: var(--color-navy); }
  .m-marks .att.both .lnk { background: var(--color-navy); }
  .m-marks .wsq { display: inline-flex; align-items: center; gap: 4px; }
  .m-marks .wsq .ct { width: 7px; height: 7px; border-radius: 1.5px; background: var(--color-jacket); }
  .m-marks .wsq .ct.on { background: var(--color-stone); }

  /* rule + full official title (drawn rule, no extra DOM) ── */
  .m-name { position: relative; font-family: var(--font-ui); font-size: 14.5px; line-height: 1.4; color: var(--color-charcoal);
    font-weight: var(--weight-regular); text-wrap: pretty; padding-top: 12px; margin-top: 11px; }
  /* full-bleed the within-entry rule to the screen edge (negate the row's 12px
     inset) so it matches the full-width between-entry separators. */
  .m-name::before { content: ""; position: absolute; top: 0; left: -12px; right: -12px; height: 1px; background: var(--color-oatmeal); opacity: 0.6; }
}

/* ── push-up action sheet (T3 overflow) — created by mobile_rows.js; only ever
   shown on mobile, so it is safe to define unconditionally (hidden until .show). */
.actscrim { position: fixed; inset: 0; background: rgba(30,26,29,0.34); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 1200; }
.actscrim.show { opacity: 1; pointer-events: auto; }
.actsheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--color-linen); border-top-left-radius: 18px; border-top-right-radius: 18px;
  transform: translateY(101%); transition: transform .26s var(--ease-default); z-index: 1201; padding: 0 0 max(12px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(0,0,0,0.16); }
.actsheet.show { transform: translateY(0); }
.actsheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--color-oatmeal); margin: 8px auto 4px; }
.actsheet .sh-title { font-family: var(--font-ui); font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--color-stone); padding: 6px 20px 12px; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; border-bottom: 1px solid var(--color-oatmeal); }
.actsheet .sh-act { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 20px; background: transparent; border: none; text-align: left;
  font-family: var(--font-ui); font-size: 15px; font-weight: var(--weight-medium); color: var(--color-charcoal); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.actsheet .sh-act i { font-size: 20px; color: var(--color-stone); width: 22px; text-align: center; flex: none; }
.actsheet .sh-act:active { background: var(--color-ecru); }
.actsheet .sh-sep { height: 1px; background: var(--color-oatmeal); opacity: 0.45; }
.actsheet .sh-cancel { display: block; width: calc(100% - 28px); margin: 10px 14px 0; padding: 13px; text-align: center; background: #fff;
  border: 1px solid var(--hair-2); border-radius: var(--radius-md); font-family: var(--font-ui); font-size: 14px; font-weight: var(--weight-semibold); color: var(--color-stone); cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ── toast (save / remove feedback) ── */
.m-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px); background: var(--color-charcoal); color: #fff;
  font-family: var(--font-ui); font-size: 13px; font-weight: var(--weight-medium); padding: 10px 16px; border-radius: var(--radius-pill);
  display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1300; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.m-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.m-toast i { color: #7FD49B; font-size: 16px; }
