/* AVON HMO brand system — the ONLY four brand colours are used here.
   Purple #59058D (primary) · Green #488948 · Gray #6E6E70 · Yellow #FFF212 */
:root {
  --purple: #59058D;
  --purple-600: #4a0475;
  --purple-050: #f4ecfa;
  --green: #488948;
  --gray: #6E6E70;
  --yellow: #FFF212;
  --ink: #241a2e;
  --paper: #ffffff;
  --line: #e7e1ee;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #faf8fc;
  line-height: 1.5;
}
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 1rem; font-weight: 600; padding: 12px 22px; text-align: center;
  transition: transform .05s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--purple); color: #fff; box-shadow: 0 6px 16px rgba(89,5,141,.28); }
.btn-primary:hover { background: var(--purple-600); color: #fff; }
.btn-accent { background: var(--yellow); color: var(--purple); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.btn-accent:hover { filter: brightness(.97); color: var(--purple); }
.btn-ghost { background: transparent; color: var(--purple); border: 1.5px solid var(--purple); }
.btn-ghost:hover { background: var(--purple-050); color: var(--purple); }
.btn-block { width: 100%; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; background: #fff;
  border-bottom: 3px solid var(--yellow);
  box-shadow: 0 2px 10px rgba(89,5,141,.06);
}
.site-header .brand-logo { height: 38px; width: auto; display: block; }
.site-header nav { display: flex; align-items: center; gap: 18px; }
.site-header nav a.navlink { color: var(--gray); font-weight: 600; font-size: .95rem; }
.site-header nav a.navlink:hover { color: var(--purple); text-decoration: none; }

/* ---- Footer ---- */
.site-footer {
  background: var(--purple); color: #efe7f6;
  border-top: 3px solid var(--yellow);
  padding: 20px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; font-size: .88rem;
}
.site-footer .foot-brand { color: #fff; font-weight: 700; letter-spacing: .3px; }
.site-footer a { color: var(--yellow); }
.site-footer .foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer .muted { color: #cdb9de; }

/* ---- Landing ---- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255,242,18,.16), transparent 60%),
    linear-gradient(135deg, var(--purple) 0%, #7B1AB5 100%);
  color: #fff; padding: 84px 32px 96px;
}
.hero-inner { max-width: 1120px; margin: 0 auto; display: grid;
  grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center; }
.hero .eyebrow {
  display: inline-block; background: rgba(255,242,18,.16); color: var(--yellow);
  font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin: 0 0 16px; }
.hero p.lead { font-size: 1.12rem; color: #ecdff6; max-width: 34ch; margin: 0 0 28px; }
.hero .cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; align-items: center; }
.hero-art .pulse-card {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px; padding: 26px; width: 100%; max-width: 340px;
  backdrop-filter: blur(2px);
}
.hero-art .pulse-card h3 { margin: 0 0 14px; color: #fff; font-size: 1.05rem; }
.chip { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:12px;
  background: rgba(255,255,255,.10); margin-bottom: 10px; color:#fff; font-weight:600; font-size:.92rem; }
.chip .dot { width:10px; height:10px; border-radius:50%; flex:none; }

.features { max-width: 1120px; margin: -48px auto 0; padding: 0 32px 64px;
  position: relative; z-index: 5; display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.feature {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  box-shadow: 0 10px 30px rgba(89,5,141,.08);
}
.feature .ficon { width: 44px; height: 44px; border-radius: 12px; display:flex;
  align-items:center; justify-content:center; margin-bottom: 14px; color:#fff; font-size:1.3rem; }
.feature h3 { margin: 0 0 8px; color: var(--purple); font-size: 1.08rem; }
.feature p { margin: 0; color: var(--gray); font-size: .95rem; }

.page { display: flex; flex-direction: column; min-height: 100vh; }
.page > main { flex: 1; }

/* ---- Auth / login ---- */
.auth-page {
  min-height: 100vh; display: flex; flex-direction: column;
  background:
    linear-gradient(135deg, rgba(89,5,141,.94) 0%, rgba(123,26,181,.92) 100%),
    url("../img/auth-bg.svg");
  background-size: cover; background-position: center; background-attachment: fixed;
}
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 18px;
  padding: 34px 30px; box-shadow: 0 24px 60px rgba(19,2,32,.35);
  border-top: 4px solid var(--yellow);
}
.auth-card .auth-logo { display: block; height: 40px; margin: 4px auto 18px; }
.auth-card h1 { text-align: center; font-size: 1.25rem; margin: 0 0 4px; color: var(--purple); }
.auth-card .sub { text-align: center; color: var(--gray); font-size: .9rem; margin: 0 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--gray); font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 1rem; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(89,5,141,.14); }
.auth-error {
  background: #fbeaf3; color: #8a1050; border: 1px solid #f3c9df;
  padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px;
}
.auth-note {
  background: #eef7ee; color: #2f6a2f; border: 1px solid #cfe6cf;
  padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px;
}
.auth-foot-note { text-align: center; color: var(--gray); font-size: .8rem; margin-top: 16px; }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .features { grid-template-columns: 1fr; margin-top: 24px; }
  .site-header { padding: 12px 18px; }
}

/* ===== Staff portal shell (Dash /app) ===== */
.portal { display: flex; min-height: 100vh; background: #f4f2f8; }

/* --- Sidebar (purple) --- */
.sidebar {
  width: 248px; flex: none; align-self: stretch;
  background: linear-gradient(180deg, #59058D 0%, #4a0475 100%);
  color: #efe7f6; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 20px 14px 16px;
  /* A long nav (e.g. IT Admin, who sees every module) must scroll inside the
     purple panel instead of overflowing past it onto the light page. */
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.28); border-radius: 999px;
}
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar .side-logo { display: block; width: 150px; margin: 4px auto 6px; }
.sidebar .side-tagline {
  text-align: center; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: #c9b3dd; margin-bottom: 16px;
}
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; margin-bottom: 16px;
}
.side-user .avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--yellow); color: var(--purple); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.side-user .who { min-width: 0; }
.side-user .who .name { color: #fff; font-weight: 600; font-size: .9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who .role {
  display: inline-block; margin-top: 2px; font-size: .68rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--purple);
  background: var(--yellow); border-radius: 999px; padding: 1px 8px;
}
/* HR/Gatekeeper client switcher in the sidebar */
.side-clients {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 14px;
}
.side-clients-label {
  font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  color: #c9b3dd; font-weight: 700; margin-bottom: 6px;
}
.side-client-single { color: #fff; font-weight: 600; font-size: .9rem; }
.side-client-radio .side-client-option {
  display: flex; align-items: center; gap: 8px; color: #e4d7f0;
  font-size: .88rem; font-weight: 600; padding: 4px 0; cursor: pointer;
}
.side-client-radio .side-client-input { accent-color: var(--yellow); cursor: pointer; }

.sidebar .nav { gap: 2px; }
/* Group headings that split the nav by module/role */
.sidebar .nav-group-label {
  font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 800; color: #b79ad0; padding: 12px 12px 4px; margin-top: 2px;
}
.sidebar .nav-group-label:first-child { margin-top: 0; padding-top: 2px; }
.sidebar .side-link {
  display: block; color: #e4d7f0 !important; font-weight: 600; font-size: .92rem;
  padding: 10px 12px; border-radius: 10px; border-left: 3px solid transparent;
  text-decoration: none; transition: background .12s ease, color .12s ease;
}
.sidebar .side-link:hover { background: rgba(255,255,255,.10); color: #fff !important; }
.sidebar .side-link.active {
  background: rgba(255,255,255,.16); color: #fff !important;
  border-left-color: var(--yellow);
}
/* New-notifications count on the Notifications nav link */
.sidebar .nav-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar .nav-badge {
  min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--yellow); color: var(--purple);
  font-size: .72rem; font-weight: 800; line-height: 1.4; text-align: center;
}
.sidebar .nav-badge.is-empty { display: none; }

/* Per-module "new" chips shown when opening the Notifications inbox */
.notif-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.notif-chip-lead {
  font-weight: 800; color: var(--purple); background: var(--purple-050);
  border-radius: 999px; padding: 3px 12px; font-size: .82rem;
}
.notif-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 12px;
  background: #fff; font-size: .82rem; color: var(--ink);
}
.notif-chip .chip-label { font-weight: 600; }
.notif-chip .chip-count {
  min-width: 20px; text-align: center; padding: 0 7px; border-radius: 999px;
  background: var(--green); color: #fff; font-weight: 800; font-size: .74rem;
}

