/* CarVital 2026.11.11.4 */
/* Scoped to VIA's tools; existing screens, navigation and brand assets are preserved. */
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) {
  margin: 14px 0 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) * {
  box-sizing: border-box;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tools,
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-choices,
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-choice {
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  text-align: left;
  overflow-wrap: anywhere;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies)
  .cv-guide-tools
  .cv-guide-choice[aria-pressed='true'] {
  color: #a3d82c;
  border-color: #a3d82c;
  background: #202819;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-panel {
  border: 1px solid #303529;
  border-radius: 14px;
  padding: 12px;
  background: #151911;
  margin-top: 10px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) h4 {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  margin: 10px 0;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) h5 {
  font: inherit;
  font-weight: 600;
  margin: 12px 0 5px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) p,
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) label,
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) summary {
  font-size: 12px;
  line-height: 1.6;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) summary {
  cursor: pointer;
  padding: 10px 0;
  min-height: 44px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-search-row {
  display: flex;
  gap: 7px;
  margin: 8px 0;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) input {
  min-width: 0;
  width: 100%;
  flex: 1;
  font-size: 16px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-search-row .btn {
  min-height: 44px;
  max-width: 48%;
  white-space: normal;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-result {
  border-top: 1px solid #303529;
  margin-top: 12px;
  padding-top: 8px;
  line-height: 1.6;
  font-size: 12px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) a {
  color: #a3d82c;
  text-decoration: underline;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-safety {
  border-left: 3px solid #d9be73;
  padding-left: 10px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-premium {
  margin-top: 12px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-usage {
  margin-top: 8px;
  border-top: 1px solid #303529;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) button:focus-visible,
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) input:focus-visible,
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) summary:focus-visible {
  outline: 2px solid #a3d82c;
  outline-offset: 3px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) button:disabled {
  opacity: 0.55;
  cursor: wait;
}
#ci {
  min-width: 0;
}
@media (max-width: 360px) {
  :is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tools .cv-guide-choice {
    flex: 1 1 42%;
  }
  :is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-panel {
    padding: 10px;
  }
}

:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-via-lamp {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  vertical-align: middle;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) button:has(.cv-via-lamp) {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-via-sound {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 44px;
  margin: 10px 0;
}

#thread .cv-via-chat-avatar {
  display: inline-flex;
  flex: 0 0 auto;
}
#thread .cv-via-chat-avatar .via-bot-mark {
  transform: scaleX(-1);
}

#thread .cv-via-chat-avatar {
  margin-left: 8px;
}
#thread .cv-via-bot-message > .bubble {
  margin-left: 22px;
  max-width: min(82%, calc(100% - 22px));
}

/* Stable groups keep the shortcuts aligned at every phone width. */
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tools {
  display: block;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tool-group + .cv-guide-tool-group {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #303529;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tool-group h4 {
  font-size: 12px;
  color: #b8bfaa;
  margin: 0 0 8px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
:is(#cv-via-tools, #cv-via-followup, #cv-via-replies) .cv-guide-tool-grid .cv-guide-choice {
  width: 100%;
  min-height: 52px;
  margin: 0;
  border-radius: 12px;
  text-align: left;
}

/* Compact branding only inside the VIA conversation. */
#view:has(:is(#cv-via-tools, #cv-via-followup, #cv-via-replies)) .via-poster .via-lockup-reference {
  width: 68%;
  max-width: 220px;
  margin: 4px auto 0;
}
#view:has(:is(#cv-via-tools, #cv-via-followup, #cv-via-replies)) .via-poster .via-features {
  padding: 5px 5px 6px;
  margin-top: 2px;
}
#view:has(:is(#cv-via-tools, #cv-via-followup, #cv-via-replies)) .via-poster .via-features .feat {
  font-size: 9px;
  line-height: 1.2;
  gap: 2px;
  letter-spacing: 0;
}
#view:has(:is(#cv-via-tools, #cv-via-followup, #cv-via-replies))
  .via-poster
  .via-features
  .feat
  svg {
  width: 13px;
  height: 13px;
}

