/* ─────────────────────────────────────────────
   People Portal – design system 2026
   Default (platform) palette:
     #f7f6fb  paper       (content ground)
     #f5f2fe  lilac-50    (outer ground / fills)
     #001044  navy        (ink)
     #5c1ed8  indigo      (primary)  ·  #8f3bff violet (gradient start)
     #efe9ff  lilac-100   (primary tint)
     #a881ff  lilac       (accent)
   Fonts: Instrument Sans (body) + Bricolage Grotesque (headings)
   The employee portal overrides --sim-* per company at runtime
   (templates/header.php); this base is the People Portal default.
   Simera is not special — it would be just another company brand if configured.
───────────────────────────────────────────── */

/* ── Tokens ── */
:root {
  /* Brand — People Portal indigo/violet */
  --sim-primary:       #5c1ed8;
  --sim-primary-dark:  #4a17ad;
  --sim-primary-rgb:   92, 30, 216;
  --sim-primary-light: #efe9ff;
  --sim-accent:        #a881ff;

  /* Contrast-safe derivatives. Default to the brand colour (the base brand is
     already readable); client-header overrides these per entity when a brand's
     colour is too light to read — see readableTextColor()/onColor() in PHP.
     --sim-primary-text = brand used as TEXT on a light surface (links, headings).
     --sim-on-primary   = text placed ON a primary-filled element (buttons). */
  --sim-primary-text:  var(--sim-primary);
  --sim-on-primary:    #ffffff;

  /* Gradients — primary buttons + brand flourishes */
  --sim-grad:      linear-gradient(102deg, #8f3bff 0%, #5c1ed8 100%);
  --sim-grad-soft: linear-gradient(102deg, #a881ff 0%, #6d33f3 100%);

  /* Radio / checkbox "choice" accent — a neutral slate that reads cleanly on
     EVERY company brand (deliberately NOT the brand colour; the admin console
     overrides it to indigo via body.sim-admin). */
  --sim-choice-accent:      #6b7c9e;   /* muted slate */
  --sim-choice-accent-rgb:  107, 124, 158;
  --sim-choice-tint:        #f1f3f8;   /* faint fill when hover/selected */

  /* Ground & surfaces */
  --sim-bg:         #f5f2fe;   /* lilac-50 — outer background / subtle fills */
  --sim-sidebar:    #ffffff;   /* sidebar + topnav */
  --sim-content-bg: #f7f6fb;   /* main content area (paper) */
  --sim-surface:    #ffffff;   /* cards */
  --sim-th-bg:      #f7f8fb;   /* neutral off-white for table headers (never the brand bg) */

  /* Text */
  --sim-ink:       #001044;   /* navy */
  --sim-ink-muted: #585d7e;
  --sim-ink-subtle:#7a7fa0;

  /* Borders — neutral so they read on any company brand (admin overrides to
     lilac via body.sim-admin) */
  --sim-border:        rgba(0,16,68,.08);
  --sim-border-strong: rgba(0,16,68,.14);

  /* Radius */
  --sim-radius:    0.625rem;  /* 10px */
  --sim-radius-lg: 0.875rem;  /* 14px */
  --sim-radius-xl: 1.25rem;   /* 20px */

  /* Form controls — one set of numbers for inputs, selects, textareas, buttons
     and choice cards, so a row containing several of them lines up. Anything
     that deliberately reads as compact (table-row buttons, *-sm) opts out. */
  --sim-control-border: 1px;
  --sim-control-radius: var(--sim-radius);
  --sim-control-pad-y:  .6rem;
  --sim-control-pad-x:  .9rem;
  --sim-control-h:      2.625rem;   /* 42px — the height they all settle on */
  --sim-control-h-sm:   2rem;       /* 32px — table rows and inline toolbars */
  --sim-control-pad-y-sm: .35rem;
  --sim-control-pad-x-sm: .8rem;

  /* Shadows */
  --sim-shadow-xs: 0 1px 2px rgba(0,10,30,.05);
  --sim-shadow:    0 1px 3px rgba(0,10,30,.05), 0 4px 16px rgba(0,10,30,.07);
  --sim-shadow-lg: 0 4px 8px rgba(0,10,30,.07), 0 16px 48px rgba(0,10,30,.11);
  --sim-shadow-xl: 0 8px 16px rgba(0,10,30,.09), 0 32px 80px rgba(0,10,30,.15);

  /* Sidebar tokens — neutral (company-agnostic); the admin console overrides
     these to navy ink + lilac active via body.sim-admin */
  --sim-sidebar-fg:        rgba(0,16,68,.74);
  --sim-sidebar-fg-hover:  #001044;
  --sim-sidebar-active-bg: rgba(0,16,68,.07);
  --sim-sidebar-hover-bg:  rgba(0,16,68,.04);
  --sim-sidebar-border:    rgba(0,16,68,.08);

  /* Layout tokens */
  --sim-topnav-h:  52px;
  --sim-sidebar-w: 220px;
  --sim-drawer-w:  min(86vw, 320px);   /* mobile slide-in drawer width */

  /* Typography — Instrument Sans body + Bricolage Grotesque headings (People
     Portal). Companies may override the body font per-brand at runtime. */
  --sim-font:         'Instrument Sans', system-ui, sans-serif;
  --sim-font-heading: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
}

/* ── Global reset / base ── */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--sim-font);
  font-size: 0.9375rem;
  background-color: var(--sim-bg);
  color: var(--sim-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Admin portal theme: People Portal brand (violet/indigo, Bricolage + Instrument Sans) ──
   Scoped to body.sim-admin ONLY so the multi-tenant people portal (which themes these
   same tokens per-company at runtime) is untouched. Solid accent = indigo #5c1ed8;
   the violet→indigo gradient is used only on primary buttons + the admin marker pill. */
body.sim-admin {
  /* Typography — Inter across the whole admin portal (body + headings) */
  --sim-font:         'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sim-font-heading: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Brand — indigo solid, lilac fills */
  --sim-primary:       #5c1ed8;
  --sim-primary-dark:  #4a17ad;
  --sim-primary-rgb:   92, 30, 216;
  --sim-primary-light: #efe9ff;   /* lilac-100 */
  --sim-accent:        #a881ff;   /* lilac */

  /* Gradients */
  --sim-grad:      linear-gradient(102deg, #8f3bff 0%, #5c1ed8 100%);
  --sim-grad-soft: linear-gradient(102deg, #a881ff 0%, #6d33f3 100%);

  /* Ink */
  --sim-ink:        #001044;   /* navy */
  --sim-ink-muted:  #33395c;   /* darkened: 6.4:1 → 11.2:1 on white */
  --sim-ink-subtle: #4a5175;   /* darkened: 3.9:1 (below AA) → 7.7:1 */

  /* Lines / surfaces */
  --sim-border:        #e7e4f3;
  --sim-border-strong: #d7d0ee;
  --sim-bg:         #f5f2fe;    /* lilac-50 — table headers, hovers */
  --sim-content-bg: #f7f6fb;    /* paper */
  --sim-surface:    #ffffff;

  /* Choice controls (checkbox/radio) → brand */
  --sim-choice-accent:     #5c1ed8;
  --sim-choice-accent-rgb: 92, 30, 216;
  --sim-choice-tint:       #f5f2fe;

  /* Sidebar → navy ink + lilac active */
  --sim-sidebar-fg:    rgba(0,16,68,.92);   /* nav text: 7.6:1 → 15.1:1 on white */
  --sim-sidebar-fg-hover:  #001044;
  --sim-sidebar-active-bg: #efe9ff;   /* lilac-100 */
  --sim-sidebar-hover-bg:  #f5f2fe;   /* lilac-50 */
  --sim-sidebar-border:    #e7e4f3;

  background-color: #f7f6fb;   /* paper — was #FAFAF7 */
  line-height: 1.6;
}
body.sim-admin .sim-layout { background: #f7f6fb; }   /* outer shell */
body.sim-admin .sim-main   { background: #f7f6fb; }   /* content area */

/* Headings — Bricolage Grotesque on title-level text (eyebrows stay in body font) */
body.sim-admin .admin-page-title,
body.sim-admin .sim-page-title,
body.sim-admin .sim-card-title,
body.sim-admin .sim-admin-tile-value,
body.sim-admin .sim-stat-value,
body.sim-admin .sim-auth-heading {
  font-family: var(--sim-font-heading);
  letter-spacing: -.02em;
  line-height: 1.04;
}

/* Primary buttons — the one place the gradient fill is used */
body.sim-admin .btn-primary {
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-border-color: transparent;
  background: var(--sim-grad);
  border-color: transparent;
  color: #fff;
}
body.sim-admin .btn-primary:hover  { background: var(--sim-grad); opacity: .92; }
body.sim-admin .btn-primary:active { opacity: 1; }

/* Admin marker pill — gradient (was red) */
body.sim-admin .sim-admin-wordmark        { background: var(--sim-grad); }
body.sim-admin .sim-admin-wordmark:hover  { background: var(--sim-grad-soft); }
body.sim-admin .sim-admin-badge {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-color: rgba(92,30,216,.2);
}

/* Eyebrow labels in indigo (palette: "indigo — eyebrow text") */
body.sim-admin .card-header-sim { color: var(--sim-primary-text); }

/* Active nav item text in indigo (flat, on the lilac-100 active fill from the token) */
body.sim-admin .sim-sidebar-link.active,
body.sim-admin .sim-sidebar-sublink.active,
body.sim-admin .sim-sidebar-group-btn.active { color: var(--sim-primary-text); }

/* Info/brand badge → lilac + indigo (semantic green/red/amber/yellow unchanged) */
body.sim-admin .sim-badge-blue {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
}

/* flatpickr — recolor selected/today to brand (date picker is otherwise unthemed) */
body.sim-admin .flatpickr-day.selected,
body.sim-admin .flatpickr-day.selected:hover {
  background: var(--sim-primary);
  border-color: var(--sim-primary);
}
body.sim-admin .flatpickr-day.today { border-color: var(--sim-primary); }

/* Softer, violet-tinted card shadow */
body.sim-admin .card {
  box-shadow: 0 1px 2px rgba(0,16,68,.04), 0 6px 20px rgba(92,30,216,.06);
}

/* ── Button system ── */

/* Primary */
.btn-primary {
  --bs-btn-bg:           var(--sim-primary);
  --bs-btn-border-color: var(--sim-primary);
  --bs-btn-color:        var(--sim-on-primary);
  --bs-btn-hover-color:  var(--sim-on-primary);
  --bs-btn-active-color: var(--sim-on-primary);
  --bs-btn-hover-bg:     var(--sim-primary-dark);
  --bs-btn-hover-border-color: var(--sim-primary-dark);
  --bs-btn-active-bg:    var(--sim-primary-dark);
  font-family: var(--sim-font);
  font-weight: 700;
  font-size: .875rem;
  border-width: var(--sim-control-border);
  border-radius: var(--sim-control-radius);
  padding: var(--sim-control-pad-y) 1.4rem;
  min-height: var(--sim-control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  letter-spacing: .01em;
  transition: background .15s, opacity .15s;
  box-shadow: none;
}
.btn-primary:hover  { opacity: .9; box-shadow: none; }
.btn-primary:active { opacity: 1; }

/* Secondary */
.sim-btn-secondary,
.btn-outline-secondary {
  font-family: var(--sim-font);
  font-weight: 600;
  font-size: .875rem;
  color: var(--sim-ink-muted) !important;
  background: var(--sim-surface) !important;
  border: var(--sim-control-border) solid var(--sim-border-strong) !important;
  border-radius: var(--sim-control-radius) !important;
  padding: var(--sim-control-pad-y) 1.25rem;
  min-height: var(--sim-control-h);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  transition: border-color .14s, color .14s, background .14s;
  cursor: pointer;
  line-height: 1.4;
  box-shadow: var(--sim-shadow-xs);
}
.sim-btn-secondary:hover,
.btn-outline-secondary:hover {
  border-color: var(--sim-ink-subtle) !important;
  color: var(--sim-ink) !important;
  background: var(--sim-bg) !important;
}

/* Item action — list row buttons */
.sim-item-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--sim-font);
  font-size: .8rem;
  font-weight: 700;
  color: var(--sim-ink);
  background: var(--sim-surface);
  border: 1px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  padding: .35rem .8rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--sim-shadow-xs);
  transition: background .12s, border-color .12s;
}
.sim-item-btn:hover {
  background: var(--sim-bg);
  border-color: var(--sim-ink-subtle);
  color: var(--sim-ink);
}

/* Back link */
.sim-back-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  text-decoration: none;
  letter-spacing: .01em;
  transition: color .13s;
}
.sim-back-link:hover { color: var(--sim-ink); }
.sim-back-link svg   { flex-shrink: 0; }

.btn-outline-primary {
  --bs-btn-color:        var(--sim-primary);
  --bs-btn-border-color: var(--sim-primary);
  --bs-btn-hover-bg:     var(--sim-primary);
  --bs-btn-hover-border-color: var(--sim-primary);
  border-radius: var(--sim-radius);
  font-weight: 600;
}
.btn-outline-danger {
  font-family: var(--sim-font);
  font-weight: 600;
  font-size: .875rem;
  border-width: var(--sim-control-border);
  border-radius: var(--sim-control-radius);
  padding: var(--sim-control-pad-y) 1.25rem;
  min-height: var(--sim-control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  line-height: 1.4;
  box-shadow: var(--sim-shadow-xs);
  transition: border-color .14s, color .14s, background .14s;
}

/* Compact controls opt out of the standard height — table rows and toolbars
   would otherwise become twice as tall as they need to be. */
.btn-sm, .admin-btn-set, .sim-item-btn,
.form-control-sm, .form-select-sm,
.sim-input.form-control-sm, .sim-input.form-select-sm {
  min-height: var(--sim-control-h-sm);
}
/* The full-size padding set by .btn-primary / .btn-outline-* / .sim-input wins on
   source order, so the compact tier has to restate it to actually be compact. */
.btn-sm.btn-primary, .btn-sm.btn-outline-secondary, .btn-sm.btn-outline-danger,
.btn-sm.sim-btn-secondary,
.sim-input.form-control-sm, .sim-input.form-select-sm {
  padding: var(--sim-control-pad-y-sm) var(--sim-control-pad-x-sm);
  font-size: .8rem;
}
/* The table-row action button joins the same tier rather than being 2px off. */
.admin-btn-set {
  padding: var(--sim-control-pad-y-sm) var(--sim-control-pad-x-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}

/* Card — white surface on stone background */
.card {
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-lg);
  box-shadow: 0 1px 2px rgba(0,10,30,.04), 0 4px 12px rgba(0,10,30,.06);
  background: var(--sim-surface);
}

/* ── App layout ─────────────────────────────────────────────────────────── */
/* Outer shell: topnav on top, sidebar+main side-by-side below */
.sim-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--sim-bg);
}

/* Horizontal row containing sidebar + main */
.sim-body {
  display: flex;
  flex: 1;
  min-width: 0;
}

/* ── Top navigation bar ─────────────────────────────────────────────────── */
.sim-topnav {
  height: var(--sim-topnav-h);
  background: var(--sim-surface);
  border-bottom: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: .875rem;
  position: sticky;
  top: 0;
  z-index: 200;
  flex-shrink: 0;
}

.sim-topnav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.sim-topnav-logo {
  height: 22px;
  width: auto;
  display: block;
}

.sim-topnav-spacer { flex: 1; }

.sim-topnav-user {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}

.sim-topnav-name {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--sim-ink);
}

/* Company context switcher pill in topnav */
.sim-company-switcher {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .65rem .3rem .4rem;
  border: 1px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  font-size: .78rem;
  font-weight: 700;
  color: var(--sim-ink);
  text-decoration: none;
  transition: background .12s, border-color .12s;
  max-width: 180px;
}
.sim-company-switcher:hover { background: var(--sim-bg); color: var(--sim-ink); border-color: var(--sim-primary); }
.sim-company-switcher-logo { width: 22px; height: 22px; border-radius: 4px; object-fit: contain; }
.sim-company-switcher-initial {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sim-company-switcher-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sim-topnav-signout {
  font-family: var(--sim-font);
  font-size: .8rem;
  font-weight: 600;
  color: var(--sim-ink);
  background: transparent;
  border: 1px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  padding: .3rem .8rem;
  cursor: pointer;
  transition: background .13s, color .13s;
  white-space: nowrap;
}
.sim-topnav-signout:hover {
  background: var(--sim-bg);
  color: var(--sim-ink);
}

/* Admin badge in topnav */
/* Admin portal wordmark (replaces Simera logo in admin topnav) */
.sim-admin-wordmark {
  display: inline-flex;
  align-items: center;
  padding: .3rem .8rem;
  background: #dc2626;
  color: #fff !important;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}
.sim-admin-wordmark:hover { color: #fff !important; background: #c11f1f; }

.sim-admin-badge {
  display: inline-flex;
  align-items: center;
  padding: .22rem .65rem;
  background: rgba(220,38,38,.1);
  color: #dc2626;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid rgba(220,38,38,.2);
}

/* Logged-in admin name in topnav */
.sim-admin-user-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  margin-left: .5rem;
  white-space: nowrap;
}

/* Sidebar divider between feature nav and admin management */
.sim-sidebar-divider {
  height: 1px;
  background: var(--sim-border);
  margin: .5rem .75rem;
}

/* Hamburger toggle — sits inside topnav, shown only on mobile */
.sim-topbar-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--sim-radius);
  cursor: pointer;
  flex-shrink: 0;
}

.sim-topbar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--sim-ink-muted);
  border-radius: 99px;
  transition: transform .22s ease, opacity .18s ease;
}

