/* Paradise Valley Ask PV v5 — landing + widget component styles. */
/* Extracted by tools/build_v5_assets.py from the design artifact,    */
/* with .util-bar removed and V5 production extensions appended.      */
:root {
    /* v5 — MAXIMUM CONTRAST palette (WCAG AAA target, 7:1+) */
    /* All color text on white reads at ≥10:1. */
    --pv-blue: #002F7A;       /* 11.5:1 on white */
    --pv-blue-deep: #001F54;  /* 16:1 on white */
    --pv-blue-darker: #00173F;
    --pv-blue-soft: #0048B8;  /* 8.6:1 on white */
    --pv-blue-tint: #CFDEF7;
    --pv-green: #1F5A08;      /* 8.5:1 on white */
    --pv-green-deep: #0F3A00;
    --pv-amber: #6B3F00;      /* 8:1 on white */

    /* Neutrals — pure, not tinted */
    --bg: #FFFFFF;
    --bg-alt: #F0F0F0;        /* solid grey, no blue tint */
    --bg-tint: #E0E0E0;
    --ink: #000000;           /* pure black — 21:1 */
    --ink-2: #0A0A0A;
    --ink-dim: #2B2B2B;       /* 13:1 on white */
    --line: #000000;          /* borders are always visible */
    --line-strong: #000000;

    --shadow-deep: 0 40px 80px -24px rgba(0, 0, 0, 0.45), 0 8px 24px -8px rgba(0,0,0,0.25);
    --shadow-med: 0 14px 40px -12px rgba(0,0,0,0.35), 0 4px 12px -4px rgba(0,0,0,0.2);
    --shadow-soft: 0 4px 12px -4px rgba(0,0,0,0.25);

    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;

    --hit: 56px;
    --font-base: 21px;
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    line-height: 1.65;
    font-size: 20px;
  }

  /* ===== a11y ===== */
  .skip-link {
    position: absolute; top: -100px; left: 16px;
    background: var(--pv-blue); color: #fff;
    padding: 12px 20px; border-radius: 8px;
    z-index: 9999; text-decoration: none; font-weight: 600;
    transition: top 0.2s;
  }
  .skip-link:focus { top: 16px; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
  }
  :focus-visible {
    outline: 2px solid var(--pv-blue);
    outline-offset: 3px;
    border-radius: 4px;
  }

  /* =======================================================
     ================ HOST PAGE (.gov-style) =================
     ======================================================= */

  

  /* Main nav */
  .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 10;
  }
  .nav-logo {
    height: 44px;
    width: auto;
    display: block;
  }
  .nav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 6px 12px;
    width: 220px;
    font-size: 13px;
    color: var(--ink-dim);
  }
  .nav-search input {
    border: none; outline: none; background: transparent;
    flex: 1; font-family: inherit; font-size: 13px;
  }

  /* Hero — photograph + brand-blue gradient wash */
  .hero {
    position: relative;
    min-height: 560px;
    display: flex;
    /* Top-align hero content so the badge + h1 sit near the nav instead of
       centering vertically inside the 560px min-height band. */
    align-items: flex-start;
    overflow: hidden;
    isolation: isolate;
  }
  .hero-image {
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
      linear-gradient(105deg, rgba(0, 23, 63, 0.92) 0%, rgba(0, 31, 84, 0.82) 45%, rgba(0, 47, 122, 0.55) 70%, rgba(0, 47, 122, 0.35) 100%),
      /* Photographic desert placeholder — layered radial gradients */
      radial-gradient(ellipse 80% 60% at 80% 30%, #C9946A 0%, transparent 50%),
      radial-gradient(ellipse 60% 50% at 30% 70%, #8B5A3C 0%, transparent 55%),
      radial-gradient(ellipse 100% 60% at 50% 100%, #3B2418 0%, transparent 60%),
      linear-gradient(180deg, #E8C89C 0%, #C9946A 30%, #8B5A3C 60%, #4A2C1F 100%);
  }
  .hero-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0 0.08 0 0 0 0.3 0'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
    mix-blend-mode: overlay;
    opacity: 0.7;
  }

  /* Camelback silhouette SVG */
  .hero-mountains {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 58%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.92;
  }
  .hero-mountains svg { width: 100%; height: 100%; display: block; }

  .hero-content {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    /* Top padding trimmed 80 -> 32 to pull text up toward the nav.
       Bottom padding kept at 90 so the dark hero band retains its
       presence (hero min-height still 560px). */
    padding: 32px 40px 90px;
    width: 100%;
    color: #fff;
  }
  .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.14);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.25);
    padding: 8px 14px;
    border-radius: 99px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 28px;
  }
  .hero-badge .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--pv-green);
    box-shadow: 0 0 10px var(--pv-green);
    animation: blink 2.2s ease-in-out infinite;
  }
  @keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: 0.5 } }

  .hero h1 {
    font-family: "Source Serif 4", serif;
    font-weight: 400;
    font-size: clamp(44px, 6.4vw, 84px);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 0 0 24px;
    max-width: 16ch;
    text-wrap: balance;
  }
  .hero h1 .ital {
    font-style: italic;
    color: #FFE066;
    text-decoration: underline;
    text-decoration-color: rgba(255, 224, 102, 0.6);
    text-underline-offset: 8px;
  }
  .hero p.lede {
    font-family: "Source Serif 4", serif;
    font-size: clamp(20px, 1.6vw, 24px);
    font-style: italic;
    line-height: 1.6;
    max-width: 60ch;
    margin: 0 0 44px;
    opacity: 1;
  }
  .hero p.lede strong { font-style: normal; font-family: "Inter"; font-weight: 500; }

  .hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }
  .btn {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 18px 30px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, background 0.2s, border 0.2s;
    min-height: 56px;
  }
  .btn-primary {
    background: #fff;
    color: var(--pv-blue);
  }
  .btn-primary:hover { transform: translateY(-1px); background: var(--pv-blue-tint); }
  .btn-secondary {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.5);
  }
  .btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

  /* Quick-service cards (mimic PV home layout) */
  .services {
    max-width: 1280px;
    margin: 0 auto;
    padding: 52px 40px 80px;
  }
  .services-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
  }
  .services-title {
    font-family: "Source Serif 4", serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--pv-blue);
    letter-spacing: -0.01em;
  }
  .services-title .ital { font-style: italic; }
  .services-sub {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-dim);
  }
  .service-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }
  .service {
    background: var(--pv-blue);
    color: #fff;
    border-radius: var(--radius-md);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    min-height: 136px;
  }
  .service:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-med);
  }
  .service::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 110% 110%, rgba(255,255,255,0.15), transparent 60%);
    pointer-events: none;
  }
  .service-ico {
    width: 34px; height: 34px;
    color: #fff;
  }
  .service-ico svg { width: 100%; height: 100%; }
  .service-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    margin-top: auto;
  }
  .service.accent {
    background: var(--pv-green);
  }

  @media (max-width: 900px) {
    .service-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-content { padding: 60px 24px 70px; }
  }

  /* =======================================================
     ==================== ASK PV WIDGET =====================
     ======================================================= */

  .pv-widget-root {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 1000;
    font-family: "Inter", sans-serif;
  }

  /* -- Collapsed bubble -- */
  .pv-bubble {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px 18px 20px;
    background: var(--pv-blue);
    color: #fff;
    border-radius: 999px;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: var(--shadow-deep);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
  }
  .pv-bubble::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 60% 100% at 0% 50%, rgba(124, 179, 66, 0.35), transparent 65%),
      radial-gradient(ellipse 60% 100% at 100% 50%, rgba(78, 111, 217, 0.55), transparent 65%);
  }
  .pv-bubble::after {
    content: "";
    position: absolute;
    top: 0; left: -40%;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    animation: sweep 5s ease-in-out infinite;
    animation-delay: 2s;
  }
  @keyframes sweep { 0% { left: -40% } 35%, 100% { left: 120% } }
  .pv-bubble:hover { transform: translateY(-2px) scale(1.02); }
  .pv-bubble > * { position: relative; z-index: 1; }

  .pv-bubble-seal {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  }
  .pv-bubble-seal::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 20% 20%, #CFE4FF 0%, transparent 6%),
      radial-gradient(circle at 80% 30%, #7CB342 0%, transparent 6%),
      radial-gradient(circle at 70% 80%, #FFFFFF 0%, transparent 6%),
      radial-gradient(circle at 15% 75%, #4E6FD9 0%, transparent 6%);
    animation: particles 4s linear infinite;
  }
  @keyframes particles {
    0% { transform: rotate(0deg); opacity: 0.9 }
    50% { opacity: 0.5 }
    100% { transform: rotate(360deg); opacity: 0.9 }
  }
  .pv-bubble-logo {
    width: 38px;
    position: relative;
    z-index: 1;
  }
  .pv-bubble-text { display: flex; flex-direction: column; line-height: 1.1; }
  .pv-bubble-text .primary { font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
  .pv-bubble-text .secondary {
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: none;
    opacity: 0.9;
    margin-top: 3px;
    font-weight: 500;
  }
  .pv-bubble-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--pv-green);
    margin-left: 4px;
    box-shadow: 0 0 0 0 rgba(124, 179, 66, 0.7);
    animation: pulse 2.2s ease-out infinite;
  }
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(124, 179, 66, 0.7) }
    70% { box-shadow: 0 0 0 10px rgba(124, 179, 66, 0) }
    100% { box-shadow: 0 0 0 0 rgba(124, 179, 66, 0) }
  }

  /* Tooltip greeting */
  .pv-tooltip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 16px);
    background: #fff;
    color: var(--ink);
    padding: 18px 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-med);
    white-space: nowrap;
    font-family: "Source Serif 4", serif;
    font-style: italic;
    font-size: 20px;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: all 0.3s;
    border: 2px solid var(--line);
  }
  .pv-widget-root.tooltip-visible .pv-tooltip {
    opacity: 1;
    transform: translateY(0);
  }
  .pv-tooltip::after {
    content: "";
    position: absolute;
    top: 100%; right: 32px;
    width: 12px; height: 12px;
    background: #fff;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transform: rotate(45deg) translateY(-7px);
  }

  /* Mobile chat-pill + tooltip adjustments. The default 28px bottom
     position has the bubble overlap the iOS Safari / Chrome bottom
     toolbar on phones; lift it ~64px (plus iPhone safe-area inset for
     the home indicator) so it floats clear of browser chrome. The
     tooltip also scales down ~30% for narrow viewports — at 20px
     italic serif it dominates the small screen and clips against the
     edge. Applies to both v5 (deprecated) and v6 landing — the bubble
     is the same in both. */
  @media (max-width: 720px) {
    .pv-widget-root {
      right: 16px;
      bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }
    .pv-tooltip {
      font-size: 14px;
      padding: 12px 16px;
      border-radius: 12px;
      bottom: calc(100% + 12px);
    }
    .pv-tooltip::after {
      width: 10px;
      height: 10px;
      right: 24px;
    }
  }

  /* -- Expanded panel -- */
  .pv-panel {
    position: absolute;
    right: 0; bottom: 0;
    width: 520px;
    height: 720px;
    background: #fff;
    border-radius: 22px;
    border: 2.5px solid #000;
    box-shadow: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.4) translateY(40px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s,
                width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                right 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-radius 0.4s;
    border: 1px solid var(--line);
  }
  .pv-widget-root.is-open .pv-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  /* Fullscreen anchoring:
     Avoid 100vw — on Chrome/Windows it includes the host-page scrollbar width
     (~17px), so `calc(100vw - 48px)` is wider than the visible viewport and
     pushes the panel's left edge off-screen. Instead, inset the root itself
     by 24px using the visible viewport, and fill the panel edge-to-edge. */
  .pv-widget-root.is-fullscreen {
    inset: 24px;
    width: auto;
    height: auto;
  }
  .pv-widget-root.is-fullscreen .pv-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
    border-radius: 16px;
  }
  .pv-widget-root.is-open .pv-bubble {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
  }

  /* Header — blue base + subtle sunrise warmth along the top edge.
     Layer order matters (top-most listed first): warm tones sit above the
     cooler radials so the sunrise reads without overwhelming the PV blue. */
  .pv-header {
    position: relative;
    padding: 24px 24px 22px;
    background:
      radial-gradient(ellipse 140% 80% at 50% -10%, rgba(255, 183, 94, 0.28) 0%, transparent 55%),
      radial-gradient(ellipse 110% 70% at 85% 0%, rgba(255, 138, 101, 0.22) 0%, transparent 60%),
      radial-gradient(ellipse 100% 120% at 100% 0%, rgba(124, 179, 66, 0.30) 0%, transparent 55%),
      radial-gradient(ellipse 100% 100% at 0% 0%, rgba(78, 111, 217, 0.5) 0%, transparent 60%),
      linear-gradient(135deg, var(--pv-blue-darker) 0%, var(--pv-blue) 100%);
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
  }
  .pv-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n2'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n2)' opacity='0.3'/></svg>");
    mix-blend-mode: overlay;
    opacity: 0.35;
    pointer-events: none;
  }
  .pv-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
  }
  .pv-header-seal {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    position: relative;
  }
  .pv-header-seal::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 50% 0%, #CFE4FF, transparent 12%),
      radial-gradient(circle at 100% 50%, #7CB342, transparent 10%),
      radial-gradient(circle at 50% 100%, #fff, transparent 10%),
      radial-gradient(circle at 0% 50%, #4E6FD9, transparent 10%);
    animation: particles 6s linear infinite;
    opacity: 0.85;
  }
  .pv-header-seal-logo {
    width: 30px;
    position: relative;
    z-index: 1;
  }
  .pv-header-meta { flex: 1; line-height: 1.1; }
  .pv-header-name {
    font-family: "Source Serif 4", serif;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  .pv-header-name .ital { font-style: italic; color: #FFFFFF; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.4); text-underline-offset: 4px; }
  .pv-header-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: none;
    opacity: 1;
    font-weight: 500;
  }
  .pv-header-sub .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--pv-green);
    box-shadow: 0 0 8px var(--pv-green);
  }
  .pv-header-actions { display: flex; gap: 4px; }
  .pv-iconbtn {
    width: 44px; height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s;
  }
  .pv-iconbtn:hover { background: rgba(255,255,255,0.28); }
  .pv-iconbtn svg { width: 20px; height: 20px; }

  .pv-header-divider {
    height: 1px;
    background: rgba(255,255,255,0.18);
    margin: 14px -18px 0;
  }
  .pv-header-context {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0.01em;
    text-transform: none;
    opacity: 0.95;
    font-weight: 500;
  }

  /* Body */
  .pv-body {
    flex: 1 1 auto;
    min-height: 0; /* critical: allows nested flex child to actually scroll */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 18px 8px;
    background: #fff;
    scroll-behavior: smooth;
  }
  .pv-body::-webkit-scrollbar { width: 6px; }
  .pv-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

  .pv-empty { display: flex; flex-direction: column; min-height: 100%; }
  .pv-greet { margin-bottom: 20px; }
  .pv-greet-kicker {
    font-family: "Inter", sans-serif;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pv-blue);
    margin-bottom: 12px;
    font-weight: 700;
  }
    .pv-greet-title {
    font-family: "Source Serif 4", serif;
    font-size: 38px;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 14px;
    font-weight: 500;
    text-wrap: balance;
  }
  .pv-greet-title .ital { font-style: italic; color: var(--pv-blue); }
  .pv-greet-sub {
    font-family: "Source Serif 4", serif;
    font-style: italic;
    font-size: 20px;
    color: var(--ink);
    line-height: 1.6;
    margin: 0;
  }

  /* Prompt cards (v7 responsive grid)
   * ───────────────────────────────────
   * Default: 1-column grid for narrow docked widget.
   * ≥640px:  2 columns.
   * Fullscreen ≥1100px gets 3 cols (set in fullscreen rules below).
   * Fullscreen ≥1400px gets 4 cols (set in fullscreen rules below).
   * Label spans all columns; the "Show all N" expander also spans full row. */
  .pv-prompts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 4px;
    min-width: 0;
  }
  .pv-prompts-label {
    grid-column: 1 / -1;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 700;
  }
  .pv-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    transition: all 0.2s;
    position: relative;
    min-height: 52px;
    min-width: 0;
  }
  .pv-prompt:hover {
    transform: translateX(2px);
    border-color: var(--pv-blue);
    background: var(--pv-blue-tint);
  }
  .pv-prompt-ico {
    width: 34px; height: 34px;
    border-radius: 9px;
    flex-shrink: 0;
    display: grid; place-items: center;
    color: #fff;
    background: var(--pv-blue);
  }
  .pv-prompt-ico.c1 { background: var(--pv-blue); }
  .pv-prompt-ico.c2 { background: var(--pv-blue-soft); }
  .pv-prompt-ico.c3 { background: var(--pv-green); }
  .pv-prompt-ico.c4 { background: var(--pv-blue-deep); }
  .pv-prompt-ico.c5 { background: var(--pv-blue-darker); }
  .pv-prompt-ico svg { width: 17px; height: 17px; }
  .pv-prompt-text { flex: 1; line-height: 1.3; min-width: 0; }
  .pv-prompt-text .lbl {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pv-prompt-text .sub {
    display: block;
    font-family: "Inter", sans-serif;
    font-size: 11.5px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-dim);
    margin-top: 2px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pv-prompt-arrow {
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s;
    color: var(--pv-blue);
    font-weight: 600;
  }
  .pv-prompt:hover .pv-prompt-arrow { opacity: 1; transform: translateX(0); }

  /* Collapsed docked grid: hide everything past the top 4 cards. The label
     is child 1, so prompts 5..N live at nth-child 6+. The expander button
     is excluded because it has class .pv-prompts-more, not .pv-prompt. */
  .pv-prompts.collapsed > .pv-prompt:nth-child(n+6) { display: none; }
  .pv-prompts-more {
    grid-column: 1 / -1;
    padding: 8px 12px;
    background: transparent;
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--pv-blue);
    transition: background 0.2s, border-color 0.2s;
  }
  .pv-prompts-more:hover {
    background: var(--pv-blue-tint);
    border-color: var(--pv-blue);
    border-style: solid;
  }

  /* 2-col at tablet / docked-wide. Scoped to the fullscreen grid so the
     docked <details> dropdown stays a 1-col vertical list at every width. */
  @media (min-width: 640px) {
    .pv-widget-root.is-fullscreen .pv-prompts { grid-template-columns: 1fr 1fr; }
  }
  /* 3-col once we're in fullscreen on a laptop-sized screen. */
  @media (min-width: 1100px) {
    .pv-widget-root.is-fullscreen .pv-prompts { grid-template-columns: repeat(3, 1fr); }
  }
  /* 4-col on desktop. */
  @media (min-width: 1400px) {
    .pv-widget-root.is-fullscreen .pv-prompts { grid-template-columns: repeat(4, 1fr); }
  }

  /* ─── Docked "Popular Questions" dropdown (v8) ─────────────────────────
     Collapses the empty-state prompt section behind a <summary> toggle to
     save vertical space. Expanded content is a 1-col vertical list of all
     N cards — no inner grid, no "Show all N" row, always resets to closed
     on re-render. JS handles the height animation to work around native
     <details> snapping. */
  .pv-prompts-details {
    margin-top: 4px;
  }
  .pv-prompts-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-2);
    user-select: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  .pv-prompts-summary::-webkit-details-marker { display: none; }
  .pv-prompts-summary:hover,
  .pv-prompts-details[open] > .pv-prompts-summary {
    background: var(--pv-blue-tint);
    border-color: var(--pv-blue);
    color: var(--pv-blue);
    border-style: solid;
  }
  .pv-prompts-summary-chev {
    display: inline-block;
    transition: transform 0.25s ease;
    font-size: 11px;
  }
  .pv-prompts-details[open] > .pv-prompts-summary .pv-prompts-summary-chev {
    transform: rotate(180deg);
  }
  .pv-prompts-summary-hint {
    margin-left: auto;
    margin-right: 8px;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-dim);
    opacity: 0.7;
    white-space: nowrap;
    user-select: none;
  }
  .pv-prompts-details[open] > .pv-prompts-summary .pv-prompts-summary-hint {
    display: none;
  }
  /* The inner wrapper is the animated element. Default 0 height (closed);
     JS measures scrollHeight on open and transitions to that value, then
     clears the inline style so future content changes don't get clipped. */
  .pv-prompts-inner {
    overflow: hidden;
    height: 0;
    transition: height 0.25s ease;
  }
  .pv-prompts-details[open] > .pv-prompts-inner {
    height: auto;
  }
  /* Inside the dropdown: flatten to a flex column regardless of viewport.
     Also neutralize the grid rules so the 640px breakpoint doesn't kick in. */
  .pv-prompts.pv-prompts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    grid-template-columns: none;
    padding: 6px 4px 2px;
  }

  /* Entry stagger */
  .pv-widget-root.is-open .pv-greet,
  .pv-widget-root.is-open .pv-prompts-label,
  .pv-widget-root.is-open .pv-prompt {
    animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  .pv-widget-root.is-open .pv-greet { animation-delay: 0.15s; }
  .pv-widget-root.is-open .pv-prompts-label { animation-delay: 0.22s; }
  .pv-widget-root.is-open .pv-prompt:nth-of-type(1) { animation-delay: 0.28s; }
  .pv-widget-root.is-open .pv-prompt:nth-of-type(2) { animation-delay: 0.33s; }
  .pv-widget-root.is-open .pv-prompt:nth-of-type(3) { animation-delay: 0.38s; }
  .pv-widget-root.is-open .pv-prompt:nth-of-type(4) { animation-delay: 0.43s; }
  .pv-widget-root.is-open .pv-prompt:nth-of-type(5) { animation-delay: 0.48s; }
  @keyframes riseIn { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: translateY(0) } }

  /* Messages */
  .pv-msgs { display: flex; flex-direction: column; gap: 16px; }
  .pv-msg {
    display: flex;
    gap: 12px;
    animation: msgIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  @keyframes msgIn { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: translateY(0) } }
  .pv-msg.user { flex-direction: row-reverse; }
  .pv-msg-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid; place-items: center;
  }
  .pv-msg.ai .pv-msg-avatar {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    /* Always-on idle pulse — Phase 4 combination animation.
       Gated by @media (prefers-reduced-motion: reduce) below. */
    animation: pvAvatarIdle 2.4s ease-in-out infinite;
    will-change: transform, box-shadow;
  }
  .pv-msg.ai .pv-msg-avatar svg { width: 30px; height: 30px; }
  /* Reply-arrived blink — JS adds .just-replied briefly when a stream ends. */
  .pv-msg.ai.just-replied .pv-msg-avatar {
    animation: pvAvatarBlink 0.6s ease-out 1;
  }
  @keyframes pvAvatarIdle {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(78,111,217,0.35); }
    50%      { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(78,111,217,0); }
  }
  @keyframes pvAvatarBlink {
    0%   { transform: scale(1.14); box-shadow: 0 0 0 8px rgba(124,179,66,0.35); }
    100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(124,179,66,0); }
  }
  .pv-msg.user .pv-msg-avatar {
    background: var(--pv-blue);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
  }
  .pv-msg.user .pv-msg-avatar svg { width: 30px; height: 30px; }
  .pv-msg-body { max-width: 84%; font-size: 19px; line-height: 1.65; }
  .pv-msg.user .pv-msg-body { text-align: right; }
  .pv-msg-bubble {
    padding: 16px 20px;
    border-radius: 18px;
  }
  .pv-msg.ai .pv-msg-bubble {
    background: #fff;
    color: var(--ink);
    border: 2px solid #000;
    border-top-left-radius: 4px;
  }
  .pv-msg.user .pv-msg-bubble {
    background: var(--pv-blue);
    color: #fff;
    border: 2px solid #000;
    border-top-right-radius: 4px;
  }
  .pv-msg-bubble p { margin: 0 0 8px; }
  .pv-msg-bubble p:last-child { margin: 0; }
  .pv-msg-meta {
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-dim);
    margin-top: 6px;
    font-weight: 500;
  }

  /* Citations — collapsible <details>/<summary> dropdown */
  .pv-citations { margin-top: 10px; }
  /* Hide the browser-default disclosure triangle in every engine. */
  .pv-citations > summary { list-style: none; }
  .pv-citations > summary::-webkit-details-marker { display: none; }
  .pv-citations-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    user-select: none;
  }
  .pv-citations-summary:hover { background: var(--pv-blue-tint); }
  .pv-citations-summary:focus-visible {
    outline: 2px solid var(--pv-blue);
    outline-offset: 2px;
  }
  .pv-citations-label {
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--ink-2);
    font-weight: 700;
  }
  .pv-citations-chevron {
    color: var(--ink-2);
    flex-shrink: 0;
    transition: transform 0.15s ease;
  }
  .pv-citations[open] .pv-citations-chevron { transform: rotate(90deg); }
  .pv-citations-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 8px;
  }
  .pv-cite {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 2.5px solid #000;
    border-radius: 12px;
    font-size: 16px;
    text-decoration: none;
    color: var(--ink);
    transition: all 0.2s;
  }
  .pv-cite:hover { border-color: var(--pv-blue); background: var(--pv-blue-tint); }
  .pv-cite-num {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--pv-blue);
    color: #fff;
    display: grid; place-items: center;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    flex-shrink: 0;
    font-weight: 700;
  }
  .pv-cite-body {
    flex: 1;
    line-height: 1.4;
    min-width: 0; /* lets ellipsis actually kick in inside a flex child */
  }
  .pv-cite-body .t {
    font-weight: 700;
    display: block;
    font-size: 15px;
    /* Titles can be long — wrap gracefully rather than clip. */
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .pv-cite-body .u {
    display: block;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    color: var(--ink-2);
    margin-top: 4px;
    /* Truncation affects ONLY the visible label — the `href` on the parent
       anchor is untouched, so the link still opens the full URL. `title=`
       on the anchor carries the full URL for hover/AT tooltip. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .pv-cite-ext { color: var(--ink-dim); flex-shrink: 0; }

  /* Typing */
  .pv-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
  .pv-typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--pv-blue);
    opacity: 0.4;
    animation: dot 1.2s ease-in-out infinite;
  }
  .pv-typing span:nth-child(2) { animation-delay: 0.15s; }
  .pv-typing span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0) }
    40% { opacity: 1; transform: translateY(-3px) }
  }
  /* Inline label beside the thinking dots — fills the silent tool-call
     window with meaningful progress ("Searching permits…"). Empty node
     reserves vertical space so the bubble doesn't reflow when a label
     first appears. Fades in for a less jarring entrance. */
  .pv-thinking-label {
    margin-top: 4px;
    font-family: "Inter", sans-serif;
    font-size: 12.5px;
    color: var(--ink-dim);
    min-height: 16px;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .pv-thinking-label:not(:empty) { opacity: 0.85; }

  /* Composer */
  .pv-composer {
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    padding: 8px 14px 10px;
    background: #fff;
  }
  .pv-quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 2px;
  }
  .pv-quick {
    flex: 0 0 auto;
    padding: 7px 14px;
    border-radius: 99px;
    border: 2px solid var(--pv-blue);
    background: #fff;
    color: var(--pv-blue);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 32px;
    line-height: 1.2;
  }
  .pv-quick:hover { border-color: var(--pv-blue); background: var(--pv-blue-tint); }

  .pv-input-wrap {
    border: 3px solid #000;
    border-radius: 16px;
    background: #fff;
    transition: border 0.2s, box-shadow 0.2s;
    overflow: hidden;
  }
  .pv-input-wrap:focus-within {
    border-color: var(--pv-blue);
    box-shadow: 0 0 0 5px rgba(0, 47, 122, 0.4);
  }
  .pv-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 16px 6px;
    font-family: inherit;
    font-size: 17px;
    color: var(--ink);
    resize: none;
    outline: none;
    line-height: 1.5;
    min-height: calc(17px * 1.5 + 18px);
    max-height: 160px;
    overflow-y: auto;
  }
  .pv-input::placeholder { color: var(--ink-dim); }
  .pv-input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 6px 6px 8px;
  }
  .pv-input-left, .pv-input-right { display: flex; align-items: center; gap: 4px; }
  .pv-tool {
    width: 36px; height: 36px;
    border-radius: 9px;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    display: grid; place-items: center;
    transition: all 0.2s;
  }
  .pv-tool:hover { background: var(--pv-blue-tint); color: var(--pv-blue); border-color: var(--pv-blue); }
  .pv-tool svg { width: 18px; height: 18px; }
  .pv-tool.active { background: var(--pv-blue); color: #fff; }
  .pv-tool.recording { animation: recPulse 1.2s ease-in-out infinite; }
  @keyframes recPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46,77,183, 0.5) }
    50% { box-shadow: 0 0 0 8px rgba(46,77,183, 0) }
  }
  .pv-kbd-hint {
    font-family: "Inter", sans-serif;
    font-size: 11px;
    color: var(--ink-dim);
    opacity: 0.7;
    margin-right: 10px;
    white-space: nowrap;
    user-select: none;
  }
  @media (max-width: 480px) {
    .pv-kbd-hint { display: none; }
  }

  /* Scroll-nav pills: "↑ Top of answer" during streaming, "↓ Jump to latest"
     when the user has scrolled off the bottom.
     The nav wrapper is a sticky child of `.pv-body` so the pills always float
     at the bottom-right of the visible message viewport — regardless of panel
     width or fullscreen padding, they track the actual answer column rather
     than hugging the far edge of the panel. Hidden by default; ask_pv_v5.js
     toggles .is-visible based on pinned/streaming state. */
  .pv-scroll-nav {
    position: sticky;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-top: 8px;
    margin-right: 2px;
    z-index: 20;
    pointer-events: none; /* clicks pass through empty space; buttons re-enable */
  }
  .pv-jump {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    color: var(--pv-blue);
    border: 1.5px solid var(--pv-blue);
    border-radius: 999px;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s, color 0.15s;
    user-select: none;
    pointer-events: auto;
  }
  .pv-jump.is-visible {
    display: inline-flex;
    opacity: 1;
    transform: translateY(0);
  }
  .pv-jump:hover {
    background: var(--pv-blue);
    color: #fff;
  }
  @media (max-width: 480px) {
    .pv-jump { font-size: 11px; padding: 5px 10px; }
    .pv-scroll-nav { bottom: 10px; gap: 5px; }
  }
  .pv-send {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--pv-blue);
    color: #fff;
    border: 2px solid #000;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    transition: background 0.2s;
    min-height: 40px;
  }
  .pv-send:hover { background: var(--pv-blue-deep); border-color: var(--pv-blue-deep); }
  .pv-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--ink-dim);
    border-color: var(--ink-dim);
  }
  .pv-send svg { width: 20px; height: 20px; }
  .pv-send .kbd { display: none; }
  .pv-send .kbd {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 4px;
  }

  .pv-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    background: var(--bg-alt);
    color: var(--ink-2);
    font-family: "Inter", sans-serif;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    font-weight: 500;
  }
  .pv-foot a { color: var(--pv-blue); text-decoration: none; }
  .pv-foot .left { display: flex; gap: 10px; }
  .pv-foot .sep { opacity: 0.4; }

  /* Fullscreen mode layout */
  .pv-widget-root.is-fullscreen .pv-body { padding: 36px clamp(24px, 8vw, 120px); }
  .pv-widget-root.is-fullscreen .pv-composer { padding: 14px clamp(24px, 8vw, 120px); }
  .pv-widget-root.is-fullscreen .pv-foot { padding: 10px clamp(24px, 8vw, 120px); }
  .pv-widget-root.is-fullscreen .pv-header { padding: 22px clamp(24px, 8vw, 120px); }
  .pv-widget-root.is-fullscreen .pv-greet-title { font-size: 44px; }
  .pv-widget-root.is-fullscreen .pv-greet-sub { font-size: 18px; }
  .pv-widget-root.is-fullscreen .pv-empty,
  .pv-widget-root.is-fullscreen .pv-msgs,
  .pv-widget-root.is-fullscreen .pv-input-wrap,
  .pv-widget-root.is-fullscreen .pv-quick-row { max-width: 1000px; margin-left: auto; margin-right: auto; width: 100%; }

  /* Tweaks panel */
  .tweaks-panel {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 1100;
    width: 280px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-med);
    padding: 14px;
    font-size: 12px;
    display: none;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .tweaks-panel.visible { display: block; }
  .tweaks-title {
    font-family: "Source Serif 4", serif;
    font-size: 18px;
    margin: 0 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--pv-blue);
  }
  .tweaks-title .close { background: none; border: none; cursor: pointer; color: var(--ink-dim); font-size: 14px; }
  .tweak-group { margin-bottom: 14px; }
  .tweak-label {
    font-family: "JetBrains Mono", monospace;
    font-size: 9px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin-bottom: 6px;
  }
  .tweak-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .tweak-opt {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 11.5px;
    cursor: pointer;
    text-align: center;
    color: var(--ink);
  }
  .tweak-opt:hover { border-color: var(--pv-blue); }
  .tweak-opt.active { background: var(--pv-blue); color: #fff; border-color: var(--pv-blue); }

  /* Theme variants */
  body[data-theme="dark"] .pv-panel { background: #0F1836; color: #E7EAF6; border-color: rgba(255,255,255,0.08); }
  body[data-theme="dark"] .pv-body { background: #0F1836; }
  body[data-theme="dark"] .pv-greet-title { color: #fff; }
  body[data-theme="dark"] .pv-greet-sub { color: #CFD5EA; }
  body[data-theme="dark"] .pv-prompt { background: #1A2648; border-color: rgba(255,255,255,0.08); color: #E7EAF6; }
  body[data-theme="dark"] .pv-prompt:hover { background: #22305A; border-color: var(--pv-blue-soft); }
  body[data-theme="dark"] .pv-msg.ai .pv-msg-bubble { background: #1A2648; color: #E7EAF6; }
  body[data-theme="dark"] .pv-cite { background: #1A2648; border-color: rgba(255,255,255,0.08); color: #E7EAF6; }
  body[data-theme="dark"] .pv-composer { background: #0F1836; border-color: rgba(255,255,255,0.08); }
  body[data-theme="dark"] .pv-input-wrap { background: #1A2648; border-color: rgba(255,255,255,0.15); }
  body[data-theme="dark"] .pv-input { color: #E7EAF6; }
  body[data-theme="dark"] .pv-quick { background: #1A2648; border-color: rgba(255,255,255,0.15); color: #E7EAF6; }
  body[data-theme="dark"] .pv-tool { color: #9AA3C4; }
  body[data-theme="dark"] .pv-tool:hover { background: #1A2648; color: #fff; }
  body[data-theme="dark"] .pv-foot { background: #0A112A; color: #9AA3C4; border-color: rgba(255,255,255,0.08); }

  body[data-theme="green"] { --pv-blue: #5A8A2E; --pv-blue-deep: #3F6B1E; --pv-blue-darker: #2B4A15; --pv-blue-soft: #7CB342; --pv-blue-tint: #EBF5DE; }

  /* Bubble shape variants */
  body[data-bubble="circle"] .pv-bubble {
    padding: 10px;
    border-radius: 50%;
    width: 64px; height: 64px;
    justify-content: center;
  }
  body[data-bubble="circle"] .pv-bubble-text,
  body[data-bubble="circle"] .pv-bubble-pulse { display: none; }
  body[data-bubble="card"] .pv-bubble { border-radius: 14px; padding: 14px 20px; }

  /* Header variants */
  body[data-header="minimal"] .pv-header-seal::after { display: none; }
  body[data-header="minimal"] .pv-header { background: var(--pv-blue); }
  body[data-header="compact"] .pv-header-context,
  body[data-header="compact"] .pv-header-divider { display: none; }

  /* Density
   * ────────
   *  `comfortable` keeps the baseline values above (looser spacing, larger
   *  bubbles). `compact` is the v6 "Dense Edition" skin — tighter header,
   *  smaller avatars, dense citation chips, smaller composer. The widget
   *  ships with compact by default because most conversations are short.
   *  `ultra-compact` pushes density further for power users who want the
   *  maximum viewable transcript area (added in v7 layout rewrite).
   *
   *  NOTE on cascade order: density blocks MUST come before the text-scale
   *  blocks later in this file so that Large/X-Large can override density
   *  font sizes. Do not move these blocks below `data-text-scale` rules.
   */
  body[data-density="compact"] .pv-body { padding: 12px 14px 4px; }
  body[data-density="compact"] .pv-prompt { padding: 10px 12px; }
  body[data-density="compact"] .pv-msgs { gap: 10px; }

  /* --- v7 dense skin (header) --- */
  body[data-density="compact"] .pv-header { padding: 10px 16px 10px; }
  body[data-density="compact"] .pv-header-row { gap: 10px; }
  body[data-density="compact"] .pv-header-name { font-size: 16px; line-height: 1.15; }
  body[data-density="compact"] .pv-header-sub { font-size: 12px; margin-top: 2px; }

  /* --- v7 dense skin (panel height: responsive instead of fixed 720px) --- */
  body[data-density="compact"] .pv-panel {
    height: min(780px, calc(100vh - 48px));
    max-height: calc(100vh - 24px);
  }

  /* --- v7 dense skin (messages) --- */
  body[data-density="compact"] .pv-msg-avatar { width: 30px; height: 30px; }
  body[data-density="compact"] .pv-msg.ai .pv-msg-avatar svg { width: 22px; height: 22px; }
  body[data-density="compact"] .pv-msg-body { max-width: 88%; font-size: 15px; line-height: 1.5; }
  body[data-density="compact"] .pv-msg-bubble { padding: 9px 13px; border-radius: 13px; }
  body[data-density="compact"] .pv-msg-meta { font-size: 11px; margin-top: 3px; }

  /* --- v7 dense skin (citations, with URL/title ellipsis) --- */
  body[data-density="compact"] .pv-cite {
    padding: 7px 10px;
    border: 2px solid #000;
    border-radius: 10px;
    font-size: 12px;
    gap: 8px;
  }
  body[data-density="compact"] .pv-cite-num {
    width: 20px; height: 20px;
    font-size: 11px;
  }
  body[data-density="compact"] .pv-cite-body { min-width: 0; line-height: 1.35; }
  body[data-density="compact"] .pv-cite-body .t {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body[data-density="compact"] .pv-cite-body .u { font-size: 11px; margin-top: 2px; }

  /* --- v7 dense skin (composer) --- */
  body[data-density="compact"] .pv-input {
    padding: 10px 14px 4px;
    font-size: 14.5px;
    line-height: 1.45;
    min-height: calc(14.5px * 1.45 + 14px);
    max-height: 140px;
    overflow-y: auto;
  }
  body[data-density="compact"] .pv-input-toolbar { padding: 2px 6px 4px 6px; }
  body[data-density="compact"] .pv-send {
    padding: 8px 14px;
    border: 2px solid #000;
    border-radius: 9px;
    font-size: 13.5px;
    min-height: 36px;
    gap: 6px;
  }

  /* ─────────────────────────────────────────────────────────────────────
   *  Ultra-compact tier (v7)
   *  Opt-in denser skin that shrinks fonts ~10% below compact. Used by
   *  power users on larger displays who want to maximize visible transcript.
   *  IMPORTANT: keep this block ABOVE the `data-text-scale` blocks below so
   *  that Large / X-Large text-scale buttons still override these sizes.
   * ───────────────────────────────────────────────────────────────────── */
  body[data-density="ultra-compact"] .pv-body { padding: 10px 12px 4px; }
  body[data-density="ultra-compact"] .pv-prompt { padding: 8px 11px; font-size: 13px; }
  body[data-density="ultra-compact"] .pv-msgs { gap: 8px; }

  body[data-density="ultra-compact"] .pv-header { padding: 8px 14px; }
  body[data-density="ultra-compact"] .pv-header-row { gap: 8px; }
  body[data-density="ultra-compact"] .pv-header-name { font-size: 15px; line-height: 1.15; }
  body[data-density="ultra-compact"] .pv-header-sub { font-size: 11px; margin-top: 1px; }

  body[data-density="ultra-compact"] .pv-panel {
    height: min(780px, calc(100vh - 48px));
    max-height: calc(100vh - 24px);
  }

  body[data-density="ultra-compact"] .pv-msg-avatar { width: 26px; height: 26px; }
  body[data-density="ultra-compact"] .pv-msg.ai .pv-msg-avatar svg { width: 19px; height: 19px; }
  body[data-density="ultra-compact"] .pv-msg-body { max-width: 90%; font-size: 13.5px; line-height: 1.45; }
  body[data-density="ultra-compact"] .pv-msg-bubble { padding: 7px 11px; border-radius: 11px; }
  body[data-density="ultra-compact"] .pv-msg-meta { font-size: 10.5px; margin-top: 2px; }

  body[data-density="ultra-compact"] .pv-cite {
    padding: 6px 9px;
    border: 2px solid #000;
    border-radius: 9px;
    font-size: 11px;
    gap: 7px;
  }
  body[data-density="ultra-compact"] .pv-cite-num {
    width: 18px; height: 18px;
    font-size: 10px;
  }
  body[data-density="ultra-compact"] .pv-cite-body { min-width: 0; line-height: 1.3; }
  body[data-density="ultra-compact"] .pv-cite-body .t {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body[data-density="ultra-compact"] .pv-cite-body .u { font-size: 10px; margin-top: 1px; }

  body[data-density="ultra-compact"] .pv-input {
    padding: 8px 12px 3px;
    font-size: 13px;
    line-height: 1.4;
    min-height: calc(13px * 1.4 + 12px);
    max-height: 120px;
    overflow-y: auto;
  }
  body[data-density="ultra-compact"] .pv-input-toolbar { padding: 2px 5px 3px 5px; }
  body[data-density="ultra-compact"] .pv-send {
    padding: 6px 12px;
    border: 2px solid #000;
    border-radius: 8px;
    font-size: 13px;
    min-height: 32px;
    gap: 6px;
  }

  /* Reduced motion.
     NOTE: the previous version tried to comma-join a selector with an @media
     rule, which is invalid CSS and silently dropped. Split into two separate
     rules so both the manual toggle AND the OS preference actually work. */
  body[data-reduced-motion="true"] * {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    transition-duration: 0.1s !important;
  }
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.001s !important;
      animation-delay: 0s !important;
      transition-duration: 0.1s !important;
    }
  }

  /* a11y inline toolbar inside chat header */
  .pv-a11y-inline {
    display: flex;
    gap: 2px;
    align-items: center;
  }
  .pv-a11y-btn {
    min-width: 40px; height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1.5px solid #fff;
    background: rgba(255,255,255,0.22);
    color: #fff;
    cursor: pointer;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    display: grid;
    place-items: center;
    transition: background 0.2s;
  }
  .pv-a11y-btn:hover, .pv-a11y-btn.active { background: rgba(255,255,255,0.25); }

  /* Legacy data-font-scale rules removed — A+/A− now drive data-text-scale
     via the unified Settings pipeline (xsmall → small → normal → large →
     xlarge). See wireA11y() in ask_pv_v5.js. */

  @media (max-width: 768px) {
    .nav { padding: 14px 20px; }
    .pv-panel { width: calc(100vw - 32px); right: 16px; }
    .pv-widget-root { right: 16px; bottom: 16px; }

  }

  /* ========= TWEAK: Contrast modes ========= */
  /* Inverted (dark high-contrast) */
  body[data-contrast="inverted"] {
    background: #000;
    color: #fff;
  }
  body[data-contrast="inverted"] .nav {
    background: rgba(0,0,0,0.95);
    border-bottom-color: #fff;
  }
  body[data-contrast="inverted"] .nav a,
  body[data-contrast="inverted"] .nav-link { color: #fff; }
  body[data-contrast="inverted"] .services {
    background: #000;
  }
  body[data-contrast="inverted"] .service-card {
    background: #0A0A0A !important;
    border: 2px solid #fff !important;
    color: #fff !important;
  }
  body[data-contrast="inverted"] .service-title,
  body[data-contrast="inverted"] .service-desc { color: #fff !important; }
  body[data-contrast="inverted"] .services h2 { color: #fff !important; }
  body[data-contrast="inverted"] .services-intro { color: #E0E0E0 !important; }

  /* Widget in inverted mode */
  body[data-contrast="inverted"] .pv-panel {
    background: #000;
    border: 3px solid #fff;
  }
  body[data-contrast="inverted"] .pv-body { background: #000; }
  body[data-contrast="inverted"] .pv-greet-title { color: #fff; }
  body[data-contrast="inverted"] .pv-greet-title .ital { color: #7FB0FF; }
  body[data-contrast="inverted"] .pv-greet-sub { color: #E0E0E0; }
  body[data-contrast="inverted"] .pv-greet-kicker { color: #7FB0FF; }
  body[data-contrast="inverted"] .pv-prompt {
    background: #0A0A0A;
    border: 2.5px solid #fff;
    color: #fff;
  }
  body[data-contrast="inverted"] .pv-prompt:hover {
    background: #1A1A1A;
    border-color: #7FB0FF;
  }
  body[data-contrast="inverted"] .pv-prompt-icon { color: #7FB0FF !important; }
  body[data-contrast="inverted"] .pv-prompts-label { color: #E0E0E0; }
  body[data-contrast="inverted"] .pv-msg.ai .pv-msg-bubble {
    background: #0A0A0A;
    border: 2px solid #fff;
    color: #fff;
  }
  body[data-contrast="inverted"] .pv-msg.user .pv-msg-bubble {
    background: #fff;
    color: #000;
    border: 2px solid #fff;
  }
  body[data-contrast="inverted"] .pv-msg-meta { color: #E0E0E0; }
  body[data-contrast="inverted"] .pv-input-wrap {
    background: #0A0A0A;
    border: 3px solid #fff;
  }
  body[data-contrast="inverted"] .pv-input { color: #fff; }
  body[data-contrast="inverted"] .pv-input::placeholder { color: #B0B0B0; }
  body[data-contrast="inverted"] .pv-input-toolbar { background: #0A0A0A; }
  body[data-contrast="inverted"] .pv-cite {
    background: #0A0A0A;
    border: 2.5px solid #fff;
    color: #fff;
  }
  body[data-contrast="inverted"] .pv-cite:hover { background: #1A1A1A; border-color: #7FB0FF; }
  body[data-contrast="inverted"] .pv-cite-body .u { color: #B0B0B0; }
  body[data-contrast="inverted"] .pv-footer { background: #0A0A0A; border-top: 2px solid #fff; }
  body[data-contrast="inverted"] .pv-send { background: #fff; color: #000; border-color: #fff; }
  body[data-contrast="inverted"] .pv-send:hover { background: #7FB0FF; }
  body[data-contrast="inverted"] .pv-quick-pill { background: #0A0A0A; border: 2px solid #fff; color: #fff; }
  body[data-contrast="inverted"] .pv-quick-pill:hover { background: #1A1A1A; }
  body[data-contrast="inverted"] .pv-icon-btn { color: #fff; }
  body[data-contrast="inverted"] .pv-icon-btn:hover { background: #1A1A1A; }

  /* Monochrome (pure black & white only — no color) */
  body[data-contrast="mono"] {
    filter: none;
  }
  body[data-contrast="mono"] .pv-greet-title .ital,
  body[data-contrast="mono"] .pv-greet-kicker,
  body[data-contrast="mono"] .pv-prompt-icon,
  body[data-contrast="mono"] .hero h1 .ital { color: #000 !important; }
  body[data-contrast="mono"] .hero h1 .ital { text-decoration-color: rgba(255,255,255,0.8) !important; color: #fff !important; }
  body[data-contrast="mono"] .pv-header {
    background: #000 !important;
    color: #fff !important;
  }
  body[data-contrast="mono"] .pv-header::before,
  body[data-contrast="mono"] .pv-header::after { display: none !important; }
  body[data-contrast="mono"] .pv-send {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
  }
  body[data-contrast="mono"] .pv-msg.user .pv-msg-bubble {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
  }
  body[data-contrast="mono"] .pv-bubble {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
  }
  body[data-contrast="mono"] .pv-bubble::before,
  body[data-contrast="mono"] .pv-bubble::after { display: none !important; }
  body[data-contrast="mono"] .hero-image {
    background: #000 !important;
  }
  body[data-contrast="mono"] .hero-image::after,
  body[data-contrast="mono"] .hero-mountains { display: none !important; }
  body[data-contrast="mono"] .service-ico { color: #000 !important; background: #fff !important; border: 2px solid #000 !important; border-radius: 10px; }
  body[data-contrast="mono"] .service-card { border-color: #000 !important; }
  body[data-contrast="mono"] .pv-prompt { border-color: #000 !important; }
  body[data-contrast="mono"] .pv-cite { border-color: #000 !important; }
  body[data-contrast="mono"] .pv-cite-num { background: #000 !important; color: #fff !important; }
  body[data-contrast="mono"] .pv-greet-kicker { color: #000 !important; }
  body[data-contrast="mono"] .btn-primary { color: #000 !important; background: #fff !important; }
  body[data-contrast="mono"] .hero-badge .dot { background: #fff !important; box-shadow: 0 0 10px #fff !important; }
  body[data-contrast="mono"] .pv-empty-icon,
  body[data-contrast="mono"] .pv-prompt-icon { color: #000 !important; }

  /* ========= TWEAK: Hero Image ========= */
  body[data-hero="solid"] .hero-image {
    background: var(--pv-blue-deep) !important;
  }
  body[data-hero="solid"] .hero-image::after,
  body[data-hero="solid"] .hero-mountains {
    display: none !important;
  }

  /* ========= TWEAK: Text Scale ========= */
  /* Smaller scales — added so residents on wide desktops can cram more
     answer text on-screen. No accessibility floor per product direction. */
  body[data-text-scale="small"] { font-size: 15px; }
  body[data-text-scale="small"] .pv-msg-body { font-size: 14px; line-height: 1.5; }
  body[data-text-scale="small"] .pv-prompt { font-size: 13px; }
  body[data-text-scale="small"] .pv-input { font-size: 14px; }
  body[data-text-scale="small"] .pv-greet-title { font-size: 32px; }
  body[data-text-scale="small"] .pv-greet-sub { font-size: 14px; }
  body[data-text-scale="small"] .pv-send { font-size: 14px; min-height: 44px; }
  body[data-text-scale="small"] .pv-cite { font-size: 12px; }
  body[data-text-scale="small"] .pv-header-name { font-size: 15px; }
  body[data-text-scale="small"] .pv-header-sub { font-size: 11.5px; }

  body[data-text-scale="xsmall"] { font-size: 13px; }
  body[data-text-scale="xsmall"] .pv-msg-body { font-size: 12.5px; line-height: 1.45; }
  body[data-text-scale="xsmall"] .pv-prompt { font-size: 11.5px; }
  body[data-text-scale="xsmall"] .pv-input { font-size: 12.5px; }
  body[data-text-scale="xsmall"] .pv-greet-title { font-size: 26px; }
  body[data-text-scale="xsmall"] .pv-greet-sub { font-size: 12.5px; }
  body[data-text-scale="xsmall"] .pv-send { font-size: 12.5px; min-height: 38px; padding: 8px 14px; }
  body[data-text-scale="xsmall"] .pv-cite { font-size: 11px; }
  body[data-text-scale="xsmall"] .pv-header-name { font-size: 14px; }
  body[data-text-scale="xsmall"] .pv-header-sub { font-size: 10.5px; }

  body[data-text-scale="large"] { font-size: 22px; }
  body[data-text-scale="large"] .pv-msg-body { font-size: 21px; }
  body[data-text-scale="large"] .pv-prompt { font-size: 20px; }
  body[data-text-scale="large"] .pv-input { font-size: 20px; }
  body[data-text-scale="large"] .pv-greet-title { font-size: 42px; }
  body[data-text-scale="large"] .pv-greet-sub { font-size: 22px; }
  body[data-text-scale="large"] .pv-send { font-size: 20px; min-height: 60px; }
  body[data-text-scale="large"] .pv-cite { font-size: 17px; }

  body[data-text-scale="xlarge"] { font-size: 24px; }
  body[data-text-scale="xlarge"] .pv-msg-body { font-size: 23px; }
  body[data-text-scale="xlarge"] .pv-prompt { font-size: 22px; min-height: 80px; }
  body[data-text-scale="xlarge"] .pv-input { font-size: 22px; }
  body[data-text-scale="xlarge"] .pv-greet-title { font-size: 46px; }
  body[data-text-scale="xlarge"] .pv-greet-sub { font-size: 24px; }
  body[data-text-scale="xlarge"] .pv-send { font-size: 22px; min-height: 64px; padding: 16px 28px; }
  body[data-text-scale="xlarge"] .pv-cite { font-size: 18px; }
  body[data-text-scale="xlarge"] .pv-cite-body .t { font-size: 17px; }
  body[data-text-scale="xlarge"] .pv-a11y-btn { font-size: 16px; min-width: 44px; height: 40px; }


/* =======================================================
   ====== V5 PRODUCTION EXTENSIONS (not in artifact) ======
   ======================================================= */

/* Settings gear — small button in the widget header that opens the
   user-facing settings panel (theme/bubble/density/contrast/etc).
   Replaces the design artifact's iframe-only tweaks toggle. */
.pv-settings-btn {
  min-width: 40px; height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid #fff;
  background: rgba(255,255,255,0.22);
  color: #fff;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 700;
  display: grid; place-items: center;
  transition: background 0.2s;
}
.pv-settings-btn:hover, .pv-settings-btn.active { background: rgba(255,255,255,0.35); }

/* The settings panel is the design's .tweaks-panel re-skinned for real users;
   keep the class names so the artifact styles still apply, but ensure it can
   live inside the widget or float independently. */
.tweaks-panel {
  font-family: "Inter", sans-serif;
}
.tweaks-panel.docked {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  left: auto;
}

/* Fullscreen override: since `.pv-widget-root.is-fullscreen` now has real
   dimensions (inset: 24px — see ~line 495), the docked formula
   `bottom: calc(100% + 8px)` pushes the panel ~100vh above the root and
   off the top of the screen. Re-anchor to the visible viewport, tucked
   under the widget header on the right side. */
.pv-widget-root.is-fullscreen .tweaks-panel.docked {
  position: fixed;
  top: 104px;            /* 24px root inset + ~76px header + 4px gap */
  right: 48px;           /* 24px root inset + 24px breathing room */
  bottom: auto;
  left: auto;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
}

/* Stop + Regenerate buttons inside the composer toolbar. Shown only while a
   reply is streaming (stop) or after the last AI turn completes (regenerate). */
.pv-tool.pv-stop {
  background: #fff;
  color: var(--pv-blue);
  border-color: var(--pv-blue);
  animation: stopPulse 1.5s ease-in-out infinite;
}
.pv-tool.pv-stop:hover { background: var(--pv-blue-tint); }
@keyframes stopPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 47, 122, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(0, 47, 122, 0); }
}

/* Thumbs-up/down chip row under each assistant bubble. The design has no
   feedback UI; rolling our own to match its bordered-pill aesthetic. */
.pv-feedback {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.pv-feedback-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
  font-size: 16px;
  line-height: 1;
}
.pv-feedback-btn:hover { border-color: var(--pv-blue); background: var(--pv-blue-tint); color: var(--pv-blue); }
.pv-feedback-btn.selected {
  background: var(--pv-blue);
  color: #fff;
  border-color: var(--pv-blue);
}
.pv-feedback-btn.selected[data-rating="-1"] {
  background: var(--pv-amber);
  border-color: var(--pv-amber);
}
.pv-feedback-note {
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-left: 4px;
}
.pv-regen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--pv-blue);
  border: 1.5px solid var(--line);
  padding: 6px 12px;
  border-radius: 99px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}
.pv-regen-btn:hover { background: var(--pv-blue-tint); border-color: var(--pv-blue); }

/* Phase 6 — per-reply controls (Copy, Report) share the feedback row styling.
   Desktop: faded to 0 until the message is hovered/focused.
   Mobile: revealed at 60% opacity (CSS handles below at 768px). */
.pv-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  padding: 6px 10px;
  border-radius: 99px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  line-height: 1;
}
.pv-action-btn:hover,
.pv-action-btn:focus-visible {
  background: var(--pv-blue-tint);
  border-color: var(--pv-blue);
  color: var(--pv-blue);
  outline: none;
}
.pv-action-btn .pv-action-ico {
  width: 14px; height: 14px;
  display: inline-grid; place-items: center;
}
/* Phase 8 — while any AI message is streaming, freeze every copy button on the
   page. The native `disabled` attribute is set on the button itself (see
   renderMessage) so screen readers announce the disabled state; the CSS here
   kills pointer events and desaturates so the control also reads "disabled"
   visually. Belt-and-suspenders per advisor review.

   Selectors are scoped under `.pv-msg.ai .pv-feedback` so the specificity
   (0,6,0) beats the hover-reveal rule below (`.pv-msg.ai:hover .pv-feedback
   .hover-only`, 0,5,0). Without this scoping, hovering a finalized message
   during streaming lights the buttons back up to full opacity with pointer-
   events restored — the HTML `disabled` attr still blocks the click, but the
   user sees an enabled-looking button that does nothing. */
.pv-msg.ai .pv-feedback .pv-action-btn[disabled],
.pv-msg.ai:hover .pv-feedback .pv-action-btn[disabled],
.pv-msg.ai:focus-within .pv-feedback .pv-action-btn[disabled],
.pv-msg.ai .pv-feedback .pv-action-btn[disabled]:hover,
.pv-msg.ai .pv-feedback .pv-action-btn[disabled]:focus-visible {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
  background: transparent;
  border-color: var(--line);
  color: var(--ink-dim);
}
/* Desktop hover-reveal: hide until the owning AI message is hovered/focused.
   The feedback row (.pv-feedback) itself stays visible (thumbs are always-on
   per spec); only the .hover-only children fade. */
@media (hover: hover) and (pointer: fine) {
  .pv-msg.ai .pv-feedback .hover-only {
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
  }
  .pv-msg.ai:hover .pv-feedback .hover-only,
  .pv-msg.ai:focus-within .pv-feedback .hover-only {
    opacity: 1;
    pointer-events: auto;
  }
}
/* Mobile / touch: always-visible at 60% opacity (touch has no hover). */
@media (hover: none), (pointer: coarse) {
  .pv-msg.ai .pv-feedback .hover-only {
    opacity: 0.6;
  }
}

/* Phase 5 — mic is experimental/flaky; hide on desktop, show only on small
   viewports where voice input is most used. */
@media (min-width: 769px) {
  .pv-tool#pv-mic { display: none !important; }
}

/* Services grid — design artifact had an empty shell comment; we fill it
   with six real PV service links styled like the .service-grid already
   defined above. Extra rules below only layer on interactions. */
.services h2 {
  font-family: "Source Serif 4", serif;
  font-size: 36px;
  font-weight: 400;
  color: var(--pv-blue);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.services h2 .ital { font-style: italic; }
.services-intro {
  font-family: "Source Serif 4", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-dim);
  margin: 0 0 28px;
  max-width: 72ch;
}

/* Mic "unsupported" hint — shown briefly when Web Speech API is missing. */
.pv-mic-unsupported {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink-2);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
  animation: fadeOut 4s forwards;
  z-index: 20;
}
@keyframes fadeOut {
  0%, 70% { opacity: 1; }
  100%    { opacity: 0; pointer-events: none; }
}

/* In-widget confirmation dialog (replaces window.confirm). Scoped to the
   panel so the scrim dims only the widget, not the full page. */
.pv-confirm-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 18, 54, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  animation: pv-confirm-fade 140ms ease-out;
}
@keyframes pv-confirm-fade { from { opacity: 0; } to { opacity: 1; } }
.pv-confirm-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px 16px;
  box-shadow: var(--shadow-lg, 0 18px 40px rgba(0, 18, 54, 0.25));
  min-width: 260px;
  max-width: 360px;
  width: calc(100% - 48px);
  animation: pv-confirm-rise 160ms ease-out;
}
@keyframes pv-confirm-rise {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pv-confirm-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--pv-ink, #0b1220);
  margin-bottom: 16px;
  line-height: 1.35;
}
.pv-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.pv-confirm-cancel,
.pv-confirm-ok {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.pv-confirm-cancel {
  background: transparent;
  color: var(--pv-ink, #0b1220);
  border-color: rgba(0, 18, 54, 0.15);
}
.pv-confirm-cancel:hover { background: rgba(0, 18, 54, 0.04); }
.pv-confirm-ok {
  background: var(--pv-blue, #002F7A);
  color: #fff;
}
.pv-confirm-ok:hover { filter: brightness(1.08); }
.pv-confirm-cancel:focus-visible,
.pv-confirm-ok:focus-visible {
  outline: 2px solid var(--pv-blue, #002F7A);
  outline-offset: 2px;
}

/* Phase 7 — Report modal extends the confirm-card shell. Wider to fit radios
   + textarea without cramping. */
.pv-confirm-card.pv-report-card {
  max-width: 440px;
}
.pv-report-body {
  margin-bottom: 16px;
}
.pv-report-opts {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.pv-report-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 120ms, background 120ms;
}
.pv-report-opt:hover {
  border-color: var(--pv-blue);
  background: var(--pv-blue-tint);
}
.pv-report-opt input[type="radio"] {
  accent-color: var(--pv-blue);
  margin: 0;
}
.pv-report-textlabel {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.pv-report-text {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
.pv-report-text:focus {
  outline: 2px solid var(--pv-blue);
  outline-offset: 1px;
  border-color: var(--pv-blue);
}

/* Lightweight toast (feedback confirmation, errors). */
.pv-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pv-blue);
  color: #fff;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-med);
  animation: toastSlide 3.2s forwards;
  z-index: 30;
}
@keyframes toastSlide {
  0%    { opacity: 0; transform: translate(-50%, -10px); }
  10%, 85% { opacity: 1; transform: translate(-50%, 0); }
  100%  { opacity: 0; transform: translate(-50%, -10px); }
}

/* Mobile: the design panel keeps drawer semantics; on first open ≤768px we
   force fullscreen via JS adding the is-fullscreen class. A CSS fallback
   covers edge cases where JS never runs (e.g. stale cache). */
@media (max-width: 768px) {
  .pv-widget-root.is-open:not(.is-fullscreen) .pv-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    right: 8px;
    bottom: 8px;
    border-radius: 14px;
  }
}

/* =======================================================
   ================ V6 BEHAVIORAL POLISH ==================
   =======================================================
   Backs one JS-driven behavior ported from the v6 Dense Edition:
     1. .pv-panel.has-messages — collapses the quick-chip row and the
        in-header a11y toolbar once a conversation starts (chips + a11y
        buttons only help the empty/first-turn state).
*/

/* (1) has-messages: collapse quick chips + in-header a11y toolbar once
   the conversation has started. Transitions ease the collapse instead of
   popping elements out of layout.
   v7: chips now flex-wrap so max-height must accommodate 2–3 wrapped rows. */
.pv-quick-row,
.pv-header-context {
  transition: max-height 0.3s ease, margin 0.3s ease, opacity 0.2s ease;
  max-height: 140px;
}
/* Quick chips intentionally stay visible for the entire session so residents
   can jump to common tasks without scrolling back to the empty state.
   The a11y toolbar (A−/A+/contrast/motion) also stays visible — users need
   those controls most *during* a conversation, not before one. If you ever
   want to collapse it again after first message, re-add the rule below:
     .pv-panel.has-messages .pv-header-context { max-height: 0; ... }
   The transitions on the base selector will still ease it in/out. */


/* -----------------------------------------------------------------
   Phase 9 — Print stylesheet
   Target: a resident presses Ctrl+P to archive an answer / screenshot
   the conversation. We strip the chat UI chrome (header icons, composer,
   launcher bubble) and force-expand collapsed Sources so the printed
   page carries the full citation list.
   ----------------------------------------------------------------- */
@media print {
  /* Host page probably has its own layout; don't fight it — just let
     the widget content expand inline. */
  .pv-widget-root,
  .pv-widget-root.is-open,
  .pv-widget-root.is-fullscreen {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
  }
  .pv-panel {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    box-shadow: none !important;
    border: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  .pv-body {
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
  }

  /* Hide interactive chrome that isn't useful on paper. */
  .pv-bubble,
  .pv-header-actions,
  .pv-composer,
  .pv-foot,
  .pv-feedback,
  .pv-regen-btn,
  .pv-action-btn,
  .tweaks-panel,
  .pv-toast,
  .pv-confirm-scrim,
  .pv-a11y-inline,
  .pv-header-divider,
  .pv-prompts,
  .pv-quick-row,
  .pv-mic-unsupported,
  button[data-action] {
    display: none !important;
  }

  /* Keep a minimal header so the printed page has context, but drop
     the decorative gradients that waste ink. */
  .pv-header {
    background: #fff !important;
    color: #000 !important;
    border-bottom: 1px solid #000 !important;
    padding: 8px 0 !important;
  }
  .pv-header::before { display: none !important; }
  .pv-header-name,
  .pv-header-sub { color: #000 !important; }

  /* Force-expand the Sources disclosure so citations print in full.
     Hide the chevron since there's no "click" on paper. */
  .pv-citations { display: block !important; }
  .pv-citations > summary { list-style: none; }
  .pv-citations .pv-citations-list { display: flex !important; flex-direction: column; gap: 4px; }
  .pv-citations .pv-citations-chevron { display: none !important; }
  /* Show the full URL instead of the ellipsis-truncated label. */
  .pv-cite-body .u {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-all;
  }

  /* High-contrast print. */
  .pv-msg.ai .pv-msg-bubble,
  .pv-msg.user .pv-msg-bubble {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
  .pv-msg-avatar {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
    animation: none !important;
  }
  .pv-msg-meta {
    color: #000 !important;
    font-size: 11px !important;
  }

  /* Links — show the href next to the label so the printout is legible
     without the screen. Limit to external-anchor-style links to avoid
     junk next to every internal button. */
  .pv-msg-bubble a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #333;
    word-break: break-all;
  }

  /* Avoid cutting a reply mid-page when possible. */
  .pv-msg { break-inside: avoid; page-break-inside: avoid; }
}

/* -----------------------------------------------------------------
   Phase 10 — A11y polish
   Global focus-visible ring for every interactive widget control. We
   used :focus-visible so ring only shows for keyboard nav, not mouse.
   ----------------------------------------------------------------- */
.pv-widget-root .pv-tool:focus-visible,
.pv-widget-root .pv-feedback-btn:focus-visible,
.pv-widget-root .pv-action-btn:focus-visible,
.pv-widget-root .pv-regen-btn:focus-visible,
.pv-widget-root .pv-prompt:focus-visible,
.pv-widget-root .pv-cite:focus-visible,
.pv-widget-root .pv-citations-summary:focus-visible,
.pv-widget-root .pv-bubble:focus-visible,
.pv-widget-root .pv-a11y-btn:focus-visible {
  outline: 2px solid var(--pv-blue, #002F7A);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(78, 111, 217, 0.18);
}
/* Textarea + input inside the widget. */
.pv-widget-root textarea:focus-visible,
.pv-widget-root input[type="text"]:focus-visible,
.pv-widget-root input[type="search"]:focus-visible {
  outline: 2px solid var(--pv-blue, #002F7A);
  outline-offset: 1px;
}
/* Visually-hidden helper for screen-reader-only cues. */
.pv-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* -----------------------------------------------------------------
   Responsive breakpoint tune-ups.
   Targets: iPhone SE (360), iPhone 13/14 (390), small tablet (720),
   laptop (1024), desktop (1440), widescreen (1920).
   Each block only nudges spacing/typography — no layout rewrites.
   ----------------------------------------------------------------- */

/* 360px — iPhone SE / older Android. Tightest mobile. */
@media (max-width: 380px) {
  .pv-widget-root.is-fullscreen .pv-body { padding: 18px 14px; }
  .pv-widget-root.is-fullscreen .pv-header { padding: 14px 14px; }
  .pv-widget-root.is-fullscreen .pv-composer { padding: 10px 14px; }
  .pv-widget-root.is-fullscreen .pv-greet-title { font-size: 24px; }
  .pv-widget-root.is-fullscreen .pv-greet-sub { font-size: 15px; }
  .pv-msg-body { font-size: 16px; }
  .pv-header-name { font-size: 20px; }
  .pv-header-sub { font-size: 11px; }
}

/* 390px — iPhone 13/14/15. The sweet spot for most touch users. */
@media (min-width: 381px) and (max-width: 430px) {
  .pv-widget-root.is-fullscreen .pv-body { padding: 22px 16px; }
  .pv-widget-root.is-fullscreen .pv-greet-title { font-size: 28px; }
  .pv-msg-body { font-size: 17px; }
}

/* 720px — small tablet portrait / large phone landscape.
   Widget flips from fullscreen-drawer to bottom-sheet comfort. */
@media (min-width: 481px) and (max-width: 820px) {
  .pv-widget-root.is-fullscreen .pv-body { padding: 28px clamp(18px, 5vw, 36px); }
  .pv-widget-root.is-fullscreen .pv-greet-title { font-size: 32px; }
}

/* 1024px — laptop / iPad landscape. Stock widget sizing works but
   prompt cards benefit from a hair more breathing room. */
@media (min-width: 1000px) and (max-width: 1200px) {
  .pv-widget-root.is-fullscreen .pv-empty,
  .pv-widget-root.is-fullscreen .pv-msgs,
  .pv-widget-root.is-fullscreen .pv-input-wrap,
  .pv-widget-root.is-fullscreen .pv-quick-row { max-width: 860px; }
}

/* 1440px — standard desktop. 1000px column reads well here. */
@media (min-width: 1400px) and (max-width: 1700px) {
  .pv-widget-root.is-fullscreen .pv-empty,
  .pv-widget-root.is-fullscreen .pv-msgs,
  .pv-widget-root.is-fullscreen .pv-input-wrap,
  .pv-widget-root.is-fullscreen .pv-quick-row { max-width: 1000px; }
  .pv-widget-root.is-fullscreen .pv-greet-title { font-size: 44px; }
}

/* 1920px+ — widescreen. Cap stays at 1000px for readability;
   line length past ~1100px hurts comprehension per the same research
   that informs the base cap. Just add extra side padding so content
   doesn't hug a far-off edge. */
@media (min-width: 1800px) {
  .pv-widget-root.is-fullscreen .pv-body { padding: 48px clamp(40px, 10vw, 220px); }
  .pv-widget-root.is-fullscreen .pv-composer { padding: 18px clamp(40px, 10vw, 220px); }
  .pv-widget-root.is-fullscreen .pv-foot { padding: 14px clamp(40px, 10vw, 220px); }
  .pv-widget-root.is-fullscreen .pv-header { padding: 28px clamp(40px, 10vw, 220px); }
}

/* =======================================================================
   V7 — FULLSCREEN SPLIT LAYOUT (left rail + main transcript)
   =======================================================================
   Goal (from user): "split the screen so the ask and history are on the
   left and answer pane is on the right; maximize screen space for long
   responses".

   Docked mode is unchanged — flex column with history hidden.
   Fullscreen at >=1100px flips `.pv-panel` into a CSS grid with four
   named areas. The sidebar (aside.pv-history) holds history; the composer
   sits below it on the same column. The main transcript (.pv-body) spans
   the full height of the right column. Below 1100px we revert to the
   single-column flex layout (sidebar auto-hides).

   Cascade note: this block intentionally lives AFTER the smaller-width
   fullscreen media queries above so that the `max-width` caps they set
   on `.pv-body`, `.pv-msgs`, etc. get overridden at >=1100px where the
   grid already constrains width.
   ----------------------------------------------------------------------- */
.pv-history { display: none; }
.pv-sidebar-expand { display: none; }

/* Split layout kicks in at >=1200px only. Per the v7 UX spec, laptops at
   1100-1199 keep the single-column layout so users aren't stuck with a
   cramped two-pane view. Sidebar-collapse state from localStorage is also
   only applied at >=1200px (see ask_pv_v5.js sidebarCollapse handlers). */
@media (min-width: 1200px) {
  .pv-widget-root.is-fullscreen .pv-panel {
    display: grid;
    grid-template-columns: 340px 1fr;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "header    header"
      "aside     body"
      "composer  composer"
      "foot      foot";
    /* NOTE: do NOT set left/right/top/bottom/width/height here. The base
       fullscreen rules (~line 495) inset the root by 24px using the visible
       viewport (avoiding 100vw scrollbar pollution) and fill the panel with
       top/right/bottom/left: 0. Overriding any of those pulls the panel
       off-screen. */
  }
  .pv-widget-root.is-fullscreen .pv-header   { grid-area: header; }
  .pv-widget-root.is-fullscreen .pv-history  {
    grid-area: aside;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--bg-alt);
    border-right: 1px solid var(--line);
  }
  .pv-widget-root.is-fullscreen .pv-body     { grid-area: body; min-height: 0; }
  /* Composer spans BOTH columns so the textarea + Send button + tool row
     get full viewport width at the bottom. Keeps the 340px sidebar uncluttered
     (history only) and gives the input comfortable room at any viewport. */
  .pv-widget-root.is-fullscreen .pv-composer {
    grid-area: composer;
    border-top: 1px solid var(--line);
  }
  .pv-widget-root.is-fullscreen .pv-foot     { grid-area: foot; }

  /* Collapsed: revert to single-column layout + reveal the floating expander.
     Handlers in ask_pv_v5.js toggle the `sidebar-collapsed` class on .pv-panel
     and persist that choice to localStorage (keyed to viewport >=1200px). */
  .pv-widget-root.is-fullscreen .pv-panel.sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "body"
      "composer"
      "foot";
  }
  .pv-widget-root.is-fullscreen .pv-panel.sidebar-collapsed .pv-history { display: none; }
  /* Composer no longer has border-right in either split or collapsed state
     (composer now spans both columns by default), so no override needed. */
  .pv-widget-root.is-fullscreen .pv-panel.sidebar-collapsed .pv-sidebar-expand {
    display: grid;
    place-items: center;
    position: absolute;
    top: 72px;
    left: 10px;
    z-index: 20;
    width: 32px; height: 32px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }
  .pv-widget-root.is-fullscreen .pv-panel.sidebar-collapsed .pv-sidebar-expand:hover {
    background: var(--pv-blue-tint);
    color: var(--pv-blue);
    border-color: var(--pv-blue);
  }
  .pv-widget-root.is-fullscreen .pv-panel.sidebar-collapsed .pv-sidebar-expand svg {
    width: 16px; height: 16px;
  }

  /* Drop the 860px / 1000px readability caps — the right column is already
     bounded by the grid (viewport - 340px sidebar). Keep a soft upper bound
     for very wide screens so paragraph length stays readable. */
  .pv-widget-root.is-fullscreen .pv-body,
  .pv-widget-root.is-fullscreen .pv-msgs,
  .pv-widget-root.is-fullscreen .pv-input-wrap,
  .pv-widget-root.is-fullscreen .pv-quick-row,
  .pv-widget-root.is-fullscreen .pv-empty {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  /* Soft cap the transcript readable width at ~1200px on very wide
     monitors so we keep comfortable line length. Sidebar still gets its
     full real estate. */
  .pv-widget-root.is-fullscreen .pv-msgs,
  .pv-widget-root.is-fullscreen .pv-empty { max-width: 1200px; }

  /* Padding trimmed since we no longer use `clamp(...)` side padding — the
     sidebar/body columns now carry the side real estate themselves. */
  .pv-widget-root.is-fullscreen .pv-body { padding: 20px 28px; }
  .pv-widget-root.is-fullscreen .pv-composer { padding: 10px 14px; }
  .pv-widget-root.is-fullscreen .pv-foot { padding: 10px 28px; }
  .pv-widget-root.is-fullscreen .pv-header { padding: 16px 28px; }
}

/* History rail — internal styling. Only visible when the parent aside
   is `display: flex` (set by the grid layout above). */
.pv-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.pv-history-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pv-history-toggle {
  width: 28px; height: 28px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.3s;
}
.pv-history-toggle:hover {
  background: var(--pv-blue-tint);
  color: var(--pv-blue);
  border-color: var(--pv-blue);
}
.pv-history-toggle svg { width: 14px; height: 14px; }
.pv-history-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}
/* History row: wrapper div containing two sibling <button>s. The wrapper
   itself is NOT interactive — nesting buttons inside a button violates HTML
   spec and breaks keyboard focus / screen-reader announcements. The main
   button carries the clickable surface; the reuse button floats top-right. */
.pv-history-row {
  position: relative;
  margin: 0 0 4px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}
.pv-history-row.active {
  background: var(--pv-blue-tint);
  border-color: var(--pv-blue);
}
.pv-history-row-main {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 34px 8px 10px; /* right padding clears the reuse button */
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.3;
  border-radius: 8px;
}
.pv-history-row-main:hover,
.pv-history-row-main:focus-visible {
  background: var(--pv-blue-tint);
  outline: none;
}
.pv-history-row-main:focus-visible {
  box-shadow: 0 0 0 2px var(--pv-blue);
}
.pv-history-row .q {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.pv-history-row .t {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--ink-dim);
  font-weight: 500;
}
.pv-history-row-reuse {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pv-history-row-reuse svg { width: 12px; height: 12px; }
.pv-history-row-reuse:hover,
.pv-history-row-reuse:focus-visible {
  background: var(--pv-blue);
  color: #fff;
  border-color: var(--pv-blue);
  outline: none;
}
.pv-history-empty {
  padding: 14px 12px;
  color: var(--ink-dim);
  font-size: 12px;
  text-align: center;
}

/* v7: "Explore more" related-queries row appended under the latest answer
   in fullscreen. Keeps nudging the user toward next-step questions without
   the full popular-card grid. */
.pv-explore-more {
  margin: 14px 0 6px;
  padding: 10px 0 0;
  border-top: 1px dashed var(--line);
}
.pv-explore-more-label {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}
/* LLM-generated (answer-aware) variant — softer tint on the header so users
   can tell these are tailored to the current answer, not generic defaults. */
.pv-explore-more.is-dynamic .pv-explore-more-label {
  color: var(--pv-blue);
}
.pv-explore-more.is-dynamic {
  border-top-color: var(--pv-blue-tint, var(--line));
}
.pv-explore-more-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}
.pv-explore-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  transition: all 0.2s;
  min-height: 44px;
}
.pv-explore-card:hover {
  border-color: var(--pv-blue);
  background: var(--pv-blue-tint);
  transform: translateY(-1px);
}
.pv-explore-card .lbl {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
}
.pv-explore-card .sub {
  font-size: 11px;
  color: var(--ink-dim);
  font-weight: 500;
}

/* ==========================================================================
   Phase 9 — PDF via window.print()
   --------------------------------------------------------------------------
   The PDF button on each AI message populates a hidden <div id="pv-print-root"
   class="pv-print-only"> with the question + answer + expanded sources, then
   calls window.print(). These rules keep the container invisible in the live
   view (default display:none), then in @media print context they flip it on
   and hide everything else on the page.

   Known user-facing gaps this CSS must close (vs. the clipboard-paste path):
     - Colors not carrying over  → -webkit-print-color-adjust: exact
     - Code blocks losing style  → explicit background + border on pre/code
     - Citation list stripped    → plain <ol> with clickable <a>, no flex
   ========================================================================== */

/* Hidden by default — only visible inside the print engine. */
.pv-print-only { display: none; }

@media print {
  /* Force backgrounds and colored borders to print. Without this, Chromium
     and Firefox strip backgrounds to save ink — the PDF would come out
     mostly black-on-white and miss the brand feel entirely. */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide the live widget; show only the print container. `body > *` catches
     every top-level sibling rendered by the template. */
  body > *:not(.pv-print-only) { display: none !important; }
  .pv-print-only { display: block !important; }

  /* US Letter with sensible margins. Typography below is in pt so it respects
     the user's print scaling. */
  @page { size: letter; margin: 0.75in; }

  html, body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .pv-print-doc {
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-size: 11pt;
    line-height: 1.55;
    color: #111111;
    max-width: none;
  }

  /* ---- Question block (top) ---- */
  .pv-print-q {
    background: #f3f6fb !important;
    border-left: 4px solid #002F7A !important;
    padding: 10pt 12pt;
    margin: 0 0 16pt 0;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .pv-print-q-label {
    font-family: "Inter", Arial, sans-serif;
    font-size: 8.5pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #002F7A !important;
    margin: 0 0 3pt 0;
  }
  .pv-print-q-text {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 13pt;
    font-weight: 600;
    color: #0f172a !important;
    line-height: 1.35;
  }

  /* ---- Answer body ---- */
  .pv-print-answer {
    color: #111111 !important;
  }
  .pv-print-answer h1,
  .pv-print-answer h2,
  .pv-print-answer h3,
  .pv-print-answer h4 {
    color: #0f172a !important;
    page-break-after: avoid;
    break-after: avoid-page;
    font-weight: 700;
  }
  .pv-print-answer h1 { font-size: 17pt; margin: 14pt 0 6pt 0; }
  .pv-print-answer h2 { font-size: 14pt; margin: 12pt 0 5pt 0; }
  .pv-print-answer h3 { font-size: 12pt; margin: 10pt 0 4pt 0; }
  .pv-print-answer h4 { font-size: 11pt; margin: 9pt 0 3pt 0; }

  .pv-print-answer p { margin: 0 0 9pt 0; }
  .pv-print-answer ul,
  .pv-print-answer ol {
    margin: 0 0 9pt 0;
    padding-left: 24pt;
  }
  .pv-print-answer li { margin: 0 0 4pt 0; }
  .pv-print-answer li > p { margin: 0 0 4pt 0; }
  .pv-print-answer blockquote {
    margin: 9pt 0;
    padding: 4pt 10pt;
    border-left: 3pt solid #cbd5e1 !important;
    color: #334155 !important;
    font-style: italic;
  }
  .pv-print-answer hr {
    border: none;
    border-top: 1pt solid #e5e7eb !important;
    margin: 12pt 0;
  }

  /* ---- Code blocks (the second failure mode) ----
     Explicit background + border + monospace. white-space: pre-wrap prevents
     wide code lines from overflowing the page margin. page-break-inside
     avoids splitting a short code block across pages. */
  .pv-print-answer pre {
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 3pt;
    padding: 8pt 10pt;
    margin: 9pt 0;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 9.5pt;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    page-break-inside: avoid;
    break-inside: avoid;
    color: #0f172a !important;
  }
  .pv-print-answer code {
    background: #f3f4f6 !important;
    color: #0f172a !important;
    padding: 1pt 4pt;
    border-radius: 2pt;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 9.5pt;
  }
  .pv-print-answer pre code {
    background: transparent !important;
    padding: 0;
    border: none;
    font-size: inherit;
  }

  /* ---- Links (in answer body AND sources list) ----
     Blue + underlined so the PDF reads as "this is a link" even when printed
     on paper. Clickable in PDF viewers that honor hyperlinks. */
  .pv-print-answer a,
  .pv-print-sources a {
    color: #0048B8 !important;
    text-decoration: underline;
    word-break: break-word;
  }

  /* ---- Tables (markdown tables in the answer) ---- */
  .pv-print-answer table {
    border-collapse: collapse;
    width: 100%;
    margin: 9pt 0;
    font-size: 10pt;
    page-break-inside: auto;
  }
  .pv-print-answer thead { display: table-header-group; }
  .pv-print-answer tr { page-break-inside: avoid; }
  .pv-print-answer th,
  .pv-print-answer td {
    border: 1px solid #d1d5db !important;
    padding: 5pt 7pt;
    text-align: left;
    vertical-align: top;
  }
  .pv-print-answer th {
    background: #f3f4f6 !important;
    font-weight: 700;
    color: #0f172a !important;
  }

  /* ---- Images in the answer ---- */
  .pv-print-answer img {
    max-width: 100%;
    height: auto;
    page-break-inside: avoid;
  }

  /* ---- Sources block (third failure mode: citation list stripped) ----
     Flat numbered <ol>, bold clickable title, muted URL underneath. No flex,
     no grid, no rounded corners — every print engine handles this. */
  .pv-print-sources {
    margin-top: 18pt;
    padding-top: 12pt;
    border-top: 2pt solid #002F7A !important;
  }
  .pv-print-sources-title {
    font-family: "Inter", Arial, sans-serif;
    font-size: 12pt;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 8pt 0;
    color: #002F7A !important;
    page-break-after: avoid;
    break-after: avoid-page;
  }
  .pv-print-sources-list {
    list-style: decimal;
    margin: 0;
    padding-left: 22pt;
    font-size: 10.5pt;
  }
  .pv-print-sources-list li {
    margin: 0 0 7pt 0;
    page-break-inside: avoid;
    break-inside: avoid;
    line-height: 1.4;
  }
  .pv-print-sources-list a {
    font-family: "Source Serif 4", Georgia, serif;
    font-weight: 600;
    font-size: 11pt;
  }
  .pv-print-src-url {
    font-family: "Inter", Arial, sans-serif;
    font-size: 9pt;
    color: #4b5563 !important;
    margin-top: 1pt;
    word-break: break-all;
  }
  .pv-print-src-title {
    font-family: "Source Serif 4", Georgia, serif;
    font-weight: 600;
    color: #0f172a !important;
  }
}