/* Mirror only the robot area; the VIA lettering and ECG keep their direction. */
#view:has(:is(#cv-via-tools, #cv-via-followup, #cv-via-replies))
  .via-poster
  .via-lockup-reference
  > img:first-child {
  clip-path: inset(0 0 0 42%);
}
#view:has(:is(#cv-via-tools, #cv-via-followup, #cv-via-replies))
  .via-poster
  .via-lockup-reference::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  z-index: 1;
  pointer-events: none;
  background: url('/assets/carvital-brand-v26-2/via-brand-banner.webp') left center / 238.095238%
    100% no-repeat;
  transform: scaleX(-1);
}

/* Quiet, branded progress feedback; reduced-motion preferences are respected. */
#thread .via-analysis-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  background: #191c14;
  color: #f4f5ef;
  border: 1px solid #303529;
  margin-left: 22px;
  max-width: calc(100% - 22px);
}
#thread .via-analysis-pending::after {
  content: none;
  animation: none;
}
.cv-via-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 16px;
  color: #aeea2b;
}
.cv-via-thinking-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: cv-via-thinking 1.35s ease-in-out infinite;
  opacity: 0.45;
}
.cv-via-thinking-dots i:nth-child(2) {
  animation-delay: 0.18s;
}
.cv-via-thinking-dots i:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes cv-via-thinking {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cv-via-thinking-dots i {
    animation: none;
    opacity: 0.8;
  }
}

/* Direct shortcuts and a compact account row, scoped to the conversation. */
.cv-via-conversation-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}
.cv-via-conversation-actions .badge {
  font-size: 10px;
  padding: 5px 7px;
  white-space: normal;
}
.cv-via-conversation-actions .btn {
  font-size: 10px;
  line-height: 1.3;
  min-height: 44px;
  padding: 6px 7px;
  min-width: 0;
  white-space: normal;
}
.cv-via-conversation-actions .cv-via-private {
  font-size: 10px;
  min-width: 0;
}
#cv-via-tools {
  margin: 8px 0;
}
#cv-via-tools .cv-guide-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice {
  font-size: 11px;
  text-align: center;
  min-width: 0;
  min-height: 44px;
  padding: 7px 5px;
  border-radius: 11px;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice[aria-pressed='true'] {
  color: #aeea2b;
  background: #202819;
  border-color: #aeea2b;
}
#view:has(#cv-via-tools) .via-poster .via-lockup-reference {
  width: 58%;
  max-width: 180px;
  margin: 0 auto;
}
#view:has(#cv-via-tools) .via-poster .via-features {
  display: none;
}
#view:has(#cv-via-tools) #via-ai-notice {
  font-size: 11px !important;
  line-height: 1.45 !important;
  padding: 8px 10px !important;
  margin: 8px 0 !important;
}
#cv-via-replies {
  margin: 6px 0 10px;
}
#cv-via-replies .cv-guide-followups {
  margin: 0 0 0 22px;
}
#cv-via-replies .cv-guide-choice {
  border-radius: 16px;
  background: #1d2415;
  border-color: #506432;
  color: #e3edce;
}
.cv-via-composer {
  margin-top: 8px;
}
.cv-via-composer input {
  min-height: 44px;
}
#cv-via-followup {
  margin-top: 12px;
}

/* Standard and Premium use the same pill shape and touch height. */
.cv-via-conversation-actions .badge,
.cv-via-conversation-actions .btn {
  border-radius: 999px;
  min-height: 44px;
  box-sizing: border-box;
  line-height: 1.3;
}
.cv-via-conversation-actions .badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
}

#cv-via-tools .cv-guide-shortcuts {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice {
  grid-column: span 2;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice:nth-child(n + 4) {
  grid-column: span 3;
}

/* Smaller controls, with enough spacing to remain easy to target. */
.cv-via-conversation-actions .badge,
.cv-via-conversation-actions .btn {
  min-height: 36px;
  padding: 5px 7px;
  font-size: 10px;
}
#cv-via-tools .cv-guide-shortcuts {
  max-width: 360px;
  margin: 0 auto;
  gap: 5px;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice {
  justify-self: center;
  width: 100%;
  max-width: 112px;
  min-height: 34px;
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.3;
  border-radius: 999px;
}
#cv-via-replies .cv-guide-choice {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 11px;
}