/* Hamburger morphs into an X while the drawer is open */
.sim-topbar-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sim-topbar-toggle.open span:nth-child(2) { opacity: 0; }
.sim-topbar-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Small avatar variant (topnav) */
.sim-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: .72rem;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sim-sidebar {
  width: var(--sim-sidebar-w);
  flex-shrink: 0;
  background: var(--sim-sidebar);
  border-right: 1px solid var(--sim-sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--sim-topnav-h);
  height: calc(100vh - var(--sim-topnav-h));
  overflow-y: auto;
  z-index: 100;
}

.sim-sidebar-header {
  padding: 1.5rem 1.4rem 1.25rem;
  border-bottom: 1px solid var(--sim-sidebar-border);
  flex-shrink: 0;
}

.sim-sidebar-header img {
  height: 24px;
  width: auto;
  display: block;
}

.sim-sidebar-nav {
  flex: 1;
  padding: 1.1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.sim-sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .58rem .85rem;
  border-radius: var(--sim-radius);
  font-size: .875rem;
  font-weight: 600;
  color: var(--sim-sidebar-fg);
  text-decoration: none;
  transition: background .13s, color .13s;
  white-space: nowrap;
}

.sim-sidebar-link svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: .8;
  transition: opacity .13s;
}

.sim-sidebar-link:hover {
  background: var(--sim-sidebar-hover-bg);
  color: var(--sim-ink);
}
.sim-sidebar-link:hover svg { opacity: 1; }

.sim-sidebar-link.active {
  background: var(--sim-sidebar-active-bg);
  color: var(--sim-ink);
  font-weight: 700;
}
.sim-sidebar-link.active svg { opacity: 1; }

/* ── Sidebar collapsible group ──────────────────────────────────────────────── */
.sim-sidebar-group { margin-bottom: 2px; }

.sim-sidebar-group-btn {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .58rem .85rem;
  border-radius: var(--sim-radius);
  font-size: .875rem;
  font-weight: 600;
  color: var(--sim-sidebar-fg);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background .13s, color .13s;
  white-space: nowrap;
}
.sim-sidebar-group-btn svg.group-icon { flex-shrink: 0; width: 16px; height: 16px; opacity: .8; transition: opacity .13s; }
.sim-sidebar-group-btn:hover { background: var(--sim-sidebar-hover-bg); color: var(--sim-ink); }
.sim-sidebar-group-btn:hover svg.group-icon { opacity: 1; }
.sim-sidebar-group-btn.active { color: var(--sim-ink); font-weight: 700; }
.sim-sidebar-group-btn.active svg.group-icon { opacity: 1; }

.sim-sidebar-group-arrow {
  margin-left: auto;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  opacity: .5;
  transition: transform .2s ease, opacity .13s;
}
.sim-sidebar-group.open .sim-sidebar-group-arrow { transform: rotate(90deg); opacity: .8; }

.sim-sidebar-group-items {
  display: none;
  padding-left: 1.6rem;
  padding-top: 2px;
  padding-bottom: 4px;
}
.sim-sidebar-group.open .sim-sidebar-group-items { display: block; }

/* Desktop (real mouse only): a group's sub-items open as a floating panel to the
   RIGHT of the rail on hover (positioned by JS in footer.php, since the sidebar
   clips overflow). Touch/mobile keeps the inline click-to-expand accordion. */
@media (hover: hover) and (pointer: fine) {
  .sim-sidebar-group-items {
    position: fixed;
    left: 0; top: 0;                       /* real values set by JS on hover */
    z-index: 1200;
    min-width: 208px;
    max-width: 260px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    padding: .4rem;
    background: var(--sim-sidebar);
    border: 1px solid var(--sim-sidebar-border);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0,16,68,.16);
  }
  /* On desktop the inline .open no longer expands — the flyout does. */
  .sim-sidebar-group.open .sim-sidebar-group-items { display: none; }
  .sim-sidebar-group.sim-flyout-open .sim-sidebar-group-items { display: block; }
  /* Chevron points right to signal a flyout; never rotates down. */
  .sim-sidebar-group.open .sim-sidebar-group-arrow,
  .sim-sidebar-group.sim-flyout-open .sim-sidebar-group-arrow { transform: none; opacity: .85; }
}

.sim-sidebar-sublink {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .42rem .7rem;
  border-radius: var(--sim-radius);
  font-size: .825rem;
  font-weight: 600;
  color: var(--sim-sidebar-fg);
  text-decoration: none;
  transition: background .13s, color .13s;
  white-space: nowrap;
  margin-bottom: 2px;
}
.sim-sidebar-sublink:hover { background: var(--sim-sidebar-hover-bg); color: var(--sim-ink); }
.sim-sidebar-sublink.active { background: var(--sim-sidebar-active-bg); color: var(--sim-ink); font-weight: 700; }

/* ── Searchable country input ───────────────────────────────────────────────── */
.sim-search-select-wrap { position: relative; }
.sim-search-select-wrap input[type="text"] { cursor: pointer; }
.sim-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--sim-primary);
  border-radius: var(--sim-radius);
  box-shadow: var(--sim-shadow);
  max-height: 220px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
}
.sim-search-dropdown.open { display: block; }
.sim-search-dropdown-item {
  padding: .45rem .85rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--sim-ink);
  cursor: pointer;
  transition: background .1s;
}
.sim-search-dropdown-item:hover,
.sim-search-dropdown-item.highlighted { background: var(--sim-bg); }
.sim-search-dropdown-empty {
  padding: .75rem .85rem;
  font-size: .85rem;
  color: var(--sim-ink-muted);
  text-align: center;
}

.sim-sidebar-footer {
  padding: .875rem .75rem;
  border-top: 1px solid var(--sim-sidebar-border);
  flex-shrink: 0;
}

.sim-sidebar-signout {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .85rem;
  border-radius: var(--sim-radius);
  font-size: .84rem;
  font-weight: 600;
  color: var(--sim-sidebar-fg);
  text-decoration: none;
  transition: background .13s, color .13s;
}
.sim-sidebar-signout svg { flex-shrink: 0; width: 15px; height: 15px; opacity: .8; }
.sim-sidebar-signout:hover {
  background: var(--sim-sidebar-hover-bg);
  color: var(--sim-ink);
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.sim-main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 2.75rem 4rem;
  overflow-x: hidden;
  background: var(--sim-content-bg); /* paper (People Portal) / company bg */
}

/* Mobile overlay — sits below topnav */
.sim-sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--sim-topnav-h);
  left: 0; right: 0; bottom: 0;
  background: rgba(0,10,30,.4);
  z-index: 250;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.sim-sidebar-overlay.open { display: block; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .sim-topnav { padding: 0 1rem; gap: .625rem; }

  /* Sidebar slides in from the right as an off-canvas drawer */
  .sim-sidebar {
    position: fixed;
    top: var(--sim-topnav-h);
    right: calc(-1 * var(--sim-drawer-w) - 12px);
    left: auto;
    height: calc(100dvh - var(--sim-topnav-h));
    width: var(--sim-drawer-w);
    max-width: 320px;
    transition: right .26s cubic-bezier(.32,.72,0,1), box-shadow .26s ease;
    box-shadow: none;
    z-index: 300;
    border-right: none;
    border-left: 1px solid var(--sim-sidebar-border);
    overscroll-behavior: contain;
  }

  .sim-sidebar.open {
    right: 0;
    box-shadow: -10px 0 40px rgba(0,10,30,.22);
  }

  /* Roomier tap targets in the drawer */
  .sim-sidebar-nav        { padding: .9rem .85rem 1.4rem; gap: .15rem; }
  .sim-sidebar-link,
  .sim-sidebar-group-btn  { padding: .72rem .9rem; font-size: .9375rem; }
  .sim-sidebar-sublink    { padding: .6rem .9rem; font-size: .875rem; }
  .sim-sidebar-group-items { padding-bottom: .15rem; }

  .sim-main { padding: 1.75rem 1.25rem 3rem; }
}

/* User avatar circle */
.sim-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sim-primary);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.sim-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .sim-page / .sim-content removed — layout now handled by .sim-layout / .sim-main */

/* ── Auth / login page ── */
/* ── People Portal brand — pre-auth flow (login · verify · register · magic ·
   choose-contract · no-contract) ─────────────────────────────────────────────
   Scoped to body.pp-auth so the multi-tenant portal (themed per-company at
   runtime) stays untouched. Same identity as the admin console: Bricolage
   Grotesque + Instrument Sans, indigo #5c1ed8, violet→indigo gradient on primary
   buttons, navy ink, lilac fills, paper background. */
body.pp-auth {
  --sim-font:         'Instrument Sans', system-ui, sans-serif;
  --sim-font-heading: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;

  --sim-primary:       #5c1ed8;
  --sim-primary-dark:  #4a17ad;
  --sim-primary-rgb:   92, 30, 216;
  --sim-primary-light: #efe9ff;
  --sim-accent:        #a881ff;

  --sim-grad:      linear-gradient(102deg, #8f3bff 0%, #5c1ed8 100%);
  --sim-grad-soft: linear-gradient(102deg, #a881ff 0%, #6d33f3 100%);

  --sim-ink:        #001044;
  --sim-ink-muted:  #585d7e;
  --sim-ink-subtle: #7a7fa0;

  --sim-border:        #e7e4f3;
  --sim-border-strong: #d7d0ee;
  --sim-bg:         #f5f2fe;
  --sim-content-bg: #f7f6fb;
  --sim-surface:    #ffffff;

  font-family: var(--sim-font);
  color: var(--sim-ink);
  line-height: 1.6;
}

/* Branded backdrop — soft lilac glow fading to paper (replaces the cream #F3F2EC) */
body.pp-auth .sim-auth-page {
  background:
    radial-gradient(1100px 620px at 50% -14%, #efe9ff 0%, rgba(239, 233, 255, 0) 60%),
    linear-gradient(180deg, #f7f6fb 0%, #f5f2fe 100%);
}

/* Brand mark above the card */
body.pp-auth .sim-auth-brand     { text-align: center; margin-bottom: 1.5rem; }
body.pp-auth .sim-auth-brand img { height: 34px; width: auto; }

/* Headings in Bricolage Grotesque */
body.pp-auth .sim-auth-heading {
  font-family: var(--sim-font-heading);
  letter-spacing: -.02em;
  line-height: 1.08;
}

/* Primary CTA — the one place the violet→indigo gradient fills */
body.pp-auth .btn-primary {
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-border-color: transparent;
  background: var(--sim-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(92, 30, 216, .22);
}
body.pp-auth .btn-primary:hover  { background: var(--sim-grad); color: #fff; opacity: .93; }
body.pp-auth .btn-primary:active { background: var(--sim-grad); color: #fff; opacity: 1; }
body.pp-auth .btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(92, 30, 216, .30); }

/* Icon chip + loader glass → lilac (were blue / cream) */
body.pp-auth .sim-auth-icon--primary { background: var(--sim-primary-light); color: var(--sim-primary-text); }
body.pp-auth .sim-loader-overlay     { background: rgba(237, 233, 254, 0.9); }   /* light purple */

.sim-auth-page {
  min-height: 100vh;
  background: var(--sim-content-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.sim-auth-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--sim-radius-xl);
  box-shadow: var(--sim-shadow-xl);
  border: 1px solid var(--sim-border);
  background: var(--sim-surface);
}

.sim-auth-card .card-body {
  padding: 2.5rem 2.25rem;
}

/* ── Standard page header ─────────────────────────────────────────────────── */
/* Every authenticated page (index, support, KB, profile) uses these.
   .sim-main already supplies the 2.5rem top padding — no extra top here. */
.sim-page-header {
  padding: 0 0 1.75rem;
}

.sim-page-title {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  color: var(--sim-ink);
  letter-spacing: -.03em;
  line-height: 1.15;
  margin: 0 0 .3rem;
}

.sim-page-title:last-child { margin-bottom: 0; }

.sim-page-subtitle {
  font-size: .875rem;
  color: var(--sim-ink-muted);
  margin: 0;
  line-height: 1.55;
}

/* ── Stat cards ── */
.sim-stat {
  border-radius: var(--sim-radius-lg);
  border: 1px solid var(--sim-border);
  background: var(--sim-surface);
  box-shadow: var(--sim-shadow);
  padding: 1.5rem;
  transition: box-shadow .15s;
}

.sim-stat:hover {
  box-shadow: var(--sim-shadow-lg);
}

.sim-stat-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sim-ink-muted);
  margin-bottom: .5rem;
}

.sim-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--sim-ink);
  line-height: 1;
}

.sim-stat-sub {
  font-size: .8rem;
  color: var(--sim-ink-muted);
  margin-top: .4rem;
}

/* ── Divider ── */
.sim-divider {
  border: none;
  border-top: 1px solid var(--sim-border);
  margin: 1.5rem 0;
}

/* footer removed */

/* ── Form inputs ── */
.sim-label {
  display: block;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin-bottom: .35rem;
}

.sim-input {
  font-family: var(--sim-font);
  font-size: .875rem;
  font-weight: 500;
  color: var(--sim-ink);
  background: var(--sim-surface);
  border: var(--sim-control-border) solid var(--sim-border-strong);
  border-radius: var(--sim-control-radius);
  padding: var(--sim-control-pad-y) var(--sim-control-pad-x);
  min-height: var(--sim-control-h);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--sim-shadow-xs);
}

/* Same hover the buttons and choice cards have, so a form reacts consistently. */
.sim-input:hover:not(:focus):not(:disabled):not([readonly]) { border-color: var(--sim-ink-subtle); }

.sim-input:focus {
  border-color: var(--sim-primary);
  box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .12);
  outline: none;
}

