@layer modules {
  /* Traffic: what callers did in an environment, where they stopped, and each session step by step. */
  /* Staging and live traffic are one keystroke apart, so each keeps its own colour: blue for the rehearsal, red for real callers. */
  .segmented { display: inline-flex; padding: .2rem; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-2); }
  .segment { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem 1.1rem; border-radius: var(--r-control); color: var(--ink-2); font-size: 1.3rem; font-weight: 550; text-decoration: none; }
  .segment-dot { width: .8rem; height: .8rem; border-radius: 999px; background: currentColor; opacity: .5; }
  .segment.is-staging { --segment-tone: var(--router); }
  .segment.is-live { --segment-tone: var(--danger); }
  .segment.is-active { background: var(--surface); color: var(--segment-tone, var(--ink)); box-shadow: 0 1px 2px rgb(var(--shade) / .12); }
  .segment.is-active .segment-dot { opacity: 1; background: var(--segment-tone); }
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem; margin: 0 0 1.6rem; }
  .stat { padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
  .stat dt { font-size: 1.2rem; color: var(--ink-3); }
  .stat dd { margin: .2rem 0 0; font-size: 2.2rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
  .stat.is-bad { border-color: var(--error-line); background: var(--error-surface); }
  .stat.is-bad dd { color: var(--error); }
  /* A plain-language line above the numbers, for readers who don't parse tables. */
  .traffic-summary { margin: 0 0 1.6rem; font-size: 1.5rem; line-height: 1.5; color: var(--ink-2); }
  .traffic-summary strong { color: var(--ink); font-weight: 650; }
  .traffic-summary-worst { display: block; margin-top: .3rem; }
  .traffic-section { margin-top: 1.6rem; }
  .traffic-heading { margin: 0 0 .8rem; font-size: 1.45rem; font-weight: 650; }
  /* The drop-off funnel: one rung per screen, the bar the share who reached it, the number the share lost there. */
  .funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
  .funnel-step { display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr) 15rem; align-items: center; gap: 1rem; }
  .funnel-label { min-width: 0; display: grid; gap: .1rem; }
  .funnel-name { font-size: 1.35rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .funnel-id { font-family: var(--mono); font-size: 1.1rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .funnel-bar { height: 2.2rem; border-radius: var(--r-control); background: var(--surface-2); overflow: hidden; }
  .funnel-bar span { display: flex; align-items: center; height: 100%; min-width: fit-content; padding: 0 .8rem; border-radius: var(--r-control); background: var(--router); color: var(--on-accent); font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .funnel-drop { font-size: 1.25rem; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
  .funnel-drop.is-high { color: var(--error); font-weight: 650; }
  .funnel-step.is-worst .funnel-bar span { background: var(--warning); }
  .funnel-step.is-worst .funnel-name { color: var(--error); }
  .sessions { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
  .sessions > li + li { border-top: 1px solid var(--line); }
  .traffic-session > summary { list-style: none; cursor: pointer; }
  .traffic-session > summary::-webkit-details-marker { display: none; }
  .traffic-session-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; padding: .8rem 1.2rem; }
  .traffic-session[open] > .traffic-session-row { background: var(--surface-2); }
  .session-phone { min-width: 12rem; font-family: var(--mono); font-size: 1.25rem; }
  .session-steps { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 8rem; }
  .session-timeline { list-style: none; margin: 0; padding: .6rem 1.2rem 1rem 2.4rem; display: grid; gap: .5rem; font-size: 1.3rem; }
  .session-timeline li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; }
  .timeline-call { font-family: var(--mono); font-size: 1.15rem; color: var(--ink-2); }
  .timeline-call.is-failed { color: var(--error); }
  @container panel (max-width: 34rem) { .funnel-step { grid-template-columns: minmax(0, 1fr) auto; } .funnel-bar { grid-column: 1 / -1; order: 3; } }
}