/* Distinguish account actions, reference tools and answers to VIA. */
.cv-via-conversation-actions {
  padding-bottom: 10px;
  border-bottom: 1px solid #303529;
  margin-bottom: 12px;
}
.cv-via-conversation-actions #via-clear-conversation {
  color: #dcb6b6;
  border-color: #604444;
  background: #201a18;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice {
  background: #171b14;
  color: #d9dece;
  border-color: #414738;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice[aria-pressed='true'] {
  color: #aeea2b;
  background: #202819;
  border-color: #aeea2b;
}
#cv-via-replies .cv-guide-reply-group {
  margin-left: 22px;
  border-left: 2px solid #759e26;
  padding-left: 9px;
}
#cv-via-replies .cv-guide-reply-label {
  margin: 0 0 6px;
  color: #bde571;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 600;
}
#cv-via-replies .cv-guide-followups {
  margin: 0;
}
#cv-via-replies .cv-guide-choice {
  background: #29371b;
  color: #e8f5d0;
  border-color: #718b44;
}

/* One compact horizontal row per group; native touch scrolling handles overflow. */
.cv-via-conversation-actions .badge,
.cv-via-conversation-actions .btn {
  border-radius: 6px;
  min-height: 32px;
}
#cv-via-tools .cv-guide-shortcuts {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  max-width: 100%;
  gap: 5px;
  margin: 0;
  padding: 2px 0 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #53613e transparent;
  scroll-padding: 8px;
}
#cv-via-tools .cv-guide-shortcuts .cv-guide-choice {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
}
#cv-via-replies .cv-guide-followups {
  display: flex;
  flex-wrap: nowrap;
  max-width: 100%;
  gap: 5px;
  padding: 2px 0 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #718b44 transparent;
  scroll-padding: 8px;
}
#cv-via-replies .cv-guide-choice {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 11px;
  border-radius: 6px;
}

/* Account actions sit below the exchange, separate from answer choices. */
.cv-via-conversation-actions {
  margin: 14px 0 8px;
  padding: 10px 0 0;
  border-top: 1px solid #303529;
  border-bottom: 0;
}

/* Keep final actions reachable above the persistent mobile navigation. */
#view:has(#cv-via-tools) {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
.cv-via-conversation-actions {
  scroll-margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* Keep the banner intact and separate VIA's speech from its avatar. */
#view:has(#cv-via-tools) .via-poster {
  padding-top: 8px;
  padding-bottom: 5px;
}
#view:has(#cv-via-tools) .via-poster .via-lockup-reference {
  margin: 0 auto;
}
#thread .cv-via-bot-message > .bubble {
  margin-left: 38px;
  max-width: calc(100% - 50px);
}
#thread .via-analysis-pending {
  margin-left: 38px;
  max-width: calc(100% - 50px);
}
#cv-via-replies .cv-guide-reply-group {
  margin-left: 38px;
}
/* Readable inset for counters, legal notices and account controls. */
#cv-via-followup {
  padding-left: 14px;
  padding-right: 14px;
}
.cv-via-conversation-actions {
  margin-left: 12px;
  margin-right: 12px;
}

/* Keep the account counter visible directly below the usage heading. */
#cv-via-followup .cv-guide-usage-counter {
  display: block;
  margin-top: 5px;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted, #b9c1ad);
}

/* Fill the space above the menu, letting the conversation grow naturally. */
.phone:has(#cv-via-tools) {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 28px);
  max-height: 100dvh;
}
#view:has(#cv-via-tools) {
  flex: 1 1 auto;
  min-height: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0;
}
#view > .screen:has(#cv-via-tools) {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 6px;
}
#view > .screen:has(#cv-via-tools) > * {
  flex-shrink: 0;
}
#view > .screen:has(#cv-via-tools) > .back {
  align-self: flex-start;
}
#view:has(#cv-via-tools) #thread {
  flex: 1 0 auto;
}
.cv-via-chat-bottom {
  margin-top: auto;
  padding-top: 18px;
  min-width: 0;
}
.cv-via-chat-bottom .cv-via-conversation-actions {
  margin-top: 8px;
  margin-bottom: 0;
  scroll-margin-bottom: 6px;
}
.phone:has(#cv-via-tools) > #nav {
  position: relative;
  inset: auto;
  flex: 0 0 auto;
}
@media (max-width: 700px), (max-height: 480px) and (pointer: coarse) {
  .phone:has(#cv-via-tools) {
    height: 100dvh;
  }
}

