:root {
  --inchiostro: #17181c;
  --tenue: #6b7078;
  --linea: #e3e5e9;
  --fondo: #fbfbfc;
  --accento: #1f5f4b;
  --errore: #a3282d;
  --avviso: #8a5a00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--inchiostro);
  background: var(--fondo);
}

/* ---------------------------------------------------------------- accesso */
body.accesso { display: grid; place-items: center; min-height: 100vh; }
body.accesso .riquadro {
  width: min(360px, 92vw); background: #fff; padding: 32px;
  border: 1px solid var(--linea); border-radius: 14px;
}
body.accesso h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
label { display: block; margin-top: 18px; font-size: 13px; color: var(--tenue); }
input {
  width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--linea); border-radius: 8px; background: #fff;
}
input:focus { outline: 2px solid color-mix(in srgb, var(--accento) 40%, transparent); outline-offset: 1px; }
button {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--linea);
  background: #fff; padding: 10px 16px; color: var(--inchiostro);
}
button:hover:not(:disabled) { border-color: #c9ccd2; }
button.primario { background: var(--accento); border-color: var(--accento); color: #fff; }
button.primario:hover:not(:disabled) { background: #1a5342; }
button.pericolo { color: var(--errore); border-color: #e8c9ca; }
button:disabled { opacity: .45; cursor: not-allowed; }
body.accesso button { width: 100%; margin-top: 24px; background: var(--accento); border-color: var(--accento); color: #fff; }
.tenue { color: var(--tenue); font-size: 13px; }
.errore { color: var(--errore); font-size: 13px; }

/* ------------------------------------------------------------------ guscio */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--linea); background: #fff;
}
.marca { font-weight: 600; letter-spacing: -.01em; }
.marca span {
  font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--tenue); border: 1px solid var(--linea); border-radius: 999px; padding: 2px 8px; margin-left: 8px;
  vertical-align: 2px;
}
main { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 48px) 96px; }
section { margin-bottom: 48px; }
section[hidden] { display: none; }
h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--tenue);
  font-weight: 600; margin: 0 0 16px;
}

/* ------------------------------------------------------------------- drop */
#dropzone {
  border: 1.5px dashed #cfd3da; border-radius: 14px; background: #fff;
  padding: 44px 24px; text-align: center; cursor: pointer; transition: .15s;
}
#dropzone:hover, #dropzone.attivo { border-color: var(--accento); background: #f4f9f7; }
#dropzone forte { display: block; font-size: 17px; font-weight: 600; margin-bottom: 6px; }

.elenco { margin-top: 16px; border: 1px solid var(--linea); border-radius: 12px; background: #fff; overflow: hidden; }
.elenco .riga {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--linea); font-size: 14px;
}
.elenco .riga:last-child { border-bottom: 0; }
.elenco .riga .dx { color: var(--tenue); white-space: nowrap; }
.azioni { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; flex-wrap: wrap; }

/* -------------------------------------------------------------- progresso */
.barra { height: 6px; background: #eceef1; border-radius: 99px; overflow: hidden; }
.barra > i { display: block; height: 100%; width: 0; background: var(--accento); transition: width .3s; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.kpi div { background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 14px 16px; }
.kpi b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--tenue); }

details.file { background: #fff; border: 1px solid var(--linea); border-radius: 12px; margin-top: 10px; }
details.file summary { padding: 12px 16px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
details.file summary::-webkit-details-marker { display: none; }
details.file pre {
  margin: 0; padding: 16px; border-top: 1px solid var(--linea); max-height: 420px; overflow: auto;
  font: 12.5px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; color: #2a2c31;
}

/* ---------------------------------------------------------------- tabella */
.tabella { width: 100%; border-collapse: collapse; background: #fff; font-size: 13.5px; }
.tabella th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--tenue); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap;
}
.tabella td { padding: 8px 10px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabella td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabella input { border: 0; background: transparent; padding: 4px 2px; width: 100%; font: inherit; }
.tabella input:hover { background: #f4f5f7; }
.tabella input.modificato { background: #fff6e0; }
.tabella tr.gruppo td { background: #f5f6f8; font-weight: 600; }
.tabella tr.totale td { font-weight: 600; background: #f0f5f3; }
.pillola {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--linea); color: var(--tenue); white-space: nowrap;
}
.pillola.no { color: var(--errore); border-color: #e8c9ca; background: #fdf4f4; }
.pillola.si { color: var(--accento); border-color: #cfe3db; background: #f2f9f6; }
.avviso { background: #fffdf4; border: 1px solid #efe0b8; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: var(--avviso); }
