/* ==========================================================================
   Themis-One - foglio di stile principale
   Palette e layout ispirati al mockup fornito dal cliente.
   ========================================================================== */

:root {
  --navy-900: #0b2038;
  --navy-800: #0f2a4d;
  --navy-700: #163a63;
  --navy-600: #1f4e83;
  --accent: #e6492e;
  --accent-dark: #c93a22;
  --accent-soft: #fdeae5;
  --blue-soft: #e7f0ff;
  --blue: #2f6fed;
  --purple-soft: #f1ebfe;
  --purple: #8b5cf6;
  --green: #1fa971;
  --green-soft: #e4f8ef;
  --amber: #e0a325;
  --amber-soft: #fdf3dc;
  --red: #e0433a;
  --red-soft: #fbe6e4;
  --bg: #f2f4f8;
  --card: #ffffff;
  --border: #e6e9f0;
  --text: #16233b;
  --text-muted: #6b7789;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --sidebar-w: 84px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Inter", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

h1, h2, h3, h4 { margin: 0; color: var(--navy-900); }

.icn { display: inline-block; vertical-align: middle; }

/* ---------------------------------------------------------------------- */
/* Layout generale                                                        */
/* ---------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-content {
  padding: 28px 32px 48px;
  flex: 1;
}

.app-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.app-footer a {
  color: inherit;
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.app-footer--login {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  border-top: none;
}

.app-footer--login p {
  color: rgba(255, 255, 255, 0.55);
}

/* ---------------------------------------------------------------------- */
/* Sidebar                                                                 */
/* ---------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  z-index: 40;
}

.sidebar-logo {
  margin-bottom: 22px;
}

.sidebar-logo img { display: block; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
}

.sidebar-link {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #9fb3cf;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: var(--accent);
}

.sidebar-link .tooltip {
  position: absolute;
  left: 62px;
  background: var(--navy-900);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: var(--shadow);
}

.sidebar-link:hover .tooltip {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-footer {
  margin-top: auto;
}

/* ---------------------------------------------------------------------- */
/* Topbar                                                                  */
/* ---------------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand img {
  display: block;
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.topbar-brand-text strong {
  font-size: 15px;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.topbar-brand-text span {
  font-size: 11.5px;
  color: #9fb3cf;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.topbar-group-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  margin-left: 6px;
  padding-left: 16px;
  color: #9fb3cf;
  font-size: 12.5px;
}

.topbar-group-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* Area aziendale selezionata (link alla pagina di scelta area) */
.topbar-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.topbar-area:hover { background: rgba(255, 255, 255, 0.16); }
.topbar-area > span:not(.topbar-area-cambia) { display: flex; flex-direction: column; line-height: 1.1; }
.topbar-area small {
  font-size: 10px;
  color: #9fb3cf;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.topbar-area-cambia {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 11px;
}

@media (max-width: 900px) {
  .topbar-area small, .topbar-area-cambia { display: none; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.weather-widget {
  position: relative;
}

.weather-widget-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 999px;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.weather-widget-trigger:hover,
.weather-widget-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, 0.16); }

.weather-widget .icn { color: var(--accent); }

.weather-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: 220px;
  padding: 14px 16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.weather-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.weather-popover-row strong { color: var(--text); font-size: 13px; }

.weather-popover-fonte {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.traffic-widget {
  position: relative;
}

.traffic-widget-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 999px;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.traffic-widget-trigger:hover,
.traffic-widget-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, 0.16); }

.traffic-widget .icn { color: var(--green); }
.traffic-widget.is-rallentato .icn { color: var(--amber); }
.traffic-widget.is-congestionato .icn { color: var(--red); }

.traffic-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: 240px;
  padding: 14px 16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.traffic-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.traffic-popover-row strong { color: var(--text); font-size: 13px; }