/* Reserve free height for messages; keep the complete reply block together at the bottom. */
#view:has(#cv-via-tools) #thread {
  flex: 1 0 auto;
  min-height: 0 !important;
}
.cv-via-chat-bottom {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 12px;
}
.cv-via-chat-bottom > * {
  flex-shrink: 0;
}
.cv-via-chat-bottom #cv-via-followup {
  margin-bottom: 6px;
}
.cv-via-chat-bottom .cv-via-conversation-actions {
  margin-top: 4px;
  padding-top: 10px;
}
/* Use the existing back navigation on the brand row, only in VIA. */
#view:has(#cv-via-tools) .persistent-brand-bar {
  gap: 6px;
}
#view:has(#cv-via-tools) .cv-via-inline-back {
  position: static;
  inset: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  background: transparent;
}
#view:has(#cv-via-tools) .cv-via-inline-back > button {
  min-width: 0;
  max-width: 90px;
  padding: 6px 8px !important;
  font-size: 11px;
  white-space: nowrap !important;
}

#view:has(#cv-via-tools) .cv-via-current-label {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #303529;
  font-size: 11px;
}

/* One compact disclosure row, with the live account counter at the right. */
#cv-via-followup .cv-guide-usage > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  list-style: none;
}
#cv-via-followup .cv-guide-usage > summary::-webkit-details-marker {
  display: none;
}
#cv-via-followup .cv-guide-usage > summary::before {
  content: '▸';
  font-size: 11px;
}
#cv-via-followup .cv-guide-usage[open] > summary::before {
  content: '▾';
}
#cv-via-followup .cv-guide-usage-counter {
  display: inline;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* A discreet right arrow below the last reference tool; swipe still works. */
#cv-via-tools .cv-guide-scroll-next {
  display: block;
  margin: 0 0 0 auto;
  width: 32px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bde571;
  font: 18px/24px system-ui;
  cursor: pointer;
}
#cv-via-tools .cv-guide-scroll-next[hidden] {
  display: none;
}
#cv-via-tools .cv-guide-scroll-next:disabled {
  opacity: 0.35;
  cursor: default;
}
#cv-via-tools .cv-guide-scroll-next:focus-visible {
  outline: 2px solid #bde571;
  outline-offset: 1px;
}
/* Reply choices share the composer's left edge, giving the final choice room. */
#cv-via-replies .cv-guide-reply-group {
  margin-left: 0;
  min-width: 0;
}
#cv-via-replies .cv-guide-followups {
  min-width: 0;
  scroll-padding-inline: 4px;
}

