/* sip-monitor - foglio di stile unico (login + pannelli).
   Tema scuro da strumento di osservabilità SIP: fondo blu-nero, tutto in
   monospace, accento ciano per gli stati attivi e viola per un host del
   ladder. I messaggi SIP sono colorati per classe (--sip-*). */

/* JetBrains Mono self-hosted (subset latin): se i file non ci sono si
   ricade sullo stack di sistema senza altri effetti. */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-600.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-700.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  --bg: #0a0e17;
  --panel: #0e1420;
  --panel-2: #121a28;
  --inset: #0b1018;
  --border: #1c2434;
  --border-strong: #2a3446;

  --text: #e6edf3;
  --text-muted: #8492a6;
  --text-dim: #5b6675;

  --accent: #5ec6e6; /* ciano: stati attivi, selezione, link */
  --accent-strong: #7dd3ec; /* fill bottoni */
  --on-accent: #06131b; /* testo su fill ciano */
  --accent-soft: rgba(94, 198, 230, 0.12);
  --violet: #a78bfa; /* host secondario nel ladder */

  /* Classi dei messaggi SIP: ladder, lista e cella CAUSE. */
  --sip-req: #6cc7e8;
  --sip-ack: #9aa7b8;
  --sip-1xx: #e0b23f;
  --sip-2xx: #4fd08a;
  --sip-3xx: #e0b23f;
  --sip-err: #f0555b; /* >=4xx e CANCEL */

  /* Fondi tenui derivati, per i pochi elementi a pillola colorata. */
  --tint-ok: rgba(79, 208, 138, 0.12);
  --tint-warn: rgba(224, 178, 63, 0.12);
  --tint-err: rgba(240, 85, 91, 0.12);

  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 12px;
  --radius-sm: 6px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

/* Scrollbar sottile e scura, sia Firefox sia WebKit. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: var(--pill);
}

::-webkit-scrollbar-thumb:hover {
  background: #3a465c;
  background-clip: padding-box;
}

::selection {
  color: var(--text);
  background: rgba(94, 198, 230, 0.28);
}

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
}

button {
  font: inherit;
  cursor: pointer;
}

/* ------------------------------------------------------------- login */

body.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 21rem;
  max-width: 100%;
  padding: 1.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.login-card .subtitle {
  margin: 0.3rem 0 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.field {
  display: block;
  margin-bottom: 0.9rem;
}

.field > span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 0.45rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--pill);
}

input::placeholder {
  color: var(--text-dim);
}

input[type="search"]::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.45);
}

input:hover {
  border-color: var(--border-strong);
}

input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Focus sempre visibile, anche dove il :focus non basta (righe, bottoni). */
input:focus-visible,
button:focus-visible,
summary:focus-visible,
tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-primary {
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.5rem;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  border-radius: var(--pill);
}

.btn-primary:hover:not(:disabled) {
  background: #98dff2;
  border-color: #98dff2;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Riservato sempre, così il form non salta quando compare l'errore. */
.form-error {
  min-height: 1.15rem;
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  color: var(--sip-err);
}

.form-error:not(:empty) {
  padding: 0.45rem 0.7rem;
  background: var(--tint-err);
  border: 1px solid rgba(240, 85, 91, 0.35);
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------- struttura app */

body.app-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  flex-shrink: 0;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.topbar .spacer {
  flex: 1;
}

.topbar .who {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Stato del canale realtime: presente ma senza rubare attenzione. */
.conn {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.conn-dot {
  width: 0.45rem;
  height: 0.45rem;
  background: var(--text-dim);
  border-radius: 50%;
}

.conn[data-state="live"] {
  color: var(--sip-2xx);
}

.conn[data-state="live"] .conn-dot {
  background: var(--sip-2xx);
  box-shadow: 0 0 6px rgba(79, 208, 138, 0.6);
}

.conn[data-state="reconnecting"] {
  color: var(--sip-1xx);
}

.conn[data-state="reconnecting"] .conn-dot {
  background: var(--sip-1xx);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

/* Bottone di servizio (Riprova): pillola con solo il bordo. */
.btn-quiet {
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--pill);
}

.btn-quiet:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border-strong);
}

/* Azione principale della topbar. */
.btn-accent {
  padding: 0.3rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  border-radius: var(--pill);
}

.btn-accent:hover:not(:disabled) {
  background: #98dff2;
  border-color: #98dff2;
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: default;
}

.workspace {
  display: grid;
  flex: 1;
  gap: 0.75rem;
  min-height: 0; /* senza questo i pannelli non scrollano dentro il grid */
  padding: 0.75rem;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  flex-shrink: 0;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.6rem 0.85rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}

.panel-head .count {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* -------------------------------------------------------- filtri */

.filters {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

/* Toggle finestra temporale: due pillole mutuamente esclusive. */
.segmented {
  display: inline-flex;
  gap: 0.35rem;
}

.segmented button {
  padding: 0.26rem 0.8rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--pill);
}

.segmented button:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border-strong);
}

.segmented button[aria-pressed="true"] {
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Filtri booleani: stessa pillola, lo stato lo dà la checkbox nativa. */
.check {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.26rem 0.8rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  cursor: pointer;
  user-select: none;
}

.check:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border-strong);
}

