/* Backoffice: sidebar fissa e contenuto a tutta larghezza, tabelle dense. */

.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 16px; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--border); }
.sidebar .brand { font-weight: 700; color: var(--text); padding: 4px 8px; }
.sidebar .brand:hover { text-decoration: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--muted); padding: 7px 10px; border-radius: var(--radius-sm); }
.sidebar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.sidebar nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-top: 1px solid var(--border); }
.side-foot .who { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.shell main { max-width: none; margin: 0; padding: 20px 28px 48px; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0; border: 0; flex-direction: row; align-items: center; }
}

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: 200px; }
table.dense td, table.dense th { padding: 6px 10px; }
.results { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; max-height: 240px; overflow: auto; }
.results li { padding: 4px 0; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.results code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 0 0; color: var(--muted); font-size: 13px; }

details.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); }
details.card[open] > summary::before { content: "–"; }
details.card[open] > summary { margin-bottom: 12px; }

.toolbar.bulk { padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface-2); opacity: .6; }
.toolbar.bulk.active { opacity: 1; background: var(--accent-soft); }
tr.selected td { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; overflow-x: auto; padding-top: 8px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 26px; font-size: 11px; }
.bar i { display: block; width: 16px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar small, .bar span { color: var(--muted); }
.bar small { margin-top: 4px; }
td.payload { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
pre.export { max-height: 320px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); font-size: 12px; }
.product { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
.product .thumb.big { height: 180px; }
@media (max-width: 700px) { .product { grid-template-columns: 1fr; } }
.bar i.seg-block { background: var(--warn); border-radius: 0; }
.bar i.seg-err { background: var(--bad); border-radius: 4px 4px 0 0; }
.bar i.seg-muted { background: var(--border); }
.bar.pair .pair-cols { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.bar.pair .pair-cols i { width: 9px; }
.secret { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--warn-soft); }
.secret code { font-size: 13px; word-break: break-all; }
tr.muted td { color: var(--faint); }
/* barre impilate (dashboard del catalogo) */
.bar .stack-col { display: flex; flex-direction: column-reverse; width: 16px; }
.bar .stack-col i { width: 100%; border-radius: 0; }
.bar .stack-col i:last-child { border-radius: 4px 4px 0 0; }
.c0 { background: var(--accent) !important; } .c1 { background: #059669 !important; } .c2 { background: #d97706 !important; }
.c3 { background: #7c3aed !important; } .c4 { background: #94a3b8 !important; } .c5 { background: #cc0c39 !important; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; background: var(--dot); }
.bars.dense { gap: 2px; overflow: hidden; }
.bars.dense .bar { flex: 1; min-width: 0; }
.bars.dense .bar .stack-col { width: 100%; max-width: 18px; }
.bars.dense .bar span, .bars.dense .bar small { white-space: nowrap; min-height: 14px; }
.bars.dense .bar:hover .stack-col { opacity: .75; }

/* dashboard live */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: minmax(0, 1fr); } }
.dash-cols h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 4px; }
.page-head .live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.page-head .live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .page-head .live i { animation: none; } }
.alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--gap); }
.alert { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--border); background: var(--surface); }
.alert.ok { color: var(--good); background: var(--good-soft); border-color: transparent; }
.alert.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.alert.ko { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.alert.info { color: var(--text); }
.kpis.people { margin-bottom: var(--gap); }
.kpis a.kpi { color: inherit; text-decoration: none; }
.kpis a.kpi:hover { background: var(--surface-2); }
.kpis.inner { margin: 8px 0 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.inner.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .kpis.inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi .hint { font-size: 12px; }
.statusbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 4px 0 6px; }
.statusbar i { display: block; height: 100%; }
.statusbar i.active { background: var(--good); } .statusbar i.pending { background: var(--warn); }
.statusbar i.error { background: var(--bad); } .statusbar i.muted { background: var(--faint); }
.legend .st::before { background: var(--faint); }
.legend .st.active::before { background: var(--good); } .legend .st.pending::before { background: var(--warn); }
.legend .st.error::before { background: var(--bad); }
.bars.dense.mini { height: 90px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed li > a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; }
.delta { font-weight: 600; font-size: 12px; } .delta.down { color: var(--good); } .delta.up { color: var(--bad); } .delta.new { color: var(--muted); font-weight: 400; }
.queue-mix { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* frequenza dei controlli */
details.schedule { margin-bottom: var(--gap); }
details.schedule summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.schedule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; margin-top: 10px; align-items: end; }

/* categorie */
ul.tree { list-style: none; margin: 0; padding: 0; }
ul.tree li { padding: 5px 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
ul.tree li:first-child { border-top: 0; }
ul.tree .node-name { font-weight: 500; }
ul.tree .node-actions { margin-left: auto; display: inline-flex; gap: 8px; font-size: 13px; }
ul.tree li.muted .node-name { color: var(--faint); text-decoration: line-through; }
p.crumbs { font-size: 14px; margin: 6px 0 10px; }
.categories-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }

.import-progress { margin-top: 10px; }