/* Optional private follow-up: same VIA colours and compact controls. */
#cv-via-outcomes {
  min-width: 0;
  margin: 6px 0 8px;
}
.cv-outcome-box {
  border: 1px solid #343b2b;
  border-radius: 12px;
  padding: 10px 12px;
  background: #15190f;
  font-size: 12px;
  line-height: 1.5;
}
.cv-outcome-box summary {
  cursor: pointer;
  color: #e2ebd2;
  min-height: 28px;
  display: list-item;
}
.cv-outcome-box p {
  margin: 8px 0;
}
.cv-outcome-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cv-outcome-btn {
  font-size: 11px !important;
  padding: 7px 10px !important;
  min-height: 36px;
  white-space: normal;
  max-width: 100%;
}
.cv-outcome-item {
  border-top: 1px solid #343b2b;
  margin-top: 10px;
  padding-top: 5px;
}
.cv-outcome-field {
  display: block;
  margin: 9px 0;
}
.cv-outcome-field select,
.cv-outcome-field input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 16px;
  margin-top: 4px;
}
.cv-outcome-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0;
}
.cv-outcome-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 3px;
}
.cv-outcome-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Dedicated reference library: existing CarVital typography, colours and controls. */
.cv-reference-shortcuts {
  min-width: 0;
  margin: 4px 0 0;
}
.cv-reference-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #53613e transparent;
  scroll-padding: 8px;
  padding: 2px 0 6px;
}
.cv-reference-row > .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 6px;
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  text-align: center;
}
.cv-reference-row > .btn[aria-pressed='true'] {
  color: #aeea2b;
  background: #202819;
  border-color: #aeea2b;
}
.cv-reference-scroll-next {
  display: block;
  margin: 0 0 0 auto;
  width: 32px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bde571;
  font: 18px/24px system-ui;
  cursor: pointer;
}
.cv-reference-scroll-next[hidden] {
  display: none;
}
.cv-reference-scroll-next:disabled {
  opacity: 0.35;
  cursor: default;
}
.cv-reference-scroll-next:focus-visible {
  outline: 2px solid #bde571;
  outline-offset: 1px;
}
#cv-via-library {
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
#cv-via-library * {
  box-sizing: border-box;
}
#cv-via-library .cv-reference-filter {
  display: grid;
  gap: 7px;
  margin: 4px 0 12px;
}
#cv-via-library label {
  display: grid;
  gap: 6px;
  font-size: 12px;
}
#cv-via-library input,
#cv-via-library select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  font-size: 16px;
}
#cv-via-library .cv-reference-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
#cv-via-library .cv-reference-card {
  min-width: 0;
  border: 1px solid #303529;
  border-radius: 12px;
  background: #151911;
  padding: 12px;
}
#cv-via-library .cv-reference-theme {
  margin: 0;
  font-size: 11px;
}
#cv-via-library .cv-reference-title,
#cv-via-library h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font: inherit;
  font-weight: 700;
  margin: 5px 0 10px;
}
#cv-via-library .cv-via-lamp {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}
#cv-via-library .cv-via-sound {
  width: 100%;
  height: 44px;
  margin: 8px 0;
  display: block;
}
#cv-via-library .btn {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  font-size: 12px;
}
#cv-via-library a {
  color: #a3d82c;
}
#cv-via-library :is(button, input, select, summary):focus-visible {
  outline: 2px solid #a3d82c;
  outline-offset: 3px;
}
#view:has(#cv-via-library) {
  padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px));
}

#view:has(#cv-via-library) .persistent-brand-bar {
  gap: 6px;
}
#view:has(#cv-via-library) .cv-via-inline-back {
  position: static;
  inset: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  background: transparent;
}
#view:has(#cv-via-library) .cv-via-inline-back > button {
  min-width: 0;
  max-width: 90px;
  padding: 6px 8px !important;
  font-size: 11px;
  white-space: nowrap !important;
}

/* Keep account actions immediately above the app menu while the conversation scrolls. */
.phone > .cv-via-conversation-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 18px;
  min-width: 0;
  background: #0b0d08;
  border-top: 1px solid #303529;
}
#cv-via-tools:empty {
  margin: 0;
}

#cv-via-library select {
  background: #151911;
  color: #f4f5ef;
  border: 1px solid #414738;
  border-radius: 8px;
  padding: 8px;
}

/* Compact rectangular entries inside each section, one readable item per row. */
#cv-via-library .cv-reference-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 3px;
  min-height: 58px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow-wrap: anywhere;
}
#cv-via-library .cv-reference-tile .cv-reference-theme {
  grid-column: 1;
  grid-row: 1;
  font-size: 10px;
  line-height: 1.3;
}
#cv-via-library .cv-reference-tile .cv-reference-title {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
}
#cv-via-library .cv-reference-tile .cv-via-lamp {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
}
#cv-via-library .cv-reference-open {
  grid-column: 2;
  grid-row: 1/3;
  color: #aeea2b;
  font-size: 11px;
  white-space: nowrap;
}
#cv-via-library .cv-reference-row > .btn {
  min-height: 32px;
  font-size: 11px;
  white-space: nowrap;
}

