/* ============================================================
   PASSAGE by Khoshà — mobile-first layer (mb- prefix)
   Loads AFTER styles.css / employer.css / worker.css / govbar.css
   / passport.css, so equal-specificity rules here win. Everything
   that would change desktop behaviour is scoped inside
   @media (max-width:760px); the menu overlay/trigger rules below
   are unscoped but inert above 760px because the trigger that
   opens the overlay is itself only ever shown under 760px.
   ============================================================ */

/* ---------- full-screen menu: trigger (hidden until mobile) ---------- */
.mb-menu-btn{
  display:none;
}

/* ---------- full-screen menu: overlay shell ---------- */
.mb-menu-overlay{
  position:fixed; inset:0; z-index:300;
  display:flex; flex-direction:column;
  background:linear-gradient(165deg,var(--paper) 0%,var(--bone) 55%,var(--bone-2) 100%);
  opacity:0; visibility:hidden; pointer-events:none;
  transform:translateY(10px) scale(.99);
  transition:opacity .4s cubic-bezier(.2,.9,.3,1), transform .4s cubic-bezier(.2,.9,.3,1), visibility .4s;
  overscroll-behavior:contain;
}
.mb-menu-overlay.mb-open{ opacity:1; visibility:visible; pointer-events:auto; transform:none; }

