:root {
  /* Palette Commercial Meeting HB (week16 deck) */
  --hb-navy: #1B355E;           /* brand primary: navy dominante nel deck */
  --hb-navy-dark: #112445;      /* variante più scura per hover/overlay */
  --hb-accent: #c4a960;          /* oro elegante, firma menswear HB */
  --hb-red: #E63946;             /* rosso enfasi/alert (mutuato dal deck) */
  --bg: #f5f6f8;                 /* off-white leggermente freddo */
  --surface: #ffffff;
  --border: #e1e4ea;
  --text: #1B355E;               /* titoli in navy, coerente con i deck */
  --text-body: #1f2937;
  --muted: #6b7280;
  --danger: #E63946;
  --success: #196B24;            /* verde sobrio dal tema */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--hb-navy);
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--hb-accent); color: var(--hb-navy);
  border-radius: 6px; font-weight: 800;
}
.title { font-weight: 700; font-size: 18px; }
.subtitle { color: #cbd5e1; font-size: 13px; margin-left: 6px; }

.filters { display: flex; gap: 16px; align-items: center; }
.filters label { font-size: 12px; color: #cbd5e1; display: flex; flex-direction: column; gap: 4px; }
.filters input, .filters select {
  background: #fff; color: var(--text); border: none; border-radius: 4px;
  padding: 6px 8px; font-size: 13px;
}

.tabs {
  display: flex; gap: 2px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.tab {
  background: none; border: none; padding: 14px 18px;
  font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--hb-navy); border-bottom-color: var(--hb-accent); font-weight: 700; }

main { padding: 24px; }
.panel.hidden { display: none; }
.panel h2 { margin-top: 0; font-size: 22px; color: var(--hb-navy); }

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 4px; color: var(--hb-navy); }

.chart {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; margin-bottom: 16px; min-height: 320px;
}

.drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 48px; text-align: center; color: var(--muted); cursor: pointer;
  background: var(--surface);
}
.drop-zone.drag { border-color: var(--hb-accent); color: var(--hb-navy); }

.loaded-files { list-style: none; padding: 0; margin: 16px 0; }
.loaded-files li {
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 6px; font-size: 13px;
}

button.danger {
  background: var(--danger); color: white; border: none;
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
}

.hint { color: var(--muted); font-size: 13px; }
code {
  background: #eef2ff; padding: 1px 6px; border-radius: 3px; font-size: 12px;
}

.foot {
  display: flex; justify-content: space-between; padding: 12px 24px;
  border-top: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12px;
}

/* ====== Login gate ====== */
body.locked { overflow: hidden; }
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #1f2d5c 0%, #0b1530 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-overlay.hidden { display: none; }
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border-radius: 12px; padding: 28px 28px 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 14px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-title { font-weight: 700; font-size: 18px; color: var(--hb-navy); }
.auth-sub { color: var(--muted); font-size: 13px; }
.auth-card label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
}
.auth-card input {
  padding: 10px 12px; font-size: 15px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
}
.auth-card input:focus { outline: none; border-color: var(--hb-accent); }
.auth-submit {
  margin-top: 6px; background: var(--hb-navy); color: white;
  border: none; padding: 12px; border-radius: 6px;
  font-weight: 600; cursor: pointer; font-size: 15px;
}
.auth-submi