/* Bonyadkar mobile-only responsive safety layer.
   All rules are scoped to small viewports; desktop rendering remains untouched. */
@media screen and (max-width: 767.98px) {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  body { max-width:100%; }
  :where(main,article,section,aside,form,fieldset,.card,.panel,.container,.container-fluid,.row,.col,.col-md-6,.col-lg-6,.col-lg-4) { min-width:0; }
  :where(img,video,canvas,svg) { max-width:100%; }
  :where(img,video) { height:auto; }
  :where(h1,h2,h3,h4,p,li,label,th,td,.card-title) { overflow-wrap:anywhere; }
  :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea,select) {
    max-width:100%; min-width:0; box-sizing:border-box;
    font-size:16px; /* avoids iOS auto-zoom while focusing */
  }
  :where(textarea) { max-width:100%; }
  :where(.form-grid,.fields-grid,.filter-grid,.filters-grid,.stats-grid,.dashboard-grid,.two-columns,.two-column,.grid-2,.grid-3,.grid-4,.profile-grid,.settings-grid,.report-grid) {
    grid-template-columns:minmax(0,1fr);
  }
  :where(.modal-dialog,.modal-content,.dialog,.popover,.dropdown-menu) { max-width:calc(100vw - 24px); }
  :where(.modal-dialog) { margin-inline:12px; }
  :where(.table-responsive,[class*="table-wrap"],[class*="table-container"],[class*="table-scroll"]) {
    max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch;
  }
  :where(table:not(.calendar-grid)) { max-width:100%; }
  :where(.form-actions,.action-buttons,.button-group,.page-actions) { flex-wrap:wrap;gap:8px; }
  :where(.form-actions,.action-buttons,.button-group,.page-actions)>* { max-width:100%; }
  :where(button,.btn,[type="submit"],[role="button"]) { touch-action:manipulation; }
  :where(.form-control,.form-select) { max-width:100%; }
  :where(.card,.panel,.card-body) { max-width:100%; }
  :where(.breadcrumb,.tabs,.nav-tabs,.filter-chips) { max-width:100%; }
  :where(.bk-page-visual-photo,.bk-page-visual-box img) { max-width:100%; }
}
/* Tight phones: ensure form layouts are not split into unusably narrow columns. */
@media screen and (max-width: 420px) {
  :where(.form-grid,.fields-grid,.filter-grid,.filters-grid,.stats-grid,.dashboard-grid,.two-columns,.grid-2,.grid-3,.grid-4,.profile-grid,.settings-grid,.report-grid) {
    grid-template-columns:minmax(0,1fr);
  }
  :where(.modal-dialog) { margin-inline:8px;max-width:calc(100vw - 16px); }
}
/* Portal-specific mobile containment. No change to its native menu/drawer logic. */
@media screen and (max-width: 767.98px) {
  :where(.emp-main,.emp-content-wrapper,.admin-main,.admin-content,.jobseeker-main,.js-main,.bk-panel-main) {
    min-width:0;max-width:100%;
  }
  :where(.emp-content-wrapper,.admin-content,.jobseeker-content) {
    box-sizing:border-box;
  }
  :where(.emp-content-wrapper) { overflow-x:clip; }
}