.mb-menu-amb{position:absolute;border-radius:50%;filter:blur(80px);opacity:.55;pointer-events:none}
.mb-menu-amb1{width:340px;height:340px;background:radial-gradient(circle,#EADFC8 0%,transparent 68%);top:-120px;right:-90px}
.mb-menu-amb2{width:300px;height:300px;background:radial-gradient(circle,#E4EAE2 0%,transparent 66%);bottom:-100px;left:-90px}

.mb-menu-head{position:relative;z-index:2;display:flex;align-items:center;gap:12px;padding:20px 18px 8px;flex:0 0 auto}
.mb-menu-word{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.mb-menu-word .brand-orb{width:38px;height:38px;flex:0 0 38px}
.mb-menu-word .brand-orb svg{width:19px;height:19px}
.mb-menu-wordtxt{display:flex;flex-direction:column;gap:4px;min-width:0}
.mb-menu-name{font-family:var(--disp);font-weight:800;font-size:15px;letter-spacing:.2em;white-space:nowrap}
.mb-menu-rcic{font-size:10.5px;letter-spacing:.06em;color:var(--green);background:rgba(30,58,51,.08);padding:2px 9px;border-radius:99px;width:fit-content}
.mb-menu-close{flex:0 0 auto;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;border:1px solid var(--stroke);background:rgba(255,255,255,.65);color:var(--ink-soft);transition:all .2s}
.mb-menu-close svg{width:16px;height:16px}
.mb-menu-close:active{transform:scale(.92)}
.mb-menu-close:focus-visible,.mb-menu-btn:focus-visible,.mb-menu-tile:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

.mb-menu-scroll{position:relative;z-index:2;flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:6px 18px calc(30px + env(safe-area-inset-bottom,0px))}

.mb-menu-sec{margin-top:22px}
.mb-menu-sec:first-child{margin-top:8px}
.mb-menu-sec-t{font-size:10.5px;letter-spacing:.18em;text-transform:uppercase;color:var(--gold-deep);font-weight:700;margin-bottom:10px;padding-left:2px}
.mb-menu-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}

.mb-menu-tile{
  display:flex;flex-direction:column;justify-content:center;gap:10px;
  min-height:64px;padding:16px 14px;text-align:left;
  background:rgba(255,255,255,.62);border:1px solid var(--stroke-soft);border-radius:20px;
  color:var(--ink);transition:transform .22s,box-shadow .22s,border-color .22s,background .22s;
  opacity:0;transform:translateY(16px);
  animation:mbTileIn .5s cubic-bezier(.2,.9,.3,1) both;
}
.mb-menu-tile:active{transform:scale(.96)}
.mb-menu-tile .orb{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--bone);border:1px solid var(--stroke-soft);color:var(--gold-deep);transition:all .25s}
.mb-menu-tile .orb svg{width:17px;height:17px}
.mb-menu-lbl{font-weight:600;font-size:13.5px;letter-spacing:.01em;line-height:1.25}
.mb-menu-tile.on{border-color:rgba(169,130,76,.5);background:rgba(216,184,119,.14);box-shadow:var(--shadow-soft)}
.mb-menu-tile.on .orb{background:radial-gradient(circle at 32% 28%,var(--gold-hi),var(--gold) 58%,var(--gold-deep));color:#fff;border-color:transparent}

@keyframes mbTileIn{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}

@media (prefers-reduced-motion:reduce){
  .mb-menu-tile{animation:none!important;opacity:1!important;transform:none!important}
  .mb-menu-word .brand-orb{animation:none!important}
  .mb-menu-overlay{transition:opacity .15s!important;transform:none!important}
}

/* ============================================================
   MOBILE — everything below is scoped to <=760px so desktop
   layout/behaviour is completely untouched.
   ============================================================ */
@media (max-width:760px){

  /* ---------- kill the old bottom dock, the full-screen menu
     replaces it entirely ---------- */
  .side{display:none!important}
  .main{height:100%}
  .view{padding-bottom:calc(24px + env(safe-area-inset-bottom,0px))}
  .toast-root{bottom:calc(20px + env(safe-area-inset-bottom,0px))}

  /* ---------- menu trigger, first thing in the topbar ---------- */
  .mb-menu-btn{
    display:grid;place-items:center;width:38px;height:38px;flex:0 0 38px;
    border-radius:50%;border:1px solid var(--stroke-soft);background:var(--bone);
    color:var(--ink-soft);order:-2;transition:all .2s;
  }
  .mb-menu-btn svg{width:17px;height:17px}
  .mb-menu-btn:active{transform:scale(.92)}
  .mb-menu-btn[aria-expanded="true"]{border-color:var(--gold);color:var(--gold-deep);background:rgba(216,184,119,.14)}

  /* ---------- topbar: fix the crowding — the old rules never let
     .top-tools actually wrap, so the search row (order:3, basis:100%)
     just squeezed everything else instead of dropping to its own
     line. Wrapping it here is the whole fix. ---------- */
  .topbar{gap:8px 10px}
  .top-tools{flex-wrap:wrap;justify-content:flex-end;row-gap:8px;gap:8px}
  .crumb{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;order:-1}
  .searchbox{margin-top:2px}

  /* ---------- gov-links bar + record tabs: guarantee a single
     scrollable line with a soft edge fade hinting more content ---------- */
  .gv-bar::after{
    content:"";position:absolute;top:0;right:0;bottom:2px;width:26px;z-index:3;
    background:linear-gradient(90deg,transparent,var(--paper) 78%);pointer-events:none;
  }
  .tabs{position:relative;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .tab{flex:0 0 auto}
  .tabs::after{
    content:"";position:absolute;top:0;right:0;bottom:0;width:26px;
    background:linear-gradient(90deg,transparent,var(--paper) 78%);pointer-events:none;
  }

  /* ---------- dossier header: identity row stays compact, action
     buttons become a neat full-width row, stats a true 2-up grid ---------- */
  .dh-main{gap:14px}
  .dh-id{min-width:0;flex:1 1 140px}
  .dh-actions{flex:0 0 100%;display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px}
  .dh-actions .btn{width:100%;white-space:normal;line-height:1.25;text-align:center}
  .dh-stats{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .dh-stat{min-width:0}

  /* ---------- tables: any table not already inside a scrollable
     .tbl-wrap gets wrapped by mobile.js so nothing forces the
     page wider than the viewport ---------- */
  .mb-tbl-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
  /* empty-state placeholders (colspan cells) shouldn't take the
     cardable row's flex/space-between treatment */
  .tbl.cardable td[colspan]{display:block}

  /* ---------- small width-safety touches ---------- */
  .noc-search{width:100%;min-width:0}
  .emp-doc-filter{min-width:0}

  /* NOC Explorer sets an inline `grid-template-columns:2fr 1fr` on
     .grid-2 for its desktop two-pane layout. Inline styles beat a
     plain class rule at any width, so without !important this stays
     two panes (and overflows) even on a 360px phone. */
  .grid-2{grid-template-columns:1fr!important}
}