.sim-input.is-invalid { border-color: #dc2626; }
.sim-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
/* A required field that was left empty on submit (sim-forms.js adds .is-invalid): red on every kind of control,
   including the custom phone-code select, Tom Select dropdowns, checkboxes and file pickers. */
.form-control.is-invalid, .form-select.is-invalid, .sim-phone-code.is-invalid, textarea.is-invalid { border-color: #dc2626 !important; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus, .sim-phone-code.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
select.is-invalid + .ts-wrapper .ts-control, select.is-invalid + .ts-wrapper.single .ts-control { border-color: #dc2626 !important; }
.form-check-input.is-invalid { border-color: #dc2626; }
.sim-row-invalid, .sim-choice:has(input.is-invalid) { outline: 1px solid #dc2626; outline-offset: 2px; border-radius: 8px; }

/* Phone row: country-code dropdown joined flush to the number input */
.sim-phone-row {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.sim-phone-code {
  flex: 0 0 auto;
  width: 210px;
  min-width: 0;
}

.sim-phone-number {
  flex: 1;
  min-width: 0;
}

.sim-field-error {
  font-size: .8rem;
  color: #dc2626;
  margin-top: .3rem;
}

@media (max-width: 360px) {
  .sim-phone-code  { width: 120px; }
}

/* ── Alerts ── */
.alert-danger {
  background: #fff0f0;
  border-color: #fccaca;
  color: #b91c1c;
  border-radius: var(--sim-radius);
  font-size: .875rem;
}

/* ── Profile page ── */
.profile-page {
  padding-bottom: 3rem;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  font-size: 1.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* .profile-name replaced by .sim-page-title */

.profile-email {
  font-size: .9rem;
  color: var(--sim-ink-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .25rem;
}

/* Card section header */
.card-header-sim {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--sim-border);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--sim-ink-subtle);
  background: var(--sim-surface);
  border-radius: var(--sim-radius-lg) var(--sim-radius-lg) 0 0;
}

.card-header-sim svg {
  flex-shrink: 0;
  color: var(--sim-ink-muted);
  opacity: .6;
}

/* Buttons in a card header keep their normal (title) case, not the header's uppercase */
.card-header-sim .btn {
  text-transform: none;
  letter-spacing: normal;
}

/* Profile key-value list */
.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--sim-border);
  font-size: .875rem;
  flex-wrap: wrap;
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-label {
  flex: 0 0 110px;
  font-weight: 600;
  color: var(--sim-ink-muted);
  font-size: .8125rem;
}

.profile-value {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  color: var(--sim-ink);
  font-weight: 500;
}

.profile-link {
  color: var(--sim-primary-text);
  text-decoration: none;
  font-weight: 600;
}

.profile-link:hover {
  text-decoration: underline;
}

.profile-empty {
  color: var(--sim-ink-muted);
  font-style: italic;
  font-size: .8125rem;
}

/* Badges */
.sim-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sim-badge-green  { background: #dcfce7; color: #166534; }
.sim-badge-muted  { background: rgba(0,0,0,.06); color: var(--sim-ink-muted); }

/* Tags (roles) */
.sim-tag {
  display: inline-flex;
  align-items: center;
  padding: .3rem .8rem;
  background: rgba(var(--sim-primary-rgb), .08);
  color: var(--sim-primary-text);
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
}

/* Code */
.sim-code {
  font-size: .75rem;
  background: var(--sim-bg);
  color: var(--sim-ink-muted);
  padding: .15rem .45rem;
  border-radius: 4px;
  border: 1px solid var(--sim-border);
  word-break: break-all;
}

/* Pre / JSON block */
.sim-pre {
  margin: 0;
  background: var(--sim-bg);
  border-radius: var(--sim-radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: .78rem;
  line-height: 1.6;
  border: 1px solid var(--sim-border);
}

.sim-pre code {
  color: var(--sim-ink);
}

/* ── Full-screen loader overlay ── */
.sim-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(237, 233, 254, 0.9);   /* light purple */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
}

/* Comet-trail orbit: 6 dots chasing each other */
.sim-orbit {
  position: relative;
  width: 80px;
  height: 80px;
}

.sim-orbit-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--sim-primary);
  animation: sim-orbit-spin 1.5s linear infinite;
}

.sim-orbit-dot:nth-child(1) { animation-delay:  0s;      opacity: 1.00; }
.sim-orbit-dot:nth-child(2) { animation-delay: -0.25s;   opacity: 0.72; }
.sim-orbit-dot:nth-child(3) { animation-delay: -0.50s;   opacity: 0.48; }
.sim-orbit-dot:nth-child(4) { animation-delay: -0.75s;   opacity: 0.28; }
.sim-orbit-dot:nth-child(5) { animation-delay: -1.00s;   opacity: 0.14; }
.sim-orbit-dot:nth-child(6) { animation-delay: -1.25s;   opacity: 0.05; }

@keyframes sim-orbit-spin {
  from { transform: rotate(0deg)   translateY(-28px) rotate(0deg);   }
  to   { transform: rotate(360deg) translateY(-28px) rotate(-360deg); }
}

.sim-loader-text {
  text-align: center;
}

.sim-loader-msg {
  font-weight: 700;
  font-size: 1rem;
  color: var(--sim-ink);
  margin: 0 0 .25rem;
  transition: opacity .2s ease;
}

.sim-loader-sub {
  font-size: .8rem;
  color: var(--sim-ink-muted);
  margin: 0;
}

/* ── Info / notice banner ── */
.sim-notice {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  background: var(--sim-primary-light);
  border: 1px solid rgba(var(--sim-primary-rgb), .18);
  border-left: 3px solid var(--sim-primary);
  border-radius: var(--sim-radius);
  padding: .875rem 1rem;
  font-size: .84rem;
  color: var(--sim-ink-muted);
  line-height: 1.55;
}

.sim-notice svg {
  color: var(--sim-primary-text);
  margin-top: .05rem;
}

.sim-notice strong {
  color: var(--sim-ink);
  display: block;
  margin-bottom: .15rem;
}

.sim-notice a {
  color: var(--sim-primary-text);
  font-weight: 700;
  text-decoration: none;
}

.sim-notice a:hover {
  text-decoration: underline;
}

/* ── Tom Select – Simera overrides ── */
/* Default: fill the field width like a normal input */
.ts-wrapper { width: 100%; }

/* Phone-code dropdown: narrow, joined flush to the number input */
.ts-wrapper.sim-phone-code,
.ts-wrapper.sim-secphone-code {
  flex: 0 0 auto;
  width: 210px;
  min-width: 0;
}
.sim-phone-row .ts-wrapper.sim-phone-code .ts-control,
.sim-phone-row .ts-wrapper.sim-secphone-code .ts-control {
  border-radius: var(--sim-radius) 0 0 var(--sim-radius) !important;
  border-right-width: 0 !important;
  overflow: hidden;            /* clip a long dial-code label at the edge (horizontally) */
}
/* Keep the selected dial code on one line — no wrap, no vertical clipping */
.ts-wrapper.sim-phone-code .ts-control .item,
.ts-wrapper.sim-secphone-code .ts-control .item {
  white-space: nowrap;
}
.sim-phone-row .sim-phone-number {
  border-radius: 0 var(--sim-radius) var(--sim-radius) 0 !important;
}

/* Match .sim-input exactly so dropdowns line up with text inputs everywhere.
   The min-height + centering keeps empty and filled controls the same height
   (an empty single-select would otherwise render shorter than a filled one). */
.ts-wrapper .ts-control {
  font-family: var(--sim-font);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--sim-ink);
  background: var(--sim-surface);
  border: 1px solid var(--sim-border-strong);
  border-radius: var(--sim-radius) !important;
  padding: .6rem .9rem;
  box-shadow: var(--sim-shadow-xs);
  min-height: calc(1.5em + 1.2rem + 2px); /* line-height + padding + border = .sim-input height */
  align-items: center;
  flex-wrap: nowrap;
}
.ts-wrapper .ts-control > .item,
.ts-wrapper .ts-control > input {
  line-height: 1.5;
}
/* Keep a selected (possibly long) label on a single line, truncating with … */
.ts-wrapper .ts-control > .item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Hover affordance on the trigger */
.ts-wrapper:not(.focus):not(.disabled) .ts-control:hover {
  border-color: var(--sim-ink-muted);
}

.ts-wrapper.focus .ts-control {
  border-color: var(--sim-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .12) !important;
}

/* Kill any inherited <select> caret on the wrapper; we draw our own on the control */
.ts-wrapper { background-image: none !important; }

/* Suppress the theme's built-in caret — we draw our own chevron below */
.ts-wrapper.single .ts-control:after { content: none !important; border: 0 !important; }

/* Custom chevron on single selects (not the joined phone-code trigger) — a
   single, consistent grey caret in every state (closed / hover / open). */
.ts-wrapper.single:not(.sim-phone-code):not(.sim-secphone-code) .ts-control {
  padding-right: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b7280' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right .8rem center !important;
  background-size: .85rem !important;
}

.ts-wrapper .ts-control input {
  font-family: var(--sim-font);
  font-size: .875rem;
  color: var(--sim-ink);
}

.ts-wrapper .ts-control input::placeholder {
  color: #adb5bd;
}

.ts-dropdown {
  font-family: var(--sim-font);
  font-size: .875rem;
  border: 1.5px solid var(--sim-border);
  border-radius: var(--sim-radius);
  box-shadow: var(--sim-shadow-lg);
  margin-top: 4px;
  z-index: 1100;          /* above the sticky topnav + sidebar */
  overflow: hidden;       /* round the corners of the scrolling list */
}

/* Phone-code menu (rendered on <body>) is wider than its narrow trigger */
.ts-dropdown.ts-dropdown-phone {
  min-width: 300px;
}

.ts-dropdown .ts-dropdown-content {
  max-height: 280px;
  padding: .3rem;            /* gutter so option hover-pills don't touch the edges */
}

.ts-dropdown .option {
  padding: .5rem .7rem;
  margin: 1px 0;
  border-radius: calc(var(--sim-radius) - 3px);
  color: var(--sim-ink);
  font-weight: 500;
  cursor: pointer;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: rgba(var(--sim-primary-rgb), .09);
  color: var(--sim-primary-text);
}

/* The currently-selected value, when shown in the list */
.ts-dropdown .option[aria-selected="true"] {
  font-weight: 700;
  color: var(--sim-primary-text);
}

.ts-dropdown .optgroup-header {
  padding: .5rem .7rem .25rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--sim-ink-muted);
}

.ts-dropdown .no-results,
.ts-dropdown .create {
  padding: .55rem .7rem;
  color: var(--sim-ink-muted);
  font-weight: 500;
}

.ts-dropdown .highlight {
  background: transparent;
  font-weight: 800;
  color: var(--sim-primary-text);
}

/* ── Compact filter selects at the top of list pages ──
   FIXED width (not auto) so typing in the searchable dropdown can never resize
   the control — that growth was shoving the whole filter row / page around. */
.ts-wrapper.sim-filter {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  flex: 0 0 220px;
}
.ts-wrapper.sim-filter .ts-control {
  width: 100%;
  overflow: hidden;
}
/* Pin the type-to-search input to the leftover space and override TomSelect's
   inline autosize width, so a long query can't widen the box. */
.ts-wrapper.sim-filter .ts-control > input {
  flex: 1 1 0 !important;
  width: 0 !important;
  min-width: 0 !important;
}
select.sim-filter { width: 220px; min-width: 220px; }   /* fallback before TomSelect upgrades */

/* On small screens let the filters span the row instead of overflowing. */
@media (max-width: 575.98px) {
  .admin-filter-bar .ts-wrapper.sim-filter,
  .admin-filter-bar select.sim-filter {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }
}

@media (max-width: 400px) {
  .ts-wrapper.sim-phone-code { width: 150px; }
}

/* Tables that should never wrap a cell onto multiple lines */
.admin-table-nowrap th,
.admin-table-nowrap td { white-space: nowrap; }

/* ── Utilities ── */
.fw-800 { font-weight: 800; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-primary { color: var(--sim-primary-text) !important; }

/* ── Extra badge variants ──────────────────────────────────────────────────── */
.sim-badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.sim-badge-orange {
  background: #fef3c7;
  color: #92400e;
}

.sim-badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

/* ── Support list page ────────────────────────────────────────────────────── */
.support-page { max-width: none; }   /* full width */

/* .support-hero / .support-title / .support-subtitle replaced by .sim-page-header system */

.support-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.support-item {
  padding: .95rem 1.4rem;
  border-bottom: 1px solid var(--sim-border);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .3rem .75rem;
  transition: background .12s;
}

.support-item:last-child { border-bottom: none; }

.support-item:hover { background: rgba(0,0,0,.02); }

.support-item-meta {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.support-item-date {
  font-size: .78rem;
  color: var(--sim-ink-muted);
  font-weight: 600;
}

.support-item-content {
  grid-column: 1;
  grid-row: 2;
}

.support-item-subject {
  font-size: .95rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin: 0;
  line-height: 1.35;
}

.support-item-action {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
}

/* .support-read-more replaced by .sim-item-btn */

@media (max-width: 480px) {
  .support-item {
    grid-template-columns: 1fr;
  }
  .support-item-action {
    grid-column: 1;
    grid-row: 3;
    justify-content: flex-start;
  }
}

/* ── Support detail / thread ──────────────────────────────────────────────── */
.support-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.thread-msg {
  border-radius: var(--sim-radius);
  border: 1px solid var(--sim-border);
  background: #fff;
  overflow: hidden;
}

.thread-msg-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.2rem;
  background: #fff;
  border-bottom: 1px solid var(--sim-border);
}

.thread-msg--you .thread-msg-header { background: #fff; }

.thread-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sim-primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.thread-msg--support .thread-msg-avatar {
  background: var(--sim-ink);
}

.thread-msg-sender {
  font-size: .875rem;
  font-weight: 700;
  color: var(--sim-ink);
}

.thread-msg-date {
  font-size: .775rem;
  color: var(--sim-ink-muted);
  margin-left: .5rem;
}

.thread-msg-body {
  padding: 1.1rem 1.2rem;
  font-size: .875rem;
  color: var(--sim-ink);
  line-height: 1.7;
}

.thread-msg-body p { margin: 0 0 .75rem; }
.thread-msg-body p:last-child { margin-bottom: 0; }
.thread-msg-body a { color: var(--sim-primary-text); }
.thread-msg-body img { max-width: 100%; height: auto; }
.thread-msg-body blockquote {
  border-left: 3px solid var(--sim-border);
  margin: .75rem 0;
  padding: .4rem 1rem;
  color: var(--sim-ink-muted);
  font-size: .82rem;
}


/* ── Support filter bar ──────────────────────────────────────────────────────── */
.support-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.support-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .32rem .85rem;
  border: 1px solid var(--sim-border-strong);
  border-radius: 99px;
  background: var(--sim-surface);
  font-family: var(--sim-font);
  font-size: .8rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  cursor: pointer;
  box-shadow: var(--sim-shadow-xs);
  transition: border-color .12s, color .12s, background .12s, box-shadow .12s;
}

.support-filter-btn:hover {
  border-color: var(--sim-ink-subtle);
  color: var(--sim-ink);
}

.support-filter-btn.active {
  border-color: var(--sim-ink);
  background: var(--sim-ink);
  color: #fff;
  box-shadow: none;
}

.support-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  background: rgba(0,0,0,.1);
  color: inherit;
}

.support-filter-btn.active .support-filter-count {
  background: rgba(255,255,255,.2);
}

/* ── Support thread header label ─────────────────────────────────────────────── */
.support-thread-header {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.support-thread-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--sim-ink-muted);
}

/* ── Thread message improvements ─────────────────────────────────────────────── */
.thread-msg-meta {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  flex: 1;
  min-width: 0;
}

.thread-msg-role {
  font-size: .72rem;
  color: var(--sim-ink-muted);
  font-weight: 500;
}

.thread-msg--latest {
  border-color: var(--sim-border);
}

.thread-msg-body-inner {
  font-size: .875rem;
  color: var(--sim-ink);
  line-height: 1.7;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Reset common email HTML inside thread bodies */
.thread-msg-body-inner p   { margin: 0 0 .75rem; }
.thread-msg-body-inner p:last-child { margin-bottom: 0; }
.thread-msg-body-inner a   { color: var(--sim-primary-text); }
.thread-msg-body-inner img { max-width: 100%; height: auto; display: block; }
.thread-msg-body-inner ul,
.thread-msg-body-inner ol  { padding-left: 1.4rem; margin: 0 0 .75rem; }
.thread-msg-body-inner table { max-width: 100%; border-collapse: collapse; }
.thread-msg-body-inner td,
.thread-msg-body-inner th  { padding: .3rem .5rem; }

/* Quoted / forwarded content */
.thread-msg-body-inner blockquote,
.thread-msg-body-inner .gmail_quote,
.thread-msg-body-inner .yahoo_quoted {
  border-left: 3px solid var(--sim-border);
  margin: .75rem 0;
  padding: .5rem 1rem;
  color: var(--sim-ink-muted);
  font-size: .82rem;
}

/* Collapse deeply nested quoted chains */
.thread-msg-body-inner .gmail_quote .gmail_quote,
.thread-msg-body-inner blockquote blockquote {
  display: none;
}

/* ── Support reply compose box ───────────────────────────────────────────────── */
.support-reply-wrap { }

.support-reply-compose {
  margin-top: 0;
}

.support-reply-textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.65;
}

/* Success banner */
.sim-alert-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--sim-radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: #15803d;
}

