/* ============================================================
   FlowJourney shell — phone on the left, backend sequence on the right.

   Everything here is scoped under `body.jmode` (or the `.j*` / `.jd-*`
   prefixes) so the wallet's own stylesheets are untouched: the same
   css/js that renders the standalone demo renders the phone here.
   ============================================================ */

body.jmode {
  display: block;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: #eef2f6;
  --jbar-h: 56px;
  --jd-future: #c2cdd8;
  --jd-past: #46586b;
  --jd-active: var(--brand-green-600);
  --jd-ink: #1e293b;
}

/* ---------------- top bar ---------------- */
.jbar {
  height: var(--jbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: #0d1b2a;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
.jbar-logo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #22d3a5;
}
.jbar-logo b { color: #fff; font-weight: 800; }
.jbar-brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.jbar-sub {
  font-size: 12px;
  color: #7d8fa3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jbar-controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.jbar select {
  background: #17293c;
  color: #e6eef6;
  border: 1px solid #2b4157;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
.jbar select:focus { border-color: var(--jd-active); }
#journey-select { min-width: 230px; }

.jbtn {
  border: 1px solid #2b4157;
  background: #17293c;
  color: #e6eef6;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
}
.jbtn:hover { background: #203549; }
.jbtn-primary {
  background: var(--brand-green-600);
  border-color: var(--brand-green-600);
  color: #fff;
}
.jbtn-primary:hover { background: var(--brand-green-400); border-color: var(--brand-green-400); }
.jbar-speed { font-size: 12px; color: #7d8fa3; display: flex; align-items: center; gap: 6px; }

/* ---------------- workspace ---------------- */
.jworkspace {
  height: calc(100vh - var(--jbar-h));
  display: flex;
  gap: 0;
  min-height: 0;
}
.jphone {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 22px;
  background:
    radial-gradient(120% 90% at 30% 0%, #f7faf8 0%, #e4ebe6 60%, #dde5e0 100%);
  border-right: 1px solid #d5dee6;
}
/* The device keeps its own 400x860 proportions but is allowed to shrink to the
   window: a laptop at 900px tall would otherwise crop the bottom nav. */
body.jmode .device {
  height: min(860px, calc(100vh - var(--jbar-h) - 36px));
  max-height: none;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22), 0 0 0 9px #111, 0 0 0 11px #333;
}

.jpanel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.jpanel-hint {
  flex: 0 0 auto;
  padding: 9px 20px;
  font-size: 12px;
  color: #5b6b7c;
  background: #f6f9fb;
  border-bottom: 1px solid #e3eaf0;
}

/* ---------------- diagram ---------------- */
#journey-diagram {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.jd-lanes {
  position: relative;
  height: 54px;
  flex: 0 0 auto;
  overflow: hidden;
  border-bottom: 1px solid #e8eef3;
  background: #fff;
}
.jd-lanes-inner { position: absolute; inset: 0; will-change: transform; }
.jd-lane {
  position: absolute;
  top: 11px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 8px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.15;
  padding: 0 6px;
  opacity: 0.62;
  transition: opacity 180ms, box-shadow 180ms, transform 180ms;
}
.jd-lane.is-active {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.jd-lane-actor  { background: #111827; }
.jd-lane-app    { background: var(--brand-green-600); }
.jd-lane-gw     { background: #334155; }
.jd-lane-mm     { background: var(--brand-red-dark); }
.jd-lane-core   { background: #1e3a8a; }
.jd-lane-notify { background: #7c3aed; }
.jd-lane-ext    { background: #b45309; }

.jd-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, #fbfdfe 0 32px, #fff 32px 64px);
}
.jd-canvas { position: relative; }
.jd-canvas svg { position: absolute; inset: 0; }
.jd-labels { position: absolute; inset: 0; }

.jd-life {
  stroke: #d3dde5;
  stroke-width: 1.4;
  stroke-dasharray: 5 5;
}
.jd-bar {
  fill: #cbd5e1;
  transition: fill 220ms;
}
.jd-bar.is-past { fill: #93a4b5; }
.jd-bar.is-active { fill: var(--jd-active); }

.jd-arrow {
  stroke: var(--jd-future);
  stroke-width: 1.7;
  fill: none;
  transition: stroke 200ms, stroke-width 200ms;
}
.jd-step.is-past .jd-arrow { stroke: var(--jd-past); }
.jd-step.is-active .jd-arrow { stroke: var(--jd-active); stroke-width: 2.6; }
.jd-kind-return .jd-arrow,
.jd-kind-async .jd-arrow { stroke-dasharray: 6 4; }

.jd-step .jd-arrow { marker-end: url(#jd-head-future); }
.jd-step.is-past .jd-arrow { marker-end: url(#jd-head-past); }
.jd-step.is-active .jd-arrow { marker-end: url(#jd-head-active); }

.jd-num circle {
  fill: var(--jd-future);
  transition: fill 200ms, r 200ms;
}
.jd-num text {
  fill: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-family);
}
.jd-step.is-past .jd-num circle { fill: var(--jd-past); }
.jd-step.is-active .jd-num circle { fill: var(--jd-active); }

.jd-label {
  position: absolute;
  padding: 3px 7px;
  border-radius: 7px;
  text-align: center;
  cursor: pointer;
  color: #7f8f9e;
  transition: color 200ms, background 200ms, box-shadow 200ms;
  background: rgba(255, 255, 255, 0.9);
}
.jd-label:hover { background: #f1f6fa; box-shadow: 0 0 0 1px #dbe5ee; }
.jd-label-main { font-size: 12px; font-weight: 600; line-height: 1.3; }
.jd-label-sub { font-size: 10.5px; line-height: 1.3; margin-top: 2px; opacity: 0.85; }
.jd-label.is-past { color: var(--jd-ink); }
.jd-label.is-past .jd-label-sub { color: #7d8b99; }
.jd-label.is-active {
  color: var(--brand-green-800);
  background: #eaf7ef;
  box-shadow: 0 0 0 1px rgba(var(--brand-green-rgb), 0.35), 0 4px 14px rgba(var(--brand-green-rgb), 0.16);
}
.jd-label.is-active .jd-label-main { font-weight: 700; }
.jd-label.is-active .jd-label-sub { color: var(--brand-green-700); }

/* ---------------- detail strip ---------------- */
.jpanel-detail {
  flex: 0 0 auto;
  height: 188px;
  overflow: auto;
  background: #0d1b2a;
  color: #cbd8e4;
  padding: 12px 18px 16px;
  border-top: 1px solid #0a1622;
  font-size: 12.5px;
  line-height: 1.5;
}
.jd-detail-empty { display: flex; flex-direction: column; gap: 4px; }
.jd-detail-empty strong { color: #fff; font-size: 14px; }
.jd-detail-empty span { color: #7d8fa3; }
.jd-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.jd-detail-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-green-600); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
}
.jd-detail-route { color: #8fa3b6; font-size: 12px; }
.jd-detail-route b { color: #e2e8f0; padding: 0 2px; }
.jd-detail-kind {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px;
}
.jd-kindtag-call { background: #14532d; color: #7ee2ab; }
.jd-kindtag-return { background: #1e3a5f; color: #93c5fd; }
.jd-kindtag-self { background: #422006; color: #fcd34d; }
.jd-kindtag-async { background: #3b0764; color: #d8b4fe; }
.jd-detail-pin { font-size: 11px; color: #64748b; }
.jd-detail-title { color: #fff; font-size: 14px; font-weight: 600; }
.jd-detail-sub { color: #93a7ba; margin-top: 2px; }
.jd-detail-desc { color: #a8bccd; margin-top: 7px; max-width: 78ch; }
.jd-detail-code {
  margin: 9px 0 0;
  padding: 10px 12px;
  background: #071119;
  border: 1px solid #16283a;
  border-radius: 8px;
  color: #9fe8c2;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}

/* ---------------- narrow screens ---------------- */
@media (max-width: 1100px) {
  .jworkspace { flex-direction: column; overflow: auto; }
  .jphone { border-right: none; border-bottom: 1px solid #d5dee6; }
  body.jmode .device { height: 720px; }
  .jpanel { min-height: 560px; }
}