.check input {
  width: 0.8rem;
  height: 0.8rem;
  margin: 0;
  accent-color: var(--accent);
}

.check:has(input:checked) {
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.check:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.filters .search {
  flex: 1;
  min-width: 11rem;
  max-width: 22rem;
  margin-left: auto;
  padding: 0.26rem 0.8rem;
  font-size: 0.76rem;
}

/* -------------------------------------------------------- tabella */

.calls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.calls-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.45rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  background: var(--panel-2);
  box-shadow: inset 0 -1px 0 var(--border);
}

.calls-table tbody td {
  padding: 0.38rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.calls-table tbody tr {
  cursor: pointer;
}

.calls-table tbody tr:hover > td {
  background: var(--panel-2);
}

/* Riga selezionata: due linee ciano sopra e sotto, fondo appena tintato. */
.calls-table tbody tr.is-selected > td,
.calls-table tbody tr.is-selected:hover > td {
  background: var(--accent-soft);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* Arrivata con l'ultimo evento realtime: si accende e sfuma da sola. */
@keyframes row-arrived {
  from {
    background: var(--accent-soft);
  }
  to {
    background: transparent;
  }
}

.calls-table tbody tr.is-new > td {
  animation: row-arrived 2.5s ease-out;
}

.col-time,
.col-dur,
.col-pdd,
.col-cause {
  font-variant-numeric: tabular-nums;
}

.col-time {
  color: var(--text-muted);
}

.col-dur,
.col-pdd {
  color: var(--text);
  text-align: right;
}

/* A→B può essere lungo: è l'unica colonna elastica. */
.col-party {
  max-width: 0;
  width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A brillante, B spento sotto: come nel riferimento restano su due livelli
   di lettura anche stando sulla stessa riga. */
.party-a {
  font-weight: 700;
  color: var(--text);
}

.party-arrow {
  margin: 0 0.35rem;
  color: var(--text-dim);
}

.party-b {
  color: var(--text-dim);
}

.muted {
  color: var(--text-dim);
}

.badge {
  display: inline-block;
  padding: 0.02rem 0.4rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: var(--pill);
}

.badge-live {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(94, 198, 230, 0.35);
}

/* Cella CAUSE colorata per classe di risposta. */
.cause {
  display: inline-block;
  min-width: 2.4rem;
  padding: 0.02rem 0.4rem;
  font-weight: 700;
  text-align: center;
  border-radius: var(--radius-sm);
}

.cause-2xx {
  color: var(--sip-2xx);
  background: var(--tint-ok);
}

.cause-3xx {
  color: var(--sip-3xx);
  background: var(--tint-warn);
}

.cause-4xx {
  color: var(--sip-err);
  background: var(--tint-err);
}

/* --------------------------------------------- stati della lista */

.state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.state strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  color: var(--text);
}

.state.state-error strong {
  color: var(--sip-err);
}

.state .hint {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.state button {
  margin-top: 0.9rem;
}

/* Barra sottile durante il ricarico, per non far sparire la lista. */
.loading-bar {
  flex-shrink: 0;
  height: 2px;
  background: var(--accent-soft);
  overflow: hidden;
}

.loading-bar.is-active::after {
  display: block;
  width: 40%;
  height: 100%;
  content: "";
  background: var(--accent);
  animation: slide 0.9s linear infinite;
}

@keyframes slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(350%);
  }
}

.panel-foot {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--panel-2);
  border-top: 1px solid var(--border);
}

