/* Cassetto tabella dati (in basso). Stessi valori di #right-panel, .rp-panel-header, .el-row e .pfm-group. */
#tab-drawer {
  position: fixed; left: 56px; right: 0; bottom: 0; height: 42vh; z-index: 970; /* sopra slider e logo, a destra della toolbar */
  display: none; flex-direction: column;
  background: rgba(248, 251, 255, 0.98);
  border: 1px solid rgba(30, 60, 160, 0.13); border-bottom: none;
  box-shadow: 0 -6px 40px rgba(30, 60, 160, 0.13);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 12px; color: #1a2a50;
}
#tab-drawer.open { display: flex; }
body:has(#rp-wrap.open) #tab-drawer { right: 400px; } /* non copre il pannello destro */

.tab-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; flex-shrink: 0;
  background: rgba(240, 245, 255, 0.8); border-bottom: 1px solid rgba(30, 60, 160, 0.1);
}
.tab-head h2 { font-size: 13px; font-weight: 700; color: #1a3898; letter-spacing: 0.06em; text-transform: uppercase; margin-right: 4px; }
#tab-count { flex: 1 1 200px; font-size: 11px; font-weight: 600; color: var(--ink-3); }

.tab-btn {
  font: inherit; font-size: 11px; font-weight: 700; padding: 5px 12px; cursor: pointer;
  background: #fff; color: var(--c-brand-blue); border: 1px solid rgba(36, 88, 200, 0.3); border-radius: 6px;
}
.tab-btn:hover { background: rgba(36, 88, 200, 0.08); }
.tab-btn.primary { background: var(--c-brand-orange); border-color: var(--c-brand-orange); color: var(--c-white); }
.tab-btn.primary:hover { filter: brightness(1.12); }
#tab-close { border: none; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 2px 8px; }
#tab-close:hover { color: var(--c-brand-orange); }

.tab-cols { position: relative; }
.tab-cols summary { list-style: none; }
.tab-cols summary::-webkit-details-marker { display: none; }
.tab-cols-pop {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 5; width: 320px; max-height: 300px; overflow: auto;
  background: var(--c-white); border: 1px solid rgba(30, 60, 160, 0.14); border-radius: 12px; padding: 8px;
  box-shadow: 4px -4px 20px rgba(30, 60, 160, 0.18);
}
.tab-cols-act { display: flex; gap: 6px; margin-bottom: 6px; }
.tab-col-item { display: block; padding: 3px 4px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--ink); }
.tab-col-item:hover { background: rgba(36, 88, 200, 0.07); }
#tab-drawer input[type="checkbox"] { accent-color: var(--c-brand-orange); }

.tab-scroll { flex: 1; overflow: auto; }
#tab-table { border-collapse: collapse; width: max-content; min-width: 100%; }
#tab-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 7px 10px; white-space: nowrap;
  background: #f0f5ff; border-bottom: 1px solid rgba(30, 60, 160, 0.14);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink);
}
#tab-table td { padding: 6px 10px; border-bottom: 1px solid rgba(30, 60, 160, 0.06); max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tab-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #3a4a78; }
#tab-table tbody tr { cursor: pointer; }
#tab-table tbody tr:hover td { background: rgba(36, 88, 200, 0.06); }
#tab-table tbody tr.sel td { background: rgba(36, 88, 200, 0.12); }
.tab-chk { width: 34px; text-align: center; position: sticky; left: 0; }
#tab-table td.tab-chk { background: #f8fbff; z-index: 1; }
#tab-table th.tab-chk { z-index: 2; }
#tb-tabella.active { color: var(--c-brand-orange); }

[data-theme="dark"] #tab-drawer { background: rgba(20, 20, 22, 0.98); border-color: rgba(255, 255, 255, 0.075); box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.5); color: #d4d4d8; }
[data-theme="dark"] .tab-head { background: rgba(36, 36, 38, 0.85); border-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .tab-head h2 { color: #e4e4e8; }
[data-theme="dark"] #tab-count { color: #8e8e96; }
[data-theme="dark"] .tab-btn { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.15); color: #e4e4e8; }
[data-theme="dark"] .tab-btn.primary { background: var(--c-brand-orange); border-color: var(--c-brand-orange); color: var(--c-white); }
[data-theme="dark"] .tab-cols-pop { background: rgba(28, 28, 30, 0.97); border-color: rgba(255, 255, 255, 0.11); box-shadow: 4px -4px 20px rgba(0, 0, 0, 0.45); }
[data-theme="dark"] .tab-col-item { color: #d4d4d8; }
[data-theme="dark"] .tab-col-item:hover { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] #tab-table th { background: rgba(36, 36, 38, 0.98); border-bottom-color: rgba(255, 255, 255, 0.11); color: #d4d4d8; }
[data-theme="dark"] #tab-table td { border-bottom-color: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] #tab-table td.num { color: #d4d4d8; }
[data-theme="dark"] #tab-table td.tab-chk { background: rgb(20, 20, 22); }
[data-theme="dark"] #tab-table tbody tr:hover td { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] #tab-table tbody tr.sel td { background: rgba(255, 255, 255, 0.1); }

@media (max-width: 639px) {
  #tab-drawer, body:has(#rp-wrap.open) #tab-drawer { left: 0; right: 0; bottom: var(--nav-h, 56px); height: 55vh; z-index: 900; }
  .tab-cols-pop { width: min(320px, 90vw); }
}
