@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap');

  :root{
    --bg:#f5f7f5;
    --surface:#ffffff;
    --surface-2:#eef2ee;
    --border:#dbe1dc;
    --text:#182420;
    --text-muted:#5c6b63;
    --accent:#008245;
    --accent-strong:#0b5347;
    --accent-tint:#e2f2ed;
    --warn:#c1560c;
    --warn-bg:#fdf1e6;
    --danger:#b3261e;
    --danger-bg:#fbebe9;
    --focus:#0f6e5c;
  }
  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --bg:#0f1613;
      --surface:#161f1b;
      --surface-2:#1c2622;
      --border:#2a3a34;
      --text:#e8ede9;
      --text-muted:#93a69c;
      --accent:#3ddab0;
      --accent-strong:#2bb896;
      --accent-tint:#173028;
      --warn:#f0a34e;
      --warn-bg:#33270f;
      --danger:#ff8b80;
      --danger-bg:#341614;
      --focus:#3ddab0;
    }
  }
  :root[data-theme="dark"]{
    --bg:#0f1613;
    --surface:#161f1b;
    --surface-2:#1c2622;
    --border:#2a3a34;
    --text:#e8ede9;
    --text-muted:#93a69c;
    --accent:#3ddab0;
    --accent-strong:#2bb896;
    --accent-tint:#173028;
    --warn:#f0a34e;
    --warn-bg:#33270f;
    --danger:#ff8b80;
    --danger-bg:#341614;
    --focus:#3ddab0;
  }

  *{box-sizing:border-box;}
  body{
    background:var(--bg);
    color:var(--text);
    font-family: "Comfortaa", sans-serif;
    padding:0 20px;
  }
  .wrap{
    max-width:960px;
    margin:0 auto;
    padding-block:40px 20px;
    display:flex;
    flex-direction:column;
    gap:28px;
  }

  header{
    display:flex;
    flex-direction:column;
    gap:10px;
  }
  .eyebrow{
    font-family: "Comfortaa", sans-serif;
    font-size:12px;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--accent-strong);
    font-weight:600;
  }
  h1{
    font-size:clamp(26px,4vw,34px);
    font-weight:700;
    margin:0;
    text-wrap:balance;
    letter-spacing:-.01em;
  }
  .version{
    margin:0;
    font-family: "Comfortaa", sans-serif;
    font-size:11px;
    color:var(--text-muted);
  }
  header p{
    margin:0;
    max-width:70ch;
    color:var(--text-muted);
    font-size:15px;
    line-height:1.55;
  }
  header p code{
    font-family: "Comfortaa", sans-serif;
    background:var(--surface-2);
    border:1px solid var(--border);
    border-radius:4px;
    padding:1px 5px;
    font-size:13px;
  }

  .card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    padding:22px;
    display:flex;
    flex-direction:column;
    gap:14px;
  }
  .card[hidden]{ display:none; }

  label.field-label{
    font-size:13px;
    font-weight:600;
    color:var(--text);
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:10px;
  }
  label.field-label .hint{
    font-weight:400;
    color:var(--text-muted);
    font-size:12.5px;
  }

  .pod-hint{
    margin:0;
    color:var(--text-muted);
    font-size:12.5px;
  }

  select, input[type="text"]{
    width:100%;
    background:var(--surface-2);
    color:var(--text);
    border:1px solid var(--border);
    border-radius:10px;
    padding:11px 14px;
    font-family: "Comfortaa", sans-serif;
    font-size:13.5px;
    line-height:1.6;
  }
  input[type="text"].pod-invalid,
  select.comune-invalid{
    background:var(--danger-bg);
    border-color:var(--danger);
  }
  select:focus-visible, input[type="text"]:focus-visible{
    outline:2px solid var(--focus);
    outline-offset:1px;
  }

  .field-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
  }
  @media (max-width:520px){
    .field-grid{ grid-template-columns:1fr; }
  }
  .field{
    display:flex;
    flex-direction:column;
    gap:8px;
  }

  .row{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
  }

  button{
    font-family:inherit;
    font-size:14px;
    font-weight:600;
    border-radius:9px;
    padding:10px 18px;
    border:1px solid transparent;
    cursor:pointer;
    transition:background .15s ease, border-color .15s ease, opacity .15s ease;
  }
  button:focus-visible{
    outline:2px solid var(--focus);
    outline-offset:2px;
  }
  button.primary{
    background:var(--accent);
    color:#ffffff;
  }
  button.primary:hover{ background:var(--accent-strong); }
  button.primary:disabled{
    opacity:.55;
    cursor:not-allowed;
  }
  button.ghost{
    background:transparent;
    border-color:var(--border);
    color:var(--text);
  }
  button.ghost:hover{ background:var(--surface-2); }
  button.ghost:disabled{
    opacity:.5;
    cursor:default;
  }

  .status{
    font-family: "Comfortaa", sans-serif;
    font-size:12.5px;
    color:var(--text-muted);
    min-height:16px;
    display:flex;
    align-items:center;
    gap:8px;
  }
  .spinner{
    width:12px; height:12px;
    border-radius:50%;
    border:2px solid var(--border);
    border-top-color:var(--accent);
    animation:spin .7s linear infinite;
    flex:none;
  }
  @media (prefers-reduced-motion: reduce){
    .spinner{ animation:none; }
  }
  @keyframes spin{ to{ transform:rotate(360deg); } }

  .alert{
    border-radius:10px;
    padding:12px 14px;
    font-size:13.5px;
    line-height:1.5;
    border:1px solid transparent;
    display:none;
  }
  .alert.show{ display:block; }
  .alert.danger{
    background:var(--danger-bg);
    border-color:color-mix(in srgb, var(--danger) 35%, transparent);
    color:var(--danger);
  }

  .results-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
  }
  .results-head h2{
    font-size:16px;
    margin:0;
    font-weight:600;
  }
  .chip{
    font-family: "Comfortaa", sans-serif;
    font-size:12px;
    font-weight:600;
    padding:3px 9px;
    border-radius:999px;
    background:var(--accent-tint);
    color:var(--accent-strong);
    white-space:nowrap;
  }

  .table-scroll{
    overflow-x:auto;
    border:1px solid var(--border);
    border-radius:10px;
  }
  table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
    min-width:760px;
  }
  thead th{
    text-align:left;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.06em;
    color:var(--text-muted);
    font-weight:600;
    padding:10px 12px;
    background:var(--surface-2);
    border-bottom:1px solid var(--border);
    position:sticky;
    top:0;
  }
  tbody td{
    padding:10px 12px;
    border-bottom:1px solid var(--border);
    font-family: "Comfortaa", sans-serif;
    font-variant-numeric:tabular-nums;
    vertical-align:top;
  }
  tbody tr:last-child td{ border-bottom:none; }
  tbody tr:hover{ background:var(--surface-2); }
  td.pod{ font-weight:600; }
  td.comune, td.gestore{ font-family:"IBM Plex Sans", sans-serif; }
  td.cer{ font-family:"IBM Plex Sans", sans-serif; font-weight:600; }

  .badge{
    display:inline-block;
    font-family: "Comfortaa", sans-serif;
    font-size:11.5px;
    font-weight:600;
    padding:2px 8px;
    border-radius:6px;
    white-space:nowrap;
  }
  .badge.ok{
    background:var(--accent-tint);
    color:var(--accent-strong);
  }
  .badge.miss{
    background:var(--warn-bg);
    color:var(--warn);
  }
  .badge.err{
    background:var(--danger-bg);
    color:var(--danger);
  }

  .note{
    font-size:12px;
    color:var(--text-muted);
    margin-top:2px;
  }

  .empty-state{
    color:var(--text-muted);
    font-size:13.5px;
    padding:20px 4px;
    text-align:center;
  }

  footer{
    color:var(--text-muted);
    font-size:12px;
    display:flex;
    flex-direction:column;
    gap:4px;
  }
  footer a{ color:var(--accent-strong); }