/* Warning colours are semantic, limited to the warning symbol and its row. */
#cv-via-library [data-lamp-color='red'] {
  --cv-lamp-color: #ff8c88;
}
#cv-via-library [data-lamp-color='orange'] {
  --cv-lamp-color: #f4bb56;
}
#cv-via-library [data-lamp-color='green'] {
  --cv-lamp-color: #72d694;
}
#cv-via-library [data-lamp-color='blue'] {
  --cv-lamp-color: #82bdff;
}
#cv-via-library [data-lamp-color] {
  border-left: 3px solid var(--cv-lamp-color);
}
#cv-via-library [data-lamp-color] .cv-via-lamp {
  color: var(--cv-lamp-color);
}
#cv-via-library .cv-lamp-severity {
  font-weight: 700;
  color: #eee;
}
#cv-via-library .cv-lamp-severity[data-severity='critical'] {
  color: #ff8c88;
}
#cv-via-library .cv-lamp-severity[data-severity='high'] {
  color: #f4bb56;
}

/* Encyclopedia: compact, expandable themes with their own result count. */
#cv-via-library .cv-reference-groups {
  display: grid;
  gap: 8px;
  min-width: 0;
}
#cv-via-library .cv-reference-group {
  min-width: 0;
  border: 1px solid #35402b;
  border-radius: 8px;
  background: #151b11;
  overflow: hidden;
}
#cv-via-library .cv-reference-group > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 750;
  color: #e8eedf;
}
#cv-via-library .cv-reference-group > summary::-webkit-details-marker {
  display: none;
}
#cv-via-library .cv-reference-group > summary > span:first-child {
  flex: 1;
  min-width: 0;
}
#cv-via-library .cv-reference-group-count {
  font-size: 11px;
  font-weight: 500;
  color: #a5b099;
  white-space: nowrap;
}
#cv-via-library .cv-reference-group-arrow {
  font-size: 22px;
  line-height: 1;
  color: #aeea2b;
  flex: none;
}
#cv-via-library .cv-reference-group[open] > summary {
  color: #aeea2b;
  border-bottom: 1px solid #35402b;
}
#cv-via-library .cv-reference-group[open] .cv-reference-group-arrow {
  transform: rotate(90deg);
}
#cv-via-library .cv-reference-group > .cv-reference-results {
  padding: 8px;
}

