/* pf.ilbarone.net - tema dark coerente con www.ilbarone.net */
:root {
  --bg:       #0d1117;
  --bg2:      #161b22;
  --bg3:      #1e2430;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --border:   rgba(255,255,255,.08);
  --border2:  rgba(255,255,255,.14);
  --accent:   #10ffb4;
  --cyan:     #06b6d4;
  --purple:   #a855f7;
  --orange:   #f59e0b;
  --red:      #ef4444;
  --green:    #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 20px;
  min-height: 100vh;
}

.container { max-width: 1280px; margin: 0 auto; }

/* Header */
.header {
  background: linear-gradient(135deg, rgba(6,182,212,.12), rgba(168,85,247,.10));
  border: 1px solid var(--border);
  padding: 2rem;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(6,182,212,.06) inset;
}
.header::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 20% 20%, rgba(6,182,212,.18), transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(168,85,247,.16), transparent 70%);
  pointer-events: none;
}
.header > * { position: relative; }
.header h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  margin-bottom: .25rem;
  background: linear-gradient(135deg, #06b6d4, #10ffb4 60%, #a855f7);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header h1 i { -webkit-text-fill-color: var(--cyan); }
.header p { color: var(--muted); }

/* Latest grid (live values) */
.latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: .75rem;
}
.metric {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform .15s, border-color .15s;
}
.metric:hover {
  transform: translateY(-2px);
  border-color: var(--border2);
}
.metric-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.metric-temp-est .metric-icon { background: rgba(245,158,11,.15); color: var(--orange); }
.metric-temp-int .metric-icon { background: rgba(239,68,68,.15);  color: var(--red); }
.metric-umidita  .metric-icon { background: rgba(6,182,212,.15);  color: var(--cyan); }
.metric-pressione .metric-icon { background: rgba(168,85,247,.15); color: var(--purple); }
.metric-body { flex: 1; min-width: 0; }
.metric-label {
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .2rem;
  font-weight: 600;
}
.metric-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
}
.metric-value span {
  font-size: .9rem;
  color: var(--muted);
  font-weight: 500;
}

.latest-note {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 1.5rem;
}
.latest-note strong { color: var(--text); }

.empty-state {
  background: var(--bg2);
  border: 1px dashed var(--border2);
  border-radius: 14px;
  padding: 3rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.empty-state i {
  font-size: 2.4rem;
  color: var(--muted);
  display: block;
  margin-bottom: .8rem;
}
.empty-state p { color: var(--muted); }

/* Controls (range buttons + day picker) */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.day-picker {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.day-picker label {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
}
.day-picker input[type="date"] {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
  color-scheme: dark;
}
.day-picker input[type="date"]:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6,182,212,.2);
}

.rb {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: .55rem 1rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.rb:hover {
  background: rgba(255,255,255,.05);
  border-color: var(--accent);
  color: var(--accent);
}
.rb.active {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #fff;
  border-color: rgba(6,182,212,.5);
  box-shadow: 0 4px 14px rgba(6,182,212,.3);
}

.loading-bar {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  padding: .5rem;
  margin-bottom: 1rem;
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
  margin-right: .4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chart cards */
.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}
.chart-card h2 {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.chart-card h2 i { color: var(--cyan); }
.chart-wrapper {
  position: relative;
  height: 360px;
  width: 100%;
  background: var(--bg);
  border-radius: 10px;
  padding: .5rem;
  border: 1px solid var(--border);
}

.footer {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.footer a { color: var(--cyan); text-decoration: none; }
.footer a:hover { color: var(--accent); }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

@media (max-width: 768px) {
  body { padding: 12px; }
  .header { padding: 1.5rem 1rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .range-buttons { justify-content: center; }
  .day-picker { justify-content: center; }
  .chart-wrapper { height: 280px; }
  .metric-value { font-size: 1.4rem; }
}
