/* RX Torace by Radiolog. Tutto è sotto .rlrx per non interferire con il tema. */
.rlrx {
  --rlrx-bg: #ffffff;
  --rlrx-soft: #f4f6f9;
  --rlrx-line: #dfe3ea;
  --rlrx-text: #1d2430;
  --rlrx-muted: #5f6b7a;
  --rlrx-accent: #1f6feb;
  --rlrx-accent-ink: #ffffff;
  --rlrx-ok: #1a7f37;
  --rlrx-ok-soft: #dcf3e3;
  --rlrx-warn: #9a6700;
  --rlrx-warn-soft: #fff4d6;
  --rlrx-bad: #b42318;
  --rlrx-bad-soft: #fde4e1;
  --rlrx-radius: 14px;
  color: var(--rlrx-text);
  max-width: 1100px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.5;
  box-sizing: border-box;
}
.rlrx *, .rlrx *::before, .rlrx *::after { box-sizing: border-box; }
.rlrx-hidden { display: none !important; }

.rlrx-card {
  background: var(--rlrx-bg);
  border: 1px solid var(--rlrx-line);
  border-radius: var(--rlrx-radius);
  padding: 20px;
  margin: 0 0 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.rlrx-step { font-size: 1.05rem; margin: 4px 0 12px; }
.rlrx-step:not(:first-child) { margin-top: 24px; }
.rlrx-muted { color: var(--rlrx-muted); font-size: .88rem; margin: 6px 0 0; }
.rlrx-avviso {
  background: var(--rlrx-warn-soft);
  border-left: 4px solid var(--rlrx-warn);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: .9rem;
}

/* intestazione */
.rlrx-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px; margin: 0 0 16px;
  border-radius: calc(var(--rlrx-radius) + 4px);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(15, 181, 174, .22) 0%, rgba(15, 181, 174, 0) 55%),
    linear-gradient(135deg, #0b1f3a 0%, #12325e 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(11, 31, 58, .18);
}
.rlrx-logo { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)); }
.rlrx-hero-text { min-width: 0; }
.rlrx .rlrx-title {
  margin: 0; padding: 0; border: 0;
  font-size: clamp(1.7rem, 4.5vw, 2.4rem); line-height: 1.1; font-weight: 800; letter-spacing: -.02em;
  color: #fff;
}
.rlrx-subtitle { margin: 6px 0 0; font-size: clamp(1rem, 2.4vw, 1.15rem); color: #cfe0ff; }
.rlrx-tagline { margin: 10px 0 0; font-size: .85rem; color: #a9bddb; }
.rlrx-pill {
  display: inline-block; padding: 2px 10px; margin-right: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600;
}

/* upload */
.rlrx-drop {
  border: 2px dashed var(--rlrx-line);
  border-radius: var(--rlrx-radius);
  background: var(--rlrx-soft);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.rlrx-drop:hover, .rlrx-drop:focus-visible, .rlrx-drop.is-over { border-color: var(--rlrx-accent); background: #eef4ff; outline: none; }
.rlrx-drop-icon { font-size: 2.2rem; line-height: 1; }
.rlrx-drop-title { font-weight: 600; margin: 8px 0 0; }
.rlrx-preview {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin: 0 auto;
  background: #000;
  border-radius: 10px;
}

/* bottoni */
.rlrx-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.rlrx-btn {
  appearance: none;
  border: 1px solid var(--rlrx-line);
  background: var(--rlrx-bg);
  color: var(--rlrx-text);
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  flex: 1 1 auto;
}
.rlrx-btn:hover { border-color: var(--rlrx-accent); }
.rlrx-btn:focus-visible { outline: 3px solid rgba(31, 111, 235, .35); outline-offset: 1px; }
.rlrx-btn-sm { padding: 6px 12px; min-height: 38px; font-size: .9rem; flex: 0 1 auto; }
.rlrx-btn-ghost { background: transparent; }
.rlrx-btn-primary {
  width: 100%;
  margin-top: 18px;
  background: var(--rlrx-accent);
  border-color: var(--rlrx-accent);
  color: var(--rlrx-accent-ink);
  font-size: 1.05rem;
}
.rlrx-btn-primary:hover { filter: brightness(1.07); }
.rlrx-btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.is-busy .rlrx-btn-primary { position: relative; color: transparent; }
.is-busy .rlrx-btn-primary::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff;
  border-radius: 50%;
  animation: rlrx-spin .8s linear infinite;
}
@keyframes rlrx-spin { to { transform: rotate(360deg); } }

/* campi */
.rlrx-field { margin: 0 0 16px; }
.rlrx-label { display: block; font-weight: 600; margin: 0 0 6px; }
.rlrx-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--rlrx-soft); padding: 4px; border-radius: 12px; }
.rlrx-seg button {
  appearance: none; border: 0; background: transparent; color: var(--rlrx-text);
  font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; min-height: 40px;
}
.rlrx-seg button[aria-checked="true"] { background: var(--rlrx-bg); box-shadow: 0 1px 3px rgba(16, 24, 40, .15); color: var(--rlrx-accent); }
.rlrx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.rlrx-grid2 label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--rlrx-muted); }
.rlrx input[type="date"], .rlrx input[type="number"] {
  font: inherit; color: var(--rlrx-text); background: var(--rlrx-bg);
  border: 1px solid var(--rlrx-line); border-radius: 10px; padding: 9px 10px; min-height: 44px; width: 100%;
}
.rlrx-check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; margin-top: 8px; cursor: pointer; }
.rlrx-check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.rlrx-tips { margin-top: 12px; font-size: .9rem; }
.rlrx-tips summary { cursor: pointer; color: var(--rlrx-accent); font-weight: 600; }
.rlrx-tips ul { margin: 8px 0 0 18px; padding: 0; }
.rlrx-msg { margin-top: 12px; min-height: 1.5em; text-align: center; color: var(--rlrx-muted); }
.rlrx-msg.is-error { color: var(--rlrx-bad); font-weight: 600; }

