/* livechat-console-responsive-utilities.css - LiveChat operator console stylesheet.
   responsive media bands and the utility classes that replace former inline styles (section 6 and 7 of the design system).
   Ordered after the previous console stylesheet: the cascade of the former single livechat.css is preserved. */

/* ============================ 6. MEDIA BANDS ============================== */

/* ---- desktop / tablet (>=761px) ---- */
@media (min-width:761px) {
  /* IT4Y_LC_JANITOR_2026_07_04 pruned dead home-landing shell + empty-hint (LCDS Overview supersedes). IT4Y_LCDS2_HOME_2026_07_02 — the desktop tab-row
    display:none guard left with the tab row
     itself; the sidebar nav is the status switcher on all viewports. */
  /* header identity never widens the header (kebab-dropdown variant on mobile
     needs white-space:normal, hence the scope) */
  .app-header .who { max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}

/* ---- 1101-1320 band: 220px sidebar eats the 3-col budget → 2-col + aside overlay ---- */
@media (min-width:1101px) and (max-width:1320px) {
  .workspace { grid-template-columns:320px 1fr; }
  .pane-aside { display:none; }
  .pane-aside.mobile-open { display:flex; position:fixed; top:0; inset-inline-end:0; bottom:0;
    width:340px; max-width:90vw; z-index:var(--z-aside); box-shadow:-8px 0 24px rgba(15,23,42,.25); }
  .mobile-aside-toggle { display:inline-flex; }
}

/* ---- tablet 761-1100: 2-col + aside overlay (with close X) ---- */
@media (min-width:761px) and (max-width:1100px) {
  .workspace { grid-template-columns:320px 1fr; }
  .pane-aside { display:none; }
  .pane-aside.mobile-open { display:flex; position:fixed; top:0; inset-inline-end:0; bottom:0;
    width:340px; max-width:90vw; z-index:var(--z-aside); box-shadow:-8px 0 24px rgba(15,23,42,.25); }
  .mobile-aside-toggle { display:inline-flex; }
  .pane-aside.mobile-open .aside-mobile-close {
    display:flex; align-items:center; justify-content:center;
    position:fixed; top:10px; inset-inline-end:12px; z-index:210; /* --z-aside + 10 */
    width:38px; height:38px; border-radius:50%;
    background:var(--panel); border:1px solid var(--border);
    color:var(--text); font-size:var(--fs-xl); line-height:1; cursor:pointer;
    box-shadow:0 2px 10px rgba(15,23,42,.2);
  }
}
@media (min-width:761px) and (max-width:980px) {
  .workspace { grid-template-columns:280px 1fr; }
}

/* ---- consolidated mobile block (<=760px) ---- */
@media (max-width:760px) {
  /* hard guarantee: no horizontal page scroll; long tokens wrap */
  html, body, .app, .pane-chat, .msg-scroll { max-width:100%; overflow-x:hidden; }
  .msg-bubble, .inbox-preview, .chat-meta, .inbox-row1 .who { overflow-wrap:anywhere; }
  /* native pull-to-refresh stays enabled (never set overscroll-behavior-y:none
     or contain here — they are the native-PTR kill switches) */
  html, body { overscroll-behavior-y:auto; }
  .msg-scroll { overscroll-behavior-y:auto; }
  /* IT4Y_LC_PTR_ROOTSCROLLER_2026_07_03 — Chrome Android arms pull-to-refresh ONLY on the
     document ROOT scroller. The base shell disables it (html,body{overflow:hidden},
     the classic PTR-disable pattern) so real devices never saw the gesture even with
     overscroll-behavior:auto and zero touch preventDefault. Re-enable the root
     scroller on mobile: the page has no in-flow overflow (.app is a fixed viewport
     box) so nothing changes visually, but the pull now chains to a LIVE root and
     triggers the native refresh. overflow-x stays hidden (mobile longhand above);
     body.p360-bodylock keeps overflow:hidden !important while the drawer is open. */
  html, body { overflow-y:auto; }

  /* header: one slim row; actions fold behind the kebab */
  .app-header { position:relative; padding:6px 10px; gap:6px; flex-wrap:nowrap; align-items:center; }
  .brand { font-size:var(--fs-md); gap:6px; min-width:0; }
  .brand span:not(.brand-icon) { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .brand-icon { width:26px; height:26px; }
  .brand-badge { display:none; }
  .app-header .who { display:none; }
  .header-actions { margin-inline-start:auto; gap:6px; }
  .btn { padding:6px 10px; }
  .icon-btn { min-width:42px; min-height:42px; padding:6px 9px; }
  .lc-hdr-kebab { display:inline-flex; align-items:center; justify-content:center;
    margin-inline-start:auto; flex:0 0 auto; font-size:20px; line-height:1; padding:0 6px; }
  .hdr-actions-group { display:none; }
  .hdr-actions-group.lc-open {
    display:flex; flex-direction:column; align-items:stretch; gap:2px;
    position:absolute; top:calc(100% + 4px); inset-inline-end:8px;
    z-index:var(--z-menu); min-width:212px; max-width:80vw; padding:6px;
    background:var(--panel); border:1px solid var(--border); border-radius:var(--r-lg);
    box-shadow:var(--elev-3);
    animation:lcMenuIn .13s ease-out; transform-origin:top; will-change:opacity, transform;
  }
  /* "Signed in as …" — quiet non-interactive caption + hairline rule */
  .hdr-actions-group.lc-open .who {
    display:block; width:auto; margin:0 0 4px; padding:6px 12px 9px;
    font-size:var(--fs-xs); font-weight:500; line-height:1.35; color:var(--muted);
    text-align:start; white-space:normal; word-break:break-word;
    border-bottom:1px solid var(--border-soft);
  }
  .hdr-actions-group.lc-open .who b { font-weight:600; color:var(--text); }
  /* flat menu rows — .btn and .icon-btn become identical borderless rows */
  .hdr-actions-group.lc-open .btn,
  .hdr-actions-group.lc-open .icon-btn {
    appearance:none; -webkit-appearance:none; box-sizing:border-box;
    display:flex; align-items:center; justify-content:flex-start; gap:12px;
    width:100%; min-height:42px; margin:0; padding-block:8px; padding-inline:12px;
    background:transparent; border:1px solid transparent; border-radius:var(--r-md);
    color:var(--text); font-size:14px; font-weight:500; line-height:1.2;
    text-align:start; text-decoration:none; cursor:pointer; box-shadow:none;
    -webkit-tap-highlight-color:transparent; transition:background-color .12s ease, color .12s ease;
  }
  /* icon rows: fixed 22px glyph column so labels align */
  .hdr-actions-group.lc-open .icon-btn {
    display:grid; grid-template-columns:22px 1fr; column-gap:10px; align-items:center; font-size:var(--fs-lg);
  }
  /* synthesize labels for the icon-only buttons from title (ellipsized) */
  .hdr-actions-group.lc-open .icon-btn::after {
    content:attr(title); font-size:14px; font-weight:500; line-height:1.2;
    color:var(--text); white-space:nowrap; text-align:start;
    overflow:hidden; text-overflow:ellipsis; max-width:60vw;
  }
  /* text rows: indent label to the icon-row label column (12+22+10) */
  .hdr-actions-group.lc-open .btn { padding-inline-start:44px; }
  .hdr-actions-group.lc-open .btn:hover,
  .hdr-actions-group.lc-open .icon-btn:hover,
  .hdr-actions-group.lc-open .btn:focus-visible,
  .hdr-actions-group.lc-open .icon-btn:focus-visible {
    background:var(--panel-2); color:var(--text); border-color:transparent; outline:none;
  }
  .hdr-actions-group.lc-open .icon-btn:hover::after,
  .hdr-actions-group.lc-open .icon-btn:focus-visible::after,
  .hdr-actions-group.lc-open .icon-btn:active::after { color:var(--text); }
  .hdr-actions-group.lc-open .btn:focus-visible,
  .hdr-actions-group.lc-open .icon-btn:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
  .hdr-actions-group.lc-open .btn:active,
  .hdr-actions-group.lc-open .icon-btn:active { background:var(--accent-soft); }

  /* presence bar: compact chips, momentum scroll, right-edge fade cue */
  .presence-bar { padding:4px 10px; gap:5px; overflow-x:auto; flex-wrap:nowrap;
    -webkit-overflow-scrolling:touch;
    -webkit-mask-image:linear-gradient(90deg,#000 92%,transparent);
            mask-image:linear-gradient(90deg,#000 92%,transparent); }
  .presence-bar::-webkit-scrollbar { display:none; }
  .presence-chip { padding:2px 8px; font-size:10px; gap:5px; line-height:1.5; }
  .presence-chip .count { min-width:15px; height:15px; font-size:10px; padding:0 4px; }
  .kpi-pill { padding:2px 8px; font-size:10px; }
  .kpi-pill b { font-size:var(--fs-xs); }
  .sse-status { font-size:10px; padding:2px 7px; }

  /* workspace: single pane, view toggled by the router */
  .workspace { grid-template-columns:1fr; }
  .pane-inbox, .pane-chat { display:none; }
  .pane-inbox.mobile-active, .pane-chat.mobile-active { display:flex; }
  .mobile-back { display:inline-flex; align-items:center; gap:4px; }
  .mobile-aside-toggle { display:inline-flex; }
  .pane-aside { display:none; }
  .pane-aside.mobile-open { display:flex; position:fixed; top:0; inset-inline-end:0; bottom:0;
    width:100%; max-width:100%; z-index:var(--z-aside); box-shadow:-8px 0 24px rgba(15,23,42,.25); }
  .pane-aside.mobile-open .aside-mobile-close {
    display:flex; align-items:center; justify-content:center;
    position:fixed; top:10px; inset-inline-end:12px; z-index:210; /* --z-aside + 10 */
    width:38px; height:38px; border-radius:50%;
    background:var(--panel); border:1px solid var(--border);
    color:var(--text); font-size:var(--fs-xl); line-height:1; cursor:pointer;
    box-shadow:0 2px 10px rgba(15,23,42,.2);
  }

  /* inbox: roomier rows (the compact filter tab-row rules left with the in-pane
     tab row — IT4Y_LCDS2_HOME_2026_07_02; the drawer nav is the status switcher) */
  .inbox-item { padding:13px 14px; }
  .inbox-item.active { padding-inline-start:11px; }
  .inbox-row1 .who { display:block; max-width:60%; }
  .inbox-search input { font-size:16px; } /* iOS focus-zoom guard */

  /* chat header + messages */
  .chat-header { padding:8px 12px; gap:6px; }
  .chat-title { font-size:var(--fs-lg); }
  .chat-actions { gap:4px 5px; flex-wrap:wrap; width:auto; align-items:center; }
  .msg-scroll { padding:14px 12px; }
  .msg-row { max-width:90%; }

  /* composer: 2-line floor, safe-area inset, iOS 16px floor */
  .reply-pane { padding:10px 10px max(10px, env(safe-area-inset-bottom)); gap:7px; }
  .reply-send { width:46px; height:46px; }
  #reply-text, #note-text { box-sizing:border-box; min-height:74px; line-height:1.45;
                            padding:11px 13px; font-size:16px; }

  /* IT4Y_LC_QRSHEET_2026_07_04 — pickers are a bottom SHEET on phones (styling block at
     end of file). Geometry: full width, anchored to the pane bottom (overlays the composer
     while browsing — insert closes the sheet and reveals the composer again), height driven
     by --lc-apph so the sheet reflows live as the soft keyboard opens/closes. */
  .picker-pop { inset-inline-start:0; inset-inline-end:0; bottom:0; top:auto;
    max-height:calc(var(--lc-apph, 100dvh) - 12px);
    min-height:min(46dvh, calc(var(--lc-apph, 100dvh) - 12px)); }
  .reply-tool-btn { width:40px; height:40px; font-size:var(--fs-xl); }
  .emoji-grid { grid-template-columns:repeat(auto-fill, minmax(40px, 1fr)); }

  /* modals fit phones; inputs at the 16px iOS floor */
  .modal .pm-input, .modal.lg input[type="text"], .modal.lg input[type="number"],
  .modal.lg select, .modal.lg textarea { font-size:16px; }
  .admin-form .form-row.split { grid-template-columns:1fr 1fr; }
  .modal.lg { width:96vw; max-height:92vh; }
  .modal.lg .modal-head, .modal.lg .modal-body, .modal.lg .modal-foot {
    padding-inline-start:12px; padding-inline-end:12px; }

  /* toast: full-width strip above the composer (never on the send button) */
  .toast { inset-inline-start:12px; inset-inline-end:12px; max-width:none;
           bottom:calc(110px + env(safe-area-inset-bottom)); }

  /* sidebar drawer */
  .app-shell { display:block; height:100dvh; }
  .app-sidebar { position:fixed; top:0; inset-inline-start:0; bottom:0; width:280px; max-width:82vw; height:100dvh;
    transform:translateX(-105%); transition:transform .22s ease; z-index:var(--z-drawer); overflow-y:auto;
    -webkit-overflow-scrolling:touch; padding:max(10px, env(safe-area-inset-top, 10px)) 8px 16px;
    background:var(--bg-2); box-shadow:var(--elev-3);
    border-inline-end:1px solid var(--border-soft); }
  .app-sidebar.p360-open { transform:translateX(0); }
  .app-sidebar .nav-item { padding:12px 14px; font-size:14px; min-height:44px; margin:2px 0; width:100%; }
  .app-sidebar .nav-label { font-size:var(--fs-xs); padding:8px 14px 4px; }
  .sb-footer { padding:8px 6px max(12px, env(safe-area-inset-bottom, 12px)); }
  .p360-hamburger { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto;
    width:40px; height:40px; margin-inline-end:6px; background:var(--panel); color:var(--text);
    border:1px solid var(--border); border-radius:var(--r-lg); cursor:pointer;
    box-shadow:var(--elev-1); }
  .sidebar-backdrop.open { display:block; }
  body.p360-bodylock { overflow:hidden !important; }
  /* IT4Y_LCDS2_HOME_2026_07_02 — drawer isolation: while the drawer is open the sidebar must be
     the ONLY visible layer (no underlying nav/controls/text). The backdrop is a
     fixed sibling of .app, so click-outside-to-close still works over the blanked
     area; toasts/modals/QR overlays are body-level children and stay unaffected. */
  body.p360-bodylock .app { visibility:hidden; }
  /* drawer header: title + explicit close affordance (the page context vanishes) */
  .sb-head { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2);
             padding:2px 6px 10px; margin:0 4px var(--sp-2);
             border-bottom:1px solid var(--border-soft); }
  .sb-title { font-size:var(--fs-md); font-weight:700; color:var(--text);
              text-transform:uppercase; letter-spacing:1.2px; }
  .sb-close { width:44px; height:44px; min-width:44px; min-height:44px; padding:0;
              display:inline-flex; align-items:center; justify-content:center;
              font-size:var(--fs-lg); line-height:1; border-radius:var(--r-md);
              background:var(--panel); color:var(--text); }
}
@keyframes lcMenuIn { from{opacity:0;transform:translateY(-4px) scale(.985);} to{opacity:1;transform:none;} }

/* ---- micro-bands (kept narrow on purpose: widening them to 760px would
        change the 431-760 / 561-760 render) ---- */
@media (max-width:560px) {
  .qr-mgr { max-height:94vh; }
  .qr-row-body { white-space:normal; }
}
@media (max-width:430px) {
  .msg-row { max-width:94%; }
}

/* ---- keyboard-pin (<=760): app height tracks the VISUAL viewport via
        --lc-apph/--lc-appy (maintained by livechat.js); .lc-kbd collapses
        non-essential chrome while typing. Semantics copied exactly. ---- */
@media (max-width:760px) {
  /* fixed, viewport-tracking app box; falls back to 100dvh at idle. transform
     follows iOS visual-viewport scroll so the composer stays on the keyboard. */
  .app { position:fixed; top:0; inset-inline-start:0; inset-inline-end:0;
         height:100vh; height:100dvh; height:var(--lc-apph, 100dvh);
         transform:var(--lc-appy, none); }
  .pane-chat { min-height:0; }
  .app.lc-kbd .presence-bar { display:none; }
  /* presence-bar display:none vacates grid row 2 — pin .workspace to the 1fr
     row 3 or an empty 1fr row opens below the composer (the white-gap bug) */
  .app.lc-kbd .workspace { grid-row:3; }
  .app.lc-kbd .chat-meta { display:none; }
  .app.lc-kbd .chat-actions { display:none; }
  .app.lc-kbd .chat-header { padding:5px 12px; }
  .app.lc-kbd .app-header { padding:3px 10px; }
  .app.lc-kbd .brand span:not(.brand-icon),
  .app.lc-kbd .brand-badge { display:none; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important;
                           transition-duration:.001ms !important; scroll-behavior:auto !important; }
  .nav-item, .p360-signout .icon svg, .app-sidebar { transition:none !important; animation:none !important; }
}

/* ======================= 5b. HOME LANDING ==================================
   IT4Y_LCDS2_HOME_2026_07_02 — default chat-pane state (no selection): the operational
   home dashboard. Practically desktop/tablet only: on mobile .pane-chat is
   display:none unless mobileView==='chat' (which implies a selection).
   Tokens/semantic vars only; no !important; this section MUST stay before
   section 7 (utilities keep their last-in-source cascade position). */
.home-presence { display:flex; align-items:center; gap:6px;
                 font-size:var(--fs-sm); color:var(--text-2); font-weight:500;
                 font-variant-numeric:tabular-nums; }
.home-sec-title { margin:0 0 var(--sp-3); font-size:var(--fs-xs); font-weight:700; color:var(--text);
                  text-transform:uppercase; letter-spacing:1.1px; }
.home-recent-row { display:grid; grid-template-columns:minmax(80px,auto) 1fr auto auto;
                   align-items:center; gap:var(--sp-3); padding:10px var(--sp-2);
                   border-bottom:1px solid var(--border-soft); cursor:pointer;
                   border-radius:var(--r-sm); transition:background .12s ease; }
.home-recent-row:last-child { border-bottom:none; }
.home-recent-row:hover { background:var(--panel-2); }
.home-recent-row:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; box-shadow:none; }
.hr-who { font-weight:600; font-size:var(--fs-md); color:var(--text);
          font-family:ui-monospace,Menlo,Consolas,monospace; letter-spacing:.1px;
          max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hr-preview { min-width:0; font-size:var(--fs-sm); color:var(--text-2);
              overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.home-recent-row.unread .hr-who { font-weight:700; }
.home-recent-row.unread .hr-preview { color:var(--text); font-weight:500; }
.hr-when { font-size:var(--fs-xs); color:var(--text-2); font-weight:600; white-space:nowrap;
           font-variant-numeric:tabular-nums; }
.home-recent-empty { padding:12px 2px; color:var(--text-2); font-size:var(--fs-md); }

/* IT4Y_LC_INBOX_EMPTY_2026_07_03 — inbox views with no chat selected show a minimal empty chat pane
   (.chat-empty), NOT a dashboard. On desktop (>=1101px, where the aside is a real 3rd grid column)
   collapse the workspace to 2 columns and suppress the aside so nothing duplicates the Overview.
   Below 1101px the aside is already display:none and the grid is 2-column (section 8 media rules),
   so no rule is needed there. The dashboard is now rendered EXCLUSIVELY by the Overview view
   (.workspace.overview-mode / renderOverviewPage). Supersedes the old :has(.home-wrap) @1321 rule. */
@media (min-width:1101px){
  .workspace:has(.chat-empty){ grid-template-columns:360px 1fr; }
  .workspace:has(.chat-empty) > .pane-aside{ display:none; }
}
.chat-empty { flex:1 1 auto; min-height:0; }   /* fill the chat pane; .empty centers the content */
.chat-empty-ov { background:none; border:0; padding:0; margin:0; font:inherit; font-weight:600;
                 color:var(--accent); cursor:pointer; text-decoration:underline; }
.chat-empty-ov:hover { color:var(--accent-text); }
.chat-empty-ov:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:2px; }
.aside-empty { padding:16px 4px; color:var(--text-2); font-size:var(--fs-md); line-height:1.5; }

/* ============ 7. UTILITY CLASSES (data-sty replacement contract) ============
   These MUST stay at the end of the file: several replace inline styles that
   previously beat class rules, so they need last-in-source cascade position. */
.lc-h100 { height:100vh; }        /* boot shell */
.lc-mt14 { margin-top:14px; }     /* boot shell */
.lc-read-summary, .info-row .v.lc-read-summary { max-width:75%; }
  /* ^ compound booster: .info-row .v{max-width:60%} is 0-2-0 and would beat
     the bare 0-1-0 utility on specificity */
.lc-note-add { margin-top:8px; width:100%; }
.lc-push-end { margin:0; margin-inline-start:auto; }
.lc-muted { color:var(--muted); }
.lc-mt-12 { margin-top:12px; }
.lc-empty-compact { height:auto; padding:30px; }
.lc-modal-note { margin:0 0 16px; }
/* ======================= end IT4Y_LCDS_V1_2026_07_02 ======================= */
