/* Brand «Presenza»: blu notte #2B4A6F + pesca #E8A87C, font Schibsted Grotesk. */
:root {
  --notte: #2B4A6F;
  --notte-deep: #1b3252;
  --pesca: #E8A87C;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --fg: #1a2433;
  --muted: #6b7892;
  --green: #1faa59;
  --amber: #e2a400;
  --red: #d6373b;
  --violet: #7c3aed;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Schibsted Grotesk", -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--notte); color: #fff;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.mark {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--pesca);
  box-shadow: 0 0 0 4px rgba(232,168,124,.25);
}
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: .2px; }
.brand-sub { color: var(--pesca); font-weight: 500; font-size: .85rem; }
.env {
  margin-left: auto;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px; padding: 4px 12px; font-size: .8rem; font-weight: 600;
}
.env.prod { background: rgba(214,55,59,.25); border-color: rgba(214,55,59,.5); }
.reveal { font-size: .8rem; color: #fff; display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; align-items: center;
  background: var(--notte-deep); padding: 0 16px;
}
.tab {
  background: none; border: 0; color: #b9c6da; cursor: pointer;
  padding: 12px 16px; font: inherit; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: #fff; }
.tab.active { color: #fff; border-bottom-color: var(--pesca); }
.refresh { margin-left: auto; background: none; border: 0; color: #b9c6da; cursor: pointer; font-size: 1.1rem; }
.refresh:hover { color: #fff; }

/* Panels */
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.panel { display: none; }
.panel.active { display: block; }
.loading, .empty { color: var(--muted); padding: 24px; text-align: center; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 1.05rem; }
.card-head .id { color: var(--muted); font-size: .8rem; font-family: ui-monospace, monospace; }
.card-head .meta { color: var(--muted); font-size: .8rem; margin-left: auto; }

/* Badges */
.badge { font-size: .72rem; padding: 2px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.on { background: #e3f6ec; color: #11743f; }
.badge.off { background: #fde8e9; color: #a31419; }
.badge.comp { background: #efe7fb; color: #5b21b6; }
.badge.trial { background: #fff3d6; color: #8a6300; }
.badge.owner { background: var(--notte); color: #fff; }
.badge.member { background: #e8edf4; color: var(--notte); }
.badge.revoked { background: #fde8e9; color: #a31419; }
.badge.plat { background: #eef1f6; color: var(--notte); }
.badge.status-active, .badge.status-trialing, .badge.status-grace { background: #e3f6ec; color: #11743f; }
.badge.status-expired, .badge.status-revoked, .badge.status-paused { background: #fde8e9; color: #a31419; }
.badge.sandbox { background: #fff3d6; color: #8a6300; }

/* Tables / rows */
.rows { margin-top: 12px; }
.row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem;
}
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 120px; }
.row .dim { color: var(--muted); font-size: .82rem; }
.mono { font-family: ui-monospace, monospace; font-size: .82rem; }

/* Consent chips */
.consent { display: inline-flex; gap: 4px; }
.chip { font-size: .7rem; padding: 1px 7px; border-radius: 6px; background: #eef1f6; color: var(--muted); }
.chip.yes { background: #e3f6ec; color: #11743f; }

/* Presence health dot */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.stale { background: var(--amber); }
.dot.silent { background: var(--red); }
.dot.no-data { background: #9aa0aa; }

.section-title { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; margin: 22px 0 8px; }
.link { color: var(--notte); cursor: pointer; text-decoration: underline; background: none; border: 0; font: inherit; padding: 0; }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(20,30,50,.45); display: flex; justify-content: flex-end; z-index: 10; }
/* L'attributo [hidden] deve vincere sul display:flex sopra, altrimenti l'overlay
   resta sempre a tutto schermo e blocca click/scroll della pagina. */
.drawer[hidden] { display: none; }
.drawer-card { background: var(--card); width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 18px; }
.drawer-card header { display: flex; align-items: center; }
.drawer-card h3 { margin: 0; flex: 1; }
.x { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: var(--muted); }

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 16px; }

/* Schermata di accesso (modalità ospitata) */
.login-gate { display: flex; justify-content: center; padding: 64px 16px; }
.login-gate[hidden] { display: none; }
.login-card { max-width: 420px; width: 100%; text-align: center; }
.login-card h3 { margin: 0 0 8px; }
.login-card p { margin: 0 0 18px; }
.login-card button { cursor: pointer; padding: 10px 18px; }
#btn-logout { margin-left: 8px; }
.err { color: var(--red); padding: 16px; }
