/* livechat-console-overview-and-quick-replies.css - LiveChat operator console stylesheet.
   overview dashboard, quick-reply picker and sheets, phone compaction and density pass.
   Ordered after the previous console stylesheet: the cascade of the former single livechat.css is preserved. */

/* ── IT4Y_LC_QR_SEARCH_2026_07_03 ── quick-reply picker search + keyboard nav (token-driven, dark-aware) */
.tpl-search-wrap { padding:8px 10px 6px; position:sticky; top:0; z-index:2; background:var(--panel); }
.tpl-search { width:100%; box-sizing:border-box; padding:8px 12px; font:inherit; font-size:13px;
             color:var(--text); background:var(--bg-2); border:1px solid var(--border);
             border-radius:8px; outline:none; }
.tpl-search::placeholder { color:var(--muted); }
.tpl-search:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.tpl-item.kbd-active { background:var(--accent-soft); outline:2px solid var(--accent); outline-offset:-2px; }
.tpl-search-empty { padding:16px 12px; text-align:center; color:var(--muted); font-size:12.5px; }


/* ===== IT4Y_LC_OVERVIEW_V1 — Overview dashboard (full-width canonical landing) ===== */
.workspace.overview-mode { grid-template-columns:1fr; }
.pane-overview { display:flex; flex-direction:column; min-height:0; min-width:0; background:var(--bg); }
.ov-scroll { flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden;
  padding:20px 22px 28px; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
.ov-page .ov-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
  flex-wrap:wrap; margin-bottom:18px; }
.ov-hero-title { font-size:22px; font-weight:800; color:var(--text); letter-spacing:-.01em; line-height:1.15; }
.ov-hero-sub { font-size:var(--fs-md); color:var(--muted); margin-top:4px; }
.ov-hero-r { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ov-op-chip { display:inline-flex; align-items:center; gap:7px; padding:6px 12px; border-radius:999px;
  background:var(--presence-online-bg); color:var(--presence-online-text); font-size:var(--fs-sm); font-weight:600; }
.ov-visitors-chip { display:inline-flex; align-items:center; padding:6px 12px; border-radius:999px;
  background:var(--panel-2); color:var(--text-2); font-size:var(--fs-sm); font-weight:600; }
.sse-status.ov-sse { font-size:var(--fs-sm); }
.welcome-grid.ov-kpis { grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.ov-page .welcome-tile { position:relative; }
.tile-sub { font-size:var(--fs-xs); color:var(--muted); margin-top:4px; font-weight:500; }
.ov-cols { display:grid; grid-template-columns:1.55fr 1fr; gap:16px; align-items:start; }
.ov-side { display:flex; flex-direction:column; gap:16px; min-width:0; }
.ov-card { background:var(--panel); border:1px solid var(--border); border-radius:var(--r-lg);
  padding:16px 18px; box-shadow:var(--elev-1); min-width:0; }
.ov-card .home-sec-title { margin:0 0 10px; }
.ov-card-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:6px; }
.ov-card-head .home-sec-title { margin:0; }
.ov-viewall { background:none; border:none; color:var(--accent); font-size:var(--fs-sm); font-weight:600;
  cursor:pointer; padding:4px 6px; border-radius:var(--r-sm); }
.ov-viewall:hover { background:var(--accent-soft); }
.ov-pres-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:12px; }
.ov-pres-cell { display:flex; flex-direction:column; align-items:center; gap:2px; padding:12px 6px;
  background:var(--panel-2); border-radius:var(--r-md); }
