:root {
  --blue-900: #0b2545;
  --blue-700: #13315c;
  --blue-500: #1e5aa8;
  --blue-100: #e8f0fb;
  --verde: #2e8b57;
  --giallo: #d4a017;
  --arancione: #d2691e;
  --rosso: #b22222;
  --bg: #f4f6f9;
  --text: #1a1a1a;
  --border: #d5dbe3;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header.app-header {
  background: var(--blue-900);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

header.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header.app-header .brand img.logo {
  height: 36px;
  width: auto;
}

header.app-header h1 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

header.app-header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

header.app-header nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
}

header.app-header nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

header.app-header button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: var(--blue-700);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.shortcut-grid a {
  display: block;
  padding: 0.9rem;
  background: var(--blue-100);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--blue-900);
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--border);
}

.shortcut-grid a:hover {
  background: #dbe7f9;
}

.mappa-basilicata {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.legenda-allerta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

table.checklist {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.checklist th,
table.checklist td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: middle;
}

table.checklist th {
  background: var(--blue-100);
}

tr.row-missing {
  background: #fdecec;
}

tr.row-missing td:first-child {
  box-shadow: inset 3px 0 0 var(--rosso);
}

#autosave-status {
  font-style: italic;
}

table.checklist input[type="text"],
table.checklist input[type="time"],
table.checklist textarea,
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  font-family: inherit;
  font-size: 0.9rem;
}

select.colore-allerta.verde { background: #e5f5ec; }
select.colore-allerta.giallo { background: #fbf1d8; }
select.colore-allerta.arancione { background: #fbe6d3; }
select.colore-allerta.rosso { background: #fadcdc; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

.badge.verde { background: var(--verde); }
.badge.giallo { background: var(--giallo); }
.badge.arancione { background: var(--arancione); }
.badge.rosso { background: var(--rosso); }
.badge.bozza { background: #888; }
.badge.completata { background: var(--verde); }

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

button.primary,
.actions button {
  background: var(--blue-500);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}

button.primary:hover,
.actions button:hover {
  background: var(--blue-700);
}

button.secondary {
  background: #fff;
  color: var(--blue-700);
  border: 1px solid var(--blue-500);
}

.login-wrap {
  max-width: 380px;
  margin: 4rem auto;
}

.login-wrap .card {
  text-align: left;
}

.login-wrap .card img.logo {
  display: block;
  height: 64px;
  width: auto;
  margin: 0 auto 1rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  color: var(--blue-700);
}

.error-msg {
  color: var(--rosso);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.hint {
  font-size: 0.8rem;
  color: #666;
}

table.list-table {
  width: 100%;
  border-collapse: collapse;
}

table.list-table th,
table.list-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
  font-size: 0.9rem;
}