.sidebar .side-spacer { flex: 1 1 auto; }
.sidebar .side-signout {
  display: block; text-align: center; color: var(--purple) !important; background: var(--yellow);
  font-weight: 700; padding: 9px; border-radius: 10px; text-decoration: none; margin-top: 10px;
}
.sidebar .side-signout:hover { filter: brightness(.96); }

/* --- Main column + header --- */
.portal-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(89,5,141,.05);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .tb-title { font-weight: 700; color: var(--purple); font-size: 1.02rem; }
.topbar .tb-title .tb-sub { color: var(--gray); font-weight: 500; font-size: .8rem; display: block; }
.topbar .tb-right { display: flex; align-items: center; gap: 14px; color: var(--gray); font-size: .85rem; }
.topbar .tb-right .tb-accent { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.portal-content { padding: 24px 26px; flex: 1 1 auto; }

/* IT-admin "acting as another user" banner (below the top bar) */
.impersonation-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  background: #fff8d6; border-bottom: 2px solid var(--yellow);
  color: #5a4b00; padding: 8px 26px; font-size: .88rem; font-weight: 600;
}
.impersonation-banner .imp-sub { color: #8a7a2a; font-weight: 500; margin-left: 4px; }
.impersonation-banner .imp-return {
  background: var(--purple); color: #fff !important; text-decoration: none;
  font-weight: 700; padding: 5px 14px; border-radius: 8px; white-space: nowrap;
}
.impersonation-banner .imp-return:hover { filter: brightness(1.08); }

@media (max-width: 720px) {
  .portal { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
  .sidebar .side-spacer { display: none; }
}

/* --- Global busy overlay ---
   A full-page dimmed scrim with a centred spinner, shown by the client-side
   installer (dash_app.py) the instant an action button/link is clicked and kept up
   until the triggering Dash callback's network request actually returns. Blocks
   further clicks so the action can't be fired twice; reliable even when the
   callback opens a modal (whose output isn't mounted until it opens). */
#app-busy-overlay {
  position: fixed; inset: 0; z-index: 4000;
  display: none; align-items: center; justify-content: center;
  background: rgba(36, 26, 46, 0.35); cursor: progress;
}
#app-busy-overlay.active { display: flex; }
#app-busy-overlay .app-busy-box {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: #fff; padding: 22px 30px; border-radius: 14px;
  box-shadow: 0 14px 44px rgba(19, 2, 32, .3);
}
#app-busy-overlay .app-busy-spin {
  width: 44px; height: 44px; border-radius: 50%;
  border: 5px solid var(--purple-050); border-top-color: var(--purple);
  animation: app-busy-spin 0.7s linear infinite;
}
#app-busy-overlay .app-busy-text { color: var(--purple); font-weight: 600; font-size: .92rem; }
@keyframes app-busy-spin { to { transform: rotate(360deg); } }
