/* LAB0121 — stile condiviso delle aree riservate (admin.html e checkup-admin.html) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root {
  --ink: #111110; --paper: #F7F6F1; --soft: #EEECEA; --giallo: #F5A800; --giallo-testo: #8F6200;
  --muted: #6B6963; --border: rgba(17,17,16,.12); --errore: #B3261E;
  --f-display: 'Bebas Neue', sans-serif; --f-body: 'DM Sans', sans-serif; --f-mono: 'DM Mono', monospace;
}
body { background: var(--paper); color: var(--ink); font-family: var(--f-body); font-weight: 400; line-height: 1.55; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--giallo); outline-offset: 3px; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--giallo); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px 80px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 18px 0; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.logo { font-family: var(--f-display); font-size: 28px; letter-spacing: .06em; line-height: 1; text-decoration: none; color: var(--ink); display: block; }
.logo span { color: var(--giallo); }
.sub { font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.switch { display: flex; }
.switch a { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; padding: 11px 18px; border: 1px solid rgba(17,17,16,.3); margin-left: -1px; color: var(--muted); background: transparent; }
.switch a:first-child { margin-left: 0; }
.switch a[aria-current="page"] { background: var(--ink); color: var(--giallo); border-color: var(--ink); }
.switch a:not([aria-current]):hover { color: var(--ink); border-color: var(--ink); }

h1 { font-family: var(--f-display); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: .02em; margin-bottom: 6px; }
h2 { font-family: var(--f-display); font-weight: 400; font-size: 28px; line-height: 1; letter-spacing: .02em; margin: 32px 0 14px; }
.note { font-size: 14px; color: var(--muted); }
.mono { font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* accesso */
.box { background: #fff; border: 1px solid var(--border); padding: 44px 36px; max-width: 420px; margin: 12vh auto 0; }
.box label { display: block; font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 26px 0 8px; }
.err { color: var(--errore); font-size: 14px; min-height: 22px; margin-top: 10px; }

input, select, textarea { width: 100%; min-height: 46px; background: #fff; border: 1px solid rgba(17,17,16,.25); padding: 10px 14px; border-radius: 0; font-size: 15px; }
input:focus, select:focus { border-color: var(--giallo); box-shadow: 0 0 0 1px var(--giallo); outline: none; }

.btn { min-height: 44px; padding: 0 22px; background: var(--giallo); color: var(--ink); border: 1px solid var(--giallo); font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; transition: opacity .2s, border-color .2s; }
.btn:hover { opacity: .88; }
.btn.line { background: transparent; border-color: rgba(17,17,16,.3); }
.btn.line:hover { opacity: 1; border-color: var(--giallo); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--giallo); }
.btn.txt { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; padding: 0 8px; font-family: var(--f-body); font-size: 14px; letter-spacing: 0; text-transform: none; }
.btn.txt:hover { color: var(--ink); opacity: 1; }
.btn.danger { color: var(--errore); }

/* schede e riepiloghi */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 24px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 12px 16px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--giallo); font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--border); padding: 18px 20px; }
.kpi b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 44px; line-height: 1; }
.kpi.y b { color: var(--giallo-testo); }
.kpi span { font-size: 13px; color: var(--muted); }
.warn { background: rgba(245,168,0,.12); border: 1px solid var(--giallo); padding: 12px 16px; font-size: 14px; margin: 0 0 22px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 200px; }
.filters input[type="search"] { flex: 1; min-width: 220px; }
.count { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; color: var(--muted); white-space: nowrap; }
.bars { list-style: none; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(160px, 1.3fr) 3fr 44px; gap: 12px; align-items: center; font-size: 14px; }
.bars .t { height: 10px; background: var(--border); } .bars .t i { display: block; height: 100%; background: var(--giallo); }

/* tabelle */
.scroll { overflow-x: auto; background: #fff; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
th { text-align: left; padding: 14px 14px; font-family: var(--f-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--giallo); background: var(--ink); font-weight: 500; white-space: nowrap; }
th button { background: none; border: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; padding: 0; }
th button::after { content: ' ↕'; opacity: .4; }
th[aria-sort="ascending"] button::after { content: ' ↑'; opacity: 1; }
th[aria-sort="descending"] button::after { content: ' ↓'; opacity: 1; }
td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: rgba(17,17,16,.82); }
tbody tr:hover > td { background: var(--soft); }
tr.detail > td, tr.detail:hover > td { background: var(--paper); }
td.mono-cell { font-family: var(--f-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
td a { font-family: var(--f-mono); font-size: 12px; }
.badge { display: inline-block; font-family: var(--f-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.y { border-color: var(--giallo-testo); color: var(--giallo-testo); }
.code { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; }
.open { background: #fff; border: 1px solid var(--border); padding: 16px 18px; font-size: 14px; }
.open p + p { margin-top: 8px; }
.open dl { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 6px 16px; margin: 10px 0 14px; }
.open dt { color: var(--muted); } .open dd { font-weight: 500; }
details summary { cursor: pointer; font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--giallo-testo); }
details p { margin-top: 8px; max-width: 360px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }

.modal-bg { position: fixed; inset: 0; background: rgba(17,17,16,.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border: 1px solid var(--border); max-width: 460px; width: 100%; padding: 30px; }
.modal p { margin: 10px 0 22px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #F4F3EE; border-left: 3px solid var(--giallo); padding: 12px 20px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 60; }
.toast.on { opacity: 1; }
.state { text-align: center; padding: 70px 20px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }

@media (max-width: 900px) {
  .wrap { padding: 0 16px 60px; }
  h1 { font-size: 36px; }
  .box { padding: 32px 22px; margin-top: 8vh; }
  .open dl { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: 1fr 44px; } .bars .t { grid-column: 1 / -1; grid-row: 2; }
}