.notice {
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.76rem;
  color: var(--sip-1xx);
  background: var(--tint-warn);
  border-bottom: 1px solid var(--border);
}

/* ------------------------------------------------ pannello destro */

.sid-chip {
  max-width: 60%;
  overflow: hidden;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.tabs button {
  padding: 0.26rem 0.9rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--pill);
}

.tabs button:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border-strong);
}

.tabs button[aria-selected="true"] {
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* Colori condivisi da ladder e lista: ogni classe di messaggio definisce il
   proprio primo piano, freccia ed etichetta lo ereditano da --c-fg. */
.sip-req {
  --c-fg: var(--sip-req);
}

.sip-ack {
  --c-fg: var(--sip-ack);
}

.sip-cancel {
  --c-fg: var(--sip-err);
}

.sip-1xx {
  --c-fg: var(--sip-1xx);
}

.sip-2xx {
  --c-fg: var(--sip-2xx);
}

.sip-3xx {
  --c-fg: var(--sip-3xx);
}

.sip-4xx {
  --c-fg: var(--sip-err);
}

.sip-unknown {
  --c-fg: var(--text-muted);
}

/* ---------------------------------------------------- SIP ladder */

.ladder {
  --off-w: 5.5rem;
}

.ladder-head,
.ladder-row {
  display: grid;
  grid-template-columns: var(--off-w) minmax(0, 1fr);
}

.ladder-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}

.ladder-lanes {
  display: grid;
  grid-template-columns: repeat(var(--hosts), minmax(0, 1fr));
  align-items: center;
}

.ladder-host {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.45rem 0.3rem;
  text-align: center;
}

.host-ip {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text);
}

.host-port {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Un solo host porta l'accento viola (quello centrale, scelta stabile):
   dà un punto di riferimento nel ladder senza aggiungere dati. */
.ladder-host.is-accent .host-port {
  color: var(--violet);
}

.ladder-rows {
  padding-bottom: 1rem;
}

.ladder-row {
  align-items: stretch;
}

.ladder-row:hover {
  background: var(--panel-2);
}

/* Colonna degli scostamenti: numeri spenti, non devono competere con le
   frecce colorate. */
.ladder-off {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0.6rem;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.ladder-row .ladder-lanes {
  min-height: 2.7rem;
}

/* Linea di vita dell'host: un segmento per riga, così restano allineate
   alle colonne senza doverle disegnare in overlay. */
.lane {
  position: relative;
  grid-row: 1;
  align-self: stretch;
}

.lane::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  content: "";
  border-left: 1px dashed var(--border-strong);
}

/* La freccia occupa le colonne fra sorgente e destinazione; il padding
   laterale di mezza colonna la fa partire e arrivare al centro delle due
   linee di vita invece che ai bordi. */
.hop {
  display: flex;
  flex-direction: column;
  grid-row: 1;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.3rem 0;
  padding-right: calc(50% / var(--span));
  padding-left: calc(50% / var(--span));
  color: var(--c-fg, var(--text-muted));
  background: none;
  border: 0;
}

/* Etichetta nello stesso colore della freccia; il fondo pieno serve solo a
   non farla attraversare dalle linee di vita. */
.hop-label {
  overflow: hidden;
  padding: 0.05rem 0.4rem;
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--c-fg, var(--text));
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel);
  border-radius: var(--radius-sm);
}

.ladder-row:hover .hop-label {
  background: var(--panel-2);
}

