/* ══════════════════════════════════════════════════════════════════
   MRInsight · by StructuRad — stile di base
   Linguaggio visivo dei tool StructuRad (RM Retto), declinato in blu.
   ══════════════════════════════════════════════════════════════════ */

:root{
  --molla: cubic-bezier(.34,1.28,.64,1);
  --curva: cubic-bezier(.65,0,.2,1);
  --ease-intro: cubic-bezier(.785,.135,.15,.86);

  --bg:#F1F4F9; --surface:#FFFFFF; --surface2:#F7F9FC;
  --border:#DCE3EE; --border2:#C3CEDD;
  --text:#0F1A2B; --muted:#56667E; --faint:#93A2B8;
  --ink:#0A1628;              /* barra di navigazione */
  --accent:#1E4FA8; --accent-hover:#163D85; --accent-bg:#EAF0FB; --accent-line:#C7D6F2;
  --sky:#2F7DE1; --light:#6AB0FF; --deep:#0B2350;

  /* stati: restano distinguibili ma sobri */
  --ok:#17694A;   --ok-bg:#E6F4EE;
  --warn:#7A4E00; --warn-bg:#FDF3DC;
  --fail:#A12A2A; --fail-bg:#FBEDED;

  --nav-h:52px;
  --mono:'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --sans:'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*{box-sizing:border-box;}
[hidden]{display:none !important;}
html{background:var(--bg);}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:var(--sans); font-size:14px; line-height:1.45;
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--accent-line);}
a{color:var(--accent);}
code, .mono{font-family:var(--mono); font-size:.92em;}