.traffic-popover-fonte {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.notif-button {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 600;
  border: 2px solid var(--navy-800);
}

.account-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.account-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.account-text strong { font-size: 13.5px; color: #ffffff; }
.account-text span { font-size: 11.5px; color: #9fb3cf; }

.logout-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-soft);
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 8px;
}

.logout-link:hover { background: rgba(255, 255, 255, 0.08); }

/* Logout inviato in POST: il pulsante deve sembrare il link di prima */
.form-logout { margin: 0; }
.form-logout button {
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.form-logout .logout-link { font-weight: 600; font-size: 13.5px; }

/* ---------------------------------------------------------------------- */
/* Header pagina                                                          */
/* ---------------------------------------------------------------------- */
.page-header {
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.search-box {
  flex: 1;
  min-width: 240px;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 18px;
  color: var(--text-muted);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------- */
/* Bottoni                                                                 */
/* ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 6px 16px rgba(230, 73, 46, 0.28);
}

.btn-primary:hover { filter: brightness(1.04); }

.btn-outline {
  background: var(--card);
  color: var(--navy-800);
  border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--bg); }

.btn-ghost {
  background: transparent;
  color: var(--navy-700);
  padding: 8px 12px;
}

.btn-ghost:hover { background: var(--blue-soft); }

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
  padding: 8px 10px;
  border-radius: 8px;
}

.btn-danger-ghost:hover { background: var(--red-soft); }

.btn-sm { padding: 8px 14px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------------- */
/* Card statistiche (dashboard)                                           */
/* ---------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }

.stat-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 700;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.3;
}

.stat-value small {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-sub { font-size: 12.5px; color: var(--text-muted); font-weight: 700; }

/* ---------------------------------------------------------------------- */
/* Griglia pannelli dashboard                                             */
/* ---------------------------------------------------------------------- */
.panel-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-header h3 { font-size: 16px; font-weight: 700; }

.panel-link { font-size: 12.5px; color: var(--blue); font-weight: 600; }

/* ---------------------------------------------------------------------- */
/* Mappa "autisti attivi per regione"                                     */
/* ---------------------------------------------------------------------- */
.map-panel { margin-bottom: 18px; }

.panel-sub { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

.map-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
  align-items: flex-start;
}

.map-svg-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
  flex: 1 1 320px;
}

.italy-bg-map,
.italy-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.italy-bg-map { user-select: none; }

.map-tile rect {
  stroke: var(--card);
  stroke-width: 3;
  transition: transform 0.15s ease, filter 0.15s ease, stroke 0.15s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.map-tile:hover rect,
.map-tile:focus rect {
  transform: scale(1.06);
  stroke: var(--tile-glow, var(--card));
  filter:
    drop-shadow(0 4px 10px rgba(15, 23, 42, 0.25))
    drop-shadow(0 0 6px var(--tile-glow, rgba(47, 111, 237, 0.7)))
    drop-shadow(0 0 14px var(--tile-glow, rgba(47, 111, 237, 0.45)));
}

.map-tile { cursor: pointer; outline: none; }

.map-tile-code {
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.map-tile-value {
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.map-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 10px));
  background: var(--navy-900);
  color: #fff;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: var(--shadow);
  pointer-events: none;
  z-index: 5;
}

.map-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--navy-900);
}

.map-tooltip strong { display: block; font-size: 13px; margin-bottom: 2px; }
.map-tooltip span { color: #c7d3e6; }
.map-tooltip em { display: block; font-style: normal; font-weight: 700; color: #ff8f87; margin-top: 3px; }

/* Bollino rosso sulle regioni con autisti in scadenza critica/scaduta */
.map-alert { pointer-events: none; }
.map-alert-link { cursor: pointer; }
.map-alert-link .map-alert { pointer-events: auto; }
.map-alert-link:hover .map-alert circle:not(.map-alert-pulse) { fill: #b8302a; }
.map-tile[data-href] { cursor: pointer; }
.map-tooltip small { display: block; margin-top: 4px; font-size: 11px; color: #c7d3e6; opacity: 0.8; }
.map-alert circle { fill: var(--red); stroke: var(--card); stroke-width: 2.5; }
.map-alert text { fill: #fff; font-size: 11px; font-weight: 800; text-anchor: middle; }
.map-alert .map-alert-pulse {
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: map-alert-pulse 1.8s ease-out infinite;
}
.map-alert--scaduto .map-alert-pulse { animation-duration: 1.1s; }

@keyframes map-alert-pulse {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.1); opacity: 0; }
}

a.map-alert-legend:hover { text-decoration: underline; }
.map-alert-legend { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--red); }
.map-alert-legend-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

a.map-ranking-alert:hover { background: var(--red); color: #fff; }
.map-ranking-alert {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
}

.map-side { display: flex; flex-direction: column; gap: 14px; flex: 1 1 260px; max-width: 320px; }

.map-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.map-legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
}

.map-ranking { width: 100%; border-collapse: collapse; }

.map-ranking td {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.map-ranking tr:last-child td { border-bottom: none; }

.map-ranking-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
}

.map-ranking-value { text-align: right; font-weight: 700; color: var(--navy-900); }

.map-note { font-size: 12px; color: var(--text-muted); margin: 0; }

.map-credit { font-size: 10.5px; color: var(--text-muted); opacity: 0.75; margin-top: auto; }

@media (max-width: 640px) {
  .map-svg-wrap { max-width: 320px; }
}

/* ---------------------------------------------------------------------- */
/* Tabelle                                                                 */
/* ---------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

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

.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13.8px;
  vertical-align: middle;
}

/* Intestazioni ordinabili A-Z / Z-A (vedi main.js) */
.data-table th.th-sortable { cursor: pointer; user-select: none; }
.data-table th.th-sortable:hover,
.data-table th[aria-sort] { color: var(--navy-900); }
.data-table th.th-sortable:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.data-table th.th-sortable::after { content: "↕"; margin-left: 5px; opacity: 0.35; }
.data-table th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.data-table th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
/* Pulsante "i" con descrizione della colonna (vedi main.js) */
.data-table th .th-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  font: italic 600 10px/1 Georgia, serif;
  text-transform: none;
  vertical-align: middle;
  cursor: pointer;
  opacity: 0.7;
}
.data-table th .th-info:hover,
.data-table th .th-info[aria-expanded="true"] { opacity: 1; color: var(--blue); }
.data-table th .th-info:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.th-info-popup {
  position: absolute;
  z-index: 1000;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--navy-900);
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  line-height: 1.45;
}
.th-info-popup[hidden] { display: none; }
.th-info-popup strong { display: block; margin-bottom: 3px; }
.th-info-popup p { margin: 0; opacity: 0.9; }

.data-table td.cell-empty { text-align: center; padding: 22px 12px; }
.data-table tr[hidden] { display: none; }

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfd; }