.ov-pres-cell .pdot { margin-bottom:2px; }
.ov-pres-n { font-size:20px; font-weight:700; color:var(--text); line-height:1; }
.ov-pres-lb { font-size:var(--fs-xs); color:var(--muted); font-weight:600; }
.ov-status-row { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.ov-stat { display:flex; flex-direction:column; gap:3px; padding:12px 14px; border-radius:var(--r-md);
  background:var(--panel-2); border-inline-start:3px solid var(--muted); }
.ov-stat-open { border-inline-start-color:var(--accent); }
.ov-stat-assigned { border-inline-start-color:var(--ok); }
.ov-stat-reopened { border-inline-start-color:var(--warn); }
.ov-stat-closed { border-inline-start-color:var(--read-gray); }
.ov-stat-n { font-size:20px; font-weight:700; color:var(--text); line-height:1; }
.ov-stat-lb { font-size:var(--fs-xs); color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.03em; }
.ov-recent #home-recent { margin-top:2px; }
.ov-tips .quick-tip { margin-bottom:8px; }
.ov-tips .quick-tip:last-child { margin-bottom:0; }
.nav-item.ov-nav .icon { font-size:15px; }
@media (max-width:1200px){ .welcome-grid.ov-kpis { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:1040px){ .ov-cols { grid-template-columns:1fr; } }
@media (max-width:760px){
  .ov-scroll { padding:16px 12px 24px; overscroll-behavior-y:auto; } /* IT4Y_LC_OV_PTR_2026_07_04: keep root pull-to-refresh chain open on mobile */
  .ov-hero { margin-bottom:14px; }
  .ov-hero-title { font-size:19px; }
  .welcome-grid.ov-kpis { grid-template-columns:1fr 1fr; gap:10px; }
}
@media (max-width:430px){
  .welcome-grid.ov-kpis { gap:8px; }
  .ov-pres-grid, .ov-status-row { gap:8px; }
  .ov-hero-r { width:100%; }
}

/* ── IT4Y_LC_QRSHEET_2026_07_04 ── phone bottom-sheet treatment for the emoji + quick-reply
   pickers. Root cause of the "squished picker" bug: with the soft keyboard open the old
   popover was capped at (visual viewport - 130px) ABOVE the composer ≈ ~190px total → a
   single visible template. The sheet spans the full width, overlays the composer, and its
   height tracks --lc-apph, so search + language tabs + a tall scrollable list stay usable
   at every keyboard state. Dim backdrop is the 100vmax spread shadow — paint-only, so the
   existing outside-click-to-close and Escape handlers keep working unchanged. */
@media (max-width:760px){
  .picker-pop{
    border-radius:16px 16px 0 0;
    border-inline-start:0; border-inline-end:0; border-bottom:0;
    padding:8px 12px max(12px, env(safe-area-inset-bottom));
    gap:8px;
    box-shadow:0 -12px 34px rgba(2,6,23,.35), 0 0 0 100vmax rgba(2,6,23,.38);
    animation:lcSheetIn .18s ease-out;
    z-index:60;
  }
  .picker-pop::before{ content:""; flex:0 0 4px; width:44px; border-radius:999px;
    background:var(--border); align-self:center; }
  .picker-head{ padding-bottom:8px; }
  .picker-close{ min-width:42px; min-height:42px; display:inline-flex;
    align-items:center; justify-content:center; }
  .picker-tab{ padding:9px 14px; min-height:40px; }
  .qr-mgr-open{ min-height:40px; }
  .tpl-search-wrap{ padding:6px 2px; }
  .tpl-search{ font-size:16px; padding:11px 14px; }
  .tpl-list{ gap:8px; }
  .tpl-item{ padding:12px; min-height:48px; }
  .picker-body{ -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
  /* keyboard-open compaction (.lc-kbd = soft keyboard measured open): the visual viewport
     may be ~350px tall, so reclaim sheet chrome for the template list — drop the grab
     handle, single-row scrollable language tabs, tighter gaps. */
  .app.lc-kbd .picker-pop::before{ display:none; }
  .app.lc-kbd .picker-pop{ gap:6px; padding-top:6px; }
  .app.lc-kbd .picker-pop .picker-head{ padding-bottom:4px; }
  .app.lc-kbd .picker-pop .picker-tabs{ flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
  .app.lc-kbd .picker-pop .picker-tabs::-webkit-scrollbar{ display:none; }
  .app.lc-kbd .picker-pop .picker-tab{ white-space:nowrap; flex:0 0 auto; min-height:36px; padding:7px 12px; }
  .app.lc-kbd .picker-pop .tpl-search-wrap{ padding-top:2px; }
  .app.lc-kbd .picker-pop .tpl-item{ padding:9px 12px; min-height:44px; }
}
@keyframes lcSheetIn{ from{opacity:.6; transform:translateY(28px);} to{opacity:1; transform:none;} }

/* ── IT4Y_LC_QRSHEET2_2026_07_04 ── sheet fix-pack 2.
   (1) Language tabs vanished with the keyboard open: overflow-x:auto on .picker-tabs removed
       the flexbox automatic minimum size, so long template content crushed the row to a ~5px
       sliver. Head / tabs / search are now rigid (flex:0 0 auto + min-heights); ONLY the
       .picker-body list absorbs the height pressure and scrolls.
   (2) Compaction: tight type + spacing, 2-line preview clamp on template bodies (insert uses
       the full data-body text, only the on-card preview is clamped) — several templates now
       fit above an active keyboard. Search input stays 16px = iOS no-focus-zoom floor. */
@media (max-width:760px){
  /* 1 — chrome rows are non-negotiable */
  .picker-pop .picker-head, .picker-pop .picker-tabs, .picker-pop .tpl-search-wrap { flex:0 0 auto; }
  .picker-pop .picker-head { min-height:30px; }
  .picker-pop .picker-tabs { min-height:36px; align-items:center; flex-wrap:nowrap;
    overflow-x:auto; scrollbar-width:none; }
  .picker-pop .picker-tabs::-webkit-scrollbar { display:none; }
  .picker-pop .picker-tab { white-space:nowrap; flex:0 0 auto; }
  /* 2 — compact scale */
  .picker-pop { padding:6px 10px max(8px, env(safe-area-inset-bottom)); gap:6px; }
  .picker-pop .picker-title { font-size:13px; }
  .picker-pop .picker-close { min-width:38px; min-height:38px; font-size:16px; padding:2px 6px; }
  .picker-pop .qr-mgr-open { min-height:32px; font-size:12px; padding:4px 10px; }
  .picker-pop .picker-tab { padding:6px 11px; min-height:34px; font-size:12.5px; }
  .picker-pop .tpl-search-wrap { padding:4px 2px; }
  .picker-pop .tpl-search { padding:8px 12px; font-size:16px; }
  .picker-pop .tpl-list { gap:6px; }
  .picker-pop .tpl-item { padding:8px 10px; min-height:44px; }
  .picker-pop .tpl-item .tpl-icon { font-size:16px; }
  .picker-pop .tpl-item .tpl-label { font-size:12px; margin-bottom:1px; }
  .picker-pop .tpl-item .tpl-body { font-size:12.5px; line-height:1.35; white-space:normal;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  /* keyboard-open tier: match/beat the v1 kbd selectors' specificity, appended later so it wins */
  .app.lc-kbd .picker-pop .picker-head { padding-bottom:3px; min-height:28px; }
  .app.lc-kbd .picker-pop .picker-tab { min-height:32px; padding:5px 10px; }
  .app.lc-kbd .picker-pop .tpl-item { padding:7px 10px; min-height:42px; }
  .app.lc-kbd .picker-pop .tpl-search { padding:7px 12px; }
  /* modest idle-state floor so the sheet is never a stub, but list still dominates */
  .picker-pop { min-height:min(40dvh, calc(var(--lc-apph, 100dvh) - 12px)); }
}

/* ── IT4Y_LC_MOBCOMPACT_2026_07_05 ── phone vertical-space compaction. Audited @375x700:
   chrome above the inbox list was 198px and each conversation row 130px (five stacked meta
   lines) -> 4 rows visible; the chat view gave the message scroll only 48% of the screen.
   Everything below is metrics-only (padding/type/line-merges) — no behavior changes. Line
   merges use display:inline-flex siblings inside a display:block parent (a flex-column
   parent puts every child on its own row, which was the original bloat). Tap targets stay
   >=28-42px. Appended last: wins over the earlier <=760 block at equal specificity. */
@media (max-width:760px){
  /* app chrome */
  .app-header{ padding:3px 8px; gap:5px; }
  .app-header .brand{ font-size:13.5px; gap:6px; }
  .p360-hamburger{ width:36px; height:36px; }
  .presence-bar{ padding:2px 8px; gap:5px; flex-wrap:nowrap; overflow-x:auto;
    scrollbar-width:none; align-items:center; min-height:24px; }
  .presence-bar::-webkit-scrollbar{ display:none; }
  .presence-bar > *{ flex:0 0 auto; white-space:nowrap; }
  /* inbox chrome */
  .inbox-toolbar{ padding:5px 12px; }
  .inbox-toolbar .btn{ padding:4px 10px; min-height:28px; font-size:12px; }
  .inbox-search{ padding:6px 12px; }
  .inbox-search input{ padding:7px 11px; font-size:16px; } /* 16px = iOS no-zoom floor */
  /* inbox rows: 130px -> ~90px */
  .inbox-item{ padding:8px 12px; }
  .inbox-item .inbox-body{ display:block; }
  .inbox-item .inbox-row1, .inbox-item .inbox-row3{ display:flex; }
  .inbox-item .who{ font-size:12.5px; overflow:hidden; text-overflow:ellipsis;
    white-space:nowrap; min-width:0; }
  .inbox-item .inbox-country, .inbox-item .inbox-tags{ display:inline-flex;
    vertical-align:middle; margin:0 0 1px; margin-inline-end:6px; }
  .inbox-item .inbox-preview{ padding-top:0; font-size:11.5px;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .inbox-item .inbox-row3{ padding-top:0; }
  /* chat view */
  .chat-header{ padding:5px 10px; gap:4px; }
  .chat-title{ font-size:13.5px; white-space:nowrap; overflow:hidden;
    text-overflow:ellipsis; display:block; }
  .chat-title-block .chat-country, .chat-title-block .chat-meta{ display:inline-flex;
    vertical-align:middle; margin-inline-end:8px; max-width:48%; overflow:hidden; }
  .chat-meta{ white-space:nowrap; text-overflow:ellipsis; }
  .chat-actions{ gap:5px; }
  .chat-actions .btn{ padding:3px 9px; min-height:30px; font-size:12px; }
  .chat-rating-banner{ padding:6px 12px; font-size:12px; }
  .chat-rating-banner *{ line-height:1.3; }
  .msg-scroll{ padding:8px 10px; }
  .msg-row{ margin-bottom:8px; }
  .msg-bubble{ padding:8px 11px; }
  .reply-pane{ padding:8px 8px max(8px, env(safe-area-inset-bottom)); gap:6px; }
  #reply-text, #note-text{ min-height:56px; padding:9px 12px; }
  .reply-send{ width:42px; height:42px; }
  .reply-tool-btn{ width:36px; height:36px; }
}

/* ── IT4Y_LC_DENSITY_2026_07_05 ── platform-wide density pass (desktop + mobile).
   Layer 1: LCDS token re-declaration — compacts all --fs-* / --sp-* consumers at once.
   Layer 2: hardcoded-px hotspots + desktop line-merges. Mobile tier re-asserted at the end
   so phones stay equal-or-tighter than desktop. Legibility floors: body 13px, bubbles 13px,
   16px mobile inputs (iOS zoom), tap targets >=36px mobile. */
:root{
  --fs-xs:10.5px; --fs-sm:11.5px; --fs-md:12.5px; --fs-lg:14px; --fs-xl:16px;
  --sp-1:3px; --sp-2:6px; --sp-3:9px; --sp-4:12px; --sp-5:15px; --sp-6:18px;
  --r-bubble:15px; --sidebar-w:198px;
}
body{ font-size:13px; }
/* app chrome */
.app-header{ padding:6px 12px; gap:8px; }
.presence-bar{ padding:4px 12px; }
.app-sidebar{ padding:10px 6px; }
.nav-item{ padding:7px 10px; gap:8px; }
.nav-label{ padding:6px 10px 3px; }
/* inbox */
.inbox-toolbar{ padding:6px 10px; }
.inbox-search{ padding:7px 10px; }
.inbox-search input{ padding:7px 10px; }
.inbox-item{ padding:8px 12px 8px 10px; }
.inbox-item .inbox-body{ display:block; }
.inbox-item .inbox-row1, .inbox-item .inbox-row3{ display:flex; }
.inbox-item .who{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.inbox-item .inbox-country, .inbox-item .inbox-tags{ display:inline-flex;
  vertical-align:middle; margin:0 0 1px; margin-inline-end:6px; }
.inbox-item .inbox-preview{ padding-top:0; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; }
.inbox-item .inbox-row3{ padding-top:0; }
/* chat viewport */
.chat-header{ padding:7px 12px; }
.chat-title{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; }
.chat-title-block .chat-country, .chat-title-block .chat-meta{ display:inline-flex;
  vertical-align:middle; margin-inline-end:8px; max-width:48%; overflow:hidden; }
.chat-meta{ white-space:nowrap; text-overflow:ellipsis; }
.msg-scroll{ padding:12px 14px; }
.msg-bubble{ padding:8px 12px; font-size:13px; }
.msg-row{ margin-bottom:10px; }
.reply-pane{ padding:8px 10px; }
#reply-text, #note-text{ padding:8px 11px; min-height:40px; }
/* details panel */
.pane-aside .aside{ padding:12px; }
/* home dashboard */
.ov-page .ov-hero{ margin-bottom:12px; }
.ov-hero-title{ font-size:18px; }
.welcome-tile{ padding:10px 12px; }
.ov-scroll{ padding:12px 14px 18px; }
.ov-cols{ gap:12px; }
.welcome-grid.ov-kpis{ gap:9px; }
/* mobile tier: keep phones equal-or-tighter than desktop for everything touched above */
@media (max-width:760px){
  .app-header{ padding:3px 8px; gap:5px; }
  .presence-bar{ padding:2px 8px; }
  .inbox-toolbar{ padding:5px 10px; }
  .inbox-search{ padding:6px 10px; }
  .inbox-search input{ font-size:16px; } /* iOS no-zoom floor */
  .inbox-item{ padding:7px 10px; }
  .chat-header{ padding:4px 8px; }
  .msg-bubble{ padding:7px 10px; }
  .msg-row{ margin-bottom:7px; }
  .msg-scroll{ padding:8px 10px; }
  .reply-pane{ padding:7px 8px max(8px, env(safe-area-inset-bottom)); }
  #reply-text, #note-text{ min-height:52px; padding:9px 12px; font-size:16px; }
}

/* ── IT4Y_LC_QRMGR_VIS_2026_07_05 ── mobile QR sheet decapitation fix.
   The ≤760 bottom sheet's max-height (calc(--lc-apph - 12px), QRSHEET line ~853) let the
   sheet grow tall enough that its TOP rose above the workspace top edge, where
   .workspace{overflow:hidden} clips it — the grab handle and the whole .picker-head row
   ("Quick replies" title, the ✎ Manage button, ✕ close) became invisible AND untappable
   (taps fell through to the presence-bar behind). Triggered once operators grew the
   template library. Cap must reserve the app chrome above the workspace: idle =
   app-header + presence-bar (~75px) + gap; keyboard open (.lc-kbd) hides the presence bar
   and compacts the header. min-height floors lowered to match — min beats max in CSS, so
   an unlowered floor would re-decapitate on short keyboard viewports. .picker-body keeps
   absorbing the height pressure and scrolls; head/tabs/search stay rigid (QRSHEET2). */
@media (max-width:760px){
  .picker-pop{ max-height:calc(var(--lc-apph, 100dvh) - 92px);
               min-height:min(40dvh, calc(var(--lc-apph, 100dvh) - 92px)); }
  .app.lc-kbd .picker-pop{ max-height:calc(var(--lc-apph, 100dvh) - 60px);
               min-height:min(40dvh, calc(var(--lc-apph, 100dvh) - 60px)); }
}
