/* SCECES Agenda Ispettori — mobile first */
:root {
  --brand: #1d4b9c;
  --brand-2: #163a7a;
  --brand-soft: #e6edf9;
  --accent: #f3b31a;
  --ok: #1a8a57;
  --ok-soft: #e0f3ea;
  --bad: #cf3434;
  --bad-soft: #fbe6e6;
  --warn: #b97800;
  --warn-soft: #fff3d6;
  --info-soft: #e3eefc;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --text: #17202f;
  --muted: #64708a;
  --line: #dde2ec;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .22);
  --radius: 14px;
  --tap: 46px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 62px;
  --topbar-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #6f9bf0;
    --brand-2: #4d7fe0;
    --brand-soft: #1c2c4c;
    --ok: #4cc38a;
    --ok-soft: #17342a;
    --bad: #ff7b7b;
    --bad-soft: #3b1f22;
    --warn: #f1b94a;
    --warn-soft: #382c12;
    --info-soft: #182a45;
    --bg: #0e1521;
    --surface: #172131;
    --surface-2: #1c2839;
    --text: #e8edf6;
    --muted: #93a0b8;
    --line: #2a3850;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.lg { width: 26px; height: 26px; }
.ic.sm { width: 16px; height: 16px; }

/* ---------- boot / spinner ---------- */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--bg); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 48px 0; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) 14px 0;
  background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar { background: #14203a; } }
.topbar .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; color: #fff; text-decoration: none; }
.topbar .logo img { width: 34px; height: 34px; border-radius: 8px; background: #fff; padding: 2px; object-fit: contain; }
.topbar .title { font-weight: 600; font-size: 1.05rem; }
.iconbtn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: transparent; color: inherit; cursor: pointer; position: relative;
}
.iconbtn:active { background: rgba(127, 127, 127, .2); }
.topbar .iconbtn:hover { background: rgba(255, 255, 255, .12); }
.netbadge { display: none; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: .8rem; font-weight: 600; }
body.offline .netbadge { display: inline-flex; }

.body { flex: 1; display: flex; min-height: 0; }
.view { flex: 1; min-width: 0; padding: 14px 14px calc(var(--tabbar-h) + var(--safe-b) + 22px); max-width: 960px; width: 100%; margin: 0 auto; }
.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; position: relative; min-width: 0;
}
.tab.active { color: var(--brand); }
.tab.desk { display: none; }
.tab .cnt {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: .68rem; display: grid; place-items: center;
}
.tab .cnt.soft { background: var(--brand); }
@media (min-width: 900px) {
  .tab.desk { display: flex; }
  .tab.mob { display: none; }
  .body { padding-left: 220px; }
  .tabbar {
    top: calc(var(--topbar-h) + var(--safe-t)); bottom: 0; right: auto; width: 220px; height: auto; flex-direction: column;
    justify-content: flex-start; padding: 12px 10px; gap: 4px; border-top: 0; border-right: 1px solid var(--line);
  }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; }
  .tab.active { background: var(--brand-soft); }
  .tab .cnt { position: static; margin-left: auto; }
  .view { padding-bottom: 40px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none; user-select: none;
}
.btn:active { transform: translateY(1px); filter: brightness(.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0b1220; } }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 14px; }
.section-title { margin: 22px 2px 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 2px 14px; }
.pagehead h1 { font-size: 1.35rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: block; padding: 14px; color: inherit; text-decoration: none; position: relative; overflow: hidden; }
.stat .n { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--brand); }
.stat .l { margin-top: 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat.hot .n { color: var(--bad); }
.stat .ic { position: absolute; right: 10px; top: 10px; opacity: .18; width: 34px; height: 34px; }

.vlist { display: grid; gap: 10px; }
@media (min-width: 900px) { .vlist.cols { grid-template-columns: 1fr 1fr; } }
.vcard { padding: 14px; display: grid; gap: 8px; position: relative; }
.vcard.sel { outline: 2px solid var(--brand); }
.vcard .top { display: flex; align-items: flex-start; gap: 10px; }
.vcard .when { font-size: .8rem; font-weight: 700; color: var(--brand); text-transform: capitalize; }
.vcard .ditta { font-weight: 700; }
.vcard .addr { color: var(--muted); font-size: .92rem; }
.vcard .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .84rem; color: var(--muted); }
.vcard .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.vcard .note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: .88rem; display: flex; gap: 8px; }
.pick { width: 24px; height: 24px; accent-color: var(--brand); flex: none; margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty .ic { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.s1 { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.s2 { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.s3, .badge.s4 { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.s5 { background: var(--info-soft); color: var(--brand); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.okb { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 200px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 38px; }
.sticky-actions {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); z-index: 20; margin-top: 12px; padding: 10px;
  display: flex; gap: 8px; align-items: center; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--brand); box-shadow: var(--shadow-lg);
}
@media (min-width: 900px) { .sticky-actions { bottom: 18px; } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .lbl { font-size: .84rem; font-weight: 700; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364708a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input[readonly] { background: var(--surface-2); }
input[type="date"] { min-width: 0; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
.field.two { grid-template-columns: 1fr 1fr; gap: 10px; }
.field.two > label { grid-column: 1 / -1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .82rem; color: var(--muted); }
.err { color: var(--bad); font-size: .85rem; }

.seg { display: flex; gap: 6px; }
.seg > button {
  flex: 1; min-height: var(--tap); padding: 6px 8px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 700; cursor: pointer; line-height: 1.15;
}
.seg.wrapseg { flex-wrap: wrap; }
.seg.wrapseg > button { flex: 1 1 calc(50% - 6px); }
.seg > button[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg > button[aria-checked="true"] { color: #0b1220; } }
.seg.cnc > button[data-v="1"][aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.seg.cnc > button[data-v="2"][aria-checked="true"] { background: var(--bad); border-color: var(--bad); }
.seg.cnc > button[data-v="3"][aria-checked="true"] { background: #6b7690; border-color: #6b7690; }
.seg.cnc > button[aria-checked="true"] { color: #fff; }
.seg .sub { display: block; font-size: .68rem; font-weight: 600; opacity: .85; }

.switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--bad); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; background: linear-gradient(180deg, var(--brand-soft), var(--bg) 60%); }
.login .box { width: 100%; max-width: 380px; padding: 26px 22px; text-align: center; }
.login img { width: 132px; height: auto; margin-bottom: 6px; border-radius: 12px; }
.login h1 { font-size: 1.25rem; margin-bottom: 4px; }
.login form { text-align: left; margin-top: 18px; }

/* ---------- wizard ---------- */
.wiz { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.wiz-head {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px;
  min-height: calc(var(--safe-t) + 54px); padding: calc(var(--safe-t) + 6px) 8px 6px; background: var(--brand); color: #fff;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wiz-head { background: #14203a; } }
.wiz-head .t { flex: 1; min-width: 0; line-height: 1.2; padding: 0 4px; }
.wiz-head .t b { display: block; font-size: 1rem; }
.wiz-head .t span { display: block; font-size: .8rem; opacity: .85; }
.wiz-head .iconbtn:hover { background: rgba(255,255,255,.14); }
.steps {
  position: sticky; top: calc(var(--safe-t) + 54px); z-index: 25; display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px;
  background: var(--surface); border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }
.step {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 19px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 700; cursor: pointer; color: var(--muted);
}
.step .no { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: .75rem; }
.step.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.step.done .no { background: var(--ok); color: #fff; }
.step.cur { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.step.cur .no { background: var(--brand); color: #fff; }
.wiz-body { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 14px 14px 130px; }
.wiz-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 12px calc(10px + var(--safe-b));
  background: var(--surface); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center;
}
.wiz-foot .status { flex: 1; min-width: 0; font-size: .78rem; color: var(--muted); text-align: center; line-height: 1.25; }
.wiz-foot .btn { min-width: 108px; }
.savestate { display: inline-flex; align-items: center; gap: 5px; }
.savestate.dirty { color: var(--warn); font-weight: 700; }

.group { margin-bottom: 12px; padding: 14px; border-left: 5px solid var(--accent); }
.group.done { border-left-color: var(--ok); }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.group-head h3 { flex: 1; font-size: .98rem; }
.okbtn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-size: .8rem; font-weight: 700; cursor: pointer;
}
.okbtn[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }

.tipo-grid { display: grid; gap: 8px; }
.tipo-opt {
  display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); cursor: pointer; text-align: left; min-height: 60px;
}
.tipo-opt b { display: block; }
.tipo-opt small { color: var(--muted); }
.tipo-opt[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); }
.tipo-opt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.tipo-opt[aria-checked="true"] .radio { border-color: var(--brand); }
.tipo-opt[aria-checked="true"] .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }

.qprog { position: sticky; top: calc(var(--safe-t) + 110px); z-index: 20; margin: -4px 0 12px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 700; }
.bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .25s; }
.q { margin-bottom: 12px; padding: 14px; border-left: 5px solid var(--line); scroll-margin-top: 170px; }
.q.a1 { border-left-color: var(--ok); }
.q.a2 { border-left-color: var(--bad); }
.q.a3 { border-left-color: #6b7690; }
.q .qh { display: flex; gap: 10px; margin-bottom: 10px; align-items: baseline; }
.q .qn { font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.q .qt { font-weight: 700; }
.q .qbody { margin-top: 12px; display: grid; gap: 10px; }
.q .qtools { display: flex; gap: 8px; flex-wrap: wrap; }
.techNote { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 8px 10px; font-size: .88rem; font-weight: 600; }
.varie-row { display: flex; gap: 8px; align-items: flex-start; }
.varie-row .no { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; margin-top: 8px; font-size: .85rem; }
.varie-row textarea { min-height: 56px; }

.esito { padding: 20px; text-align: center; }
.esito .big { font-size: 1.3rem; font-weight: 800; margin: 8px 0; }
.esito.p { background: var(--ok-soft); color: var(--ok); }
.esito.n { background: var(--bad-soft); color: var(--bad); }
.esito.z { background: var(--warn-soft); color: var(--warn); }
.esito.w { background: var(--surface-2); color: var(--muted); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.checklist li.ok { color: var(--ok); }
.checklist li.ko { color: var(--bad); font-weight: 600; }
.checklist .ic { flex: none; }

/* ---------- overlay / sheet / toast ---------- */
#layer { position: relative; z-index: 60; }
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 26, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; display: flex; flex-direction: column; background: var(--surface);
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); animation: rise .2s ease-out;
  padding-bottom: var(--safe-b);
}
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 14px 10px 8px 18px; }
.sheet-h h2 { flex: 1; }
.sheet-b { overflow-y: auto; padding: 4px 18px 18px; -webkit-overflow-scrolling: touch; }
.sheet-f { display: flex; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.sheet-f .btn { flex: 1; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; } }
.dialog { max-width: 420px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .5; } }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li > button {
  width: 100%; text-align: left; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; line-height: 1.35;
}
.plist li > button:active { background: var(--surface-2); }
.plist li.sel > button { color: var(--brand); font-weight: 700; }
.plist .mine { font-size: .7rem; color: var(--accent); font-weight: 800; margin-left: 6px; }

#toasts { position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 480px; padding: 12px 16px; border-radius: 12px; background: #1c2536; color: #fff; box-shadow: var(--shadow-lg); font-weight: 600; animation: rise .2s; display: flex; gap: 10px; align-items: center; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
.toast.warn { background: #8a5b00; }
body.in-wiz #toasts { bottom: calc(90px + var(--safe-b)); }
@media (min-width: 900px) { #toasts { bottom: 20px; } }

.filelist { display: grid; gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.file .th { width: 52px; height: 52px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--muted); }
.file .th img { width: 100%; height: 100%; object-fit: cover; }
.msg { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.msg.new { background: var(--info-soft); }
.msg .h { display: flex; gap: 8px; font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); margin-bottom: 12px; font-size: .92rem; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--info-soft); color: var(--brand); }
.banner .btn { margin-top: 8px; }

@media print { .topbar, .tabbar, .wiz-foot, .steps { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- modelli di vista ---------- */
.viewsw { max-width: 420px; }
.viewsw > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
.gridwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 760px; }
table.grid th { text-align: left; padding: 10px 12px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
table.grid td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.grid tr:hover td { background: var(--surface-2); }
table.grid tr.sel td { background: var(--surface-2); box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--brand) 12%, transparent); }
table.grid td input.pick { width: 18px; height: 18px; }
.mapbox { height: min(62dvh, 560px); min-height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.leaflet-popup-content { color: #17202f; }
