:root {
  --blue: #276CA5;
  --blue-dark: #1B4A73;
  --green: #86BE41;
  --grey-bg: #F5F7FA;
  --grey-border: #E1E6EC;
  --text: #24303D;
  --text-muted: #6B7684;
  --white: #FFFFFF;
  --red: #C0392B;
  --amber: #C98A11;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--grey-bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--grey-border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand img { height: 34px; }
.topbar-brand span { font-weight: 700; color: var(--blue-dark); font-size: 1.05rem; }
.topbar-nav { display: flex; align-items: center; gap: 18px; font-size: 0.92rem; }
.topbar-nav a { color: var(--text-muted); font-weight: 500; }
.topbar-nav a.active { color: var(--blue); }
.topbar-user { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 10px; }

/* ---------- Layout ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
.container-narrow { max-width: 460px; margin: 0 auto; padding: 48px 20px; }

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--blue-dark); }
.page-header p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }

/* ---------- Card ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 { font-size: 1.1rem; margin: 0 0 16px; color: var(--blue-dark); }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 14px 0 6px; color: var(--text); }
label.first { margin-top: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grey-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(39, 108, 165, 0.12);
}
.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--blue); border: 1px solid var(--blue); }
.btn-secondary:hover { background: #EFF5FA; text-decoration: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Auth pages ---------- */
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { height: 64px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 16px; }
.alert-error { background: #FDECEA; color: var(--red); border: 1px solid #F5C6C0; }
.alert-success { background: #EAF6E4; color: #2E7D32; border: 1px solid #C6E6BA; }
.alert-info { background: #EEF5FB; color: var(--blue-dark); border: 1px solid #CFE1F0; }
.alert-warning { background: #FDF4E3; color: var(--amber); border: 1px solid #F2DEB0; }

/* ---------- Table / list ---------- */
.pratiche-list { display: flex; flex-direction: column; gap: 12px; }
.pratica-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.pratica-row:hover { border-color: var(--blue); }
.pratica-main { flex: 1; }
.pratica-main .nome { font-weight: 700; color: var(--text); }
.pratica-main .meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.pratica-stati { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-grey { background: #EEF1F4; color: var(--text-muted); }
.badge-blue { background: #E4EEF7; color: var(--blue-dark); }
.badge-amber { background: #FBF0DA; color: var(--amber); }
.badge-green { background: #E4F3DA; color: #3E7A22; }
.badge-red { background: #FBE3E0; color: var(--red); }

/* ---------- Checklist ---------- */
.checklist-group { margin-bottom: 22px; }
.checklist-group h3 { font-size: 0.95rem; color: var(--blue-dark); margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.03em; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grey-border);
  font-size: 0.9rem;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item .stato-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-mancante { background: #D8DEE5; }
.dot-caricato { background: var(--amber); }
.dot-verificato { background: var(--green); }
.dot-non_idoneo { background: var(--red); }
.checklist-item .desc { flex: 1; }
.checklist-item .upload-btn { font-size: 0.78rem; }

.progress-bar { height: 8px; background: var(--grey-border); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.progress-bar-fill { height: 100%; background: var(--green); }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .pratica-row { flex-direction: column; align-items: flex-start; }
}
.footer-note { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 40px; }
