/* =====================================================================
   BUSAYO WORLD STAFF PORTAL — additions only.
   Everything here is new and prefixed "portal-" (plus a few scoped tweaks).
   It reuses the template's colour variables, so light AND dark mode both work.
   css/styles.css (the original template styling) is unchanged.
   ===================================================================== */

/* ---------- Sign-in gate ---------- */
.portal-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--background-content);
  overflow-y: auto;
}
.portal-gate.visible { display: flex; }
.portal-gate[hidden] { display: none !important; }
.portal-gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface-new);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.portal-gate-brand {
  padding: 1rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text-on-primary-bg);
}
.portal-gate-body { padding: 1.5rem; }
.portal-gate-body h5 { margin-bottom: 1rem; }
.portal-gate-msg { min-height: 1.2em; }
.portal-gate-body code { word-break: break-all; }

/* ---------- Portal modal (forms, profiles, previews) ---------- */
.portal-modal .modal-content {
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  color: var(--text-color);
}
.portal-modal .modal-content.portal-wide { max-width: 900px; width: 95%; }
.portal-modal-title { padding-right: 2rem; font-size: 1.25rem; margin-bottom: var(--spacing-3); }
.portal-modal-body { overflow-y: auto; padding-right: .25rem; }
.portal-modal-body h6 { margin-top: 1rem; font-weight: 700; }
.portal-img-current { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.portal-img-current img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.portal-preview-frame { width: 100%; height: 70vh; border: 1px solid var(--border-color); border-radius: 8px; }
.portal-preview-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 8px; }
.portal-form-frame { width: 100%; height: 80vh; border: 1px solid var(--border-color); border-radius: 8px; background: #fff; }

/* ---------- Search / filter / add toolbars (reuses the template's sticky search bars) ---------- */
.portal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.portal-toolbar .search-container-view { flex: 1 1 220px; }
.portal-toolbar .search-container-view input,
.portal-toolbar .search-container-view input:focus { width: 100%; }
.portal-filter { flex: 0 1 200px; width: auto; max-width: 100%; }
.portal-toolbar-flat { margin-bottom: .5rem; }
.explore-search-inner .portal-filter { flex: 0 1 180px; }
.explore-search-inner .btn[data-admin-only] { flex-shrink: 0; }

/* ---------- Lists, items, states ---------- */
.portal-item { position: relative; }
.portal-item .item-icon { overflow-wrap: anywhere; }
.portal-item .item-content h6 { overflow-wrap: anywhere; }
.portal-meta { color: var(--text-secondary-new); font-size: .8rem; }
.portal-muted { color: var(--text-secondary-new); }
.portal-note { font-size: .85rem; color: var(--text-secondary-new); margin: 0; overflow-wrap: anywhere; }
.portal-pre { white-space: pre-line; overflow-wrap: anywhere; }
.portal-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary-new);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-md);
}
.portal-empty .bi { font-size: 2rem; display: block; margin-bottom: .5rem; }
.portal-empty p { margin: 0; }
.portal-empty-hint { margin-top: .5rem !important; font-size: .85rem; }
.portal-load-error { margin-bottom: 1rem; }

.portal-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: auto; }
.portal-admin-btns { display: inline-flex; gap: .35rem; margin-left: auto; }
.portal-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.portal-plain li { overflow-wrap: anywhere; }
.portal-plain .btn-sm { padding: .1rem .4rem; }

.portal-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--color-grey-light-1); }
.portal-avatar-lg { width: 96px; height: 96px; }
.portal-thumb { border-radius: 8px; }

