/* © 2026 Barusco Rovetti & Associati – Studio Legale e Tributario, Padova. Tutti i diritti riservati.
 * Applicazione dello Studio: https://www.baruscorovetti.it/applicazioni.htm
 * È vietata la copia, la modifica e la ripubblicazione del codice senza autorizzazione scritta dello Studio. */
/* Stile allineato a baruscorovetti.it e alle altre app dello studio */
:root {
  --paper: #f6f6f6;
  --sheet: #ffffff;
  --ink: #2b2b2b;
  --muted: #6b6b6b;
  --faint: #8a8a8a;
  --rule: #e2e2e2;
  --accent: #c24a04;
  --accent-soft: #fdeee4;
  --accent-deep: #9e3c03;
  --accent-bright: #f25c05;
  --seal: #b42318;
  --seal-soft: #fbe9e7;
  --ok: #2f6b3f;
  --ok-soft: #e6f2e9;
  --field: #fafafa;
  --f-body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--f-body); color: var(--ink);
  background: linear-gradient(var(--accent-soft), var(--paper) 340px) no-repeat, var(--paper);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 40px;
}
.wrap { max-width: 1180px; margin: 0 auto; display: grid; gap: 22px; }
[hidden] { display: none !important; }
a { color: var(--accent); }

/* Intestazione come la nota spese */
header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 24px; padding-bottom: 14px; border-bottom: 2px solid var(--accent); }
header h1 { margin: 0; font-size: clamp(24px, 3.2vw, 32px); font-weight: 800; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
header .sub { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.hdr-r { display: grid; justify-items: end; gap: 10px; }
.studio { font-family: var(--f-num); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: right; line-height: 1.5; }
.user { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.user b { color: var(--ink); text-transform: uppercase; font-weight: 700; }
header .linkbtn { border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); text-decoration: none; padding: 7px 12px; border-radius: 4px; font-weight: 600; font-size: 13.5px; }
header .linkbtn:hover { border-color: var(--accent); color: var(--accent); }

.eyebrow { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-bright); font-weight: 700; }
h1 { font-weight: 800; }
h2 { margin: 0; font-size: 18.4px; font-weight: 600; }
.lead { margin: 6px 0 0; color: var(--muted); max-width: 75ch; }
.small { font-size: 13px; }
.mono { font-family: var(--f-num); font-size: 12.5px; }

/* Layout */
.grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 24px; min-width: 0; }
.panel.risultati { border-top: 4px solid var(--accent); }
form { display: grid; gap: 18px; }

/* Campi */
label, .lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
select, input[type=date], input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--field); color: var(--ink); font: 600 15.2px var(--f-body); }
select:focus-visible, input:focus-visible, button:focus-visible, .seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.help { font-size: 13px; color: var(--muted); margin-top: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; width: fit-content; max-width: 100%; background: var(--field); }
.seg label { margin: 0; padding: 8px 14px; font-weight: 500; color: var(--ink); cursor: pointer; border-right: 1px solid var(--rule); font-size: 14.5px; text-transform: none; letter-spacing: 0; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; }
.quickdates { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quickdates button { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--rule); background: var(--sheet); color: var(--muted); cursor: pointer; }
.quickdates button:hover { border-color: var(--accent); color: var(--accent); }
.regime { font-size: 13.5px; padding: 9px 12px; border-radius: 4px; background: var(--accent-soft); color: var(--ink); }

/* Pulsanti */
.btn { font: 700 15.2px var(--f-body); letter-spacing: .02em; padding: 11px 16px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.sec { background: var(--sheet); color: var(--ink); border-color: var(--rule); font-weight: 600; }
.btn.sec:hover { border-color: var(--accent); color: var(--accent); background: var(--sheet); }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; color: var(--accent); cursor: pointer; text-decoration: underline; }
.copy { font: 600 14px var(--f-body); padding: 7px 14px; border-radius: 4px; border: 1px solid var(--rule); color: var(--ink); background: var(--sheet); cursor: pointer; }
.copy:hover { border-color: var(--accent); color: var(--accent); }