.cell-strong { font-weight: 600; color: var(--navy-900); }
.cell-muted { color: var(--text-muted); }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------------------------------------------------------------------- */
/* Badge / pillole di stato                                               */
/* ---------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-grey { background: #eef0f4; color: var(--text-muted); }

/* Scadenza prenotata: viola, distinto da tutti i livelli di allerta */
.badge-booked { background: var(--purple-soft); color: var(--purple); box-shadow: inset 0 0 0 1.5px var(--purple); }

/* Scadenze: "Scaduta" piena, "Critica" con punto pulsante */
.badge-expired { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(224, 67, 58, 0.35); }
.badge-critical { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-ring 1.6s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(224, 67, 58, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(224, 67, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 67, 58, 0); }
}

/* Righe tabella con scadenza critica/scaduta: barra laterale + fondo tinto */
.data-table tr.row-critical td { background: #fff8f7; }
.data-table tr.row-expired td { background: var(--red-soft); }
.data-table tr.row-critical td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.data-table tr.row-expired td:first-child { box-shadow: inset 5px 0 0 var(--red); }
.data-table tr.row-critical:hover td { background: #fdeeec; }
.data-table tr.row-expired:hover td { background: #f8d9d6; }
.data-table tr.row-booked td { background: #faf7ff; }
.data-table tr.row-booked td:first-child { box-shadow: inset 4px 0 0 var(--purple); }
.data-table tr.row-booked:hover td { background: var(--purple-soft); }

/* Righe dello scadenzario cliccabili per aggiungere una prenotazione */
.data-table tr.row-clickable { cursor: pointer; }
.data-table tr.row-clickable:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }

/* Anello rosso attorno all'avatar dell'autista con scadenze critiche */
.avatar-alert { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 5px var(--red); }
.avatar-alert--critico { animation: avatar-pulse 2s ease-in-out infinite; }

@keyframes avatar-pulse {
  0%, 100% { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 5px var(--red); }
  50%      { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 5px rgba(224, 67, 58, 0.25); }
}

/* Riepilogo scadenze nella lista autisti */
.expiry-summary { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.expiry-summary-text { font-size: 12.5px; color: var(--text-muted); }
.expiry-summary-text b { color: var(--red); }

/* ---------------------------------------------------------------------- */
/* Avatar iniziali autista                                                */
/* ---------------------------------------------------------------------- */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--navy-800);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-lg { width: 84px; height: 84px; font-size: 26px; border-radius: 20px; }

.person-cell { display: flex; align-items: center; gap: 12px; }

/* ---------------------------------------------------------------------- */
/* Mappa / grafico placeholder                                            */
/* ---------------------------------------------------------------------- */
.map-placeholder {
  height: 220px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 25% 30%, rgba(47,111,237,0.12), transparent 40%),
    radial-gradient(circle at 75% 65%, rgba(31,169,113,0.12), transparent 45%),
    var(--bg);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.bar-chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.bar-chart-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  height: 160px;
  padding-top: 10px;
}

.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.bar { width: 100%; max-width: 46px; border-radius: 8px 8px 0 0; }
.bar-col span { font-size: 11.5px; color: var(--text-muted); }

/* ---------------------------------------------------------------------- */
/* Form                                                                    */
/* ---------------------------------------------------------------------- */
.form-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* Impostazioni: i riquadri si affiancano due per riga */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.settings-nav { margin-bottom: 18px; }
.settings-nav .filter-pill:hover { color: var(--navy-900); border-color: var(--navy-800); }
.settings-grid > .form-card { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.settings-grid > .form-card:target { box-shadow: var(--shadow), 0 0 0 2px var(--navy-800); }

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--navy-700);
  margin: 26px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-section-title:first-child { margin-top: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field.full { grid-column: 1 / -1; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy-700);
}

.field .hint { font-size: 11.5px; color: var(--text-muted); }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field input[type="password"],
.field input[type="file"],
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.8px;
  color: var(--text);
  background: #fcfdfe;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { resize: vertical; min-height: 80px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field-checkbox input { width: 17px; height: 17px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------------- */
/* Login                                                                   */
/* ---------------------------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(230, 73, 46, 0.16), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(47, 111, 237, 0.18), transparent 40%),
    var(--navy-900);
  padding: 20px;
}

.login-card {
  background: var(--card);
  width: 100%;
  max-width: 400px;
  border-radius: 18px;
  padding: 38px 34px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-logo img { display: block; max-width: 100%; height: auto; }
.login-logo strong { display: block; font-size: 16px; color: var(--navy-900); }
.login-logo span { display: block; font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card p.lead { color: var(--text-muted); font-size: 13.5px; margin: 0 0 24px; }

.login-card form { display: flex; flex-direction: column; gap: 16px; }

.login-footnote {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: #9fb3cf;
}

/* ---------------------------------------------------------------------- */
/* Tabs (scheda autista)                                                  */
/* ---------------------------------------------------------------------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding-bottom: 0;
}

.tab-link {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2.5px solid transparent;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tab-link:hover { color: var(--navy-800); }

.tab-link.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.tab-alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  margin-left: -2px;
}
.tab-alert-dot--critico { animation: pulse-ring 1.6s ease-out infinite; }

/* ---------------------------------------------------------------------- */
/* Profilo autista - intestazione                                        */
/* ---------------------------------------------------------------------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  margin-bottom: 22px;
}

.profile-meta { flex: 1; }
.profile-meta h2 { font-size: 21px; }
.profile-meta .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.profile-meta .meta-row span { display: flex; align-items: center; gap: 6px; }

.profile-actions { display: flex; gap: 10px; }

/* Banner scadenze critiche/scadute nella scheda autista */
.expiry-alert {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: -8px 0 22px;
  background: var(--red-soft);
  border: 1.5px solid var(--red);
  color: var(--navy-900);
}

.expiry-alert--scaduto {
  background: linear-gradient(135deg, var(--red), #b8302a);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 28px rgba(224, 67, 58, 0.3);
}

.expiry-alert-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--red);
  color: #fff;
  animation: alert-shake 3.5s ease-in-out infinite;
}
.expiry-alert--scaduto .expiry-alert-icon { background: rgba(255, 255, 255, 0.18); }

@keyframes alert-shake {
  0%, 88%, 100% { transform: rotate(0); }
  91% { transform: rotate(-9deg); }
  94% { transform: rotate(8deg); }
  97% { transform: rotate(-4deg); }
}

.expiry-alert-body { flex: 1; min-width: 0; }
.expiry-alert-body > strong { display: block; font-size: 17px; }
.expiry-alert-body > span { font-size: 13px; opacity: 0.85; }

.expiry-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.expiry-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 7px;
  border-radius: 12px;
  background: var(--card);
  color: var(--navy-900);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease;
}
.expiry-chip:hover { transform: translateY(-2px); }

