:root {
  --ink: #1d2733; --muted: #5d6b7a; --line: #e3e8ee; --bg: #f5f7fa; --card: #fff;
  --accent: #0b6e4f; --accent-2: #e8f4ef; --warn: #b45309; --bad: #c0392b;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #0f2a1f; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: .2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 4px rgba(61,220,151,.18); }
.status { font-size: 12px; opacity: .85; }
.layout { display: grid; grid-template-columns: 440px 1fr; height: calc(100% - 52px); }
.panel { overflow-y: auto; padding: 12px; border-right: 1px solid var(--line); }
.mapwrap { position: relative; }
arcgis-map { width: 100%; height: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; }
.row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.row input[type=text] { flex: 1; }
input[type=text], input[type=number] { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; }
label { font-size: 12px; color: var(--muted); display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink); cursor: pointer; }
.check { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--ink); font-size: 13px; }
.btn { padding: 7px 11px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn-ghost { background: #fff; color: var(--accent); }
.btn-primary { width: 100%; padding: 9px; font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.active { background: #093d2c; }
.file { display: inline-block; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.hidden { display: none !important; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.kpi { background: var(--accent-2); border-radius: 8px; padding: 8px; }
.kpi b { display: block; font-size: 18px; }
.kpi span { font-size: 11px; color: var(--muted); }
.best { background: #fff8e6; border: 1px solid #f5d27a; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.tab { border: 0; background: none; padding: 6px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover { background: #f0f6f3; }
td.num, th.num { text-align: right; white-space: nowrap; }
.tabpane { max-height: 46vh; overflow: auto; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; color: #fff; white-space: nowrap; }
.b-alta { background: #1a9641; } .b-media { background: #5aa02c; } .b-bassa { background: #e67e22; } .b-satura { background: var(--bad); } .b-nd { background: #9aa5b1; }
.actions { margin-top: 10px; flex-wrap: wrap; }
.pickhint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #0f2a1f; color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.print-only { display: none; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; grid-template-rows: auto 60vh; } .panel { border-right: 0; } }
@media print {
  body > *:not(#print) { display: none !important; }
  .print-only { display: block; padding: 0 8mm; font-size: 11px; }
  .print-only img { width: 100%; border: 1px solid #ccc; margin: 6px 0; }
  .print-only h1 { font-size: 16px; margin: 0 0 4px; }
  .print-only h2 { font-size: 13px; margin: 12px 0 4px; }
  .print-only table { font-size: 10px; }
  .print-only tr { page-break-inside: avoid; }
}

/* accesso ArcGIS */
.signin { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; background: #f4f6f8; }
.signin .card { max-width: 420px; text-align: center; padding: 28px; }
.signin h2 { margin: 0 0 10px; font-size: 18px; }
.signin p { margin: 0 0 18px; color: #4a5560; }
.btn-signout { margin-left: 12px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-signout:hover { background: rgba(255,255,255,.12); }
