/* ===== Modulo Arricchimento — sub-tab Fonti (palette ottanio) ===== */
#fonti-panel-arricchimento .arric-panel { padding: 4px 2px; }

.arric-panel-header h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-base, #0E3B45);
}
#arric-layer-select { width: 100%; padding: 6px 8px; margin-bottom: 6px; }
.arric-toolbar { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.arric-tbtn {
  flex: 1 1 0;
  min-width: 60px;
  padding: 7px 6px;
  background: #fff;
  color: var(--brand-base, #0E3B45);
  border: 1px solid var(--brand-base, #0E3B45);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.arric-tbtn:hover:not(:disabled) { background: #eef5f6; }
.arric-tbtn.active { background: var(--brand-base, #0E3B45); color: #fff; }
.arric-tbtn:disabled { color: #b8c2c4; border-color: #d6dee0; background: #f5f7f7; cursor: not-allowed; }

.arric-controls { margin-top: 12px; }

.arric-search { position: relative; margin-bottom: 10px; }
#arric-search-q { width: 100%; padding: 6px 8px; box-sizing: border-box; }
#arric-search-results {
  list-style: none;
  padding: 0;
  margin: 2px 0 0 0;
  max-height: 180px;
  overflow: auto;
  background: #fff;
  border: 1px solid #d6dee0;
  border-radius: 4px;
}
#arric-search-results:empty { display: none; }
#arric-search-results li {
  padding: 6px 8px;
  cursor: pointer;
  border-bottom: 1px solid #eef2f3;
  font-size: 12px;
}
#arric-search-results li:last-child { border-bottom: 0; }
#arric-search-results li:hover { background: #eef5f6; }

.arric-filters { margin: 4px 0 10px 0; font-size: 12px; }
.arric-filters label {
  display: block;
  margin-bottom: 8px;
  color: #34474c;
  font-weight: 500;
}
.arric-filters select,
.arric-filters input {
  width: 100%;
  padding: 5px 6px;
  margin-top: 3px;
  box-sizing: border-box;
}

.arric-stats {
  margin: 10px 0;
  padding: 8px 10px;
  background: #eef5f6;
  border-left: 3px solid var(--brand-base, #0E3B45);
  border-radius: 3px;
  font-size: 12px;
  color: #243237;
}
.arric-stats:empty { display: none; }
.arric-bbox-info { color: #5a6b6f; font-size: 11px; margin-top: 4px; }

.arric-legend { margin-top: 12px; font-size: 11px; color: #34474c; }
.arric-legend > div { display: flex; align-items: center; margin: 4px 0; }
.arric-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 7px;
  border: 1px solid #243237;
  border-radius: 2px;
}
.arric-swatch-nct { background: #B4595A; }
.arric-swatch-nceu { background: #890103; }
.arric-swatch-unknown { background: #C9B0B0; }

/* Popup proprietario */
.arric-popup { font-size: 12px; min-width: 230px; max-width: 300px; }
.arric-popup strong { font-size: 13px; color: var(--brand-base, #0E3B45); }
.arric-popup hr { margin: 6px 0; border: 0; border-top: 1px solid #e3e9ea; }
.arric-popup .row { margin: 2px 0; }
.arric-popup .row b { color: #34474c; font-weight: 600; }
.arric-popup-fonte { color: #8a979a; font-size: 10px; margin-top: 6px; font-style: italic; }

/* ===== Grandi Patrimoni Intelligence ===== */
.arric-intel { margin: 4px 0 10px 0; }
.arric-subcluster { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.arric-chip {
  padding: 4px 9px; font-size: 11px; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--brand-base, #0E3B45); border: 1px solid var(--brand-base, #0E3B45); border-radius: 12px;
}
.arric-chip:hover { background: #eef5f6; }
.arric-chip.active { background: var(--brand-base, #0E3B45); color: #fff; }
.arric-fld { display: block; font-size: 12px; color: #34474c; font-weight: 500; margin-bottom: 8px; }
.arric-fld select { width: 100%; padding: 5px 6px; margin-top: 3px; box-sizing: border-box; }
#arric-sub-denom { font-size: 11px; }
.arric-geo { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.arric-geo label { font-size: 11px; color: #34474c; font-weight: 500; }
.arric-geo select { width: 100%; padding: 4px 4px; margin-top: 2px; box-sizing: border-box; font-size: 11px; }
#arric-btn-reset { width: 100%; }

.arric-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.arric-kpi-card { background: #f8fafc; border: 1px solid #e8edf1; border-radius: 8px; padding: 9px 10px; text-align: left; }
.arric-kpi-lbl { font-size: 9.5px; color: #64748b; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; margin-bottom: 3px; }
.arric-kpi-val { font-size: 18px; font-weight: 700; color: var(--brand-base, #0E3B45); line-height: 1.15; }
.arric-kpi-val--pos { color: #15803d; }
.arric-kpi-val--neg { color: #b91c1c; }
.arric-kpi-sub { font-size: 10px; color: #94a3b8; margin-top: 3px; }
.arric-kpi-empty {
  grid-column: 1 / -1; padding: 16px 12px; text-align: center; font-size: 12px;
  color: #64748b; background: #f8fafc; border: 1px dashed #d6dee0; border-radius: 8px; line-height: 1.4;
}

.arric-actions { margin: 8px 0; }

/* Dashboard modale */
.arric-dash-overlay {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
}
.arric-dash-box {
  background: #fff; border-radius: 10px; width: 92vw; max-width: 1200px; height: 86vh;
  display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); overflow: hidden;
}
.arric-dash-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid #eee;
}
.arric-dash-head h3 { margin: 0; font-size: 15px; color: var(--brand-base, #0E3B45); }
.arric-dash-x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: #888; }
.arric-dash-x:hover { color: var(--brand-base, #0E3B45); }
.arric-dash-kpi { display: flex; gap: 10px; padding: 12px 18px; flex-wrap: wrap; }
.arric-dash-kpi .arric-kpi-card { min-width: 140px; }
.arric-dash-grid {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 10px; padding: 0 18px 18px; overflow: auto;
}
.arric-dash-chart { min-height: 240px; border: 1px solid #f0f0f0; border-radius: 6px; }
.arric-dash-loading { padding: 30px; text-align: center; color: #888; font-size: 13px; }

/* ===== Popup particella + subalterni (stile Mappatura) ===== */
.arric-popup-pi { min-width: 270px; max-width: 340px; }
.arric-pi-cf { font-size: 11px; color: #64748b; margin-top: 2px; }
.arric-units-wrap { max-height: 210px; overflow: auto; margin-top: 4px; }
.arric-units { width: 100%; border-collapse: collapse; font-size: 11px; }
.arric-units th {
  position: sticky; top: 0; background: #f8fafc; text-align: left; color: #64748b;
  font-weight: 600; font-size: 9.5px; text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 1px solid #e3e9ea; padding: 3px 5px;
}
.arric-units td { padding: 3px 5px; border-bottom: 1px solid #f0f3f4; vertical-align: top; }
.arric-units tbody tr:last-child td { border-bottom: 0; }
.arric-units .arric-u-sub { font-weight: 600; color: var(--brand-base, #0E3B45); white-space: nowrap; }
.arric-units .arric-u-cons { color: #94a3b8; }
.arric-units .arric-u-r { text-align: right; white-space: nowrap; color: #475569; }

/* ===== Modalità Property Intelligence: spegne il pannello "Gestione perizie" ===== */
body.arric-pi-active #surfaceGroupNavWindow { display: none !important; }