/* ══════════════ NAV ══════════════ */
nav{
  position:sticky; top:0; z-index:100; height:var(--nav-h);
  background:var(--ink); color:#fff;
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:0 2rem;
}
.nav-brand{display:flex; flex-direction:column; gap:1px; min-width:0; text-decoration:none; color:inherit;}
.nav-title{
  font-family:var(--mono); font-size:12.5px; letter-spacing:.04em;
  display:flex; align-items:center; gap:9px; white-space:nowrap;
}
.nav-title b{font-weight:500; color:var(--light);}
.nav-title .by{color:#7F90AA;}
.nav-logo{display:block; width:28px; height:16px; flex-shrink:0;}
.nav-logo svg{display:block; width:100%; height:100%;}
.nav-sub{font-family:var(--mono); font-size:11px; color:#7F90AA; padding-left:37px; white-space:nowrap;}
.nav-right{display:flex; align-items:center; gap:8px;}

.live-pill{
  display:inline-flex; align-items:center; gap:7px;
  font-family:var(--mono); font-size:11px; color:#C6D3E8;
  padding:3px 10px; border-radius:999px; background:rgba(255,255,255,.06);
}
.live-dot{width:7px; height:7px; border-radius:50%; background:var(--light); animation:livePulse 2.4s ease-out infinite;}
.live-pill.ok .live-dot{background:#4FD1A0; --pulse:79,209,160;}
.live-pill.fail .live-dot{background:#F07070; --pulse:240,112,112;}
@keyframes livePulse{
  0%{box-shadow:0 0 0 0 rgba(var(--pulse,106,176,255),.55);}
  70%{box-shadow:0 0 0 7px rgba(var(--pulse,106,176,255),0);}
  100%{box-shadow:0 0 0 0 rgba(var(--pulse,106,176,255),0);}
}

/* ══════════════ LAYOUT ══════════════ */
.page{max-width:1080px; margin:0 auto; padding:1.6rem 2rem 5rem;}
.page-head{margin:.4rem 0 1.4rem;}
.kicker{font-size:10px; font-weight:600; letter-spacing:.22em; text-transform:uppercase; color:var(--sky);}
h1{margin:.2rem 0 .3rem; font-size:24px; font-weight:500; letter-spacing:-.01em;}
.lead{margin:0; color:var(--muted); max-width:68ch;}

/* ══════════════ SCHEDE ══════════════ */
.card{
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  margin:0 0 14px; box-shadow:0 1px 0 rgba(15,26,43,.02);
  transition:border-color .2s ease, box-shadow .25s ease;
}
.card:focus-within{border-color:var(--accent-line); box-shadow:0 6px 22px -14px rgba(30,79,168,.35);}
.card-head{
  display:flex; align-items:center; gap:12px;
  padding:.95rem 1.3rem; border-bottom:1px solid var(--border);
}
.card-head .spacer{flex:1;}
.card-num{
  width:30px; height:30px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--mono); font-size:11.5px; font-weight:500; color:#fff;
  background:linear-gradient(135deg, var(--sky), var(--accent) 70%);
  transition:transform .3s var(--molla);
}
.card:focus-within .card-num{transform:scale(1.1);}
.card-title{margin:0; font-size:15px; font-weight:500;}
.card-body{padding:1.1rem 1.3rem 1.25rem;}
.hint{font-size:11.5px; color:var(--faint); line-height:1.5;}
.senza-margine{margin-top:0;}
.spaziato{margin-top:14px;}
.checks:empty{display:none;}

/* ══════════════ CAMPI ══════════════ */
.fields{display:grid; grid-template-columns:repeat(auto-fill, minmax(min(260px,100%),1fr)); gap:12px 16px;}
label.field{display:flex; flex-direction:column; gap:6px;}
label.field span.lab{font-size:11px; font-weight:500; text-transform:uppercase; letter-spacing:.07em; color:var(--muted);}
input[type=text], input[type=password], input[type=email], select, textarea{
  font-family:var(--sans); font-size:13.5px; color:var(--text);
  padding:8px 11px; border:1.5px solid var(--border); border-radius:7px;
  background:var(--bg); outline:none; min-width:0; width:100%;
  transition:border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover{border-color:var(--border2);}
input:focus, select:focus, textarea:focus{border-color:var(--accent); background:#fff; box-shadow:0 0 0 3px rgba(30,79,168,.10);}
input::placeholder{color:var(--faint);}
input.mono{font-family:var(--mono); font-size:12.5px;}

/* ══════════════ PULSANTI ══════════════ */
button{font-family:var(--sans);}
.btn, .btn-primary, .btn-secondary{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  font-size:12px; font-weight:600; white-space:nowrap; cursor:pointer;
  padding:8px 16px; border-radius:50px; border:1.5px solid #CFD8E5;
  background:#E7ECF3; color:var(--text);
  box-shadow:inset 3px 3px 7px #CCD5E2, inset -3px -3px 7px #FFFFFF;
  transition:box-shadow .18s ease, background-color .18s ease, color .18s ease, transform .2s var(--molla);
}
.btn svg, .btn-primary svg, .btn-secondary svg{width:14px; height:14px; flex-shrink:0;}
.btn:hover, .btn-secondary:hover{
  box-shadow:inset 2px 2px 4px #CCD5E2, inset -2px -2px 4px #FFFFFF, 2px 2px 5px #CCD5E2, -2px -2px 5px #FFFFFF;
}
.btn:active, .btn-secondary:active{transform:scale(.97); box-shadow:inset 4px 4px 10px #BCC7D6, inset -1px -1px 4px #FFFFFF;}
.btn-primary{
  background:var(--accent); color:#fff; border-color:var(--accent-hover);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.14), 0 6px 16px -8px rgba(30,79,168,.7);
}
.btn-primary:hover{background:var(--accent-hover); box-shadow:inset 0 1px 0 rgba(255,255,255,.14), 0 8px 20px -8px rgba(30,79,168,.8);}
.btn-primary:active{transform:scale(.97); box-shadow:inset 3px 3px 8px rgba(0,0,0,.28);}
.btn-secondary{background:#E3ECFA; border-color:var(--accent-line); color:var(--accent);
  box-shadow:inset 3px 3px 7px #CFDCF2, inset -3px -3px 7px #F6F9FF;}
button:disabled{opacity:.55; cursor:default; transform:none !important;}
.action-row{display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:14px;}

/* ══════════════ RIGHE DI VERIFICA ══════════════ */
.checks{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px;}
.check{
  display:grid; grid-template-columns:22px minmax(0,1fr) auto; gap:1px 12px; align-items:center;
  padding:7px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface2);
  animation:popSection .4s var(--molla) both; transform-origin:top center;
}
.check .ico{width:22px; height:22px; border-radius:50%; display:grid; place-items:center; background:var(--border);}
.check .ico svg{width:12px; height:12px;}
.check .nome{font-size:13px; font-weight:500;}
.check .dett{grid-column:2 / -1; font-size:11.5px; color:var(--muted); word-break:break-word;}
.check .tempo{font-family:var(--mono); font-size:11px; color:var(--faint);}
.check.run .ico{background:var(--accent-bg);}
.check.run .ico::after{
  content:''; width:12px; height:12px; border-radius:50%;
  border:2px solid var(--accent-line); border-top-color:var(--accent); animation:gira .7s linear infinite;
}
.check.ok   {border-color:#CBE7DA;} .check.ok .ico{background:var(--ok); color:#fff; animation:posa .45s var(--molla);}
.check.warn {border-color:#F1DDB0; background:#FFFBF2;} .check.warn .ico{background:#C98A12; color:#fff; animation:posa .45s var(--molla);}
.check.fail {border-color:#EFCFCF; background:#FFF7F7;} .check.fail .ico{background:var(--fail); color:#fff; animation:posa .45s var(--molla);}
.check.skip {opacity:.7;} .check.skip .ico{background:var(--border2); color:#fff;}
@keyframes gira{to{transform:rotate(360deg);}}
@keyframes posa{from{transform:scale(.4);} to{transform:scale(1);}}

.badge{
  display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px;
  font-family:var(--mono); font-size:11px; border:1px solid var(--border); background:var(--surface2); color:var(--muted);
}
.badge.ok{color:var(--ok); background:var(--ok-bg); border-color:#CBE7DA;}
.badge.warn{color:var(--warn); background:var(--warn-bg); border-color:#F1DDB0;}
.badge.fail{color:var(--fail); background:var(--fail-bg); border-color:#EFCFCF;}

.avviso{
  display:flex; gap:10px; padding:10px 14px; border-radius:10px; margin:0 0 12px;
  font-size:12.5px; background:var(--accent-bg); border:1px solid var(--accent-line); color:var(--deep);
}
.avviso.fail{background:var(--fail-bg); border-color:#EFCFCF; color:var(--fail);}

pre.rapporto{
  margin:0; white-space:pre-wrap; font-family:var(--mono); font-size:12px; line-height:1.6;
  background:var(--surface2); border:1.5px solid var(--border); border-radius:10px; padding:14px 16px; max-height:320px; overflow:auto;
}
.status{min-height:18px; margin-top:8px; font-family:var(--mono); font-size:11px; color:var(--ok); transition:opacity .3s ease;}
.status:empty{opacity:0;}

/* ══════════════ FOOTER ══════════════ */
.app-footer{
  position:fixed; right:2rem; bottom:.55rem; z-index:80;
  display:flex; flex-direction:column; align-items:flex-end; gap:1px; text-align:right;
  padding:4px 11px; border-radius:10px;
  background:rgba(241,244,249,.86); backdrop-filter:blur(6px);
  font-size:10px; letter-spacing:.02em; color:#9AA8BC; pointer-events:none;
}

/* ══════════════ COMPARSA A CASCATA ══════════════ */
.pop-section{opacity:0; transform:scale(.9); transform-origin:top center;
  animation:popSection .46s var(--molla) var(--pop-delay, 0ms) forwards;}
@keyframes popSection{from{opacity:0; transform:scale(.9);} to{opacity:1; transform:scale(1);}}

/* logo che si disegna (contorno → riempimento) */
.logo-draw path{
  stroke:url(#srGrad); stroke-width:30; stroke-linecap:round; stroke-linejoin:round;
  stroke-dasharray:1; stroke-dashoffset:1; fill-opacity:0;
  animation:disegna .9s var(--ease-intro) forwards, riempi .5s ease-out .45s forwards;
}
@keyframes disegna{to{stroke-dashoffset:0;}}
@keyframes riempi{to{fill-opacity:1; stroke-opacity:0;}}

@media (max-width:720px){
  nav{padding:0 1rem;}
  .nav-sub{display:none;}
  .page{padding:1.2rem 1rem 4rem;}
  .app-footer{position:static; width:auto; margin:0 auto 1.2rem; align-items:center; text-align:center; background:none;}
}
@media (prefers-reduced-motion: reduce){
  .pop-section, .check, .check .ico{animation:none !important; opacity:1; transform:none;}
  .logo-draw path{animation:none; stroke-dashoffset:0; fill-opacity:1; stroke-opacity:0;}
}

/* prova di disegno 3D (diagnostica) */
.prova-3d{margin-top:10px; display:flex; justify-content:center;}
.prova-3d canvas{width:240px; height:160px; border-radius:10px; border:1px solid var(--border); background:var(--surface2);}
.app-footer a{color:inherit; text-decoration:none; border-bottom:1px dotted currentColor; pointer-events:auto;}
.app-footer a:hover{color:var(--accent);}