.sim-alert-success svg { color: #16a34a; }

/* ── Support item ticket number ──────────────────────────────────────────────── */
.support-item-ticket {
  font-size: .72rem;
  color: var(--sim-ink-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* (mobile collapse styles now live in the Navbar section above) */

/* ── Admin portal ─────────────────────────────────────────────────────────── */
/* admin-navbar / admin-logout-btn replaced by .sim-topnav system */

.admin-page {
  /* padding provided by .sim-main — only constrain width here */
  max-width: 1300px;
}

/* Stat pills in header */
.admin-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .9rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 800;
  background: #fff;
  border: 1px solid var(--sim-border);
  color: var(--sim-ink-muted);
}

.admin-stat-pill span {
  font-weight: 500;
  font-size: .75rem;
}

.admin-stat-pill--green  { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.admin-stat-pill--orange { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.admin-stat-pill--red    { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* Admin dashboard quick-nav tiles */
.sim-admin-tile {
  padding: 1.1rem 1.25rem;
  border-radius: var(--sim-radius-lg);
  box-shadow: var(--sim-shadow-xs);
  color: var(--sim-ink);
  transition: box-shadow .12s, transform .1s;
}
a.sim-admin-tile:hover { box-shadow: var(--sim-shadow); transform: translateY(-1px); color: var(--sim-ink); }
.sim-admin-tile-value { font-size: 2rem; font-weight: 800; color: var(--sim-primary-text); line-height: 1; }
.sim-admin-tile-label { font-size: .78rem; font-weight: 600; color: var(--sim-ink-muted); margin-top: .25rem; }
.sim-admin-tile--warn .sim-admin-tile-value { color: #d97706; }

/* Table */
.admin-table {
  font-size: .875rem;
  /* separate (not collapse) so corner cells can take a border-radius — this is
     what stops a hovered/header row from square-filling the card's rounded
     corners. border-spacing:0 keeps it visually identical to a collapsed table. */
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table thead th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--sim-ink-muted);
  background: var(--sim-th-bg);
  border-bottom: 1px solid var(--sim-border);
  padding: .75rem 1rem;
  white-space: nowrap;
}

.admin-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--sim-border);
  vertical-align: middle;
  white-space: nowrap;   /* never wrap table cells onto a new line */
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover td {
  background: rgba(0,0,0,.015);
}

/* Compact form controls inside table */
.admin-select {
  font-family: var(--sim-font);
  font-size: .8rem;
  font-weight: 600;
  border-color: var(--sim-border);
  border-radius: var(--sim-radius) !important;
  padding: .3rem .6rem;
}

.admin-input {
  font-family: var(--sim-font);
  font-size: .8rem;
  font-weight: 500;
  border-color: var(--sim-border);
  border-radius: var(--sim-radius) !important;
}

.admin-btn-set {
  font-family: var(--sim-font);
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .7rem;
  color: var(--sim-primary-text);
  border-color: var(--sim-primary);
  border-radius: var(--sim-radius);
  white-space: nowrap;
}

.admin-btn-set:hover {
  background: var(--sim-primary);
  color: #fff;
}

.admin-btn-link {
  font-family: var(--sim-font);
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .7rem;
  color: var(--sim-ink-muted);
  border-color: var(--sim-border);
  border-radius: var(--sim-radius);
  white-space: nowrap;
}

.admin-btn-link:hover {
  background: var(--sim-bg);
  border-color: var(--sim-ink-muted);
  color: var(--sim-ink);
}

/* Admin search bar */
.admin-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
}

.admin-search-icon {
  position: absolute;
  left: .85rem;
  color: var(--sim-ink-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.admin-search-input {
  width: 100%;
  max-width: 380px;
  font-family: var(--sim-font);
  font-size: .875rem;
  font-weight: 500;
  color: var(--sim-ink);
  background: #fff;
  border: 1.5px solid var(--sim-border);
  border-radius: var(--sim-radius);
  padding: .55rem .85rem .55rem 2.4rem;
  transition: border-color .15s, box-shadow .15s;
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--sim-primary);
  box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .15);
}

.admin-search-input::placeholder { color: #adb5bd; }

.admin-search-count {
  margin-left: .75rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
}

/* Standard list filter bar: instant text search + dropdown filters, side by side.
   Shared by the People and Contracts list pages. */
.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}
.admin-filter-bar .admin-search-wrap {
  flex: 0 1 340px;
  min-width: 220px;
}
.admin-filter-bar .admin-search-input { max-width: none; }

/* Admin nav links */
.admin-nav-link {
  display: inline-flex;
  align-items: center;
  padding: .3rem .75rem;
  border-radius: var(--sim-radius);
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  transition: background .13s, color .13s;
}
.admin-nav-link:hover  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.admin-nav-link.active { background: rgba(255,255,255,.12); color: #fff; }

/* Admin delete button */
.admin-btn-delete {
  font-family: var(--sim-font);
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .7rem;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: var(--sim-radius);
  background: #fff;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}

.admin-btn-delete:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}

/* ── Actions dropdown button ─────────────────────────────────────────────── */
.admin-btn-actions {
  font-family: var(--sim-font);
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .75rem;
  color: var(--sim-ink);
  border: 1px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  background: var(--sim-surface);
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.admin-btn-actions:hover,
.admin-btn-actions:focus,
.admin-btn-actions.show {
  background: var(--sim-bg);
  border-color: var(--sim-primary);
  color: var(--sim-primary-text);
  outline: none;
  box-shadow: none;
}
.admin-btn-actions::after {
  margin-left: .35rem;
}

.admin-dropdown {
  min-width: 160px;
  padding: .35rem;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius);
  box-shadow: var(--sim-shadow);
  background: var(--sim-surface);
}

.admin-dropdown-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .75rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--sim-ink);
  border-radius: calc(var(--sim-radius) - 2px);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.admin-dropdown-item:hover {
  background: var(--sim-bg);
  color: var(--sim-primary-text);
}
/* Destructive items (Delete) */
.admin-dropdown-item--danger { color: #dc2626; }
.admin-dropdown-item--danger:hover { background: #fef2f2; color: #b91c1c; }
.admin-dropdown-item--danger svg { opacity: .85; }
.admin-dropdown-item:disabled,
.admin-dropdown-item[disabled] { opacity: .5; cursor: not-allowed; }
.admin-dropdown-item svg {
  flex-shrink: 0;
  opacity: .7;
}
.admin-dropdown-divider {
  margin: .25rem 0;
  border-color: var(--sim-border);
}

/* ── Knowledge Base – search bar ────────────────────────────────────────── */
.kb-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.kb-search-icon {
  position: absolute;
  left: .9rem;
  color: var(--sim-ink-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.kb-search-input {
  width: 100%;
  font-family: var(--sim-font);
  font-size: .9rem;
  font-weight: 500;
  color: var(--sim-ink);
  background: #fff;
  border: 1.5px solid var(--sim-border);
  border-radius: var(--sim-radius);
  padding: .65rem .9rem .65rem 2.55rem;
  transition: border-color .15s, box-shadow .15s;
}

.kb-search-input:focus {
  outline: none;
  border-color: var(--sim-primary);
  box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .15);
}

.kb-search-input::placeholder { color: #adb5bd; }

/* ── Knowledge Base – frontend ───────────────────────────────────────────── */
.kb-page { max-width: 1100px; }

/* 3-column card grid */
.kb-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 991px) {
  .kb-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575px) {
  .kb-cards-grid { grid-template-columns: 1fr; }
}

/* Category card */
.kb-cat-card {
  background: #fff;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius);
  overflow: hidden;
}
.kb-cat-card-header {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--sim-ink-muted);
  padding: .75rem 1.1rem .6rem;
  border-bottom: 1px solid var(--sim-border);
  background: #fff;
}
.kb-cat-card-list {
  list-style: none;
  margin: 0;
  padding: .35rem 0;
}
.kb-cat-card-item {
  border-bottom: 1px solid var(--sim-border);
}
.kb-cat-card-item:last-child {
  border-bottom: none;
}
.kb-cat-card-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.1rem;
  font-size: .84rem;
  font-weight: 600;
  color: var(--sim-ink);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.kb-cat-card-link:hover {
  background: rgba(var(--sim-primary-rgb), .05);
  color: var(--sim-primary-text);
  text-decoration: none;
}
.kb-cat-card-arrow {
  color: var(--sim-primary-text);
  opacity: .35;
  flex-shrink: 0;
  transition: opacity .12s, transform .12s;
}
.kb-cat-card-link:hover .kb-cat-card-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Knowledge Base – article viewer ─────────────────────────────────────── */
.kb-article-body {
  font-size: .9375rem;
  color: var(--sim-ink);
  line-height: 1.75;
}

.kb-article-body h1,
.kb-article-body h2,
.kb-article-body h3,
.kb-article-body h4 {
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--sim-ink);
  margin: 1.75rem 0 .6rem;
  line-height: 1.25;
}

.kb-article-body h1 { font-size: 1.5rem; }
.kb-article-body h2 { font-size: 1.2rem; }
.kb-article-body h3 { font-size: 1rem;   }
.kb-article-body h4 { font-size: .9rem;  }

.kb-article-body p  { margin: 0 0 1rem; }
.kb-article-body p:last-child { margin-bottom: 0; }

.kb-article-body a  {
  color: var(--sim-primary-text);
  font-weight: 600;
  text-decoration: none;
}
.kb-article-body a:hover { text-decoration: underline; }

.kb-article-body ul,
.kb-article-body ol {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

.kb-article-body li { margin-bottom: .35rem; }

.kb-article-body blockquote {
  border-left: 3px solid var(--sim-primary);
  margin: 1rem 0;
  padding: .5rem 1.25rem;
  color: var(--sim-ink-muted);
  font-style: italic;
}

.kb-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--sim-radius);
  display: block;
  margin: 1rem 0;
}

.kb-article-body pre {
  background: var(--sim-bg);
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.6;
  margin: 0 0 1rem;
}

.kb-article-body code {
  font-size: .82rem;
  background: var(--sim-bg);
  border: 1px solid var(--sim-border);
  border-radius: 4px;
  padding: .1rem .4rem;
  color: var(--sim-ink);
}

.kb-article-body pre code {
  background: none;
  border: none;
  padding: 0;
}

.kb-article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  margin: 0 0 1rem;
}

.kb-article-body th,
.kb-article-body td {
  border: 1px solid var(--sim-border);
  padding: .5rem .75rem;
  text-align: left;
}

.kb-article-body th {
  background: var(--sim-bg);
  font-weight: 700;
}

/* ── Knowledge Base – admin edit form ───────────────────────────────────── */
/* The KB type selector now uses the shared .sim-choice control; the
   .kb-type-option class remains only as a JS hook (no styling of its own). */

/* Current file pill (shown when editing a file article) */
.kb-current-file {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .9rem;
  background: var(--sim-bg);
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius);
  font-size: .82rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  text-decoration: none;
  margin-bottom: .75rem;
}

.kb-current-file:hover {
  color: var(--sim-primary-text);
  border-color: var(--sim-primary);
}

/* ══════════════════════════════════════════════
   Time Off module
══════════════════════════════════════════════ */

/* ── Status badges ── */
.sim-badge-yellow {
  background: #fef9c3;
  color: #854d0e;
}
.sim-badge-amber {
  background: #fef3c7;
  color: #92400e;
}

/* ── Calendar picker ── */
.sim-calendar-wrap {
  background: var(--sim-surface);
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-lg);
  padding: 1.375rem;
  display: inline-block;
  width: 100%;
  max-width: 560px;
  user-select: none;
}

.sim-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.125rem;
}

.sim-calendar-nav {
  background: none;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--sim-ink-muted);
  transition: background .15s, color .15s;
}
.sim-calendar-nav:hover {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-color: var(--sim-primary-light);
}

.sim-calendar-month {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--sim-ink);
  letter-spacing: -.02em;
}

.sim-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.sim-calendar-dow {
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--sim-ink-subtle);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .3rem 0 .6rem;
}

.sim-calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--sim-ink);
  padding: .35rem;
  transition: background .12s, color .12s;
}
.sim-calendar-day:hover:not(.past):not(.empty) {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
}
.sim-calendar-day.selected {
  background: var(--sim-primary);
  color: #fff;
  font-weight: 700;
}
.sim-calendar-day.today:not(.selected) {
  box-shadow: inset 0 0 0 2px #b8b8b8;
  font-weight: 700;
}
.sim-calendar-day.overflow:not(.selected):not(.booked) {
  color: var(--sim-ink-subtle);
  opacity: .45;
}
.sim-calendar-day.overflow.selected {
  opacity: 1;
}
.sim-calendar-day.past {
  color: var(--sim-ink-subtle);
  cursor: not-allowed;
  opacity: .5;
}
.sim-calendar-day.empty {
  cursor: default;
}
.sim-calendar-day.booked {
  background: #ebebeb;
  color: var(--sim-ink-subtle);
  cursor: not-allowed;
  opacity: .6;
  text-decoration: line-through;
}
.sim-calendar-day.booked:hover {
  background: #ebebeb;
}

.sim-calendar-summary {
  margin-top: .75rem;
  font-size: .78rem;
  color: var(--sim-ink-muted);
  min-height: 1.2em;
}
.sim-calendar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .625rem;
}
.sim-calendar-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-radius: 1rem;
  padding: .2rem .55rem .2rem .65rem;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
}
.sim-calendar-chip-remove {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--sim-primary-text);
  opacity: .6;
  font-size: .8rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.sim-calendar-chip-remove:hover { opacity: 1; }

/* ── Leave type radio cards ── */
.sim-leave-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .625rem;
}
@media (max-width: 480px) {
  .sim-leave-grid { grid-template-columns: 1fr; }
}

.sim-leave-card {
  position: relative;
}
.sim-leave-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.sim-leave-label {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .75rem 1rem;
  border: 1.5px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  transition: border-color .15s, background .15s, color .15s;
  background: var(--sim-surface);
}
.sim-leave-label:hover {
  border-color: var(--sim-primary);
  color: var(--sim-primary-text);
  background: var(--sim-primary-light);
}
.sim-leave-card input[type="radio"]:checked + .sim-leave-label {
  border-color: var(--sim-primary);
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
}
.sim-leave-dot {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sim-leave-dot::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  transition: opacity .12s;
}
.sim-leave-card input[type="radio"]:checked + .sim-leave-label .sim-leave-dot::after {
  opacity: 1;
}

