/* Bot Ledger — mobile-first, dark. v1 */
:root {
  --bg: #0b0e14;
  --card: #141924;
  --card-edge: #232b3a;
  --text: #e8ecf3;
  --muted: #8a94a6;
  --amber: #f59e0b;
  --red: #dc2626;
  --green: #22c55e;
  --blue: #3b82f6;
  --orange: #f97316;
  --grey: #64748b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---- mode banner: the one thing that must never be subtle ---- */
.banner {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 10px 16px 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.banner.dry { background: var(--amber); color: #1a1205; }
.banner.live { background: var(--red); color: #fff; animation: livepulse 1.6s ease-in-out infinite; }
#banner-mode { font-size: 19px; }
#banner-sub { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; opacity: .82; text-transform: none; }
@keyframes livepulse { 50% { filter: brightness(1.18); } }

/* ---- account strip ---- */
.account {
  padding: 12px 14px 10px;
  background: #0e121b;
  border-bottom: 1px solid var(--card-edge);
  position: sticky;
  top: 0; /* sits under banner when scrolling */
  z-index: 9;
}
.banner + .account { top: 58px; }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.acct-cell { background: var(--card); border: 1px solid var(--card-edge); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.acct-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.acct-value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.updated-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.dot.stale { background: var(--red); animation: livepulse 1.2s infinite; }
.updated-row.stale #updated-text { color: #fca5a5; font-weight: 600; }
.demo-chip {
  margin-left: auto;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 3px 8px;
  border-radius: 99px;
}

/* ---- channel filter chips ---- */
.filters {
  display: flex;
  gap: 7px;
  padding: 11px 14px 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--card-edge);
  background: var(--card);
  color: var(--muted);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: #e8ecf3; color: #0b0e14; border-color: #e8ecf3; }

/* ---- event feed ---- */
.feed { padding: 10px 14px 30px; display: flex; flex-direction: column; gap: 9px; }
.event {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-left: 4px solid var(--grey);
  border-radius: 11px;
  padding: 11px 13px;
  cursor: pointer;
}
.event:active { filter: brightness(1.15); }
.event.t-entry_signal { border-left-color: var(--green); }
.event.t-breakeven_set { border-left-color: var(--blue); }
.event.t-cancellation { border-left-color: var(--orange); }
.event.t-ignored { border-left-color: var(--grey); opacity: .62; }
.event.t-needs_review { border-left-color: var(--red); background: #1c1417; }
.ev-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ev-type {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2.5px 7px;
  border-radius: 5px;
  background: var(--grey);
  color: #fff;
}
.t-entry_signal .ev-type { background: var(--green); color: #05230f; }
.t-breakeven_set .ev-type { background: var(--blue); }
.t-cancellation .ev-type { background: var(--orange); }
.t-needs_review .ev-type { background: var(--red); }
.ev-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ev-channel { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ev-summary { font-size: 14.5px; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.ev-detail { display: none; margin-top: 10px; border-top: 1px solid var(--card-edge); padding-top: 9px; }
.event.open .ev-detail { display: block; }
.ev-kv { display: flex; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.ev-kv b { color: var(--muted); font-weight: 600; flex: none; width: 74px; }
.ev-raw {
  margin-top: 8px;
  background: #0b0e14;
  border: 1px solid var(--card-edge);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #c3cbda;
}
.ev-raw-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 9px; }

.feed-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13.5px; }
.feed-empty .fe-icon { font-size: 22px; display: block; margin-bottom: 10px; opacity: .7; }
.feed-empty .fe-title { color: var(--text); font-weight: 700; font-size: 14.5px; margin-bottom: 5px; }
.feed-empty .fe-sub { font-size: 12.5px; line-height: 1.5; max-width: 300px; margin: 0 auto; }
.feed-empty.quiet .fe-icon { color: var(--amber); }
.feed-empty.review-ok .fe-icon { color: var(--green); }

/* first-run guide */
.first-run {
  margin: 10px 14px 2px;
  background: linear-gradient(180deg, rgba(59,130,246,.09), var(--card));
  border: 1px solid rgba(59,130,246,.4);
  border-radius: 12px;
  padding: 13px 14px 12px;
}
.first-run h4 { font-size: 13.5px; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.first-run h4 .pipe-ic { color: var(--blue); }
.first-run p { color: var(--muted); font-size: 12.5px; margin-top: 7px; }
.first-run p b { color: var(--text); font-weight: 600; }
.fr-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.fr-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: #c3cbda; background: #0e121b; border: 1px solid var(--card-edge); border-radius: 99px; padding: 3px 9px; }
.fr-key i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.fr-key.k-entry i { background: var(--green); }
.fr-key.k-be i { background: var(--blue); }
.fr-key.k-cancel i { background: var(--orange); }
.fr-key.k-quiet i { background: var(--grey); }
.fr-key.k-review i { background: var(--red); }
.fr-dismiss {
  margin-top: 11px;
  background: #e8ecf3;
  color: #0b0e14;
  border: 0;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
}

/* v2 additions */
.digest { margin-top: 8px; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.digest b { color: var(--text); font-weight: 700; }

.review-alert {
  margin: 10px 14px 0;
  background: rgba(220, 38, 38, .14);
  border: 1px solid rgba(220, 38, 38, .55);
  border-radius: 11px;
  color: #fca5a5;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-alert::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: livepulse 1.2s infinite; flex: none; }

.chip.review { border-color: rgba(220,38,38,.55); color: #fca5a5; }
.chip.review.active { background: var(--red); border-color: var(--red); color: #fff; }

.ignored-group {
  border: 1px dashed var(--card-edge);
  background: transparent;
  border-radius: 11px;
  padding: 10px 13px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.ignored-group .n { color: #aab4c4; }

.new-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--amber);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  margin: 4px 0;
}
.new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: rgba(245,158,11,.4); }

/* v4 — app header wordmark */
.app-mark {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
  padding: 9px 0 0;
}
.app-mark .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 6px rgba(245,158,11,.7); flex: none; }

.ptr {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height .18s ease;
  color: var(--muted);
  font-size: 12px;
}
.ptr span { display: block; }

.offline {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 7px 14px;
  z-index: 11;
}