/* ---------- Dashboard ---------- */
#blog-content .quick-actions { flex-wrap: wrap; }
.portal-click { cursor: pointer; }
.portal-mini { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.portal-mini li { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.portal-mini small { color: var(--text-secondary-new); }
.portal-announce { padding: .6rem 0; border-bottom: 1px solid var(--border-color); display: grid; gap: .15rem; }
.portal-announce:last-child { border-bottom: 0; }
.portal-announce small { color: var(--text-secondary-new); }

/* ---------- Admin ---------- */
.portal-rows { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.portal-rows li {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .5rem 0; border-bottom: 1px solid var(--border-color); overflow-wrap: anywhere;
}
.portal-rows li:last-child { border-bottom: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 767px) {
  .portal-filter { flex: 1 1 100%; }
  .portal-modal .modal-content { padding: 1rem; }
  .portal-preview-frame { height: 60vh; }
  .portal-form-frame { height: 70vh; }
}

/* ---------- Small fixes found during visual testing ---------- */
.sidebar-right .widget,
.sidebar-right .widget small { color: var(--text-color) !important; }
.sidebar-right .widget strong { color: var(--text-color); }
.portal-person .item-content { display: block !important; }
/* the template capitalises every word in the app; keep sentences readable */
#dashBody p, .portal-note, .portal-pre, .portal-mini small, .portal-item h6, .service-card .card-text,
.portal-empty p, .portal-gate-body p { text-transform: none; }


/* Consolidated stability and responsive polish */
#portalModal { isolation: isolate; }
#portalModal .modal-content {
  max-height: min(88vh, 900px);
  overflow: auto;
  overscroll-behavior: contain;
  transform: none;
  transition: opacity .16s ease, box-shadow .16s ease;
}
#portalModal.visible .modal-content { transform: none; }
#portalModal .portal-modal-body { min-width: 0; }
#portalModal .portal-modal-body input,
#portalModal .portal-modal-body select,
#portalModal .portal-modal-body textarea { max-width: 100%; }
.portal-admin-btns { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.portal-rows > li { gap: .75rem; }
.portal-rows > li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.portal-gate input { min-width: 0; }
@media (max-width: 767.98px) {
  #portalModal { padding: .65rem; }
  #portalModal .modal-content { width: 100%; max-width: 100%; padding: 1rem; }
  .portal-rows > li { align-items: flex-start; flex-direction: column; }
  .portal-admin-btns { width: 100%; }
  .portal-admin-btns .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  #portalModal, #portalModal .modal-content, .portal-gate, .portal-toast { transition: none !important; animation: none !important; }
}

/* HOTFIX: keep the portal form modal hidden unless explicitly opened by JavaScript.
   The previous polish rules accidentally allowed its close control to appear in page flow. */
#portalModal.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 18, 30, .58);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#portalModal.modal-overlay.visible {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
#portalModal .portal-modal-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
#portalModal .portal-modal-close:hover { background: rgba(127,127,127,.14); }
#portalModal .modal-content { position: relative; width: min(100%, 560px); }
#portalModal:not(.visible) .portal-modal-close { display: none; }
/* Keep navigation taps immediate and avoid accidental transition blocking. */
.sidebar-tabs .tab-button, .footer-nav .nav-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}


/* MODAL SURFACES (theme-aware). Dialogs stay opaque and legible in every theme because they read the
   semantic tokens defined in css/app.css (--bg-modal, --text-primary, --input-*, --overlay-bg ...).
   The fallbacks only apply if app.css is missing. These replace the old hardcoded-white hotfix blocks. */
#portalModal.modal-overlay.visible {
  background: var(--overlay-bg, rgba(12, 18, 28, 0.62)) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#portalModal .modal-content,
.portal-modal .modal-content,
.modal .modal-content,
.bw-dialog {
  position: relative;
  background-color: var(--bg-modal, #ffffff) !important;
  color: var(--text-primary, #20252b) !important;
  border: 1px solid var(--border-color, #d8dde4);
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
#portalModal .modal-content {
  width: min(100%, 900px);
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}
#portalModal .modal-content input:not([type="checkbox"]):not([type="radio"]),
#portalModal .modal-content select,
#portalModal .modal-content textarea,
.portal-modal input, .portal-modal select, .portal-modal textarea,
.modal input, .modal select, .modal textarea,
.bw-dialog input, .bw-dialog select, .bw-dialog textarea {
  background-color: var(--input-bg, #ffffff) !important;
  color: var(--input-text, #20252b) !important;
  border: 1px solid var(--input-border, #c8ced6);
  opacity: 1 !important;
}
#portalModal .modal-content input[type="file"] {
  background-color: var(--input-bg, #ffffff) !important;
  color: var(--text-secondary, #20252b) !important;
}
#portalModal .modal-content .modal-header,
#portalModal .modal-content .modal-body,
#portalModal .modal-content .modal-footer,
.portal-modal .modal-header, .portal-modal .modal-body, .portal-modal .modal-footer,
.modal .modal-header, .modal .modal-body, .modal .modal-footer {
  background-color: transparent;
  color: var(--text-primary, #17212b);
  border-color: var(--border-color, #d8dde4);
}
#portalModal .portal-modal-close {
  z-index: 2;
  color: var(--text-secondary, #394150);
}
@media (max-width: 640px) {
  #portalModal.modal-overlay.visible { padding: .5rem; }
  #portalModal .modal-content { width: 100%; max-width: 100%; max-height: 94vh; }
}

/* Desktop/tablet polish only: retain the established phone template. */
@media (min-width: 768px) {
  .sidebar-left { overflow-y: auto; }
  .sidebar-left .sidebar-tabs .tab-button { transition: background-color .18s ease, color .18s ease, padding-left .18s ease; }
  .sidebar-left .sidebar-tabs .tab-button:hover { padding-left: 1.15rem; }
  .sidebar-left .sidebar-tab-filter input { border-radius: 10px; }
  .sidebar-left .sidebar-footer { margin-top: auto; }
  .sidebar-left .bw-sidebar-launcher { flex: 0 0 auto; }
  .sidebar-right, .main-content, .content-area { min-width: 0; }
  .modal-content, .portal-modal .modal-content { border-radius: 16px; box-shadow: 0 18px 55px rgba(10, 28, 48, .18); }
  input, select, textarea { transition: border-color .16s ease, box-shadow .16s ease; }
  input:focus, select:focus, textarea:focus { outline: none; border-color: #4d9e7a; box-shadow: 0 0 0 3px rgba(77,158,122,.18); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-left .sidebar-tabs .tab-button, input, select, textarea { transition: none !important; }
}
/* Phones only: lift the sidebar footer above the bottom nav bar */
@media (max-width: 767px) {
  .sidebar-left {
    padding-bottom: 65px; /* same as .footer-nav height */
  }
}
/* =====================================================================
   DESKTOP & TABLET UI POLISH  (min-width: 768px ONLY)
   Visual refinement layer: softer depth, smoother motion, tidier spacing.
   Same colours, layout and markup as the original template — nothing here
   applies on phones, and no scripts or functions are touched.
   To switch it off, delete this whole block.
   ===================================================================== */
@media (min-width: 768px) {
  :root {
    --bw-ease: cubic-bezier(.22, .61, .36, 1);
    --bw-shadow-1: 0 1px 2px rgba(11,61,46, .06), 0 4px 14px -6px rgba(11,61,46, .14);
    --bw-shadow-2: 0 2px 4px rgba(11,61,46, .06), 0 18px 34px -14px rgba(11,61,46, .30);
  }
  body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
  .content-main { scroll-behavior: smooth; padding: .5rem .85rem 1rem; }
  ::selection { background: rgba(200,146,42, .35); }

  /* ----- Left icon rail ----- */
  .footer-nav { box-shadow: 6px 0 28px -12px rgba(11,61,46, .22); }
  .nav-item { transition: color .25s var(--bw-ease), background-color .25s var(--bw-ease); }
  .nav-item:not(.active):hover { color: var(--color-blue-dark-1); background-color: rgba(200,146,42, .08); }
  .nav-item .bi { transition: transform .35s var(--bw-ease), color .25s var(--bw-ease); }
  .nav-item:not(.active):hover .bi { transform: scale(1.14); }
  .footer-nav::before { box-shadow: inset 2px 0 4px rgba(11,61,46, .08); }

  /* ----- Sidebar (tabs) ----- */
  .sidebar-left { box-shadow: 8px 0 26px -18px rgba(11,61,46, .45); }
  .sidebar-left .sidebar-header,
  .sidebar-left .sidebar-footer { letter-spacing: .14em; }
  .sidebar-tab-filter { box-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
  .sidebar-tab-filter input { transition: border-color .25s var(--bw-ease), box-shadow .25s var(--bw-ease), background-color .25s var(--bw-ease); }
  .sidebar-left .sidebar-tabs .tab-button {
    letter-spacing: .01em;
    transition: background-color .25s var(--bw-ease), color .25s var(--bw-ease), box-shadow .25s var(--bw-ease), padding-left .25s var(--bw-ease);
  }
  .sidebar-left .sidebar-tabs .tab-button:hover { box-shadow: 0 6px 14px -8px rgba(11,61,46, .55); }
  .sidebar-left .sidebar-tabs .tab-button.active { box-shadow: inset 3px 0 8px rgba(200,146,42, .12), 0 6px 14px -10px rgba(11,61,46, .4); }

  /* ----- Top header ----- */
  .content-header { box-shadow: 0 8px 22px -12px rgba(7,42,31, .55); }
  .dark-mode-toggle { transition: background .25s var(--bw-ease), transform .25s var(--bw-ease), border-color .25s var(--bw-ease); }
  .dark-mode-toggle:hover { transform: rotate(-12deg) scale(1.08); }
  #searchIcon { transition: color .2s ease, transform .25s var(--bw-ease); }
  #searchIcon:hover { transform: scale(1.1); }
  .breadcrumb-trail .bc-item { transition: color .2s ease; }

  /* ----- Right panel ----- */
  .sidebar-right .widget { border-radius: 14px; box-shadow: var(--bw-shadow-1); transition: transform .3s var(--bw-ease), box-shadow .3s var(--bw-ease); }
  .sidebar-right .widget:hover { box-shadow: var(--bw-shadow-2); }

  /* ----- Home: section cards ----- */
  .card-section { border-radius: 16px; border: 1px solid rgba(212,206,196, .55); box-shadow: var(--bw-shadow-1); margin-bottom: .6rem; }
  .card.card-section:hover { transform: none; box-shadow: var(--bw-shadow-1); }
  .card-section .card-header { border-radius: 16px 16px 0 0; }
  .card-section .card-header h3 { letter-spacing: -.01em; }
  .card-section .see-all { border-radius: 999px; padding: .35rem 1rem; box-shadow: var(--bw-shadow-1); transition: transform .25s var(--bw-ease), box-shadow .25s var(--bw-ease), background-color .25s var(--bw-ease); }
  .card-section .see-all:hover { transform: translateY(-2px); box-shadow: var(--bw-shadow-2); }
  .card-section .quote0 { border-radius: 14px; box-shadow: inset 0 2px 8px rgba(11,61,46, .10); }
  .grid-item { transition: transform .3s var(--bw-ease); }
  .grid-item:hover { transform: translateY(-5px); }
  #tab1 .grid-item img { border-radius: 14px; box-shadow: 0 6px 14px -6px rgba(7,42,31, .45); transition: transform .3s var(--bw-ease), box-shadow .3s var(--bw-ease); }
  #tab1 .grid-item img:hover { transform: scale(1.06); box-shadow: 0 14px 26px -10px rgba(7,42,31, .55); }
  .grid-item .text { transition: color .2s ease; }

  /* ----- Lists & resource cards ----- */
  .list-item { border-radius: 14px; border: 1px solid rgba(212,206,196, .45); box-shadow: var(--bw-shadow-1);
    transition: transform .3s var(--bw-ease), box-shadow .3s var(--bw-ease), border-color .3s var(--bw-ease); }
  .list-item:hover { transform: translateY(-3px); box-shadow: var(--bw-shadow-2); border-color: rgba(200,146,42, .55); }
  .list-item .item-icon { letter-spacing: -.01em; line-height: 1.25; }
  .service-card { border-radius: 14px !important; border: 1px solid rgba(212,206,196, .45); transition: transform .3s var(--bw-ease), box-shadow .3s var(--bw-ease); }
  .service-card .card-img-top { transition: transform .5s var(--bw-ease); }
  .service-card:hover .card-img-top { transform: scale(1.04); }
  .service-card .position-relative { overflow: hidden; }
  .card { transition: transform .3s var(--bw-ease), box-shadow .3s var(--bw-ease); }
  .tag { letter-spacing: .01em; }

  /* ----- Buttons, search, form controls ----- */
  .btn { border-radius: 10px; transition: transform .25s var(--bw-ease), box-shadow .25s var(--bw-ease), background-color .25s var(--bw-ease), color .25s var(--bw-ease), filter .25s var(--bw-ease); }
  .btn:hover { box-shadow: var(--bw-shadow-1); }
  .btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
  .btn:focus-visible { outline: 3px solid rgba(200,146,42, .45); outline-offset: 2px; }
  .search-container-view input { border-radius: 12px; box-shadow: 0 1px 2px rgba(11,61,46, .05); transition: width .35s var(--bw-ease), border-color .25s var(--bw-ease), box-shadow .25s var(--bw-ease); }
  .explore-search-bar, .tab3-search-bar { backdrop-filter: saturate(1.1) blur(6px); -webkit-backdrop-filter: saturate(1.1) blur(6px); }
  .portal-filter, .form-select { border-radius: 12px; transition: border-color .25s var(--bw-ease), box-shadow .25s var(--bw-ease); }
  .alert { border-radius: 12px; }

  /* ----- Dialogs ----- */
  .portal-modal .modal-content, .modal-content { border-radius: 18px; box-shadow: 0 24px 70px -20px rgba(10, 28, 48, .45); }
  #modal.modal-overlay, #portalModal { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

  /* ----- Scrollbars: slimmer, rounder ----- */
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-thumb { border-radius: 999px; }
}
@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  .content-main { scroll-behavior: auto; }
  .nav-item, .nav-item .bi, .grid-item, .grid-item img, .list-item, .service-card, .service-card .card-img-top, .card, .btn, .see-all, .widget, .dark-mode-toggle { transition: none !important; }
}

/* =====================================================================
   CUDFIRM PALETTE — Bootstrap accent colours (all screens)
   Light + dark colour variables live at the top of css/styles.css.
   ===================================================================== */
.text-bg-primary { background-color: var(--n-jade, #1A6B4A) !important; color: #fff !important; }
.btn-warning { background-color: #C8922A; border-color: #C8922A; color: #fff; }
.btn-warning:hover, .btn-warning:focus { background-color: #E8B84B; border-color: #E8B84B; color: #0C1108; }
[data-theme="dark"] .btn-warning { background-color: #D4A84E; border-color: #D4A84E; color: #060E08; }

/* Mobile browser viewport fix: keep long portal forms scrollable and their
   final controls reachable above iOS/Android browser chrome. */
#portalModal.modal-overlay {
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: max(.5rem, env(safe-area-inset-top));
  padding-bottom: max(.5rem, env(safe-area-inset-bottom));
}
#portalModal .modal-content {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 1rem);
  max-height: calc(100dvh - max(1rem, env(safe-area-inset-top)) - max(1rem, env(safe-area-inset-bottom)));
  overflow: hidden;
}
#portalModal .portal-modal-title {
  flex: 0 0 auto;
}
#portalModal .portal-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  scrollbar-gutter: stable;
}
@media (max-width: 640px) {
  #portalModal.modal-overlay.visible {
    align-items: center;
  }
  #portalModal .modal-content {
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - max(1rem, env(safe-area-inset-top)) - max(1rem, env(safe-area-inset-bottom)));
  }
}

/* =====================================================================
   CONSISTENT IMAGE DISPLAY — Home and Staff tabs
   Normalises image frames without modifying the uploaded image files.
   ===================================================================== */

/* Home dashboard/grid images: same square frame, crop instead of stretch. */
#tab1 .grid-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  object-position: center;
}

/* Staff directory avatars: preserve the existing 56px / 96px sizes. */
.portal-avatar {
  width: 56px;
  height: 56px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  flex: 0 0 56px;
  overflow: hidden;
}

.portal-avatar-lg {
  width: 96px;
  height: 96px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  flex-basis: 96px;
}

/* Any staff profile photo rendered inside the existing person component
   uses a consistent square frame unless it already has the avatar class. */
.portal-person img:not(.portal-avatar):not(.portal-avatar-lg) {
  width: 96px;
  height: 96px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  flex-shrink: 0;
}

/* Prevent unusually sized image files from expanding their cards. */
#tab1 .grid-item {
  min-width: 0;
}
#tab1 .grid-item img,
.portal-person img,
.portal-avatar,
.portal-avatar-lg {
  max-width: 100%;
}


/* =====================================================================
   STAFF TAB IMAGE FIX — story strip and directory/profile photos
   Scoped to the existing Staff tab markup in index.html.
   ===================================================================== */

/* The horizontal staff-story cards use .s-card, not .portal-avatar.
   Give every story card and its image the same fixed portrait frame. */
#forum-content #staffStories .s-card {
  box-sizing: border-box;
  width: 85px !important; /*100*/
  min-width: 90px !important; /*100*/
  max-width: 95px !important; /*100*/
  height: 90px !important; /*140*/
  flex: 0 0 100px !important;
  overflow: hidden;
  position: relative;
  border-radius: 50% / 42%;
}

#forum-content #staffStories .s-card img {
  display: block;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  border-radius: inherit;
}

/* Keep staff directory and profile images square and consistent. */
#forum-content #staffGrid .portal-person > .d-flex > img.portal-avatar {
  display: block;
  width: 92px !important;
  height: 92px !important;
  min-width: 92px;
  max-width: 92px;
  flex: 0 0 92px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
}

#forum-content #staffGrid .portal-avatar-lg {
  display: block;
  width: 96px !important;
  height: 96px !important;
  min-width: 96px;
  max-width: 96px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 640px) {
  #forum-content #staffStories .s-card {
    width: 80px !important;
    min-width: 70px !important;
    max-width: 85px !important;
    height: 80px !important;
    flex-basis: 70px !important;
  }
}

/* Accessible show/hide control added beside password inputs. */
.portal-password-toggle {
  margin-top: .35rem;
  min-width: 4.25rem;
  touch-action: manipulation;
}
.portal-gate-body input[data-password-toggle-ready] {
  max-width: 100%;
}