/* ── File upload area ── */
.sim-file-input-wrap {
  border: 1.5px dashed var(--sim-border-strong);
  border-radius: var(--sim-radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--sim-surface);
}
.sim-file-input-wrap:hover {
  border-color: var(--sim-primary);
  background: var(--sim-primary-light);
}
.sim-file-input-wrap input[type="file"] {
  display: none;
}
.sim-file-list {
  list-style: none;
  padding: 0;
  margin: 0 0 .75rem;
}
.sim-file-add-btn {
  display: inline-flex !important;
  width: auto !important;
  align-items: center;
  gap: .4rem;
  align-self: flex-start;
  flex-shrink: 0;
}
.sim-file-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius);
  background: var(--sim-surface);
  font-size: .82rem;
  margin-bottom: .4rem;
}
.sim-file-item-name {
  flex: 1;
  min-width: 0;
  color: var(--sim-ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-file-item-size {
  font-weight: 400;
  color: var(--sim-ink-muted);
  margin-left: .35rem;
}
.sim-file-remove {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: none;
  border: none;
  padding: .2rem .4rem;
  border-radius: .3rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.sim-file-remove:hover {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Calendar + dates side-by-side layout ── */
.sim-cal-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.sim-cal-dates {
  flex: 1;
  min-width: 0;
}
.sim-cal-picker {
  flex-shrink: 0;
}
.sim-cal-dates-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--sim-ink-muted);
  margin: 0 0 .5rem;
}
.sim-cal-none {
  font-size: .82rem;
  color: var(--sim-ink-subtle);
  margin: 0;
}
@media (max-width: 767px) {
  .sim-cal-layout { flex-direction: column; }
  .sim-cal-picker,
  .sim-cal-dates  { width: 100%; }
  .sim-calendar-wrap { max-width: 100%; }
}

/* ── Approval option rows ── */
.sim-approval-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .9rem;
  border: 1.5px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  cursor: pointer;
  margin: 0;
  transition: border-color .15s, background .15s;
  background: var(--sim-surface);
}
.sim-approval-option:hover {
  border-color: var(--sim-primary);
  background: var(--sim-primary-light);
}
.sim-approval-option.checked {
  border-color: var(--sim-primary);
  background: var(--sim-primary-light);
}

/* ── Action radio card (support-topic-edit) ── */
.sim-leave-radio {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem .9rem;
  border: 1.5px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  cursor: pointer;
  margin: 0;
  transition: border-color .15s, background .15s;
  background: var(--sim-surface);
  position: relative;
}
.sim-leave-radio:hover {
  border-color: var(--sim-primary);
  background: var(--sim-primary-light);
}
.sim-leave-radio.selected {
  border-color: var(--sim-primary);
  background: var(--sim-primary-light);
}
.sim-leave-radio-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--sim-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .05rem;
  transition: border-color .15s, background .15s;
}
.sim-leave-radio-check svg {
  opacity: 0;
  color: #fff;
  transition: opacity .15s;
}
.sim-leave-radio.selected .sim-leave-radio-check {
  background: var(--sim-primary);
  border-color: var(--sim-primary);
}
.sim-leave-radio.selected .sim-leave-radio-check svg {
  opacity: 1;
}

/* ══ Standard radio / checkbox "choice" control ════════════════════════════════
   ONE source of truth for every radio + checkbox. Markup:

     <div class="sim-choice-group">                       (always stacked)
       <label class="sim-choice">
         <input type="radio|checkbox" name=".." value=".." [checked] ...>
         <span class="sim-choice-check"><svg checkmark/></span>
         <span class="sim-choice-text">
           <span class="sim-choice-title">Title</span>
           <span class="sim-choice-hint">optional hint</span>
         </span>
       </label>
       …
     </div>

   Radio → round indicator, checkbox → square (auto-detected). Selected/checked
   state is pure CSS via :has(:checked) — no per-page JS required. Recolour every
   instance by changing --sim-choice-accent / --sim-choice-tint above. */
.sim-choice-group { display: flex; flex-direction: column; gap: .6rem; }

.sim-choice {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: var(--sim-control-pad-y) var(--sim-control-pad-x);
  min-height: var(--sim-control-h);
  font-size: .875rem;
  line-height: 1.4;
  border: var(--sim-control-border) solid var(--sim-border-strong);
  border-radius: var(--sim-control-radius);
  background: var(--sim-surface);
  box-shadow: var(--sim-shadow-xs);
  cursor: pointer;
  margin: 0;
  position: relative;
  transition: border-color .15s, background .15s;
}
/* A card carrying a hint line is taller than one line by design — top-align it
   so the tick sits beside the title rather than floating mid-block. */
.sim-choice:has(.sim-choice-hint) { align-items: flex-start; }
.sim-choice:hover { border-color: var(--sim-choice-accent); background: var(--sim-choice-tint); }

/* Visually hide the native input — the label click still toggles it and any JS
   change/click listeners still fire. */
.sim-choice > input[type="radio"],
.sim-choice > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
  pointer-events: none;
}

.sim-choice-check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;                 /* radio = circle */
  border: 2px solid var(--sim-border-strong);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-top: .05rem;
  transition: border-color .15s, background .15s;
}
.sim-choice:has(input[type="checkbox"]) .sim-choice-check { border-radius: 6px; }  /* checkbox = square */
.sim-choice-check svg { opacity: 0; color: #fff; transition: opacity .15s; }

.sim-choice-text  { display: flex; flex-direction: column; min-width: 0; }
.sim-choice-title { font-weight: 600; color: var(--sim-ink); }
.sim-choice-hint  { font-size: .8rem; color: var(--sim-ink-muted); margin-top: .1rem; line-height: 1.45; }

/* Checked / selected — pure CSS */
.sim-choice:has(input:checked) { border-color: var(--sim-choice-accent); background: var(--sim-choice-tint); }
.sim-choice:has(input:checked) .sim-choice-check { background: var(--sim-choice-accent); border-color: var(--sim-choice-accent); }
.sim-choice:has(input:checked) .sim-choice-check svg { opacity: 1; }

/* Keyboard focus + disabled */
.sim-choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(var(--sim-choice-accent-rgb), .25); }
.sim-choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* Fallback indicator for "simple" .sim-choice options that have no custom
   .sim-choice-check span — render the native input as a small square (checkbox)
   or dot (radio) so it clearly reads as checkable. Elaborate cards are untouched. */
.sim-choice:not(:has(.sim-choice-check)) > input[type="checkbox"],
.sim-choice:not(:has(.sim-choice-check)) > input[type="radio"] {
  position: static;
  opacity: 1;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: .1rem 0 0;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  border: 2px solid var(--sim-border-strong);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.sim-choice:not(:has(.sim-choice-check)) > input[type="checkbox"] { border-radius: 5px; }
.sim-choice:not(:has(.sim-choice-check)) > input[type="radio"]    { border-radius: 50%; }

.sim-choice:not(:has(.sim-choice-check)) > input:checked {
  background-color: var(--sim-choice-accent);
  border-color: var(--sim-choice-accent);
}
.sim-choice:not(:has(.sim-choice-check)) > input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}
.sim-choice:not(:has(.sim-choice-check)) > input[type="radio"]:checked {
  box-shadow: inset 0 0 0 3px #fff;
}

/* ── Time Off request card (employee list) ── */
.sim-tor-row-note {
  font-size: .8rem;
  color: #92400e;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: .4rem .7rem;
  border-radius: 0 .25rem .25rem 0;
  margin-top: .35rem;
  display: inline-block;
  max-width: 420px;
}
.sim-tor-row-note.rejected {
  color: #991b1b;
  background: #fee2e2;
  border-left-color: #ef4444;
}

/* ── Admin time-off detail blocks ── */
.sim-detail-row {
  display: flex;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--sim-border);
  font-size: .875rem;
}
.sim-detail-row:last-child { border-bottom: none; }
.sim-detail-label {
  color: var(--sim-ink-muted);
  width: 160px;
  flex-shrink: 0;
  font-weight: 500;
}
.sim-detail-value {
  color: var(--sim-ink);
  flex: 1;
}
.sim-detail-dates {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.sim-detail-date-chip {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-radius: 1rem;
  padding: .15rem .6rem;
  font-size: .78rem;
  font-weight: 600;
}

/* ── Filter tab strip ── */
.sim-filter-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.sim-filter-tab {
  padding: .35rem .9rem;
  border-radius: 2rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  text-decoration: none;
  border: 1px solid var(--sim-border);
  background: var(--sim-surface);
  transition: background .15s, color .15s, border-color .15s;
}
.sim-filter-tab:hover {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-color: var(--sim-primary-light);
}
.sim-filter-tab.active {
  background: var(--sim-primary);
  color: #fff;
  border-color: var(--sim-primary);
}
.sim-filter-tab-count { opacity: .65; }

/* ══════════════════════════════════════════════
   Shared utility classes — use these everywhere,
   never inline styles for these patterns.
══════════════════════════════════════════════ */

/* ── Card defaults ── */
/* Override Bootstrap card-body to our 1.5 rem standard */
.card-body { padding: 1.5rem; }
/* Padded card sections that aren't card-body */
.card-pad    { padding: 1.5rem; }
.card-pad-lg { padding: 2rem; }
/* Clip table corners inside a card */
.card-overflow { overflow: hidden; }

/* ── Admin page-level titles ── */
.admin-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sim-ink);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0;
}
.admin-page-subtitle {
  color: var(--sim-ink-muted);
  font-size: .875rem;
  margin: .25rem 0 0;
}

/* ── Admin narrow page wrapper ── */
.admin-page-narrow { max-width: 840px; }

/* ── Card section headings (inside card-pad) ── */
/* uppercase label — used in admin detail views */
.sim-card-section-heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sim-ink-muted);
  margin: 0 0 1rem;
}
/* standard title — used in form cards (time-off-request) */
.sim-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin: 0 0 1rem;
}

/* ── Empty states ── */
.sim-empty-icon {
  width: 52px;
  height: 52px;
  background: var(--sim-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.sim-empty-text {
  color: var(--sim-ink-muted);
  font-size: .9rem;
  margin: 0;
}

/* ── Floating WhatsApp support button (user portal) ── */
.sim-wa-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1030;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.sim-wa-fab:hover,
.sim-wa-fab:focus { color: #fff; transform: scale(1.06); box-shadow: 0 10px 26px rgba(0,0,0,.26); }
.sim-wa-fab svg { width: 30px; height: 30px; display: block; }
@media (max-width: 575.98px) {
  .sim-wa-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  .sim-wa-fab svg { width: 27px; height: 27px; }
}

/* ── Book a Meeting — calendar booking embed ── */
.booking-embed { width: 100%; }
.booking-embed iframe {
  width: 100%;
  max-width: 1000px;   /* full width on mobile, capped on desktop */
  min-height: 70vh;
  border: 0;
  border-radius: var(--sim-radius);
  display: block;
}

/* ── Breadcrumb (admin pages) ── */
.sim-breadcrumb {
  font-size: .8rem;
  color: var(--sim-ink-muted);
  margin-bottom: 1rem;
}
.sim-breadcrumb a {
  color: var(--sim-ink-muted);
  text-decoration: none;
}
.sim-breadcrumb a:hover { color: var(--sim-ink); }

/* ── Shared table — identical to .admin-table, usable in user portal ── */
.sim-table {
  font-size: .875rem;
  border-collapse: separate;
  border-spacing: 0;
}
.sim-table thead th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--sim-ink-muted);
  background: var(--sim-th-bg);
  border-bottom: 1px solid var(--sim-border);
  padding: .75rem 1rem;
  white-space: nowrap;
}
.sim-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--sim-border);
  vertical-align: middle;
  white-space: nowrap;   /* never wrap table cells onto a new line */
}
.sim-table tbody tr:last-child td { border-bottom: none; }
.sim-table tbody tr:hover td      { background: rgba(0,0,0,.015); }

/* ── Flush tables in a card: round the four corner cells so a header/hover row
   never square-fills the card's rounded corners. Covers tables with a <thead>
   and tables that are tbody-only (thead-less → tbody is the table's first child). */
.card-body.p-0 .admin-table > thead > tr > th:first-child,
.card-body.p-0 .sim-table  > thead > tr > th:first-child,
.card-body.p-0 .admin-table > tbody:first-child > tr:first-child > td:first-child,
.card-body.p-0 .sim-table  > tbody:first-child > tr:first-child > td:first-child { border-top-left-radius: var(--sim-radius-lg); }
.card-body.p-0 .admin-table > thead > tr > th:last-child,
.card-body.p-0 .sim-table  > thead > tr > th:last-child,
.card-body.p-0 .admin-table > tbody:first-child > tr:first-child > td:last-child,
.card-body.p-0 .sim-table  > tbody:first-child > tr:first-child > td:last-child { border-top-right-radius: var(--sim-radius-lg); }
.card-body.p-0 .admin-table > tbody > tr:last-child > td:first-child,
.card-body.p-0 .sim-table  > tbody > tr:last-child > td:first-child { border-bottom-left-radius: var(--sim-radius-lg); }
.card-body.p-0 .admin-table > tbody > tr:last-child > td:last-child,
.card-body.p-0 .sim-table  > tbody > tr:last-child > td:last-child { border-bottom-right-radius: var(--sim-radius-lg); }

/* ── Table cell helpers ── */
.td-muted  { color: var(--sim-ink-muted); }
.td-nowrap { white-space: nowrap; }
.td-sm     { font-size: .82rem; }

/* ── Badge size variant ── */
.sim-badge-lg {
  font-size: .85rem;
  padding: .4rem .9rem;
}

/* ── Document / attachment link ── */
.sim-doc-link {
  color: var(--sim-primary-text);
  font-size: .85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.sim-doc-link:hover {
  text-decoration: underline;
  color: var(--sim-primary-dark);
}

/* ── KB article page ── */
.kb-article-page            { max-width: 760px; padding-bottom: 2rem; }
.kb-article-category-label  {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sim-primary-text);
  margin: 0 0 .5rem;
}
.kb-article-heading         {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--sim-ink);
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
  line-height: 1.2;
}
.kb-article-meta-text       { font-size: .78rem; color: var(--sim-ink-muted); margin: .75rem 0 0; }

/* ── Inline helpers ── */
.sim-value-empty  { color: var(--sim-ink-muted); font-style: italic; font-size: .8rem; }
.sim-label-hint   { color: var(--sim-ink-muted); font-weight: 500; }
.sim-label-optional { color: var(--sim-ink-muted); font-weight: 400; font-size: .78rem; }
.sim-mono         { font-family: monospace; }
.sim-pre-wrap     { white-space: pre-wrap; }
.sim-text-mono-sm { font-size: .75rem; color: var(--sim-ink-muted); font-family: monospace; }
.sim-link         { color: var(--sim-primary-text); text-decoration: none; font-weight: 600; }
.sim-link:hover   { text-decoration: underline; color: var(--sim-primary-dark); }

/* Ensure Bootstrap text-muted uses our token */
.text-muted { color: var(--sim-ink-muted) !important; }

/* sim-label-hint with size */
.sim-label-hint { color: var(--sim-ink-muted); font-weight: 500; font-size: .8rem; }

/* Textarea standard */
.sim-textarea { font-size: .875rem; resize: vertical; }
/* Support message box: starts at 6 rows, auto-grows to 10 rows, then scrolls (sizing in JS). */
#messageInput { resize: none; overflow-y: hidden; }

/* Char counter */
.sim-char-counter {
  text-align: right;
  font-size: .75rem;
  color: var(--sim-ink-subtle);
  margin-top: .25rem;
}

/* Cancel / back text link */
.sim-cancel-link {
  color: var(--sim-ink-muted);
  font-size: .875rem;
  text-decoration: none;
}
.sim-cancel-link:hover { color: var(--sim-ink); }

/* Approval option text */
.sim-approval-label { color: var(--sim-ink); font-weight: 600; }

