/* OFIW Admin — accessibilità e leggibilità */
:root{color-scheme:light;--ink:#172238;--blue:#123a61;--line:#bac5d2;--paper:#fff;--bg:#eef2f6}
html{font-size:18px}
body{background:var(--bg);color:var(--ink);font:400 1rem/1.65 system-ui,-apple-system,"Segoe UI",Arial,sans-serif}
main{box-sizing:border-box;width:calc(100% - 48px);max-width:1440px;margin:28px auto;padding:clamp(22px,3vw,42px);border:1px solid #cbd5e1;box-shadow:0 5px 24px #16263b12}
h1,h2,h3{line-height:1.25;color:#102e4e;letter-spacing:-.015em}
h1{font-size:2rem}h2{font-size:1.5rem;margin:2rem 0 .8rem;padding-bottom:.4rem;border-bottom:2px solid #d4dde7}
h3{font-size:1.2rem}
p,li,td,th,label{font-size:1rem}
a{color:#084e85;text-underline-offset:3px}
a:hover{text-decoration-thickness:2px}
button,.button,input[type=submit],input[type=button]{width:auto;min-height:48px;display:inline-flex;align-items:center;justify-content:center;padding:11px 20px;background:var(--blue);color:#fff;border:2px solid var(--blue);border-radius:8px;font-weight:650;line-height:1.3;text-decoration:none;cursor:pointer}
button:hover,.button:hover{background:#082742}
button:focus-visible,.button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #c07500;outline-offset:3px}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea{box-sizing:border-box;max-width:100%;min-height:46px;padding:10px 12px;font:inherit;color:var(--ink);background:#fff;border:2px solid #718198;border-radius:7px}
input[type=checkbox],input[type=radio]{width:20px;height:20px;accent-color:var(--blue)}
label{font-weight:700;color:#172b43}
small{font-size:.88rem;color:#394b61}
table{width:100%;border-collapse:collapse;font-size:1rem}
th{background:#e5ecf4;color:#172b43;font-weight:750;text-align:left}
th,td{padding:13px 15px!important;border-bottom:1px solid #bfcbd8!important;vertical-align:top}
tbody tr:nth-child(even){background:#f3f7fb}
tbody tr:hover{background:#e9f2fc}
.ofiw-stats{grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px}
.ofiw-stat{padding:22px!important;background:#f7f9fc!important;border:2px solid #c6d2df!important;border-radius:12px!important}
.ofiw-stat span{font-size:1rem!important;color:#293b51!important;font-weight:650}
.ofiw-stat strong{font-size:2rem!important;color:#0b3156!important;overflow-wrap:anywhere}
.error{color:#9b1c1c;font-weight:650}.success{color:#17603a;font-weight:650}
@media(max-width:650px){html{font-size:17px}main{width:calc(100% - 20px);margin:10px auto;padding:18px}th,td{padding:10px!important}.ofiw-stats{grid-template-columns:repeat(auto-fit,minmax(145px,1fr))}}

/* Mantiene compatta la schermata di accesso */
body:has(input[type=password]) main{max-width:500px}

/* OFIW visual refinement: cards, hierarchy and restrained gold accents */
body{background:linear-gradient(145deg,#e8eff6 0%,#f5f7fa 55%,#f2eee5 100%);background-attachment:fixed}
main{background:#fff;border:1px solid #c8d3df;border-top:6px solid #bd9250;border-radius:18px;box-shadow:0 14px 42px #152c4a18}
h1{border-left:6px solid #bd9250;padding-left:16px;margin-bottom:1rem}
h2{background:#edf3f9;border-left:5px solid #ba8d43;border-bottom:1px solid #cad6e2;padding:13px 16px;border-radius:0 10px 10px 0;margin-top:2.2rem}
h3{color:#173f68}
.ofiw-stat{background:linear-gradient(150deg,#fff,#f0f5fa)!important;border:1px solid #c5d2df!important;border-left:5px solid #ba8d43!important;box-shadow:0 4px 12px #102d4d0b;transition:box-shadow .15s ease}
.ofiw-stat:hover{box-shadow:0 7px 18px #102d4d1a}
.ofiw-stat strong{color:#103b63!important}
.ofiw-stats .ofiw-stat:nth-child(4n + 2){border-left-color:#37769b!important}
.ofiw-stats .ofiw-stat:nth-child(4n + 3){border-left-color:#3d826e!important}
.ofiw-stats .ofiw-stat:nth-child(4n + 4){border-left-color:#a86c58!important}
.button,button,input[type=submit]{box-shadow:0 3px 9px #0f345523}
.button:hover,button:hover,input[type=submit]:hover{box-shadow:0 5px 14px #0f34553b}
table{border:1px solid #ccd7e3;border-radius:10px;overflow:hidden}
thead th{background:#193e63!important;color:#fff!important;border-bottom:2px solid #ba8d43!important}
tbody tr:nth-child(even){background:#f0f5fa}
tbody tr:hover{background:#e4f0fb}
section[aria-label]{padding:2px 0 16px}
@media(prefers-reduced-motion:reduce){.ofiw-stat{transition:none}}

/* Revisione: griglia delicata e sezioni con tonalità distinte, senza barre laterali */
h1{border-left:0;padding-left:0}
h2{border-left:0;border-bottom:1px solid #c9d5e0;border-radius:10px;padding:14px 18px;background:#edf3f9}
.ofiw-stat,.ofiw-stats .ofiw-stat:nth-child(n){border:1px solid #cbd5df!important;border-left:1px solid #cbd5df!important;border-radius:8px!important;box-shadow:none;background:#fff!important}
.ofiw-stat:hover{box-shadow:none}
.ofiw-stats{gap:0!important;grid-template-columns:repeat(auto-fit,minmax(205px,1fr));border:1px solid #ccd6e1;border-radius:10px;overflow:hidden;background:#ccd6e1}
.ofiw-stats .ofiw-stat{margin:-.5px;border-radius:0!important;min-height:95px}
.ofiw-stats .ofiw-stat:nth-child(odd){background:#f9fbfd!important}
.ofiw-stats .ofiw-stat:nth-child(even){background:#f2f6fa!important}
/* Ogni gruppo: titolo e celle coordinate, con sfumature discrete */
h2:has(+ .ofiw-stats),h2:has(+ p + .ofiw-stats){background:#edf3fa}
h2:nth-of-type(2){background:#f4f0e7}
h2:nth-of-type(3){background:#eaf4f0}
h2:nth-of-type(4){background:#f0eff8}
h2:nth-of-type(5){background:#f9f0ec}
table{border:1px solid #ccd6e1;border-radius:8px}
thead th{background:#e6edf5!important;color:#173653!important;border-bottom:1px solid #bdcbd8!important}
th,td{border-right:1px solid #d9e1e9!important;border-bottom:1px solid #d9e1e9!important}
th:last-child,td:last-child{border-right:0!important}
tbody tr:nth-child(even){background:#f7f9fc}
tbody tr:hover{background:#edf3f9}

/* OFIW Admin v4 — compact dashboard and actual section-colored grids */
html{font-size:16px!important}
body{font-size:16px!important;line-height:1.45!important}
main{max-width:1380px!important;margin:16px auto!important;padding:24px 30px!important}
h1{font-size:1.65rem!important;margin-bottom:12px!important}
h2{font-size:1.18rem!important;margin:23px 0 10px!important;padding:10px 14px!important}
h3{font-size:1.05rem!important}
p{margin:9px 0!important}
.ofiw-stats{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:1px!important;padding:1px!important;border:1px solid #b7c7d7!important;border-radius:8px!important;background:#b7c7d7!important;margin:12px 0!important}
.ofiw-stats .ofiw-stat,.ofiw-stats .ofiw-stat:nth-child(n){box-sizing:border-box!important;min-width:0;min-height:0!important;margin:0!important;padding:12px 15px!important;border:0!important;border-radius:0!important;background:#edf4fb!important}
.ofiw-stats .ofiw-stat span{font-size:.88rem!important;font-weight:650!important}
.ofiw-stats .ofiw-stat strong{font-size:1.55rem!important;line-height:1.2!important;margin-top:4px!important}
.ofiw-stats .ofiw-stat:nth-child(even){background:#e4eef8!important}
.ofiw-stats:nth-of-type(2) .ofiw-stat:nth-child(n){background:#fbf4e7!important}
.ofiw-stats:nth-of-type(2) .ofiw-stat:nth-child(even){background:#f5e9d4!important}
.ofiw-stats:nth-of-type(3) .ofiw-stat:nth-child(n){background:#eaf5ee!important}
.ofiw-stats:nth-of-type(3) .ofiw-stat:nth-child(even){background:#dcf0e3!important}
.ofiw-stats:nth-of-type(4) .ofiw-stat:nth-child(n){background:#f0edfa!important}
.ofiw-stats:nth-of-type(4) .ofiw-stat:nth-child(even){background:#e7e1f5!important}
.ofiw-stats:nth-of-type(5) .ofiw-stat:nth-child(n){background:#fdf0eb!important}
.ofiw-stats:nth-of-type(5) .ofiw-stat:nth-child(even){background:#f8e3da!important}
button,.button,input[type=submit]{min-height:38px!important;padding:8px 14px!important;font-size:.92rem!important;margin-top:10px!important}
th,td{padding:8px 10px!important;font-size:.92rem!important}
label{margin:10px 0 4px!important}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea{min-height:38px!important;padding:7px 10px!important}
@media(max-width:900px){.ofiw-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:560px){main{width:calc(100% - 16px)!important;padding:14px!important}.ofiw-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}}

/* OFIW v5: palette per sezioni basata sull'ordine effettivo delle griglie */
.ofiw-stats{background:#aebfce!important;border-color:#aebfce!important}
.ofiw-stats .ofiw-stat:nth-child(n){background:#e5f1fc!important}
.ofiw-stats .ofiw-stat:nth-child(even){background:#d6e8f8!important}
.ofiw-stats:where(:nth-of-type(2)) .ofiw-stat:nth-child(n){background:#fff0d5!important}
.ofiw-stats:where(:nth-of-type(2)) .ofiw-stat:nth-child(even){background:#fbe4b9!important}
.ofiw-stats:where(:nth-of-type(3)) .ofiw-stat:nth-child(n){background:#dff3e8!important}
.ofiw-stats:where(:nth-of-type(3)) .ofiw-stat:nth-child(even){background:#ccebdc!important}
.ofiw-stats:where(:nth-of-type(4)) .ofiw-stat:nth-child(n){background:#eae5fa!important}
.ofiw-stats:where(:nth-of-type(4)) .ofiw-stat:nth-child(even){background:#ddd5f4!important}
.ofiw-stats:where(:nth-of-type(5)) .ofiw-stat:nth-child(n){background:#fce8df!important}
.ofiw-stats:where(:nth-of-type(5)) .ofiw-stat:nth-child(even){background:#f7d9ca!important}
/* Colora anche le griglie precedute da titoli e paragrafi: supporto :has */

/* nth-child(... of selector) conta esclusivamente le griglie .ofiw-stats */
.ofiw-stats:nth-child(2 of .ofiw-stats) .ofiw-stat:nth-child(n){background:#fff0d5!important}
.ofiw-stats:nth-child(2 of .ofiw-stats) .ofiw-stat:nth-child(even){background:#fbe4b9!important}
.ofiw-stats:nth-child(3 of .ofiw-stats) .ofiw-stat:nth-child(n){background:#dff3e8!important}
.ofiw-stats:nth-child(3 of .ofiw-stats) .ofiw-stat:nth-child(even){background:#ccebdc!important}
.ofiw-stats:nth-child(4 of .ofiw-stats) .ofiw-stat:nth-child(n){background:#eae5fa!important}
.ofiw-stats:nth-child(4 of .ofiw-stats) .ofiw-stat:nth-child(even){background:#ddd5f4!important}
.ofiw-stats:nth-child(5 of .ofiw-stats) .ofiw-stat:nth-child(n){background:#fce8df!important}
.ofiw-stats:nth-child(5 of .ofiw-stats) .ofiw-stat:nth-child(even){background:#f7d9ca!important}
