/* Version 23 — the grouped left menu, and client conversations (Messages page, lead drawer, job overview). */

/* ---------- Left menu: groups that open and close ---------- */
.nav-menu { gap: 3px; }
.nav-group.is-hidden { display: none; }
.nav-group-toggle { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 12px; padding: 0 13px; border: 0; border-radius: 12px; color: #aeb9c9; background: transparent; font: inherit; font-size: 14px; font-weight: 750; text-align: left; cursor: pointer; }
.nav-group-toggle:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-group-toggle:focus-visible, .nav-subitem:focus-visible, .nav-item:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.nav-group.holds-active > .nav-group-toggle { color: #fff; }
.nav-group-label { flex: 1; }
.nav-caret { width: 8px; height: 8px; margin-right: 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .7; transform: rotate(-45deg); transition: transform .16s ease; }
.nav-group.is-open .nav-caret { transform: rotate(45deg) translate(-2px, -2px); }
.nav-sub { display: grid; gap: 1px; margin: 1px 0 8px 24px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-sub[hidden] { display: none; }
.nav-item.nav-subitem { min-height: 38px; padding: 0 11px; border-radius: 9px; font-size: 13px; font-weight: 650; }
.nav-item.nav-subitem.is-active { position: relative; color: #fff; background: rgba(201,29,50,.9); box-shadow: none; }
.nav-group-toggle b, .nav-item b[data-unread-badge] { min-width: 20px; margin-left: auto; padding: 2px 6px; border-radius: 999px; color: #101827; background: var(--gold); font-size: 10.5px; font-weight: 900; text-align: center; }
.nav-group-toggle b[hidden], .nav-item b[hidden] { display: none; }
.nav-group.is-open > .nav-group-toggle b { display: none; } /* the count shows on Messages itself once the group is open */
.mobile-bottom-nav button { position: relative; }
.mobile-bottom-nav button b[data-unread-badge] { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; padding: 1px 5px; border-radius: 999px; color: #fff; background: var(--red); font-size: 9.5px; line-height: 1.3; }
.mobile-bottom-nav button b[hidden] { display: none; }
.mobile-bottom-nav .mobile-menu-button { color: #4c5a6e; }
@media (max-width: 760px) { .mobile-bottom-nav { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(0, 1fr); } }

/* ---------- One conversation ---------- */
.vcf-conversation { display: flex; min-width: 0; flex-direction: column; gap: 0; }
.cv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.cv-head h3 { margin: 0; font-size: 17px; }
.cv-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cv-head-actions { display: flex; flex-shrink: 0; gap: 12px; }
.cv-flag { display: inline-block; padding: 0 6px; border-radius: 6px; background: #fdecee; color: var(--red-dark); font-size: 11px; font-weight: 800; }
.cv-compact-title { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8b97a8; }
.cv-unread-count { padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #101827; letter-spacing: 0; text-transform: none; font-size: 11px; font-weight: 900; }
.cv-scroll { max-height: min(62vh, 620px); overflow-y: auto; overscroll-behavior: contain; padding: 6px 14px 14px; background: #f7f8fb; }
.vcf-conversation:not(.messages-thread) .cv-scroll { border: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.cv-timeline { display: flex; margin: 0; padding: 0; flex-direction: column; gap: 8px; list-style: none; }
.cv-day, .cv-new { display: flex; justify-content: center; margin: 10px 0 2px; }
.cv-day span { padding: 3px 10px; border-radius: 999px; background: #e7ebf1; color: #4d5a6d; font-size: 11px; font-weight: 800; }
.cv-new { align-items: center; gap: 8px; color: var(--red); font-size: 11px; font-weight: 900; }
.cv-new::before, .cv-new::after { content: ""; flex: 1; height: 1px; background: rgba(201,29,50,.35); }
.cv-text { display: flex; max-width: min(78%, 520px); flex-direction: column; gap: 3px; }
.cv-text.is-in { align-self: flex-start; }
.cv-text.is-out { align-self: flex-end; align-items: flex-end; }
.cv-bubble { padding: 9px 12px; border-radius: 16px; font-size: 14px; line-height: 1.42; overflow-wrap: anywhere; }
.cv-bubble p { margin: 0; white-space: pre-wrap; }
.cv-text.is-in .cv-bubble { border: 1px solid var(--line); border-bottom-left-radius: 5px; background: #fff; color: var(--ink); }
.cv-text.is-out .cv-bubble { border-bottom-right-radius: 5px; background: var(--navy-2); color: #f3f6fb; }
.cv-text.has-problem .cv-bubble { box-shadow: 0 0 0 2px var(--red); }
.cv-text small { padding: 0 4px; color: var(--muted); font-size: 11px; }
.cv-text.has-problem small { color: var(--red-dark); font-weight: 700; }
.cv-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.cv-photos:last-child { margin-bottom: 0; }
.cv-photos img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; background: #e5e9ef; object-fit: cover; }
.cv-photo-missing { padding: 18px 12px; border-radius: 10px; background: #eef1f5; color: var(--muted); font-size: 12px; }
.cv-event { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 2px auto; padding: 6px 12px; border-radius: 12px; color: #435065; font-size: 12.5px; font-weight: 650; text-align: center; }
.cv-event-icon { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: #e6eaf0; color: #2c3a50; font-size: 12px; font-weight: 900; }
.cv-event.is-missed .cv-event-icon, .cv-event.is-failed .cv-event-icon { background: #fde3e6; color: var(--red-dark); }
.cv-event.is-voicemail .cv-event-icon { background: #fff2c2; color: #7a5200; }
.cv-event.is-voicemail { background: #fffaf0; }
.cv-event audio { width: min(100%, 300px); height: 36px; }
.cv-empty, .cv-loading, .cv-error, .cv-note { margin: 0; padding: 14px 4px; color: var(--muted); font-size: 13px; }
.cv-error { color: var(--red-dark); font-weight: 700; }
.cv-error:empty { display: none; }
.cv-note { padding: 12px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: #fff; }
.messages-thread .cv-note { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.cv-note.is-warning { color: var(--red-dark); font-weight: 700; }
.cv-compose { display: grid; gap: 8px; padding: 10px 12px 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: #fff; }
.messages-thread .cv-compose { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.cv-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.cv-field { flex: 1; min-width: 0; }
.cv-field textarea { display: block; width: 100%; min-height: 46px; max-height: 180px; padding: 11px 13px; border: 1px solid var(--line-dark); border-radius: 14px; font: inherit; font-size: 15px; line-height: 1.4; resize: vertical; }
.cv-field textarea:focus-visible { outline: 3px solid rgba(244,196,48,.6); outline-offset: 1px; border-color: var(--ink); }
.cv-compose-row .button { min-height: 46px; padding-inline: 20px; }
.cv-compose-meta { margin: 0; color: var(--muted); font-size: 11px; }
.cv-consent { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #fff8e0; color: #5c4300; font-size: 13px; font-weight: 700; }
.cv-consent input { width: 18px; height: 18px; }
.cv-number { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; color: var(--muted); }
.cv-number select { min-height: 36px; padding: 0 10px; border: 1px solid var(--line-dark); border-radius: 9px; font: inherit; color: var(--ink); }

/* ---------- The Messages page ---------- */
.messages-layout { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.messages-list-pane { display: grid; gap: 10px; min-width: 0; }
.messages-list-pane .search-box { width: 100%; }
.messages-list { display: grid; gap: 4px; max-height: calc(100vh - 250px); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.msg-item { display: grid; gap: 3px; padding: 11px 13px; border: 1px solid transparent; border-radius: 13px; color: var(--ink); text-decoration: none; }
.msg-item:hover { background: #fff; border-color: var(--line); }
.msg-item.is-active { background: #fff; border-color: var(--ink); box-shadow: var(--shadow-sm); }
.msg-item:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.msg-item-top, .msg-item-bottom { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.msg-item-top strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.msg-item-top time { flex-shrink: 0; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.msg-preview { overflow: hidden; color: #4d5a6d; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.msg-item.is-unread .msg-preview { color: var(--ink); font-weight: 750; }
.msg-unread { flex-shrink: 0; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; text-align: center; }
.msg-kind { color: #8b97a8; font-size: 11px; font-weight: 700; }
.msg-empty { padding: 18px 6px; color: var(--muted); font-size: 13px; }
.messages-thread { min-width: 0; padding: 0; overflow: hidden; }
.messages-thread .cv-scroll { max-height: calc(100vh - 340px); min-height: 280px; }
.msg-pick { padding: 40px 20px; text-align: center; }
.messages-back { display: none; margin-bottom: 8px; }
@media (max-width: 860px) {
  .messages-layout { grid-template-columns: minmax(0, 1fr); }
  .messages-layout .messages-thread-pane { display: none; }
  .messages-layout.has-selection .messages-list-pane { display: none; }
  .messages-layout.has-selection .messages-thread-pane { display: block; }
  .messages-back { display: inline-flex; }
  .messages-list { max-height: none; }
  .messages-thread .cv-scroll { max-height: calc(100dvh - 330px); }
  .cv-text { max-width: 88%; }
}

/* Lead drawer: a jump to the conversation next to Call */
.lead-quick { display: flex; flex-wrap: wrap; gap: 8px; }
#leadTexts b { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #101827; font-size: 11px; }
#leadTexts b[hidden] { display: none; }

/* Phones: the top bar already says "Messages"; give the conversation the room. */
@media (max-width: 860px) {
  .messages-page .page-toolbar p, .messages-page .page-toolbar h2 { display: none; }
  .messages-page .page-toolbar { margin-bottom: 10px; }
  .messages-page:has(.messages-layout.has-selection) .page-toolbar { display: none; }
}

/* Inside a job panel the panel's own paragraph colors don't apply to the bubbles. */
.vcf-conversation .cv-bubble p { margin: 0; color: inherit; font-size: inherit; line-height: inherit; }
.vcf-conversation .cv-text small { margin: 0; }