/* === Mobile header stability: public navigation, employer and admin portals === */
@media screen and (max-width:767.98px) {
  /* Public pages and authentication: a single non-wrapping navigation row. */
  body:not(.bk-portal-admin):not(.bk-portal-employer) .bk-navbar {
    width:100%; max-width:100%; position:sticky; top:0; z-index:1000;
  }
  .bk-navbar .bk-container.bk-nav-inner {
    display:flex!important; flex-direction:row!important;
    justify-content:space-between!important; align-items:center!important;
    flex-wrap:nowrap!important; column-gap:8px!important;
    width:calc(100% - 24px)!important; max-width:none!important;
    min-height:64px!important; padding:7px 0!important; margin-inline:auto!important;
    grid-template-columns:none!important;
  }
  .bk-navbar .bk-header-main {
    display:flex!important; flex-direction:row!important; align-items:center!important;
    flex:1 1 auto!important; min-width:0!important; max-width:calc(100% - 62px);
    gap:8px!important; flex-wrap:nowrap!important;
  }
  .bk-navbar .bk-brand {
    display:inline-flex!important; flex:0 0 auto!important;
    width:auto!important; min-width:0!important; margin:0!important;
  }
  .bk-navbar .bk-brand-logo-box {
    display:flex!important; flex:0 0 50px!important;
    width:50px!important; min-width:50px!important; height:46px!important;
    margin:0!important; padding:0!important; overflow:visible!important;
  }
  .bk-navbar .bk-brand-logo-image{
    display:block!important;width:100%!important;height:100%!important;
    object-fit:contain!important;max-width:100%!important;
  }
  .bk-navbar .bk-mobile-menu-toggle {
    display:inline-flex!important;flex:0 0 auto!important;
    justify-content:center!important;align-items:center!important;gap:6px!important;
    min-width:82px!important;min-height:44px!important;
    font-size:12px!important;line-height:1.3!important;
    padding:8px 10px!important;margin:0!important;
    white-space:nowrap!important;
  }
  .bk-navbar .bk-mobile-menu-toggle svg {width:21px!important;height:21px!important;flex:none!important}
  .bk-navbar .bk-actions {
    display:flex!important;flex:0 0 auto!important;align-items:center!important;
    justify-content:flex-end!important;flex-wrap:nowrap!important;
    width:auto!important;max-width:66px!important;gap:0!important;margin:0!important;
  }
  .bk-navbar .bk-actions > a {display:none!important}
  .bk-navbar .bk-actions #themeToggle{
    display:inline-flex!important;justify-content:center!important;align-items:center!important;
    min-height:44px!important;min-width:54px!important;
    width:54px!important;margin:0!important;padding:8px 4px!important;
    font-size:12px!important;line-height:1.4!important;white-space:nowrap!important;
  }
  .bk-navbar .bk-menu {
    position:absolute!important;top:calc(100% + 4px)!important;
    inset-inline:0!important;right:0!important;left:0!important;
    width:100%!important;max-width:100%!important;
    max-height:min(74dvh,630px)!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;
    display:none!important;flex-direction:column!important;align-items:stretch!important;
    padding:12px!important;box-sizing:border-box!important;
    z-index:1100!important;
  }
  .bk-navbar .bk-menu.is-open {display:flex!important}
  .bk-navbar .bk-menu > a{min-height:44px;display:flex!important;align-items:center!important}
  .bk-navbar .bk-mobile-menu-auth{width:100%!important;min-width:0!important}
  .bk-navbar .bk-mobile-menu-auth a{white-space:normal!important;text-align:center!important}

  /* Employer: prevent the existing 1100px one-column header from stacking on phones. */
  body.bk-portal-employer .emp-jobseeker-like-header {
    display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;
    align-items:center!important;justify-content:space-between!important;
    gap:8px!important;padding:9px 10px!important;min-height:62px!important;
    width:100%!important;max-width:100%!important;box-sizing:border-box!important;
  }
  body.bk-portal-employer .emp-header-title-area {
    display:flex!important;flex:1 1 auto!important;min-width:0!important;max-width:100%!important;
    gap:7px!important;align-items:center!important;overflow:hidden!important;
  }
  body.bk-portal-employer .emp-header-copy{
    flex:1 1 auto!important;min-width:0!important;overflow:hidden!important;
  }
  body.bk-portal-employer .emp-header-main-title {
    font-size:14px!important;line-height:1.45!important;
    overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
  }
  body.bk-portal-employer .emp-header-subtitle{display:none!important}
  body.bk-portal-employer .emp-header-actions {
    display:flex!important;flex:0 0 auto!important;flex-wrap:nowrap!important;
    align-items:center!important;justify-content:flex-end!important;
    gap:5px!important;min-width:0!important;
  }
  body.bk-portal-employer .emp-header-icon{
    flex:0 0 34px!important;width:34px!important;min-width:34px!important;
    height:34px!important;font-size:17px!important;
  }
  body.bk-portal-employer .emp-header-primary-action,
  body.bk-portal-employer .emp-header-notification,
  body.bk-portal-employer .emp-header-company{
    flex:0 0 38px!important;width:38px!important;min-width:38px!important;
    height:40px!important;min-height:40px!important;
    padding:0!important;display:inline-flex!important;
    align-items:center!important;justify-content:center!important;
  }
  body.bk-portal-employer .emp-header-primary-label,
  body.bk-portal-employer .emp-header-company-name{display:none!important}
  body.bk-portal-employer .emp-account-menu-shell{min-width:0!important}

  /* Administration: one toolbar, no forced full-width sidebar. */
  body.bk-portal-admin .admin-mobile-topbar{
    display:flex!important;align-items:center!important;justify-content:space-between!important;
    flex-wrap:nowrap!important;gap:8px!important;
    min-height:58px!important;padding:8px 12px!important;
    width:100%!important;max-width:100%!important;box-sizing:border-box!important;
  }
  body.bk-portal-admin .admin-mobile-topbar strong{
    min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;
    white-space:nowrap!important;font-size:13px!important;
  }
  body.bk-portal-admin .admin-mobile-topbar button{
    flex:0 0 auto!important;min-height:42px!important;max-width:50%!important;
    padding:8px 12px!important;white-space:nowrap!important;
  }
  body.bk-portal-admin .admin-main{min-width:0!important;max-width:100%!important}
  body.bk-portal-admin .topbar{max-width:100%!important;min-width:0!important}
}
@media screen and (max-width:359.98px) {
  .bk-navbar .bk-container.bk-nav-inner{width:calc(100% - 14px)!important;gap:4px!important}
  .bk-navbar .bk-header-main{gap:4px!important}
  .bk-navbar .bk-brand-logo-box{width:44px!important;min-width:44px!important;flex-basis:44px!important}
  .bk-navbar .bk-mobile-menu-toggle{min-width:72px!important;padding-inline:7px!important}
  .bk-navbar .bk-actions #themeToggle{min-width:48px!important;width:48px!important}
  .bk-navbar .bk-actions{max-width:50px!important}
}

