.data-analysis-workspace{min-width:0}
.data-analysis-workspace .panel-head{align-items:flex-start;flex-wrap:wrap;gap:14px}
.data-analysis-workspace .panel-head>div:first-child{flex:1;min-width:200px}
.data-analysis-workspace .panel-head h2{line-height:1.4}
.data-analysis-workspace .panel-head .actions{align-items:center;justify-content:flex-end}
.da-filters{display:flex;align-items:end;flex-wrap:wrap;gap:12px;padding:18px 24px;border-bottom:1px solid var(--line)}
.da-filters label{display:grid;gap:6px;min-width:145px;font-size:11px;color:var(--muted);flex:1}
.da-filters label:first-child{min-width:190px;flex:1.4}
.da-filters select,.da-filters input{width:100%;min-width:0;height:38px}
.da-filters label:nth-child(4){flex:1.3}
.da-filters .button{min-height:38px}
.da-period-help,.da-status,.da-error{padding:0 24px;font-size:12px;line-height:1.65}
.da-period-help{margin-top:13px;color:#607066}
.da-status{margin-top:5px;margin-bottom:15px;color:var(--muted)}
.da-error{margin-bottom:15px;color:#9e3333}
.da-municipalities>summary{padding:16px 24px;cursor:pointer;font-weight:600;font-size:12px}
.da-municipality-links{padding:0 24px 20px;display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:9px}
.da-municipality-links a{display:grid;gap:4px;border:1px solid var(--line);border-radius:7px;padding:12px;font-size:12px;overflow-wrap:anywhere}
.da-municipality-links a:hover{background:var(--green-light);border-color:#bbcfc0}
.da-municipality-links small{color:var(--muted);font-size:10px}
.da-report-scope{display:flex;align-items:center;flex-wrap:wrap;gap:8px 18px;font-size:12px;margin:5px 0 18px}
.da-report-scope strong{font-size:15px}
.da-report-scope span,.da-report-scope small{color:#66796c}
.da-report-scope small{margin-left:auto;font-size:11px}
.da-kpis{display:grid;grid-template-columns:1.25fr 1fr 1fr 1fr;gap:15px;margin-bottom:22px}
.da-kpis .stat{min-width:0;min-height:135px;padding:20px}
.da-kpis .stat-value{font-size:clamp(21px,2.1vw,31px);overflow-wrap:anywhere;letter-spacing:-.7px}
.da-kpis .stat-value small{font-size:13px;letter-spacing:0;font-weight:500}
.da-kpis .stat-label{font-size:11px;line-height:1.5;margin-bottom:15px}
.da-kpis .stat-note{line-height:1.5}
.da-table{min-width:1050px;white-space:normal;font-size:12px}
.da-table th,.da-table td{padding:12px 14px;line-height:1.5;vertical-align:top;overflow-wrap:anywhere;max-width:250px}
.da-table th{font-size:10px;white-space:normal;background:#f6f8f4}
.da-table small{display:block;margin-top:5px;font-size:10px;color:#687a6d;line-height:1.4}
.da-table td strong{font-weight:650}
.da-table tfoot th,.da-table tfoot td{background:#edf4ec;border-top:1px solid #cfdfcb;padding-top:14px;padding-bottom:14px}
.da-table .da-number{white-space:nowrap;text-align:right;font-variant-numeric:tabular-nums}
.da-table td.da-number small{white-space:normal;min-width:125px;max-width:175px;margin-left:auto}
.da-summary-table{min-width:700px}
.da-summary-table td:first-child{white-space:nowrap}
.da-summary-table td:nth-child(2){min-width:210px;max-width:400px}
.da-table-scroll{max-height:65vh}
.da-source-link{display:inline-block;color:var(--green);text-decoration:underline;text-underline-offset:3px;font-size:11px;line-height:1.5}
.da-kind{display:inline-block;border-radius:4px;padding:4px 7px;line-height:1.4;font-size:10px;font-weight:650}
.da-kind-internal{background:#e8f0e9;color:#285a46}
.da-kind-external{background:#eaf2fa;color:#3e648a}
.da-kind-unknown{background:#fff1da;color:#8a692a}
.da-pagination{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:9px;padding:13px 24px;border-top:1px solid var(--line);font-size:11px;color:var(--muted)}
.da-pagination>span{margin-right:auto}
.da-pagination button:disabled{cursor:default}
.da-legend{display:flex;gap:15px;flex-wrap:wrap;font-size:11px;align-items:center;padding-top:4px}
.da-legend span{display:inline-flex;gap:6px;align-items:center;white-space:nowrap}
.da-legend span:before{content:"";width:10px;height:10px;border-radius:2px}
.da-legend-internal:before,.da-bar-internal{background:#326e55}
.da-legend-external:before,.da-bar-external{background:#78a9ce}
.da-monthly-chart{overflow-x:auto;padding:23px 24px 16px}
.da-monthly-bars{display:flex;gap:16px;min-width:min-content;align-items:flex-end;justify-content:flex-start}
.da-month-column{display:flex;flex-direction:column;align-items:center;flex:1;min-width:76px;max-width:150px;gap:9px;font-size:10px;color:#617368}
.da-month-column>strong{font-size:11px;white-space:nowrap;color:var(--ink);font-variant-numeric:tabular-nums}
.da-month-column>span{white-space:nowrap}
.da-bar-track{height:150px;width:100%;max-width:50px;background:#f0f4ed;display:flex;flex-direction:column;justify-content:flex-end;border-radius:4px 4px 0 0;overflow:hidden;border-bottom:1px solid #c5d5c8}
.da-bar-track>span{display:block;width:100%;flex:none}
.da-monthly-values{max-height:300px;border-top:1px solid var(--line)}
.da-monthly-values .da-table{min-width:510px}
.da-monthly-values td:nth-child(2){min-width:0}
.da-quality-counts{display:flex;flex-wrap:wrap;gap:10px 24px;padding:14px 24px;background:#faf8ef;font-size:11px;color:#746c48;border-bottom:1px solid var(--line);line-height:1.5}
.da-quality-counts strong{color:#67562b}
.da-quality-counts span:last-child{margin-left:auto;font-size:10px}
.da-quality-clear{padding:18px 24px;font-size:12px}
.da-quality-scope{padding:12px 24px;font-size:11px;line-height:1.6;color:#7e693c;background:#fffaf0;border-bottom:1px solid var(--line)}
.da-quality-reason{color:#8f602d;min-width:170px;max-width:240px!important;font-size:11px}
.da-quality .da-table{min-width:1200px}
.da-method{padding:0 4px 18px;font-size:11px;line-height:1.7;color:#657769}
.da-print-note{display:none}
.da-sr-only{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
@media(max-width:1050px){.da-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.data-analysis-workspace .panel-head .actions{justify-content:flex-start}.da-kpis .stat-value{font-size:28px}}
@media(max-width:620px){.data-analysis-workspace .panel-head{padding:16px}.da-filters{padding:16px;gap:10px}.da-filters label{min-width:calc(50% - 10px);flex:1}.da-filters label:first-child{min-width:100%}.da-filters label:nth-child(4){min-width:100%}.da-filters .button{flex:1}.data-analysis-workspace .panel-head .actions{gap:6px}.data-analysis-workspace .panel-head .actions .button{font-size:11px;padding:8px 10px}.da-period-help,.da-status,.da-error{padding-left:16px;padding-right:16px}.da-kpis{gap:10px}.da-kpis .stat{padding:16px;min-height:125px}.da-kpis .stat-value{font-size:23px}.da-kpis .stat-label{font-size:10px}.da-report-scope{align-items:flex-start;flex-direction:column;gap:5px}.da-report-scope small{margin-left:0}.da-municipalities>summary{padding:16px}.da-municipality-links{padding:0 16px 16px}.da-pagination,.da-quality-counts,.da-quality-clear{padding:12px 16px}.da-quality-counts span:last-child{margin-left:0}.da-monthly-chart{padding:18px 16px}.da-table th,.da-table td{padding:10px}}
@media print{
  body:has(.data-analysis-workspace){background:white;color:#172c20;font-size:10pt}
  body:has(.data-analysis-workspace) .sidebar,body:has(.data-analysis-workspace) .topbar,body:has(.data-analysis-workspace) .page-heading,body:has(.data-analysis-workspace) .toolbar,body:has(.data-analysis-workspace) .workspace-footer,body:has(.data-analysis-workspace) #toast,body:has(.data-analysis-workspace) #modal,.data-analysis-workspace .da-no-print{display:none!important}
  body:has(.data-analysis-workspace) main{margin-left:0}
  body:has(.data-analysis-workspace) .workspace{padding:0;max-width:none}
  .data-analysis-workspace .panel{overflow:visible;border:1px solid #ccc;border-radius:0;box-shadow:none;break-inside:auto;margin-bottom:14px}
  .data-analysis-workspace .panel-head{padding:12px}
  .data-analysis-workspace .panel-head h2{font-size:13pt}
  .da-period-help,.da-status,.da-error{padding:0 12px;font-size:9pt}
  .da-filter-panel .panel-head p{font-size:9pt}
  .da-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;break-inside:avoid}
  .da-kpis .stat{padding:10px;min-height:0;background:white!important;color:#172c20!important;border-color:#aaa}
  .da-kpis .stat-value{font-size:15pt;letter-spacing:0}
  .da-kpis .stat-label,.da-kpis .stat-note{color:#344b3a!important;font-size:8pt}
  .da-kpis .stat-value small{font-size:8pt}
  .da-report-scope{margin:10px 0;break-inside:avoid}
  .da-report-scope strong{font-size:13pt}
  .da-report-scope span,.da-report-scope small{font-size:9pt;color:#344b3a}
  .da-table-scroll,.da-monthly-values{max-height:none;overflow:visible}
  .da-table,.da-quality .da-table,.da-summary-table,.da-monthly-values .da-table{min-width:0;table-layout:fixed;width:100%;font-size:8pt}
  .da-table thead{display:table-header-group}.da-table tfoot{display:table-row-group}
  .da-table tr{break-inside:avoid}
  .da-table th{position:static;font-size:7pt;letter-spacing:0}
  .da-table th,.da-table td{padding:6px 5px;min-width:0!important;max-width:none!important;overflow-wrap:anywhere;white-space:normal!important}
  .da-table small{font-size:7pt}
  .da-number{white-space:normal!important}
  .da-source-link{display:none}
  .da-monthly-chart{display:none}
  .da-legend{font-size:8pt}
  .da-quality-counts,.da-quality-clear,.da-method{font-size:8pt}
  .da-print-note{display:block;padding:10px 12px;font-size:8pt;color:#344b3a}
  .da-method{padding:0;font-size:8pt}
  .data-analysis-workspace *{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* Associazioni da evidenze Excel: componenti isolati dal report e dai suoi filtri. */
.da-evidence-dialog {
  width: min(960px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #809086;
  border-radius: 12px;
  background: #fff;
  color: #203c30;
  box-shadow: 0 20px 60px #13291e38;
  overflow: hidden;
}
.da-evidence-dialog[open] { display: flex; flex-direction: column; }
.da-evidence-dialog::backdrop { background: #10251ccc; }
.da-evidence-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px; border-bottom: 1px solid #dce5dd; }
.da-evidence-heading h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.3; }
.da-evidence-heading p { margin: 0; color: #586d60; font-size: 14px; }
.da-evidence-body { min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 24px; }
.da-evidence-notice { padding: 16px; margin: 0 0 24px; background: #edf4fa; border-radius: 8px; color: #2d5f83; font-size: 14px; line-height: 1.6; }
#da-evidence-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 16px; }
#da-evidence-form label { grid-column: 1 / -1; font-size: 14px; font-weight: 600; }
#da-evidence-file { min-width: 0; width: 100%; min-height: 44px; padding: 8px; border: 1px solid #809086; border-radius: 8px; background: #fff; font-size: 14px; }
#da-evidence-file-help { grid-column: 1; margin: 0; color: #586d60; font-size: 14px; line-height: 1.5; }
#da-evidence-form [data-da-evidence-preview] { grid-column: 2; grid-row: 2 / 4; }
.da-evidence-dialog .button, [data-da-evidence-open] { min-height: 44px; min-width: 44px; font-size: 14px; }
.da-evidence-dialog .button { border-radius: 8px; transition: background-color 160ms, border-color 160ms; }
.da-evidence-dialog :focus-visible { outline: 3px solid #558d71; outline-offset: 3px; }
.da-evidence-dialog [aria-invalid="true"] { border-color: #a52b36; }
.da-evidence-status, .da-evidence-error { margin: 16px 0; font-size: 14px; line-height: 1.5; }
.da-evidence-status { color: #214e41; }
.da-evidence-error { color: #a52b36; padding: 12px; background: #fff8f8; border-radius: 8px; overflow-wrap: anywhere; }
.da-evidence-provenance { display: grid; gap: 8px; padding: 16px; margin-top: 24px; border: 1px solid #dce5dd; border-radius: 8px; font-size: 14px; overflow-wrap: anywhere; }
.da-evidence-provenance span { color: #586d60; }
.da-evidence-provenance code { font-size: 12px; white-space: normal; }
.da-evidence-summary { margin: 16px 0; font-size: 14px; line-height: 1.6; }
.da-evidence-group { margin-top: 12px; border: 1px solid #dce5dd; border-radius: 8px; overflow: hidden; }
.da-evidence-group > summary { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 12px 16px; font-size: 14px; font-weight: 600; cursor: pointer; background: #f4f6f1; }
.da-evidence-group > summary::before { content: '›'; font-size: 20px; }
.da-evidence-group[open] > summary::before { transform: rotate(90deg); }
.da-evidence-group .badge { margin-left: auto; }
.da-evidence-empty { padding: 16px; margin: 0; font-size: 14px; color: #586d60; }
.da-evidence-scroll { min-width: 0; max-width: 100%; }
.da-evidence-table { min-width: 820px; width: 100%; table-layout: auto; font-size: 14px; }
.da-evidence-table th, .da-evidence-table td { padding: 12px; max-width: 260px; vertical-align: top; overflow-wrap: anywhere; line-height: 1.5; }
.da-evidence-table small { display: block; margin-top: 8px; font-size: 12px; color: #586d60; }
.da-evidence-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; font-size: 14px; border-top: 1px solid #dce5dd; }
.da-evidence-pagination span { margin-right: auto; color: #586d60; }
.da-evidence-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; background: #fff; border-top: 1px solid #dce5dd; }
.da-evidence-footer p { flex: 1; min-width: 200px; margin: 0; font-size: 14px; line-height: 1.5; color: #586d60; }
@media (max-width: 620px) {
  .da-evidence-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .da-evidence-heading, .da-evidence-body, .da-evidence-footer { padding: 16px; }
  .da-evidence-heading h2 { font-size: 20px; }
  #da-evidence-form { grid-template-columns: minmax(0, 1fr); }
  #da-evidence-form [data-da-evidence-preview], #da-evidence-file-help { grid-column: 1; grid-row: auto; }
  .da-evidence-footer .button { width: 100%; }
  .da-evidence-table, .da-evidence-table tbody, .da-evidence-table tr { display: block; width: 100% !important; min-width: 0 !important; max-width: 100%; }
  .da-evidence-table colgroup { display: none; }
  .da-evidence-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .da-evidence-table tr { padding: 8px; border-top: 1px solid #dce5dd; }
  .da-evidence-table td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 8px; max-width: none; min-width: 0 !important; border: 0; padding: 8px; text-align: left !important; }
  .da-evidence-table td::before { content: attr(data-label); font-weight: 600; color: #586d60; }
  .da-evidence-table td small { grid-column: 2; margin-top: 0; }
  .da-evidence-pagination .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .da-evidence-dialog .button { transition: none; } }
@media print { .da-evidence-dialog, [data-da-evidence-open] { display: none !important; } }

/* Bolle: stessi controlli dell'anteprima Excel, azioni di ripristino separate. */
[data-da-bolla-open] { min-height: 44px; min-width: 44px; }
#da-bolla-form { display: grid; gap: 8px; }
#da-bolla-form > label { font-size: 14px; font-weight: 600; }
#da-bolla-files { width: 100%; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid #809086; border-radius: 8px; font-size: 14px; background: #fff; }
#da-bolla-file-help { margin: 0; color: #586d60; font-size: 14px; line-height: 1.5; }
#da-bolla-form [data-da-bolla-preview] { justify-self: start; }
.da-bolla-files { list-style: none; display: grid; gap: 8px; padding: 0; margin: 8px 0; }
.da-bolla-files li { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #dce5dd; border-radius: 8px; padding: 8px 12px; }
.da-bolla-files li > span { min-width: 0; overflow-wrap: anywhere; }
.da-bolla-files small { display: block; margin-top: 4px; color: #586d60; }
.da-bolla-table { min-width: 1100px; }
.da-bolla-restore { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.da-bolla-restore input { flex: none; width: 24px; height: 24px; accent-color: #214e41; }
.da-bolla-restore > span { min-width: 0; }
.da-bolla-hashes > summary { display: flex; align-items: center; min-height: 44px; color: #214e41; cursor: pointer; }
.da-bolla-hashes code { display: block; max-width: 240px; overflow-wrap: anywhere; white-space: normal; font-size: 12px; }
[data-da-bolla-restore-all] { display: block; margin-top: 12px; }
@media (max-width: 620px) { .da-bolla-files li { align-items: flex-start; gap: 8px; }.da-bolla-restore { grid-column: 2; }.da-bolla-hashes { grid-column: 2; } }
@media print { [data-da-bolla-open] { display: none !important; } }