.hop:hover .hop-label {
  box-shadow: inset 0 0 0 1px currentColor;
}

.hop-arrow {
  position: relative;
  height: 2px;
  background: currentColor;
}

.hop-arrow::after {
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  content: "";
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: translateY(-50%);
}

.dir-right .hop-arrow::after {
  right: 0;
  border-left: 7px solid currentColor;
}

.dir-left .hop-arrow::after {
  left: 0;
  border-right: 7px solid currentColor;
}

/* Messaggio che parte e arriva sullo stesso host: cappio invece di freccia. */
.hop-self {
  padding-right: 0;
  padding-left: 0;
}

.hop-self .hop-arrow {
  width: 55%;
  height: 9px;
  margin: 0 auto;
  background: none;
  border: 1px solid currentColor;
  border-top: 0;
  border-radius: 0 0 7px 7px;
}

.hop-self .hop-arrow::after {
  display: none;
}

/* ------------------------------------------------------ tab Lista */

/* Timeline: una linea verticale continua e un pallino per messaggio. */
.msg-list {
  --rail-x: 2.05rem;
  padding: 0.2rem 0 0.6rem;
}

.msg {
  position: relative;
}

.msg::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rail-x);
  width: 1px;
  content: "";
  background: var(--border);
}

.msg:first-child::before {
  top: 1.05rem;
}

.msg:last-child::before {
  bottom: auto;
  height: 1.05rem;
}

.msg-head {
  display: grid;
  column-gap: 0.5rem;
  row-gap: 0.1rem;
  align-items: center;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  cursor: pointer;
  list-style: none;
  grid-template-columns: 0.8rem 1rem 1.6rem 4.8rem minmax(0, 1fr) auto;
  grid-template-areas:
    "caret rail seq off label clock"
    "caret rail seq off route route";
}

.msg-head::-webkit-details-marker {
  display: none;
}

.msg-head::before {
  grid-area: caret;
  content: "\25B8";
  color: var(--text-dim);
}

.msg[open] .msg-head::before {
  content: "\25BE";
  color: var(--accent);
}

/* Il pallino della timeline: l'anello lo stacca dalla linea sottostante. */
.msg-head::after {
  position: absolute;
  top: 1.05rem;
  left: var(--rail-x);
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  content: "";
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--panel);
}

.msg-head:hover {
  background: var(--panel-2);
}

.msg-head:hover::after {
  box-shadow: 0 0 0 3px var(--panel-2);
}

.msg-seq {
  grid-area: seq;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: right;
}

.msg-off {
  grid-area: off;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: right;
}

.msg-label {
  grid-area: label;
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  font-weight: 700;
  color: var(--c-fg, var(--text));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-route {
  grid-area: route;
  overflow: hidden;
  font-size: 0.67rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-clock {
  grid-area: clock;
  font-size: 0.67rem;
  color: var(--text-dim);
}

/* Payload SIP: riquadro incassato, allineato alla timeline. */
.msg-raw {
  margin: 0 0.85rem 0.7rem calc(var(--rail-x) + 0.6rem);
  padding: 0.6rem 0.75rem;
  overflow-x: auto;
  /* <pre> non eredita il font dal body: senza questo il payload uscirebbe
     dal monospace dell'app. */
  font-family: var(--mono);
  font-size: 0.71rem;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Prima riga (request-line / status-line) e nomi header: giusto quel tanto
   che basta a orientarsi dentro il payload. */
.msg-raw .raw-start {
  color: var(--text);
}

.msg-raw .raw-header {
  color: rgba(94, 198, 230, 0.75);
}

/* Arrivo dal ladder: un lampo per far capire quale riga si è aperta. */
@keyframes target-flash {
  from {
    background: var(--accent-soft);
  }
  to {
    background: transparent;
  }
}

.msg.is-target {
  animation: target-flash 1.4s ease-out;
}

/* ------------------------------------- footer con le metriche */

.panel-foot.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.1rem;
}

.metric {
  display: inline-flex;
  gap: 0.4rem;
  align-items: baseline;
}

.metric-key {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-value {
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 2fr) minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
