/* ==========================================================================
   Zing Hire — phone-only mobile layer (mobile.css)  v98
   Ground-up mobile UI. Everything here is gated on BOTH:
     • the media query (<=760px), and
     • body.zhm-on (set by mobile.js only when the layer is active)
   so it is physically impossible for these rules to affect the desktop app.
   Detail flows (requirement drawer, candidate card, add-candidate) are the
   app's existing overlays and are intentionally left alone.
   ========================================================================== */

#zhm { display: none; }

@media (max-width: 760px) {

  /* When the mobile layer is active, hide the desktop chrome outright. */
  body.zhm-on .topbar,
  body.zhm-on .app-shell { display: none !important; }
  body.zhm-on { overflow: hidden; }

  /* The mobile shell belongs to the AUTHENTICATED app only. Whenever the app
     pane is hidden (loading / login / no-access), hide the shell so the auth
     screens are never covered — e.g. if a session expires while open. */
  body:has(#app.hidden) #zhm { display: none !important; }
  body:has(#app.hidden).zhm-on .topbar,
  body:has(#app.hidden).zhm-on .app-shell { display: revert !important; }

  #zhm {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    background: var(--bg, #f4f6fb);
    z-index: 40;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }

  /* Inline icons default to a sane inline size; tab bar overrides below. */
  #zhm svg { width: 18px; height: 18px; flex: none; }
  #zhm .zhm-card .top > svg { color: #c3c8d4; }
  #zhm .zhm-row svg.chev { color: #c3c8d4; }

  /* ---- header ---- */
  .zhm-hd {
    flex: none;
    background: #fff;
    border-bottom: 1px solid var(--line, #e6e8ef);
    padding: 10px 14px 8px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .zhm-hd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .zhm-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .zhm-brand img { width: 26px; height: 26px; border-radius: 7px; }
  .zhm-brand .t { font-size: 15px; font-weight: 700; color: var(--ink, #1c2230); line-height: 1.1; }
  .zhm-brand .s { font-size: 11px; color: var(--muted, #7a8194); line-height: 1.2; }

  .zhm-co {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--ink, #1c2230);
    border: 1px solid var(--line, #e6e8ef); background: #fff;
    padding: 6px 10px; border-radius: 20px; max-width: 46%;
  }
  .zhm-co .dot { width: 16px; height: 16px; border-radius: 5px; color: #fff;
    font-size: 8px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
  .zhm-co .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .zhm-co .chev { color: var(--muted, #7a8194); font-size: 10px; flex: none; }

  /* ---- mode toggle (dual-capability users only) ---- */
  .zhm-seg {
    display: flex; background: var(--bg, #f4f6fb); border-radius: 11px;
    padding: 3px; margin-top: 10px;
  }
  .zhm-seg button {
    flex: 1; border: 0; background: transparent; cursor: pointer;
    font-size: 12.5px; font-weight: 600; color: var(--muted, #7a8194);
    padding: 8px; border-radius: 9px; font-family: inherit;
  }
  .zhm-seg button.on { background: var(--primary, #c1272d); color: #fff; }

  /* ---- body / scroll area ---- */
  .zhm-body {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 14px 14px 90px;
  }
  .zhm-body.sub { padding-top: 12px; }

  .zhm-h { font-size: 12px; font-weight: 700; letter-spacing: .03em;
    color: var(--muted, #7a8194); text-transform: uppercase; margin: 4px 2px 9px; }
  .zhm-sub-hd {
    display: flex; align-items: center; gap: 10px; margin: 2px 0 12px;
  }
  .zhm-back { display: inline-flex; align-items: center; gap: 4px;
    font-size: 14px; color: var(--ink, #1c2230); background: none; border: 0;
    font-family: inherit; cursor: pointer; padding: 4px 2px; font-weight: 600; }
  .zhm-sub-hd .ttl { font-size: 16px; font-weight: 700; color: var(--ink, #1c2230); }
  .zhm-sub-hd .st { font-size: 11px; color: var(--muted, #7a8194); }

  /* ---- KPI grid ---- */
  .zhm-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 14px; }
  .zhm-kpi { background: #fff; border: 1px solid var(--line, #e6e8ef); border-radius: 14px; padding: 11px 12px; }
  .zhm-kpi .l { font-size: 11px; color: var(--muted, #7a8194); display: flex; align-items: center; gap: 4px; }
  .zhm-kpi .v { font-size: 22px; font-weight: 700; color: var(--ink, #1c2230); margin-top: 3px; line-height: 1; }
  .zhm-kpi .v small { font-size: 13px; font-weight: 600; color: var(--muted, #7a8194); }
  .zhm-kpi .d { font-size: 10.5px; color: var(--muted, #7a8194); margin-top: 3px; }

  /* ---- chips row ---- */
  .zhm-chips { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
  .zhm-chips::-webkit-scrollbar { display: none; }
  .zhm-chip { flex: none; font-size: 12px; padding: 7px 13px; border-radius: 20px;
    border: 1px solid var(--line, #e6e8ef); background: #fff; color: var(--muted, #7a8194);
    white-space: nowrap; cursor: pointer; font-family: inherit; }
  .zhm-chip .ct { font-weight: 700; margin-left: 5px; }
  .zhm-chip.on { background: var(--primary, #c1272d); border-color: var(--primary, #c1272d); color: #fff; }

  /* ---- cards ---- */
  .zhm-card { background: #fff; border: 1px solid var(--line, #e6e8ef); border-radius: 14px;
    padding: 12px 13px; margin-bottom: 10px; cursor: pointer; }
  .zhm-card:active { background: #fafbfd; }
  .zhm-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .zhm-card .n { font-size: 14px; font-weight: 700; color: var(--ink, #1c2230); }
  .zhm-card .m { font-size: 11.5px; color: var(--muted, #7a8194); margin-top: 2px; }
  .zhm-card .meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px;
    font-size: 11px; color: var(--muted, #7a8194); }
  .zhm-card .meta b { color: var(--ink, #1c2230); font-weight: 700; }
  .zhm-card .rt { font-size: 13px; font-weight: 700; color: var(--ink, #1c2230); }

  .zhm-pill { font-size: 10px; padding: 3px 9px; border-radius: 20px; font-weight: 700; white-space: nowrap; }

  /* stage progress bar */
  .zhm-prog { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
  .zhm-prog .lab { font-size: 10.5px; color: var(--muted, #7a8194); flex: none; }
  .zhm-track { flex: 1; height: 7px; border-radius: 6px; background: var(--bg, #f4f6fb); overflow: hidden; }
  .zhm-fill { height: 100%; border-radius: 6px; background: var(--primary, #c1272d); }
  .zhm-fill.ok { background: #1f9d57; }

  /* ---- buttons ---- */
  .zhm-btn { display: flex; align-items: center; justify-content: center; gap: 7px;
    font-size: 14px; font-weight: 700; padding: 13px; border-radius: 13px;
    border: 1px solid var(--line, #e6e8ef); background: #fff; color: var(--ink, #1c2230);
    width: 100%; cursor: pointer; font-family: inherit; }
  .zhm-btn.pri { background: var(--primary, #c1272d); border-color: var(--primary, #c1272d); color: #fff; }
  .zhm-btn:active { transform: scale(.99); }
  .zhm-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }

  /* Quiet, low-priority secondary action (e.g. recruiter's "Raise a
     requirement") — a small muted pill, never a full-width slab. */
  #zhm .zhm-mini { display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid var(--line, #e6e8ef); border-radius: 20px;
    font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted, #7a8194);
    padding: 8px 15px; cursor: pointer; }
  #zhm .zhm-mini:active { background: #fafbfd; }
  #zhm .zhm-mini svg { width: 15px; height: 15px; color: var(--muted, #7a8194); }

  /* ---- stage breakdown rows (read-only requirement pipeline) ---- */
  .zhm-stg { display: flex; align-items: center; justify-content: space-between;
    padding: 11px 2px; border-bottom: 1px solid var(--line, #e6e8ef); font-size: 13px; color: var(--ink, #1c2230); }
  .zhm-stg .c { font-weight: 700; }
  .zhm-kv { display: flex; justify-content: space-between; padding: 7px 2px; font-size: 12.5px; }
  .zhm-kv .k { color: var(--muted, #7a8194); }
  .zhm-kv .val { color: var(--ink, #1c2230); font-weight: 600; }

  /* ---- list rows (More menu) ---- */
  .zhm-row { display: flex; align-items: center; justify-content: space-between;
    padding: 14px 4px; border-bottom: 1px solid var(--line, #e6e8ef);
    font-size: 14.5px; color: var(--ink, #1c2230); cursor: pointer; }
  .zhm-row .lead { display: flex; align-items: center; gap: 12px; }
  .zhm-row .lic { width: 22px; text-align: center; color: var(--muted, #7a8194); }
  .zhm-row .chev { color: #c3c8d4; }

  /* ---- banners / notes ---- */
  .zhm-note { font-size: 11.5px; line-height: 1.5; padding: 10px 12px; border-radius: 11px; margin-bottom: 12px; }
  .zhm-note.info { background: var(--blue-bg, #eaf1fb); color: var(--blue-fg, #1a5fb4); }
  .zhm-note.warn { background: var(--amber-bg, #fdf1dc); color: var(--amber-fg, #a9700a); }

  .zhm-empty { text-align: center; color: var(--muted, #7a8194); font-size: 13px; padding: 40px 20px; }
  .zhm-spin { text-align: center; padding: 40px; color: var(--muted, #7a8194); font-size: 13px; }

  /* ---- bottom tab bar ---- */
  .zhm-tabs {
    flex: none; display: flex; background: #fff;
    border-top: 1px solid var(--line, #e6e8ef);
    padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .zhm-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: 0; cursor: pointer; font-family: inherit;
    font-size: 10px; font-weight: 600; color: var(--muted, #7a8194); padding: 4px 2px; }
  #zhm .zhm-tab svg { width: 22px; height: 22px; }
  .zhm-tab.on { color: var(--primary, #c1272d); }

  /* ---- company popover ---- */
  .zhm-pop-ov { position: fixed; inset: 0; background: rgba(20,24,33,.35); z-index: 60;
    display: flex; align-items: flex-end; }
  .zhm-pop { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 8px 10px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom)); max-height: 70vh; overflow-y: auto; }
  .zhm-pop h4 { margin: 10px 8px 6px; font-size: 13px; color: var(--muted, #7a8194); }
  .zhm-pop-item { display: flex; align-items: center; gap: 11px; padding: 13px 10px;
    border-radius: 11px; cursor: pointer; }
  .zhm-pop-item:active { background: var(--bg, #f4f6fb); }
  .zhm-pop-item.sel { background: var(--bg, #f4f6fb); }
  .zhm-pop-item .dot { width: 26px; height: 26px; border-radius: 8px; color: #fff; flex: none;
    font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
  .zhm-pop-item .nm { flex: 1; font-size: 14px; color: var(--ink, #1c2230); }
  .zhm-pop-item .nm small { display: block; font-size: 11px; color: var(--muted, #7a8194); }
  .zhm-pop-item .tick { color: var(--primary, #c1272d); font-weight: 700; }

  /* ---- passthrough: reuse an existing desktop screen for the long tail ---- */
  body.zhm-pass #zhm { display: none; }
  /* Re-enable page scrolling (zhm-on pins overflow:hidden for the shell) and
     stop accidental sideways drift; tall desktop screens now scroll down. */
  body.zhm-pass { overflow-y: auto !important; overflow-x: hidden !important; }
  body.zhm-pass .app-shell { display: block !important; min-height: 0 !important; max-width: 100vw; }
  body.zhm-pass .topbar { display: none !important; }
  body.zhm-pass .sidebar,
  body.zhm-pass .navdrawer-overlay { display: none !important; }
  body.zhm-pass .main-pane { padding-top: 52px; max-width: 100vw; }
  body.zhm-pass .main-pane .wrap { padding: 16px 12px 40px; max-width: 100vw; }
  /* Wide inner blocks (tables, KPI grids) scroll inside their own box rather
     than pushing the page sideways. */
  body.zhm-pass .main-pane .table-wrap { overflow-x: auto; }
  #zhmBack {
    display: none; position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 55;
    background: #fff; border-bottom: 1px solid var(--line, #e6e8ef);
    align-items: center; gap: 8px; padding: 0 12px;
    padding-top: env(safe-area-inset-top);
  }
  body.zhm-pass #zhmBack { display: flex; }
  #zhmBack button { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0;
    font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink, #1c2230); cursor: pointer; }
  #zhmBack .ttl { font-size: 14px; color: var(--muted, #7a8194); }
}
