* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial, sans-serif;
    background: #f0f2f5;
    color: #222;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── sidebar ── */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: #fff;
    padding: 20px;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.sidebar h3 {
    font-size: 16px;
    margin-bottom: 4px;
}
.sidebar label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}
.sidebar-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.reset-btn {
    all: unset;
    cursor: pointer;
    font-size: 11px;
    color: #888;
    text-decoration: underline;
}
.reset-btn:hover {
    color: #d33;
}
/* time inputs are hidden (set programmatically on anomaly click) */

/* ── main content ── */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ── metric cards ── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.empty-hint {
    grid-column: 1 / -1;
    color: #999;
    font-size: 14px;
}
.metric-card {
    background: #fff;
    border-radius: 6px;
    padding: 10px 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.metric-card h4 {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
}
.metric-card span {
    font-size: 16px;
    font-weight: 700;
}

/* ── sensor bar (multi-select in Graph tab) ── */
.sensor-bar {
    margin-bottom: 18px;
    padding-top: 8px;
}

/* ── charts ── */
.chart-sensor-id {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin: 4px 0 4px;
}
.sensor-list {
    list-style: none;
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}
/* ── in-tab filter bar (Riavvii) ── */
.tab-filter-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.tab-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
}
.tab-filter-field > label {
    font-size: 13px;
    font-weight: 600;
    color: #52514e;
}

/* ── shift amplitude filter (Analisi + Anomalie tabs) ── */
.amplitude-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.amplitude-filter-bar > label {
    font-size: 13px;
    font-weight: 600;
    color: #52514e;
}
.amplitude-bands {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.amplitude-bands label {
    font-size: 13px;
    color: #52514e;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.chart-zoom-hint {
    font-size: 12px;
    color: #898781;
    margin-bottom: 8px;
}
.chart-card {
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── metric sections ── */
.metric-section {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}
.metric-section-title {
    font-size: 15px;
    color: #333;
    margin-bottom: 10px;
}

/* ── anomalie ── */
.anomalie-sensor-block {
    margin-bottom: 24px;
}
.anomalie-kind-title {
    font-size: 13px;
    color: #555;
    padding: 12px 0 4px;
}
.anomalie-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.anomalie-header-row .anomalie-kind-title {
    padding: 12px 0 4px;
    flex: 1;
}
.export-btn {
    font-size: 11px;
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
.export-btn:hover {
    background: #f0f0f0;
}
.filter-confirmed-btn {
    font-size: 11px;
    padding: 4px 10px;
    min-width: 85px;
    border: 1px solid #4CAF50;
    border-radius: 4px;
    background: #fff;
    color: #4CAF50;
    cursor: pointer;
}
.filter-confirmed-btn:hover {
    background: #4CAF50;
    color: #fff;
}

/* ── catalogo ── */
.catalogo-section-title {
    flex: 1;
}
.catalogo-container {
    padding-top: 16px;
}

/* ── riepilogo ── */
.riepilogo-container {
    max-width: 900px;
    padding-top: 16px;
}
.riepilogo-container h2 {
    font-size: 20px;
    margin-bottom: 16px;
}
.riepilogo-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin: 24px 0 10px;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #222;
    line-height: 1.1;
}
.stat-secondary {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}