/* Sounds sit inside relevant encyclopedia entries, collapsed until requested. */
.cv-entry-sounds {
  margin-top: 14px;
  border-top: 1px solid var(--line, #30382b);
  padding-top: 8px;
}
.cv-entry-sound {
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--line, #30382b);
  border-radius: 8px;
}
.cv-entry-sound > summary {
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 0;
}
.cv-entry-sound .cv-via-sound {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 8px 0;
}
.cv-entry-sound > .btn {
  font-size: 12px;
  padding: 8px 10px;
}

.cv-entry-signs {
  margin: 6px 0 12px;
  padding-left: 20px;
}
.cv-entry-signs li {
  margin: 4px 0;
}
.cv-entry-more {
  margin-top: 12px;
  border-top: 1px solid var(--line, #30382b);
  padding-top: 10px;
}
.cv-entry-more > summary {
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Identical legal headings; confidentiality remains expandable without a marker. */
.cv-menu-legal-link {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 14px 16px !important;
  text-align: left;
  font-family: inherit;
  font-size: 13px !important;
  font-weight: 750 !important;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cv-menu-confidentiality > summary {
  list-style: none;
}
.cv-menu-confidentiality > summary::-webkit-details-marker {
  display: none;
}
.cv-menu-confidentiality > summary::marker {
  content: '';
}

/* VIA layout 2026.10.24.5. Blue-grey reference navigation is separate from chat choices. */
#view .cv-reference-shortcuts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0;
  margin: 0 0 8px;
}
#view .cv-reference-shortcuts .cv-reference-row {
  display:flex!important;flex-wrap:wrap!important;overflow:visible!important;
  white-space:normal!important;gap:8px;padding:2px;min-width:0;max-width:100%;box-sizing:border-box;
}
#view .cv-reference-shortcuts .cv-reference-row > .btn {
  flex:1 1 100px!important;min-width:0!important;max-width:100%;min-height:44px!important;
  padding:8px 10px;border:1px solid #7186a7;border-radius:8px;
  background:linear-gradient(145deg,#30445f,#22334b);color:#f0f5ff;
  white-space:normal!important;overflow-wrap:anywhere;line-height:1.4;height:auto;
}
#view .cv-reference-shortcuts .cv-reference-row > .btn:hover {
  background: #3a526f;
  border-color: #abc8ef;
}
#view
  .cv-reference-shortcuts
  .cv-reference-row
  > .btn:is([aria-pressed='true'], [aria-expanded='true']) {
  background: #425d80;
  border-color: #c5dcff;
  color: #fff;
}
#view .cv-reference-shortcuts .cv-reference-row > .btn:focus-visible {
  outline: 2px solid #c5dcff;
  outline-offset: 2px;
}
#view .cv-reference-shortcuts .cv-reference-scroll-next {
  display: inline-grid !important;
  place-items: center;
  justify-self: end;
  width: 36px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #c5dcff;
  font-size: 19px;
  line-height: 24px;
}
#view .cv-reference-shortcuts .cv-reference-scroll-next[hidden] {
  display: none !important;
}
#view .cv-via-memory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 2px;
}
#view .cv-via-library-label {
  margin: 0;
  color: #c7d8ef;
  font-size: 12px;
  font-weight: 600;
}
/* Safety stays one tap away, outside the horizontally scrolling resources. */
#view .cv-via-safety-link {
  flex: 0 1 auto;
  min-height: 32px;
  padding: 3px 0 3px 8px;
  border: 0;
  background: transparent;
  color: #f0c2a5;
  font: inherit;
  font-size: 11px;
  text-align: right;
  cursor: pointer;
}
#view .cv-via-safety-link:focus-visible,
#view .cv-via-vehicle-switch:focus-visible {
  outline: 2px solid #c5dcff;
  outline-offset: 2px;
}
/* The avatar and message bubbles float directly on the page, without a second frame. */
#view:has(#thread) .via-poster {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#view:has(#thread) .via-poster .via-lockup-reference {
  width: 37%;
  max-width: 125px;
}
#view:has(#thread) #via-ai-notice {
  background: transparent !important;
  border: 0 !important;
  color: #b6bdad !important;
  padding: 0 !important;
  margin: 4px 0 2px !important;
}
#view .cv-via-conversation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid #49533f;
}
#view:has(#cv-via-tools) .cv-via-conversation-heading .cv-via-current-label {
  margin: 0;
  padding: 0;
  border: 0;
  color: #f3f6ed;
  font-size: 15px;
  font-weight: 700;
}
#view .cv-via-vehicle-switch {
  flex: 0 0 auto;
  max-width: 44%;
  min-height: 32px;
  padding: 3px 0 3px 6px;
  border: 0;
  background: transparent;
  color: #b9c3ad;
  font: inherit;
  font-size: 11px;
  text-align: right;
  cursor: pointer;
}
#view #thread {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  margin-top: 4px !important;
}
#view #cv-via-regulation:not([hidden]) {
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid #607b9d;
  border-radius: 12px;
  background: #162335;
  color: #eef4ff;
}
.cv-regulation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cv-regulation-close {
  min-height: 44px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: #d7e5f9;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.cv-regulation-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}
#view .cv-regulation-choices > .btn {
  border-color: #607b9d;
  background: #26394f;
  color: #eef4ff;
  font-size: 12px;
}