/* Pending warning inline count */
.sim-count-warning { color: #92400e; font-weight: 600; }

/* No-results / empty table cell */
.td-empty { color: var(--sim-ink-muted); text-align: center; }

/* KB article excerpt (larger than default subtitle) */
.kb-article-excerpt { font-size: 1rem; line-height: 1.6; color: var(--sim-ink-muted); margin: 0; }

/* Overflow: hidden needed by card-pad-lg with card-body — ensure override */
.card-body.card-pad-lg { padding: 2rem; }

/* KB type-selector label sizes */
.kb-type-label { font-size: .9rem; }
.kb-type-desc  { font-size: .78rem; }

/* Max-width constraints for narrow forms and empty-state cards */
.sim-form        { max-width: 680px; }
.sim-card-sm     { max-width: 520px; }

/* Table column width helpers */
.th-num          { width: 40px; }
.th-days         { width: 60px; }
.th-days-sm      { width: 55px; }

/* Narrow text inputs inline with other controls */
.admin-input-sm  { width: 130px; }

/* Auth page classes */
.sim-auth-wrap          { width: 100%; max-width: 420px; }
.sim-auth-logo          { height: 36px; width: auto; }
.sim-auth-logo-sm       { height: 32px; width: auto; }
/* .sim-auth-card — full definition at top of auth section */
.sim-auth-body          { padding: 2.25rem 2rem; }
.sim-auth-icon          { width: 56px; height: 56px; border-radius: 50%; display: flex;
                          align-items: center; justify-content: center; margin: 0 auto 1.25rem; }
.sim-auth-icon--primary { background: rgba(0, 81, 255, .1); }
.sim-auth-icon--red     { background: #fff0f0; }
.sim-auth-heading       { font-size: 1.3rem; color: var(--sim-ink); }
.sim-auth-subtitle      { color: var(--sim-ink-muted); font-size: .875rem; }
.sim-auth-footer        { font-size: .85rem; color: var(--sim-ink-muted); }
.sim-auth-link          { color: var(--sim-primary-text); font-weight: 700; text-decoration: none; }
.sim-auth-link:hover    { text-decoration: underline; }
.sim-ink                { color: var(--sim-ink); }
.sim-auth-page--top     { align-items: flex-start; padding-top: 2.5rem; padding-bottom: 2.5rem; }
.sim-auth-wrap--wide    { max-width: 540px; margin: 0 auto; }
.sim-auth-wrap--narrow  { max-width: 380px; }
.sim-auth-eyebrow       { font-size: .7rem; font-weight: 700; text-transform: uppercase;
                          letter-spacing: .1em; color: var(--sim-ink-muted); margin: 0 0 .5rem; }

/* PDF viewer modal overrides */
.sim-modal-content {
  border-radius: var(--sim-radius-lg);
  overflow: hidden;
  border: 1px solid var(--sim-border);
}
.sim-modal-header {
  border-bottom: 1px solid var(--sim-border);
  padding: .875rem 1.25rem;
}
.sim-modal-title {
  font-size: .95rem;
  color: var(--sim-ink);
}

/* ── Drag-to-reorder (support topics) ── */
.th-drag   { width: 32px; }
.td-drag   { width: 32px; padding-right: 0 !important; }
.sim-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--sim-ink-subtle);
  cursor: grab;
  border-radius: var(--sim-radius);
  transition: color .15s, background .15s;
}
.sim-drag-handle:hover  { color: var(--sim-ink-muted); background: var(--sim-border); }
.sim-drag-handle:active { cursor: grabbing; }
.sim-drag-ghost { opacity: .45; background: var(--sim-primary-light) !important; }
.sim-sort-save-msg {
  font-size: .8rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
}

/* ── Support article alert ── */
.support-article-alert {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.125rem 1.25rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--sim-radius);
}
.support-article-alert-icon {
  flex-shrink: 0;
  color: var(--sim-primary-text);
  padding-top: .15rem;
}
.support-article-alert-body {
  flex: 1;
}
.support-article-alert-title {
  font-weight: 700;
  font-size: .925rem;
  color: var(--sim-ink);
  margin: 0 0 .25rem;
}
.support-article-alert-text {
  font-size: .85rem;
  color: var(--sim-ink-muted);
  margin: 0 0 .5rem;
}
.support-article-alert-article-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--sim-primary-text);
  margin: 0 0 .875rem;
}
.support-article-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: stretch;
}
.support-article-alert-actions .btn {
  padding-top: .35rem;
  padding-bottom: .35rem;
  display: inline-flex;
  align-items: center;
}

/* ── Event Calendar (.ev-cal-*) ─────────────────────────────────────────────── */

/* Wrapper card */
.ev-cal-wrap {
  background: var(--sim-surface);
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-lg);
  overflow: hidden;
  position: relative;
}

/* Loading overlay */
.ev-cal-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.ev-cal-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--sim-border);
  border-top-color: var(--sim-primary);
  border-radius: 50%;
  animation: ev-cal-spin .65s linear infinite;
}
@keyframes ev-cal-spin {
  to { transform: rotate(360deg); }
}

/* Nav bar (prev/next + month label + view toggle) */
.ev-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.125rem;
  border-bottom: 1px solid var(--sim-border);
  gap: .75rem;
  flex-wrap: wrap;
}
.ev-cal-nav-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ev-cal-month-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--sim-ink);
  min-width: 9rem;
  text-align: center;
}
.ev-cal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--sim-border-strong);
  border-radius: var(--sim-radius);
  background: var(--sim-surface);
  color: var(--sim-ink-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.ev-cal-nav-btn:hover {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-color: var(--sim-primary);
}
.ev-cal-nav-btn--disabled {
  opacity: .35;
  pointer-events: none;
  cursor: default;
}
.ev-cal-view-btns {
  display: flex;
  gap: .25rem;
}
.ev-cal-view-btn {
  display: inline-flex;
  align-items: center;
  padding: .3rem .75rem;
  border-radius: 20px;
  border: 1px solid var(--sim-border-strong);
  font-size: .8rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  text-decoration: none;
  background: var(--sim-surface);
  transition: background .15s, color .15s, border-color .15s;
}
.ev-cal-view-btn:hover {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
  border-color: var(--sim-primary);
}
.ev-cal-view-btn.active {
  background: var(--sim-primary);
  color: #fff;
  border-color: var(--sim-primary);
}

/* Filter bar */
.ev-cal-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1.125rem;
  border-bottom: 1px solid var(--sim-border);
  background: #fff;
}
.ev-cal-filter-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  border-radius: 20px;
  border: 1px solid var(--sim-border-strong);
  font-size: .8rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  background: var(--sim-surface);
  cursor: pointer;
  user-select: none;
  opacity: .45;
  transition: opacity .15s, border-color .15s, color .15s;
}
.ev-cal-filter-item.active {
  opacity: 1;
  color: var(--sim-ink);
  border-color: var(--sim-border-strong);
}
.ev-cal-filter-cb {
  display: none;
}
.ev-cal-filter-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Month grid */
.ev-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.ev-cal-dow {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sim-ink-subtle);
  background: #fff;
  padding: .45rem .5rem;
  text-align: center;
  border-bottom: 1px solid var(--sim-border);
}
.ev-cal-cell {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: .35rem .4rem .4rem;
  border-bottom: 1px solid var(--sim-border);
  border-right: 1px solid var(--sim-border);
  overflow: hidden;
}
.ev-cal-cell:nth-child(7n) {
  border-right: 0;
}
.ev-cal-cell--other {
  background: #fafafa;
}
.ev-cal-cell--other .ev-cal-cell-num {
  color: var(--sim-ink-subtle);
}
.ev-cal-cell--today {
  background: #eff6ff;
}
.ev-cal-cell-num {
  font-size: .8rem;
  font-weight: 700;
  color: var(--sim-ink-muted);
  align-self: flex-start;
  line-height: 1;
  margin-bottom: 2px;
}
.ev-cal-cell--today .ev-cal-cell-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sim-primary);
  color: #fff;
}

/* Event chips */
.ev-cal-event {
  display: flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.2;
  padding: .18rem .35rem;
  border-radius: 3px;
  border-left: 3px solid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  color: #fff;
}
.ev-cal-timeoff {
  display: flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.2;
  padding: .18rem .35rem;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.ev-cal-timeoff--approved {
  background: #dcfce7;
  color: #166534;
}
.ev-cal-timeoff--pending {
  background: #fef9c3;
  color: #854d0e;
}
.ev-cal-more {
  font-size: .68rem;
  font-weight: 600;
  color: var(--sim-primary-text);
  cursor: default;
  padding-left: .3rem;
}

/* Year view */
.ev-cal-year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--sim-border);
  padding: 1px;
}
@media (max-width: 767px) {
  .ev-cal-year-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .ev-cal-year-grid {
    grid-template-columns: 1fr;
  }
}
.ev-cal-mini-month {
  background: var(--sim-surface);
  padding: .75rem;
}
.ev-cal-mini-header {
  font-size: .75rem;
  font-weight: 700;
  color: var(--sim-ink);
  text-align: center;
  margin-bottom: .4rem;
}
.ev-cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.ev-cal-mini-dow {
  font-size: .55rem;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--sim-ink-subtle);
  padding: .15rem 0;
}
.ev-cal-mini-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .18rem 0;
  border-radius: 3px;
}
.ev-cal-mini-cell--today .ev-cal-mini-day-num {
  background: var(--sim-primary);
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ev-cal-mini-day-num {
  font-size: .65rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  line-height: 1;
  min-width: 14px;
  text-align: center;
}
.ev-cal-mini-cell--other .ev-cal-mini-day-num {
  color: var(--sim-ink-subtle);
}
.ev-cal-dots-row {
  display: flex;
  gap: 1px;
  justify-content: center;
  margin-top: 1px;
  min-height: 5px;
}
.ev-cal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ev-cal-dot--mini {
  width: 5px;
  height: 5px;
}
.ev-cal-dot--timeoff {
  background: #ca8a04;
}

/* Category color swatches (admin) */
.ev-cat-color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  flex-shrink: 0;
}
.ev-cat-color-swatch--lg {
  width: 26px;
  height: 26px;
  border-width: 2px;
  transition: box-shadow .15s;
}
.ev-cat-color-swatch-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .15s;
  position: relative;
}
.ev-cat-color-swatch-radio:hover {
  border-color: var(--sim-border-strong);
}
.ev-cat-color-swatch-radio.selected {
  border-color: var(--sim-ink);
}
.ev-cat-color-swatch-radio.selected .ev-cat-color-swatch--lg {
  box-shadow: 0 0 0 2px var(--sim-surface), 0 0 0 4px var(--sim-ink);
}

/* ── Tooltip (year view hover) ── */
.ev-cal-tip {
  position: fixed;
  z-index: 9999;
  background: #1a1a2e;
  color: #fff;
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.45;
  padding: .35rem .55rem;
  border-radius: 5px;
  pointer-events: none;
  white-space: pre-line;
  max-width: 220px;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}

/* ── List view ── */
.ev-cal-list {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.ev-cal-list-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.ev-cal-list-month-header {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sim-ink-subtle);
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--sim-border);
  margin-bottom: .35rem;
}
.ev-cal-list-item {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .45rem .35rem;
  border-radius: 6px;
  transition: background .1s;
}
.ev-cal-list-item:hover {
  background: var(--sim-content-bg);
}
.ev-cal-list-date {
  font-size: .72rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  white-space: nowrap;
  min-width: 5.5rem;
  padding-top: .1rem;
}
.ev-cal-list-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--sim-ink);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.ev-cal-list-cat {
  font-size: .68rem;
  font-weight: 500;
  color: var(--sim-ink-muted);
  flex-shrink: 0;
  padding-top: .1rem;
}
.ev-cal-list-badge {
  display: inline-block;
  font-size: .66rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 4px;
  line-height: 1.4;
}
.ev-cal-list-badge--approved {
  background: #dcfce7;
  color: #166534;
}
.ev-cal-list-badge--pending {
  background: #fef9c3;
  color: #854d0e;
}
.ev-cal-list-empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--sim-ink-subtle);
  font-size: .85rem;
}

/* ── Support request — urgency pills ── */
.sup-urgency-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.sup-urgency-pill {
  display: inline-flex;
  align-items: center;
  padding: .4rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--urgency-color, #6b7280);
  color: var(--urgency-color, #6b7280);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: #fff;
  transition: background .12s, color .12s;
  line-height: 1;
}
.sup-urgency-pill:hover {
  background: color-mix(in srgb, var(--urgency-color, #6b7280) 10%, #fff);
}
.sup-urgency-pill.selected {
  background: var(--urgency-color, #6b7280);
  color: #fff;
}

/* Full-width support request form (overrides the 680px .sim-form cap) */
.sim-form--wide { max-width: none; }

/* ── Topic picker cards (support request form) ─────────────────────────────── */
.sup-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
}

.sup-topic-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  padding: .9rem 1rem;
  border: 1.5px solid var(--sim-border);
  border-radius: 12px;
  background: #fff;
  color: var(--sim-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.sup-topic-card:hover {
  border-color: var(--sim-primary);
  background: rgba(var(--sim-primary-rgb), .04);
}

.sup-topic-card.selected {
  border-color: var(--sim-primary);
  background: rgba(var(--sim-primary-rgb), .06);
  box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .16);
}

.sup-topic-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(var(--sim-primary-rgb), .12);
  color: var(--sim-primary-text);
}

.sup-topic-card.selected .sup-topic-card-icon {
  background: var(--sim-primary);
  color: #fff;
}

.sup-topic-card-label {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
}


/* ── Documents module (.doc-*) ─────────────────────────────────────────────── */

/* Section wrapper */
.doc-section {}

/* Section header row: icon + title/subtitle */
.doc-section-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}
.doc-section-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--sim-radius);
  background: var(--sim-bg);
  border: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sim-ink-muted);
  margin-top: .1rem;
}
.doc-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin: 0 0 .2rem;
}
.doc-section-subtitle {
  font-size: .82rem;
  color: var(--sim-ink-muted);
  margin: 0;
  line-height: 1.5;
}

/* Coming Soon placeholder */
.doc-coming-soon-card {
  border: 2px dashed var(--sim-border) !important;
  box-shadow: none !important;
  background: var(--sim-bg) !important;
}
.doc-coming-soon {
  padding: 3rem 2rem;
  text-align: center;
}
.doc-coming-soon-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sim-surface);
  border: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--sim-ink-muted);
}
.doc-coming-soon-heading {
  font-size: .95rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin: 0 0 .4rem;
}
.doc-coming-soon-text {
  font-size: .83rem;
  color: var(--sim-ink-muted);
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Request document cards grid */
.doc-request-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .doc-request-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .doc-request-grid { grid-template-columns: 1fr; }
}

.doc-request-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 0;
}
.doc-request-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--sim-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.doc-request-card-icon--blue  { background: #eff6ff; color: #2563eb; }
.doc-request-card-icon--green { background: #f0fdf4; color: #16a34a; }
.doc-request-card-icon--amber { background: #fffbeb; color: #d97706; }

.doc-request-card-body {
  flex: 1;
}
.doc-request-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin: 0 0 .4rem;
}
.doc-request-card-desc {
  font-size: .8rem;
  color: var(--sim-ink-muted);
  margin: 0 0 .6rem;
  line-height: 1.6;
}
.doc-request-card-tag {
  display: inline-flex;
  align-items: center;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .03em;
  background: #dcfce7;
  color: #166534;
}
.doc-request-card-tag--amber {
  background: #fef3c7;
  color: #92400e;
}
.doc-request-card-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sim-border);
}
.doc-request-card-footer .btn {
  width: 100%;
}

/* Success modal */
.doc-modal {
  border-radius: var(--sim-radius-lg);
  border: none;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.doc-modal-check {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.doc-modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--sim-ink);
  margin: 0 0 .6rem;
}
.doc-modal-body {
  font-size: .9rem;
  color: var(--sim-ink-muted);
  margin: 0 0 1.5rem;
  line-height: 1.65;
}

/* ── Newsfeed (.nf-*) ──────────────────────────────────────────────────────── */

/* User feed */
.nf-feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 720px;
}

.nf-card {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}
.nf-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sim-shadow-lg);
  color: inherit;
  text-decoration: none;
}

.nf-card-cover {
  height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: var(--sim-radius-lg) var(--sim-radius-lg) 0 0;
}
.nf-card-cover + .nf-card-body {
  border-radius: 0 0 var(--sim-radius-lg) var(--sim-radius-lg);
}

.nf-card-body {
  padding: 1.25rem 1.5rem .75rem;
}
.nf-card-date {
  font-size: .7rem;
  color: var(--sim-ink-subtle);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .4rem;
}
.nf-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sim-ink);
  margin: 0 0 .5rem;
  line-height: 1.35;
}
.nf-card-excerpt {
  font-size: .83rem;
  color: var(--sim-ink-muted);
  margin: 0;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nf-card-footer {
  border-top: 1px solid var(--sim-border);
  padding: .65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nf-reaction-summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}
.nf-reaction-summary-item {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  color: var(--sim-ink-muted);
  font-weight: 600;
}
.nf-reaction-summary-item.nf-zero {
  opacity: .35;
}

.nf-read-link {
  font-size: .78rem;
  color: var(--sim-primary-text);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.nf-read-link:hover { text-decoration: underline; color: var(--sim-primary-text); }

/* Empty feed state */
.nf-empty {
  text-align: center;
  padding: 4rem 2rem;
}

/* Single post view */
.nf-post-wrap {
  max-width: 760px;
}

.nf-post-cover {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: var(--sim-radius-lg);
  display: block;
  margin-bottom: 1.5rem;
}

.nf-post-header {
  padding: 0 0 1rem;
}
.nf-post-date {
  font-size: .78rem;
  color: var(--sim-ink-subtle);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .5rem;
}
.nf-post-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--sim-ink);
  letter-spacing: -.03em;
  line-height: 1.2;
  margin: 0;
}

