:root {
  --honey: #e0a500;
  --honey-dark: #8a5a00;
  --ink: #2d2a24;
  --muted: #7a6f5f;
  --bg: #f6f2e9;
  --card: #ffffff;
  --line: #e8e0d2;
}

html,
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 18px;
  background: linear-gradient(120deg, #2d2a24 0%, #4a3c1e 58%, #8a5a00 100%);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(60, 45, 20, 0.18);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.app-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 3px 0 0;
  color: #f3e6c8;
  font-size: 13px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.header-badge {
  font-size: 11px;
  letter-spacing: 0.08em;
}

.header-meta {
  font-size: 12px;
  color: #f3e6c8;
}

/* ── Filtri ────────────────────────────────────────────────────────────────── */

.filter-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(60, 45, 20, 0.06);
}

.filter-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-line {
  margin: 10px 2px 12px;
  color: var(--muted);
  font-size: 12px;
}

.retry-hint {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.85;
}

/* ── KPI ───────────────────────────────────────────────────────────────────── */

.kpi-card {
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(60, 45, 20, 0.05);
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 2px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

/* ── Grafici e tabelle ─────────────────────────────────────────────────────── */

.chart-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(60, 45, 20, 0.05);
}

.chart-title {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.card-body {
  padding: 16px 18px;
}

/* Il menu dei dropdown deve stare sopra le card. */
.Select-menu-outer,
.dropdown-menu {
  z-index: 10000 !important;
}

.radio-inline label {
  margin-right: 12px;
  color: var(--ink);
  font-size: 13px;
}

/* Con molti valori selezionati il controllo cresce troppo: limitiamo l'area
   dei chip e la rendiamo scrollabile, senza toccare il menu a tendina. */
#org-filter .Select-multi-value-wrapper,
#device-filter .Select-multi-value-wrapper {
  display: block !important;
  max-height: 94px !important;
  overflow-y: auto !important;
}

.DateInput_input {
  font-size: 13px;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */

.app-footer {
  margin-top: 20px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.app-footer code {
  color: var(--honey-dark);
  background: #fbf7ee;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .app-shell {
    padding: 12px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    align-items: flex-start;
  }

  .kpi-value {
    font-size: 20px;
  }
}