/* risultati */
.rlrx-results-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.rlrx-results-grid > .rlrx-card { margin: 0; }
.rlrx-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rlrx-kpi { background: var(--rlrx-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.rlrx-kpi-main { grid-column: 1 / -1; background: #eef4ff; }
.rlrx-kpi-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rlrx-muted); font-weight: 600; }
.rlrx-kpi-value { font-size: 1.25rem; line-height: 1.25; margin-top: 2px; }
.rlrx-kpi-main .rlrx-kpi-value { font-size: 1.8rem; color: var(--rlrx-accent); }
.rlrx-kpi.is-ok { background: var(--rlrx-ok-soft); }
.rlrx-kpi.is-low, .rlrx-kpi.is-high { background: var(--rlrx-bad-soft); }

.rlrx-pct { margin-top: 16px; padding: 14px; border-radius: 12px; border: 1px solid var(--rlrx-line); }
.rlrx-pct-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rlrx-pct-value { font-size: 1.6rem; }
.rlrx-pct.is-ok .rlrx-pct-value { color: var(--rlrx-ok); }
.rlrx-pct.is-low .rlrx-pct-value, .rlrx-pct.is-high .rlrx-pct-value { color: var(--rlrx-bad); }
.rlrx-pct-class { margin: 2px 0 12px; font-weight: 600; }

.rlrx-gauge { position: relative; padding-bottom: 4px; }
.rlrx-gauge-track { position: relative; height: 14px; border-radius: 7px; background: var(--rlrx-bad-soft); }
.rlrx-band { position: absolute; top: 0; bottom: 0; }
.rlrx-band-2 { background: #bfe6ca; }
.rlrx-band-1 { background: #8fd3a5; }
.rlrx-marker {
  position: absolute; top: -6px; width: 4px; height: 26px; margin-left: -2px;
  background: var(--rlrx-text); border-radius: 2px; box-shadow: 0 0 0 2px var(--rlrx-bg);
}
.rlrx-gauge-scale { position: relative; height: 18px; margin-top: 6px; font-size: .72rem; color: var(--rlrx-muted); }
.rlrx-gauge-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rlrx-gauge-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--rlrx-muted); margin-top: 2px; }

.rlrx-heat-wrap { margin-top: 12px; background: #000; border-radius: 10px; overflow: hidden; text-align: center; }
.rlrx-heat { display: block; max-width: 100%; max-height: 560px; margin: 0 auto; }
.rlrx-warn { background: var(--rlrx-warn-soft); color: #5c3d00; border-radius: 8px; padding: 8px 12px; font-size: .88rem; margin: 10px 0 0; }

@media (min-width: 820px) {
  .rlrx-results-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .rlrx-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .rlrx-hero { padding: 16px; gap: 12px; }
  .rlrx-logo { width: 48px; height: 48px; }
  .rlrx-card { padding: 14px; }
  .rlrx-grid2 { grid-template-columns: 1fr; }
  .rlrx-kpi-main .rlrx-kpi-value { font-size: 1.5rem; }
  .rlrx-gauge-scale span:nth-child(even) { display: none; }
}
@media print {
  .rlrx form, .rlrx .rlrx-row, .rlrx-tips summary { display: none !important; }
  .rlrx-hero { background: none; color: #000; box-shadow: none; padding: 0 0 8px; }
  .rlrx .rlrx-title { color: #000; }
  .rlrx-subtitle, .rlrx-tagline { color: #333; }
  .rlrx-results { display: block !important; }
  .rlrx-card { box-shadow: none; break-inside: avoid; }
}

/* ---------- RX torace: reperti, indice cardiotoracico, legenda ---------- */
.rlrx-pct { margin-top: 0; }
.rlrx-pct.is-mid .rlrx-pct-value { color: var(--rlrx-warn); }
.rlrx-gauge .rlrx-band-1 { background: #8fd3a5; }
.rlrx-gauge .rlrx-band-2 { background: #f6d58a; }
.rlrx-reperti { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.rlrx-rep { border: 1px solid var(--rlrx-line); border-radius: 12px; padding: 12px 14px; background: var(--rlrx-bg); }
.rlrx-rep.is-alto { border-color: #f3b3ab; background: var(--rlrx-bad-soft); }
.rlrx-rep.is-medio { border-color: #f1d48b; background: var(--rlrx-warn-soft); }
.rlrx-rep-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rlrx-badge { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: #fff; }
.rlrx-rep.is-alto .rlrx-badge { color: var(--rlrx-bad); }
.rlrx-rep.is-medio .rlrx-badge { color: var(--rlrx-warn); }
.rlrx-bar { height: 8px; border-radius: 4px; background: rgba(0, 0, 0, .08); margin: 8px 0 0; overflow: hidden; }
.rlrx-bar-fill { height: 100%; border-radius: 4px; background: var(--rlrx-warn); }
.rlrx-rep.is-alto .rlrx-bar-fill { background: var(--rlrx-bad); }
.rlrx-rep .rlrx-btn { margin-top: 8px; }
.rlrx-nessuno { margin: 4px 0 0; font-weight: 600; color: var(--rlrx-ok); }
.rlrx-legenda { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; font-size: .82rem; color: var(--rlrx-muted); }
.rlrx-leg { display: inline-flex; align-items: center; gap: 6px; }
.rlrx-leg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.rlrx-heat-wrap { margin-top: 12px; background: #000; border-radius: 12px; overflow: hidden; }
.rlrx-heat-wrap img { display: block; width: 100%; height: auto; }