/* Risultati */
.res-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.res-head h2 { font-size: 18.4px; }
.term { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 18px; padding: 18px 0; border-top: 1px solid var(--rule); }
.term:first-of-type { border-top: 0; }
.t-name { font-weight: 700; font-size: 16px; }
.t-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pill { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.pill.per { background: var(--seal-soft); color: var(--seal); }
.pill.dv { background: var(--accent-soft); color: var(--accent-deep); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.warn { margin-top: 10px; font-size: 13.5px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 4px 4px 0; }
details { margin-top: 10px; font-size: 14px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13.5px; }
details ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
details li { margin: 2px 0; }
.src { font-size: 13px; color: var(--muted); margin-top: 8px; }
.empty { color: var(--muted); padding: 24px 0; }
.foot { font-size: 12.5px; color: var(--faint); max-width: 95ch; margin: 0; }
.err { color: var(--seal); font-size: 14px; }

/* Accesso, liberatoria, accessi */
.center { min-height: 70vh; display: grid; place-items: center; }
.box { width: min(440px, 100%); }
.box.wide { width: min(760px, 100%); }
.box h1 { font-size: 24px; margin: 4px 0 0; }
.stack { display: grid; gap: 14px; }
.legal { max-height: min(52vh, 460px); overflow-y: auto; border: 1px solid var(--rule); border-radius: 6px; padding: 4px 18px; background: var(--field); font-size: 14px; line-height: 1.65; }
.legal h3 { font-size: 14.5px; margin: 14px 0 4px; }
.legal p, .legal li { margin: 4px 0; max-width: 75ch; }
.legal ol { padding-left: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }
.boot { padding: 80px 0; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; z-index: 10; }

@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } header { grid-template-columns: minmax(0, 1fr); } .hdr-r { justify-items: start; } .studio { text-align: left; } }
@media (max-width: 460px) {
  body { padding-block: 18px 32px; }
  .panel { padding: 18px; }
  .term { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Importo principale e tabelle */
.cu-tot { padding: 4px 0 16px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.cu-num { font-family: var(--f-num); font-size: 34px; font-weight: 600; line-height: 1.1; color: var(--ink); word-break: break-word; }
.cu-tab { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 6px 0 4px; }
.cu-tab th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.cu-tab td { padding: 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.cu-tab .num { text-align: right; font-family: var(--f-num); white-space: nowrap; padding-left: 16px; }
.cu-tab .cu-sum td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
@media (max-width: 460px) { .cu-num { font-size: 28px; } }

.box-r { border: 1px solid var(--rule); border-radius: 6px; padding: 14px; margin: 0; display: grid; gap: 14px; background: var(--field); }
.box-r legend { font-size: 12.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; padding: 0 6px; }
.box-r input[type=text] { background: var(--sheet); }
.san-ravv { margin-top: 10px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent-soft); }
.san-ravv .cu-tab { margin: 0; }
.san-ravv .cu-tab td { border-bottom-color: rgba(194,74,4,.18); }

/* Logo dello studio, collegato alla homepage del sito */
.brandbar { max-width: 1180px; margin: 0 auto 18px; }
.brandlink { display: inline-block; line-height: 0; border-radius: 4px; }
.brandlink img { display: block; height: 48px; width: auto; }
.brandlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (max-width: 560px) { .brandlink img { height: 40px; } }

/* Statistiche di utilizzo (area riservata) */
.st-wrap { overflow-x: auto; margin-top: 8px; }
table.st { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
table.st th, table.st td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
table.st thead th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
table.st th:first-child { text-align: left; }
table.st td { font-family: var(--f-num); }
table.st tfoot th, table.st tfoot td { border-top: 2px solid var(--rule); border-bottom: 0; font-weight: 700; }

/* Pignoramento */
.pg-tab td .t-meta { font-size: 12.5px; margin-top: 3px; }
.pg-norma { font-size: 12px; color: var(--accent-deep); font-weight: 600; margin-top: 2px; }