/* Quill content rendering */
.nf-post-content {
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--sim-ink);
  padding: 0 !important;
  border: none !important;
}
.nf-post-content img {
  max-width: 100%;
  border-radius: var(--sim-radius);
  margin: .5rem 0;
}
.nf-post-content h1, .nf-post-content h2, .nf-post-content h3 {
  margin-top: 1.5rem;
  margin-bottom: .5rem;
  font-weight: 700;
  color: var(--sim-ink);
}
.nf-post-content p { margin-bottom: 1rem; }
.nf-post-content ul, .nf-post-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.nf-post-content blockquote {
  border-left: 3px solid var(--sim-primary);
  padding-left: 1rem;
  color: var(--sim-ink-muted);
  margin: 1rem 0;
}

/* Reactions */
.nf-post-reactions {
  border-top: 1px solid var(--sim-border);
  padding-top: 1.5rem;
  margin-top: 2rem;
}
.nf-post-reactions-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sim-ink-muted);
  margin: 0 0 .75rem;
}
.nf-reaction-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.nf-reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  border: 1.5px solid var(--sim-border-strong);
  background: #fff;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--sim-ink-muted);
  transition: background .1s, border-color .1s, color .1s;
  user-select: none;
  line-height: 1;
}
.nf-reaction-btn:hover {
  background: var(--sim-bg);
  border-color: var(--sim-primary);
  color: var(--sim-primary-text);
}
.nf-reaction-btn.active {
  background: var(--sim-primary-light);
  border-color: var(--sim-primary);
  color: var(--sim-primary-text);
}
.nf-reaction-emoji { font-size: 1.1rem; line-height: 1; }
.nf-reaction-count { font-size: .8rem; min-width: .75rem; text-align: center; }

/* Inline feed post cards (newsfeed.php full-content view) */
.nf-post-item {
  background: var(--sim-surface);
  border-radius: var(--sim-radius-lg);
  box-shadow: var(--sim-shadow);
  overflow: hidden;
}

/* Cover image fills the card width with no border radius */
.nf-post-item .nf-post-cover {
  border-radius: 0;
  margin-bottom: 0;
  max-height: 300px;
}

/* Padded content area inside each card */
.nf-post-body {
  padding: 1.5rem 1.75rem 1.25rem;
}

/* Tighter header padding inside card */
.nf-post-item .nf-post-header {
  padding: 0 0 .75rem;
}

/* Slightly smaller title in feed vs single-post view */
.nf-post-item .nf-post-title {
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
}

/* Reactions flush to body padding */
.nf-post-item .nf-post-reactions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  padding-bottom: 0;
}

/* ── Contract overview page ── */
.contract-page { max-width: none; width: 100%; }

.contract-hero {
  background: var(--sim-surface);
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-lg);
  box-shadow: var(--sim-shadow);
  padding: 1.75rem 2rem;
}

.contract-hero-logo-wrap {
  width: 72px;
  height: 72px;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-lg);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.contract-hero-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.contract-hero-logo-placeholder {
  width: 72px;
  height: 72px;
  border-radius: var(--sim-radius-lg);
  background: var(--sim-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--sim-primary-text);
  flex-shrink: 0;
}

.contract-hero-company {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--sim-ink);
  line-height: 1.2;
}

.contract-hero-role {
  font-size: .9rem;
  color: var(--sim-ink-muted);
  font-weight: 600;
  margin-top: .25rem;
}

.contract-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.contract-stat-salary { font-size: 1.35rem; }
.contract-stat-tenure { font-size: 1.35rem; }
.contract-stat-date   { font-size: 1.1rem; }

.contract-progress-track {
  height: 8px;
  background: var(--sim-primary-light);
  border-radius: 999px;
  overflow: hidden;
}

.contract-progress-fill {
  height: 100%;
  background: var(--sim-primary);
  border-radius: 999px;
  transition: width .6s ease;
}

@media (max-width: 768px) {
  .contract-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .contract-hero { padding: 1.25rem 1.25rem; }
}

@media (max-width: 480px) {
  .contract-stats-grid { grid-template-columns: 1fr; }
}

/* ══ Employee dashboard (index.php) ═══════════════════════════════════════════
   All colour comes from --sim-* tokens so the widgets adopt each company's brand
   automatically on the multi-tenant portal. */
.dash-hero {
  border-radius: var(--sim-radius-lg);
  border: 1px solid var(--sim-border);
  background:
    radial-gradient(680px 220px at 100% -60%, rgba(var(--sim-primary-rgb), .12), transparent 70%),
    var(--sim-surface);
  box-shadow: var(--sim-shadow);
  padding: 1.6rem 1.75rem;
}
.dash-hero-title { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 800; color: var(--sim-ink); letter-spacing: -.02em; margin: 0 0 .3rem; }
.dash-hero-sub   { color: var(--sim-ink-muted); font-size: .9rem; margin: 0; }

/* Stat tile: icon chip + label/value */
.dash-stat      { display: flex; align-items: center; gap: 1rem; }
.dash-stat-ico  { flex-shrink: 0; width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--sim-primary-light); color: var(--sim-primary-text); }
.dash-stat-ico svg { width: 22px; height: 22px; }
.dash-stat-body { min-width: 0; }

/* Upcoming-dates timeline */
.dash-tl        { list-style: none; margin: 0; padding: 0; }
.dash-tl-item   { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--sim-border); }
.dash-tl-item:last-child { border-bottom: none; }
.dash-tl-dot    { flex-shrink: 0; width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.dash-tl-body   { flex: 1; min-width: 0; }
.dash-tl-label  { font-weight: 700; font-size: .9rem; color: var(--sim-ink); }
.dash-tl-meta   { font-size: .78rem; color: var(--sim-ink-muted); }
.dash-tl-when   { text-align: right; flex-shrink: 0; }
.dash-tl-date   { font-weight: 700; font-size: .82rem; color: var(--sim-ink); white-space: nowrap; }
.dash-tl-rel    { font-size: .72rem; color: var(--sim-ink-subtle); white-space: nowrap; }

/* Quick-action grid */
.dash-actions      { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: 1rem 1.25rem; }
.dash-action       { display: flex; flex-direction: column; gap: .55rem; text-decoration: none; border: 1px solid var(--sim-border); border-radius: var(--sim-radius); padding: .85rem; background: var(--sim-surface); transition: border-color .15s, box-shadow .15s, transform .1s; }
.dash-action:hover { border-color: var(--sim-primary); box-shadow: var(--sim-shadow); transform: translateY(-1px); }
.dash-action-ico   { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--sim-primary-light); color: var(--sim-primary-text); }
.dash-action-ico svg { width: 18px; height: 18px; }
.dash-action-label { font-weight: 700; font-size: .82rem; color: var(--sim-ink); line-height: 1.2; }

/* Support widget */
.dash-support-item  { display: block; text-decoration: none; padding: .8rem 1.25rem; border-bottom: 1px solid var(--sim-border); }
.dash-support-item:last-child { border-bottom: none; }
.dash-support-item:hover { background: var(--sim-bg); }
.dash-support-subj  { font-weight: 600; font-size: .86rem; color: var(--sim-ink); display: block; margin-top: .35rem; line-height: 1.35; }
.dash-loading       { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 2rem 1.25rem; color: var(--sim-ink-muted); font-size: .85rem; }

/* Card footer link row */
.dash-foot          { padding: .85rem 1.25rem; border-top: 1px solid var(--sim-border); }
.dash-foot-link     { color: var(--sim-primary-text); font-weight: 700; font-size: .82rem; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.dash-foot-link:hover { text-decoration: underline; }
.dash-foot-link svg { width: 13px; height: 13px; }

.dash-spinner       { width: 20px; height: 20px; border: 2px solid var(--sim-border-strong); border-top-color: var(--sim-primary); border-radius: 50%; animation: dash-spin .7s linear infinite; }
@keyframes dash-spin { to { transform: rotate(360deg); } }

.dash-empty         { text-align: center; padding: 2rem 1.25rem; }
.dash-empty-emoji   { font-size: 1.75rem; }
.dash-empty-text    { color: var(--sim-ink-muted); font-size: .86rem; margin: .5rem 0 0; }

@media (max-width: 575.98px) { .dash-actions { grid-template-columns: 1fr; } }

/* ── Person/contract picker "Advanced search" link + modal ─────────────────── */
.sim-field-labelrow { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.sim-field-labelrow > .sim-label { margin-bottom: 0; }
.sim-adv-search-link {
  -webkit-appearance: none; appearance: none;
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  font-size: .78rem; font-weight: 600; line-height: 1.2; font-family: inherit;
  color: var(--sim-primary-text); text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .3rem;
}
.sim-adv-search-link:hover { color: var(--sim-primary-dark); text-decoration: underline; }
.sim-adv-search-link svg { width: 13px; height: 13px; flex-shrink: 0; stroke: currentColor; }
.sim-cs-scroll {
  max-height: 56vh; overflow: auto;
  border: 1px solid var(--sim-border); border-radius: 10px;
}
.sim-cs-table { font-size: .86rem; }
.sim-cs-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--sim-surface); border-bottom: 1px solid var(--sim-border);
}
.sim-cs-row { cursor: pointer; }
.sim-cs-row:hover td   { background: rgba(var(--sim-primary-rgb), .07); }
.sim-cs-row--on td     { background: rgba(var(--sim-primary-rgb), .13); }

/* ── People quick-view modal + clickable rows ─────────────────────────────── */
.admin-table tbody tr[data-quickview] { cursor: pointer; }
.pqv-field { display: flex; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--sim-border); }
.pqv-field:first-child { padding-top: 0; }
.pqv-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--sim-ink-muted); min-width: 84px; display: inline-block; }
.pqv-value { font-size: .9rem; color: var(--sim-ink); word-break: break-word; }
a.pqv-value { color: var(--sim-primary-text); text-decoration: none; }
a.pqv-value:hover { text-decoration: underline; }
.pqv-contracts { padding-top: .85rem; }
.pqv-contract { border: 1px solid var(--sim-border); border-radius: 10px; padding: .6rem .75rem; margin-top: .5rem; }
.pqv-contract:first-child { margin-top: 0; }
.pqv-contract-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.pqv-contract-pos { font-weight: 600; font-size: .9rem; color: var(--sim-ink); }
.pqv-contract-meta { font-size: .8rem; color: var(--sim-ink-muted); margin-top: .15rem; }