/* High-specificity portal header correction: overrides older portal-quality mobile stack. */
@media screen and (max-width:767.98px) {
  html[data-theme] body.bk-portal-employer .emp-panel-shell .emp-main .emp-jobseeker-like-header{
    display:flex!important;flex-direction:row!important;align-items:center!important;
    justify-content:space-between!important;flex-wrap:nowrap!important;
    gap:7px!important;padding:9px 10px!important;min-height:62px!important
  }
  html[data-theme] body.bk-portal-employer .emp-panel-shell .emp-main .emp-header-actions{
    width:auto!important;max-width:fit-content!important;min-width:0!important;
    display:flex!important;flex-wrap:nowrap!important;flex:0 0 auto!important;
    gap:5px!important
  }
  html[data-theme] body.bk-portal-employer .emp-panel-shell .emp-main .emp-header-company{
    min-width:38px!important;max-width:38px!important;width:38px!important;
    flex:0 0 38px!important
  }
}

/* Jobseeker's compact internal topbar: avoid title and controls overlapping. */
@media screen and (max-width:767.98px) {
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 {
    display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;
    align-items:center!important;column-gap:8px!important;
    width:100%!important;max-width:100%!important;min-width:0!important;
    min-height:58px!important;height:auto!important;
    padding:7px 10px!important;box-sizing:border-box!important
  }
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-topbar-center{
    display:none!important
  }
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-topbar-left{
    grid-column:1!important;min-width:0!important;display:flex!important;
    align-items:center!important;flex-wrap:nowrap!important;gap:5px!important
  }
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-topbar-brand{
    grid-column:2!important;min-width:0!important;max-width:100%!important;
    display:flex!important;align-items:center!important;overflow:hidden!important
  }
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-brand-copy{
    flex:1 1 auto!important;min-width:0!important;overflow:hidden!important
  }
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-brand-copy strong{
    display:block!important;max-width:100%!important;white-space:nowrap!important;
    overflow:hidden!important;text-overflow:ellipsis!important;font-size:13px!important
  }
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-user-btn,
  html[data-theme] body.bk-portal-jobseeker .bk-final-topbar-v2 .bk-bell-btn{
    min-width:40px!important;width:40px!important;max-width:40px!important;
    height:40px!important;flex:0 0 40px!important
  }
}