/* Only initial choices collapse; contextual answers remain directly accessible. */
#cv-via-replies .cv-guide-more {
  min-width: 0;
  flex: 0 0 auto;
}
#cv-via-replies .cv-guide-more > summary {
  min-height: 36px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid #70844e;
  border-radius: 6px;
  color: #eef5e1;
  background: #28351b;
  font-size: 11px;
  cursor: pointer;
  list-style: none;
}
#cv-via-replies .cv-guide-more > summary::-webkit-details-marker {
  display: none;
}
#cv-via-replies .cv-guide-more > summary::after {
  content: '+';
}
#cv-via-replies .cv-guide-more[open] {
  flex-basis: 100%;
}
#cv-via-replies .cv-guide-more[open] > summary::after {
  content: '−';
}
#cv-via-replies .cv-guide-more > summary:focus-visible {
  outline: 2px solid #aeea2b;
  outline-offset: 2px;
}
#cv-via-replies .cv-guide-more-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}
#cv-via-replies .cv-guide-more-choices > .btn {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
}

/* VIA SMS layout 2026.10.24.6: only the conversation scrolls; reply controls stay put. */
.phone:has(#cv-via-chat-scroll) {
  height: calc(var(--cv-dialog-visible-height, 100dvh) - 28px);
}
#view:has(#cv-via-chat-scroll) {
  overflow: hidden;
}
#view > .screen:has(#cv-via-chat-scroll) {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
#view > .screen > .cv-via-chat-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #53613e transparent;
  scroll-padding-block: 12px;
}
.cv-via-chat-scroll > * {
  flex-shrink: 0;
}
#view:has(#cv-via-chat-scroll) #thread {
  padding-bottom: clamp(32px, 5dvh, 64px);
}
#view:has(#cv-via-chat-scroll) .cv-via-chat-bottom {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: 8px;
  background: var(--bg, #090b07);
  border-top: 1px solid #303529;
}
#view #cv-via-replies .cv-guide-choice {
  min-height: 36px !important;
  padding: 5px 9px;
}
/* Only quick answers and the input belong in the fixed area. Keep it about two rows. */
#view:has(#cv-via-chat-scroll) #cv-via-replies {
  margin: 0 0 6px;
  max-height: min(120px, 20dvh);
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
#view:has(#cv-via-chat-scroll) #cv-via-replies:empty {
  display: none;
}
#view:has(#cv-via-chat-scroll) .cv-guide-reply-label {
  display: none;
}
#view:has(#cv-via-chat-scroll) .cv-guide-reply-group {
  padding: 0;
  border: 0;
}
#view:has(#cv-via-chat-scroll) .cv-guide-followups {
  margin: 0;
  padding: 0;
}
#view:has(#cv-via-chat-scroll) .cv-via-composer {
  margin-top: 0;
}
#view:has(#cv-via-chat-scroll) #cv-via-followup {
  margin: 0 0 4px;
  padding: 0;
}
#view:has(#cv-via-chat-scroll) .cv-guide-usage > summary {
  min-height: 28px;
  padding: 4px 0;
}
@media (max-width: 700px), (max-height: 480px) and (pointer: coarse) {
  .phone:has(#cv-via-chat-scroll) {
    height: var(--cv-dialog-visible-height, 100dvh);
  }
}

/* 2026.11.11.4: every chat region can shrink; long words and secondary actions wrap. */
.phone:has(#thread),#view:has(#thread),#view:has(#thread)>.screen,
#cv-via-chat-scroll,#thread,#thread>*,.cv-via-chat-bottom,.cv-via-conversation-actions{
 min-width:0;max-width:100%;box-sizing:border-box;
}
#thread .bubble{min-width:0;max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal}
#thread .bubble :is(p,span,a,strong,em,li){max-width:100%;overflow-wrap:anywhere}
#view :is(.cv-via-conversation-heading,.cv-via-memory-heading){flex-wrap:wrap;min-width:0}
#view .cv-via-conversation-heading>*{min-width:0;max-width:100%;overflow-wrap:anywhere}
#view .cv-via-vehicle-switch{flex:0 1 auto;min-height:44px;max-width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.4;padding:8px 0}
#view .cv-via-safety-link{min-height:44px;white-space:normal;overflow-wrap:anywhere}
.phone>.cv-via-conversation-actions{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}
.phone>.cv-via-conversation-actions>*{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.phone>.cv-via-conversation-actions button{height:auto;min-height:44px;line-height:1.4}
#view .cv-reference-shortcuts .cv-reference-scroll-next{display:none!important}