/* ── Person profile left tabs ─────────────────────────────────────────────── */
.sim-vtabs { gap: .15rem; }
@media (min-width: 992px) { .sim-vtabs { position: sticky; top: 1rem; } }
.sim-vtabs .nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; text-align: left; color: var(--sim-ink); font-weight: 600; font-size: .9rem;
  padding: .55rem .8rem; border-radius: 8px; border: 0; background: none;
}
.sim-vtabs .nav-link:hover { background: rgba(var(--sim-primary-rgb), .07); }
.sim-vtabs .nav-link.active { background: var(--sim-primary); color: #fff; }
.sim-vtab-count {
  font-size: .72rem; font-weight: 700; line-height: 1;
  background: rgba(0,0,0,.08); color: var(--sim-ink-muted);
  border-radius: 999px; padding: .2rem .45rem; min-width: 1.5em; text-align: center;
}
.sim-vtabs .nav-link.active .sim-vtab-count { background: rgba(255,255,255,.25); color: #fff; }

/* ── Flat cards — shadows removed across the board (temporary) ─────────────────
   Targets card/panel/tile surfaces only. Overlays (dropdowns, modals, drawer),
   inputs and focus rings keep their shadows. Delete this block to restore. */
.card,
body.sim-admin .card,
.card:hover,
.sim-stat,
.sim-stat:hover,
.nf-card,
.nf-card:hover,
.nf-post-item,
.contract-hero,
.dash-hero,
a.sim-admin-tile,
a.sim-admin-tile:hover,
.dash-action,
.dash-action:hover { box-shadow: none !important; }

/* ── Tasks: topnav trigger, sidebar badge, quick-add panel ────────────────── */
.sim-topnav-task {
  background: var(--sim-primary); color: #fff; border: 0; border-radius: 9px;
  font-size: .82rem; font-weight: 700; padding: .38rem .7rem; margin-right: .6rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.sim-topnav-task:hover { background: var(--sim-primary-dark); color: #fff; }
.sim-topnav-task svg { width: 15px; height: 15px; }
.sim-nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sim-primary); color: #fff; border-radius: 999px;
  font-size: .7rem; font-weight: 800; line-height: 1;
}
.sim-sidebar-link.active .sim-nav-badge { background: rgba(255,255,255,.28); }
.tp-search-wrap { position: relative; }
.tp-results {
  position: absolute; z-index: 20; left: 0; right: 0; margin-top: 4px;
  background: var(--sim-surface,#fff); border: 1px solid var(--sim-border); border-radius: 10px;
  max-height: 260px; overflow: auto; box-shadow: 0 8px 24px rgba(0,10,30,.12);
}
.tp-result {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: .5rem .7rem; font-size: .85rem; color: var(--sim-ink); cursor: pointer;
}
.tp-result:hover { background: rgba(var(--sim-primary-rgb),.08); }
.tp-result--empty { color: var(--sim-ink-muted); cursor: default; }
.tp-chosen {
  display: flex; align-items: center; gap: .5rem; justify-content: space-between;
  background: rgba(var(--sim-primary-rgb),.08); border: 1px solid var(--sim-border);
  border-radius: 10px; padding: .5rem .7rem;
}
.tp-chosen-label { font-size: .85rem; font-weight: 600; }
.tp-chosen-x { background: none; border: 0; font-size: 1.15rem; line-height: 1; color: var(--sim-ink-muted); cursor: pointer; }
.tp-chosen-x:hover { color: var(--sim-ink); }

/* ── Minimum font weight ───────────────────────────────────────────────────────
   Nothing in the admin renders below 400. Bootstrap's light utilities would
   undercut that if they ever got used, so they are floored here rather than
   policed by review. */
body.sim-admin .fw-light,
body.sim-admin .fw-lighter,
body.sim-admin [style*="font-weight:300"],
body.sim-admin [style*="font-weight: 300"] { font-weight: 400 !important; }

/* Birthdays — today's card is the one worth noticing at a glance. */
body.sim-admin .card.sim-birthday-today {
  border-color: var(--sim-primary, #0049E5);
  box-shadow: 0 0 0 1px var(--sim-primary, #0049E5) inset;
}
body.sim-admin .card.sim-birthday-today .card-header-sim { color: var(--sim-primary, #0049E5); }

/* Cron output — terminal-style, because that is exactly what it is. */
body.sim-admin .sim-cron-output {
  background: #0f1729;
  color: #e6edf7;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  font-size: .82rem;
  line-height: 1.55;
  margin: 0;
  max-height: 26rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Client requests — a tactile card grid of things a client can ask us for. */
.req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.req-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
  text-align: left;
  width: 100%;
  padding: 1.35rem 1.25rem 1.1rem;
  background: #fff;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-lg);
  color: var(--sim-ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.req-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--sim-primary-rgb), .45);
  box-shadow: 0 10px 28px -14px rgba(var(--sim-primary-rgb), .55);
  color: var(--sim-ink);
}
.req-card:focus-visible {
  outline: none;
  border-color: var(--sim-primary);
  box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .25);
}
.req-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
}
.req-card-icon svg { display: block; }
.req-card-title {
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
}
.req-card-desc {
  font-size: .86rem;
  color: var(--sim-ink-muted);
  line-height: 1.5;
}
.req-card-cta {
  margin-top: auto;
  padding-top: .35rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--sim-primary-text);
  opacity: .9;
  transition: transform .16s ease;
}
.req-card:hover .req-card-cta { transform: translateX(2px); }

/* ===== Horizontal tabs — shared report/list tab bar (admin + client). */
.sim-htabs { display:flex; gap:.25rem; flex-wrap:wrap; border-bottom:1px solid var(--sim-border); margin-bottom:1.25rem; }
.sim-htabs .nav-link { border:0; border-radius:8px 8px 0 0; padding:.55rem 1.05rem; font-weight:600; color:var(--sim-ink-muted); background:transparent; margin-bottom:-1px; }
.sim-htabs .nav-link:hover { color:var(--sim-ink); background:rgba(var(--sim-primary-rgb),.06); }
.sim-htabs .nav-link.active { color:var(--sim-primary-text); background:transparent; border-bottom:2px solid var(--sim-primary); }
.sim-htabs .sim-htab-count { font-size:.72rem; font-weight:700; margin-left:.4rem; padding:.05rem .45rem; border-radius:999px; background:rgba(var(--sim-primary-rgb),.14); color:var(--sim-primary-text); }

/* ─────────────────────────────────────────────────────────────
   Portal refresh (2026) — client + candidate portals only.
   A light, brand-aware polish layer: lift-on-hover, on-brand nav &
   focus, softer elevation. Every accent is a --sim-* token, so it
   re-themes per entity automatically. Scoped to body:not(.sim-admin)
   so the admin console is untouched. Purely additive — safe to remove.
───────────────────────────────────────────────────────────── */

/* Stat value size modifier — replaces scattered inline font-size:1.5rem */
.sim-stat-value--sm { font-size: 1.5rem; }

/* Stat cards: gentle lift + brand-tinted edge on hover */
body:not(.sim-admin) .sim-stat {
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
body:not(.sim-admin) .sim-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--sim-shadow-lg);
  border-color: rgba(var(--sim-primary-rgb), .35);
}
a.sim-stat { color: inherit; text-decoration: none; }

/* Clickable content cards lift the same way */
body:not(.sim-admin) a.card {
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
body:not(.sim-admin) a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sim-shadow-lg);
  border-color: rgba(var(--sim-primary-rgb), .30);
}

/* Active nav item wears the entity brand (tint + brand text/icon) */
body:not(.sim-admin) .sim-sidebar-link.active {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
}
body:not(.sim-admin) .sim-sidebar-link.active svg { opacity: 1; }

/* Primary buttons get a soft, on-brand elevation */
body:not(.sim-admin) .btn-primary {
  box-shadow: 0 1px 2px rgba(var(--sim-primary-rgb), .18), 0 6px 18px rgba(var(--sim-primary-rgb), .22);
}
body:not(.sim-admin) .btn-primary:hover {
  box-shadow: 0 2px 4px rgba(var(--sim-primary-rgb), .20), 0 10px 26px rgba(var(--sim-primary-rgb), .28);
}
body:not(.sim-admin) .btn-primary:active {
  box-shadow: 0 1px 2px rgba(var(--sim-primary-rgb), .18);
}

/* Empty-state icon picks up the brand tint instead of flat grey */
body:not(.sim-admin) .sim-empty-icon {
  background: var(--sim-primary-light);
  color: var(--sim-primary-text);
}

/* Visible, on-brand keyboard focus (accessible + polished) */
body:not(.sim-admin) a:focus-visible,
body:not(.sim-admin) button:focus-visible,
body:not(.sim-admin) .sim-sidebar-link:focus-visible {
  outline: 2px solid rgba(var(--sim-primary-rgb), .55);
  outline-offset: 2px;
  border-radius: var(--sim-radius);
}

/* Respect reduced-motion: keep the brand accents, drop the movement */
@media (prefers-reduced-motion: reduce) {
  body:not(.sim-admin) .sim-stat:hover,
  body:not(.sim-admin) a.card:hover { transform: none; }
}

/* ─────────────────────────────────────────────────────────────
   Admin global search (top nav) — contracts, people, clients, contacts.
   Scoped to the admin console. Results are built by
   assets/js/admin-global-search.js.
───────────────────────────────────────────────────────────── */
body.sim-admin .sim-gsearch { position: relative; flex: 0 1 440px; min-width: 0; margin-left: .75rem; }
body.sim-admin .sim-gsearch-box { position: relative; display: flex; align-items: center; }
body.sim-admin .sim-gsearch-icon { position: absolute; left: .7rem; width: 15px; height: 15px; color: var(--sim-ink-subtle); pointer-events: none; }
body.sim-admin .sim-gsearch-input {
  width: 100%; height: 2.125rem; padding: 0 2.4rem 0 2.1rem;
  font: inherit; font-size: .875rem; color: var(--sim-ink);
  background: var(--sim-bg); border: 1px solid var(--sim-border); border-radius: var(--sim-control-radius);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
body.sim-admin .sim-gsearch-input::placeholder { color: var(--sim-ink-subtle); }
body.sim-admin .sim-gsearch-input:hover { border-color: var(--sim-border-strong); }
body.sim-admin .sim-gsearch-input:focus { outline: none; background: #fff; border-color: var(--sim-primary); box-shadow: 0 0 0 3px rgba(var(--sim-primary-rgb), .14); }
body.sim-admin .sim-gsearch-input::-webkit-search-cancel-button { cursor: pointer; }
body.sim-admin .sim-gsearch-kbd {
  position: absolute; right: .55rem; padding: .05rem .4rem; font: inherit; font-size: .72rem; font-weight: 600;
  color: var(--sim-ink-subtle); background: #fff; border: 1px solid var(--sim-border); border-radius: 5px; pointer-events: none;
}
body.sim-admin .sim-gsearch-input:focus ~ .sim-gsearch-kbd { display: none !important; }

/* Results open as a wide, centred panel under the top bar with a dimmed page behind it. */
body.sim-admin .sim-gsearch-backdrop {
  position: fixed; inset: var(--sim-topnav-h) 0 0 0; background: rgba(15, 23, 42, .38); z-index: 1090;
}
body.sim-admin .sim-gsearch-panel {
  position: fixed; top: calc(var(--sim-topnav-h) + 10px); left: 50%; transform: translateX(-50%);
  width: min(1000px, calc(100vw - 2rem)); max-height: calc(100vh - var(--sim-topnav-h) - 2rem); overflow-y: auto;
  background: #fff; border: 1px solid var(--sim-border-strong); border-radius: var(--sim-radius-lg); box-shadow: var(--sim-shadow-lg);
  padding: 0; z-index: 1100; overscroll-behavior: contain;
}
body.sim-admin .sim-gsearch-group {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sim-ink-muted);
  background: var(--sim-bg); border-bottom: 1px solid var(--sim-border);
}
body.sim-admin .sim-gsearch-count {
  padding: 0 .45rem; font-size: .68rem; letter-spacing: 0; color: var(--sim-ink-muted); background: #fff; border: 1px solid var(--sim-border); border-radius: 999px;
}
body.sim-admin .sim-gsearch-item {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 7.5rem; align-items: center; gap: 1.25rem;
  padding: .8rem 1rem; color: var(--sim-ink); text-decoration: none; border-bottom: 1px solid var(--sim-border);
}
body.sim-admin .sim-gsearch-item:last-of-type { border-bottom: 0; }
body.sim-admin .sim-gsearch-item.is-active { background: var(--sim-primary-light); }
body.sim-admin .sim-gsearch-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
body.sim-admin .sim-gsearch-title { font-size: .95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.sim-admin .sim-gsearch-sub { font-size: .8rem; color: var(--sim-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.sim-admin .sim-gsearch-details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.7fr); gap: .35rem 1.25rem; min-width: 0; }
body.sim-admin .sim-gsearch-d { display: flex; flex-direction: column; min-width: 0; }
body.sim-admin .sim-gsearch-dl { font-size: .64rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--sim-ink-subtle); }
body.sim-admin .sim-gsearch-dv { font-size: .82rem; color: var(--sim-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.sim-admin .sim-gsearch-status {
  justify-self: end; padding: .15rem .6rem; font-size: .7rem; font-weight: 700; text-transform: capitalize; white-space: nowrap;
  color: var(--sim-ink-muted); background: var(--sim-bg); border: 1px solid var(--sim-border); border-radius: 999px;
}
body.sim-admin .sim-gsearch-foot {
  position: sticky; bottom: 0; padding: .5rem 1rem; font-size: .72rem; color: var(--sim-ink-subtle); background: var(--sim-bg); border-top: 1px solid var(--sim-border);
}
body.sim-admin .sim-gsearch-mark { padding: 0; background: rgba(var(--sim-primary-rgb), .16); color: inherit; border-radius: 2px; }
body.sim-admin .sim-gsearch-msg { padding: 1.25rem 1rem; font-size: .85rem; color: var(--sim-ink-muted); text-align: center; }

body.sim-admin .sim-gsearch-toggle {
  display: none; width: 34px; height: 34px; align-items: center; justify-content: center; padding: 0;
  color: var(--sim-ink); background: transparent; border: 1px solid var(--sim-border); border-radius: var(--sim-radius);
}

/* Small screens: icon in the bar; the box opens full-width under the header. */
@media (max-width: 767.98px) {
  body.sim-admin .sim-gsearch { flex: 0 0 auto; margin-left: auto; }
  body.sim-admin .sim-gsearch-toggle { display: inline-flex; }
  body.sim-admin .sim-gsearch-box { display: none; }
  body.sim-admin .sim-gsearch.is-open .sim-gsearch-box {
    display: flex; position: fixed; top: var(--sim-topnav-h); left: 0; right: 0; z-index: 1100;
    padding: .6rem 1rem; background: #fff; border-bottom: 1px solid var(--sim-border); box-shadow: var(--sim-shadow);
  }
  body.sim-admin .sim-gsearch.is-open .sim-gsearch-icon { left: 1.7rem; top: 50%; transform: translateY(-50%); }
  body.sim-admin .sim-gsearch-panel { top: calc(var(--sim-topnav-h) + 3.4rem); width: calc(100vw - 1rem); max-height: calc(100vh - var(--sim-topnav-h) - 4.4rem); }
  body.sim-admin .sim-gsearch-backdrop { top: calc(var(--sim-topnav-h) + 3.4rem); }
  body.sim-admin .sim-gsearch-item { grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; }
  body.sim-admin .sim-gsearch-details { grid-column: 1 / -1; order: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem 1rem; }
}

/* ─────────────────────────────────────────────────────────────
   Client portal dashboard — "Your account manager" card.
   Brand tokens only, so it re-themes per client entity.
───────────────────────────────────────────────────────────── */
.cd-am {
  display: flex; align-items: center; gap: 1.1rem; padding: 1.25rem 1.4rem;
  background: var(--sim-surface); border: 1px solid var(--sim-border); border-radius: var(--sim-radius-lg);
  box-shadow: var(--sim-shadow-xs); position: relative; overflow: hidden;
}
.cd-am::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sim-primary); }
.cd-am-avatar {
  flex: 0 0 auto; width: 76px; height: 76px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--sim-primary-light); color: var(--sim-primary-text);
  font-family: var(--sim-font-heading); font-weight: 800; font-size: 1.9rem;
  box-shadow: 0 0 0 3px var(--sim-surface), 0 0 0 4px var(--sim-border);
}
.cd-am-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-am-body { min-width: 0; }
.cd-am-eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sim-ink-muted); }
.cd-am-name { font-family: var(--sim-font-heading); font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--sim-ink); margin: .1rem 0 .45rem; }
.cd-am-contact { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.cd-am-contact li { display: flex; align-items: center; gap: .5rem; font-size: .88rem; min-width: 0; }
.cd-am-contact svg { flex: 0 0 auto; color: var(--sim-primary-text); }
.cd-am-contact a { color: var(--sim-ink); text-decoration: none; overflow-wrap: anywhere; }
.cd-am-contact a:hover { color: var(--sim-primary-text); text-decoration: underline; }
@media (max-width: 420px) { .cd-am { align-items: flex-start; } .cd-am-avatar { width: 60px; height: 60px; font-size: 1.5rem; } }

/* ─────────────────────────────────────────────────────────────
   Request cards — client portal time-off list (stacks on phones).
   Brand tokens + semantic status colours.
───────────────────────────────────────────────────────────── */
.rq-list { display: flex; flex-direction: column; gap: .75rem; }
.rq-empty { padding: 2.5rem 1rem; text-align: center; color: var(--sim-ink-muted); background: var(--sim-surface); border: 1px dashed var(--sim-border-strong); border-radius: var(--sim-radius-lg); }
.rq-card {
  position: relative; background: var(--sim-surface); border: 1px solid var(--sim-border); border-radius: var(--sim-radius-lg);
  padding: 1rem 1.15rem 1rem 1.3rem; box-shadow: var(--sim-shadow-xs); overflow: hidden;
}
.rq-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sim-border-strong); }
.rq-card--green::before { background: #16a34a; }
.rq-card--red::before   { background: #dc2626; }
.rq-card--amber::before { background: #f59e0b; }
.rq-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.rq-person { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.rq-avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; background: var(--sim-primary-light); color: var(--sim-primary-text); }
.rq-name { font-weight: 700; color: var(--sim-ink); overflow-wrap: anywhere; }
.rq-detail { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .6rem; margin-top: .6rem; font-size: .9rem; color: var(--sim-ink); }
.rq-dim { color: var(--sim-ink-muted); }
.rq-chip { padding: .1rem .55rem; font-size: .75rem; font-weight: 700; border-radius: 999px; background: var(--sim-bg); border: 1px solid var(--sim-border); color: var(--sim-ink-muted); }
.rq-decision { margin-top: .55rem; font-size: .82rem; color: var(--sim-ink-muted); }
.rq-reason { margin-top: .5rem; padding: .5rem .7rem; font-size: .86rem; color: var(--sim-ink); background: #fef2f2; border-left: 3px solid #dc2626; border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }
.rq-reason span { font-weight: 700; margin-right: .35rem; color: #b91c1c; }
.rq-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .85rem; }
.rq-reject { color: #dc2626; border-color: rgba(220,38,38,.35); }
.rq-reject:hover { color: #fff; background: #dc2626; border-color: #dc2626; }

.cd-am-cta { margin-top: .9rem; gap: .45rem; }

/* Restricted clients: a value the viewer is not allowed to see. */
.sim-restricted {
  display: inline-block;
  padding: .05rem .45rem;
  border-radius: 4px;
  background: var(--sim-surface-2, #eef0f4);
  color: var(--sim-text-muted, #6b7280);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
}

/* ══ Data export (admin/export.php) ═══════════════════════════════════════════ */
.dx-tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.dx-tab { padding: .45rem 1rem; border-radius: var(--sim-control-radius, 8px); border: 1px solid var(--sim-control-border, #d6dbe6); font-weight: 700; text-decoration: none; color: inherit; background: #fff; }
.dx-tab.active { background: var(--sim-choice-tint, #f5f2fe); border-color: var(--sim-choice-accent, #5c1ed8); color: var(--sim-choice-accent, #5c1ed8); }
.dx-toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; background: #fff; padding: .75rem 0; border-bottom: 1px solid var(--sim-control-border, #e3e7ef); margin-bottom: 1rem; }
.dx-toolbar .dx-search { flex: 1 1 240px; max-width: 340px; }
.dx-count { margin-left: auto; font-weight: 700; }
.dx-group { margin-bottom: 1.25rem; }
.dx-group-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; font-weight: 700; }
.dx-group-head .dx-group-count { font-weight: 400; color: #64748b; font-size: .85rem; }
.dx-group-head .btn-link { padding: 0; font-size: .85rem; text-decoration: none; }
.dx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .45rem; }
.dx-grid .sim-choice { min-height: 0; padding: .45rem .75rem; }
.dx-grid .sim-choice.dx-locked { opacity: .55; cursor: not-allowed; }
.dx-grid .sim-choice.dx-hidden, .dx-group.dx-hidden { display: none; }
.dx-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .45rem; }
.dx-filter-grid .sim-choice { min-height: 0; padding: .45rem .75rem; }