.expiry-chip-days {
  min-width: 46px;
  padding: 6px 8px;
  border-radius: 9px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  background: var(--red-soft);
  color: var(--red);
}
.expiry-chip-days small { font-size: 10px; font-weight: 700; margin-left: 1px; }
.expiry-chip--scaduto .expiry-chip-days { background: var(--red); color: #fff; }

.expiry-chip-text { display: flex; flex-direction: column; font-size: 12px; color: var(--text-muted); }
.expiry-chip-text b { font-size: 13px; color: var(--navy-900); }

@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .tab-alert-dot--critico, .avatar-alert--critico, .expiry-alert-icon, .map-alert .map-alert-pulse { animation: none; }
}

/* ---------------------------------------------------------------------- */
/* Liste avvisi / timeline                                                 */
/* ---------------------------------------------------------------------- */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.alert-item:last-child { border-bottom: none; }

.alert-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-text { flex: 1; min-width: 0; }
.alert-text strong { display: block; font-size: 13.5px; color: var(--navy-900); }
.alert-text span { font-size: 12.5px; color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .icn { color: #c5cede; margin-bottom: 10px; }
.empty-state p { margin: 4px 0 0; font-size: 13.5px; }

/* ---------------------------------------------------------------------- */
/* Filtri pillola                                                         */
/* ---------------------------------------------------------------------- */
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-pill {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
}

.filter-pill.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.filter-pill-clear { margin-left: 6px; font-size: 15px; line-height: 1; opacity: 0.75; }
.filter-pill-clear:hover { opacity: 1; }

/* ---------------------------------------------------------------------- */
/* Flash messages                                                          */
/* ---------------------------------------------------------------------- */
.flash-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.flash {
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  color: #fff;
}

.flash-success { background: var(--green); }
.flash-danger { background: var(--red); }
.flash-warning { background: var(--amber); color: #4a3200; }
.flash-info { background: var(--blue); }

/* ---------------------------------------------------------------------- */
/* Pannello "aggiungi record" nelle sotto-sezioni scheda autista          */
/* ---------------------------------------------------------------------- */
.add-record-panel {
  display: none;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.add-record-panel.open-panel { display: block; }

/* ---------------------------------------------------------------------- */
/* Utility                                                                 */
/* ---------------------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.card-simple {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .page-content { padding: 20px 16px 40px; }
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-2, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .account-text { display: none; }
}

/* ---------------------------------------------------------------------- */
/* Combobox cercabile (tendina + ricerca)                                  */
/* ---------------------------------------------------------------------- */

.combobox {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 480px;
}

.combobox .search-box { max-width: none; }

.toolbar-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

.toolbar-filter[hidden] { display: none; }
.toolbar-filter.toolbar-filter--compact select { padding: 6px 12px; font-size: 13px; }

.toolbar-filter select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.toolbar-filter select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.combobox-toggle,
.combobox-clear {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  text-decoration: none;
}

.combobox-clear { font-size: 20px; }
.combobox-toggle:hover,
.combobox-clear:hover { color: var(--text); }

.combobox-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.combobox-list [role=option] {
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.combobox-list [role=option].active { background: var(--bg); }
.combobox-list [role=option][aria-selected=true] .cell-strong { color: var(--accent); }

.combobox-empty {
  padding: 9px 12px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------- */
/* Utenti e permessi (pagina superadmin)                                   */
/* ---------------------------------------------------------------------- */
.perm-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }

.perm-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--blue-soft);
  color: var(--navy-700);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.perm-notice[hidden] { display: none; }

.perm-matrix .perm-col { text-align: center; width: 140px; }
.perm-matrix .perm-group td {
  background: #f7f8fb;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--navy-700);
  padding: 8px 12px;
}
.perm-matrix .perm-group:hover td { background: #f7f8fb; }
.perm-hint { font-size: 11.5px; font-weight: 500; margin-top: 2px; }

.perm-radio { display: inline-flex; cursor: pointer; position: relative; }
.perm-radio input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.perm-radio span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.perm-radio input:focus-visible + span { box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.25); }
.perm-radio input:checked + span { border-width: 6px; }
.perm-nessuno input:checked + span { border-color: var(--text-muted); }
.perm-lettura input:checked + span { border-color: var(--blue); }
.perm-modifica input:checked + span { border-color: var(--green); }

.perm-disabled { opacity: 0.45; pointer-events: none; }

/* ---------------------------------------------------------------------- */
/* Popup (dialog) - es. prenotazione dallo scadenzario                     */
/* ---------------------------------------------------------------------- */
.modal {
  width: min(560px, calc(100vw - 32px));
  border: none;
  border-radius: var(--radius);
  padding: 22px 24px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.modal-wide { width: min(720px, calc(100vw - 32px)); }

.modal::backdrop { background: rgba(15, 23, 42, 0.45); }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 17px; }

.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}

.modal-close:hover { background: var(--bg); }

.modal-summary,
.modal-booking {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 13.5px;
}

.modal-summary > div,
.modal-booking > div { display: flex; justify-content: space-between; gap: 12px; }

.modal-booking { background: var(--purple-soft); }
.modal-booking .badge { justify-self: start; background: var(--card); }

.modal [hidden] { display: none !important; }

/* ---------------------------------------------------------------------- */
/* Pagina di scelta dell'area aziendale                                    */
/* ---------------------------------------------------------------------- */
.area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.area-grid form { margin: 0; }

.area-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.area-card:hover { border-color: var(--navy-600); box-shadow: var(--shadow), 0 0 0 1px var(--navy-600); }
.area-card:active { transform: translateY(1px); }
.area-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.area-card--attiva { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 1px var(--accent); }

.area-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--blue-soft);
  color: var(--navy-700);
}

.area-card-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.area-card-title { font-size: 17px; font-weight: 700; color: var(--navy-900); }
.area-card-desc { font-size: 12.5px; color: var(--text-muted); }
.area-card-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.area-card-stats b { color: var(--navy-900); font-size: 14px; }
.area-card-go { color: var(--text-muted); flex-shrink: 0; }

/* ---------------------------------------------------------------------- */
/* Splash di caricamento                                                  */
/* ---------------------------------------------------------------------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  background: #ffffff;
  animation: splash-out 0.45s ease 1.5s forwards;
}

.splash img {
  width: min(520px, 82vw);
  height: auto;
  animation: splash-logo-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.splash-bar {
  width: min(180px, 40vw);
  height: 3px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.splash-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy-600), #c8213f);
  transform-origin: left;
  animation: splash-progress 1.4s ease-out both;
}

@keyframes splash-logo-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes splash-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes splash-out {
  to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .splash img, .splash-bar span { animation: none; }
}
