/* ============================================================
   WeVote Kit — Components
   Visual styling for things Tailwind can't express cleanly:
   badges, pills, OTP, scrollbars, chat widget, nav drawer, etc.
   Layout/spacing stays in Tailwind utilities on the markup.
   Keyframes live in animations.css.
   ============================================================ */

/* ---- status badge ---- */
.badge {
  display: inline-flex; align-items: center; gap: .4em;
  font-family: "Open Sans", monospace;
  font-size: 11px; font-weight: 500; line-height: 1;
  letter-spacing: .02em;
  padding: .42em .62em .42em .55em;
  border-radius: 7px;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.badge-pending    { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.badge-pending .dot { background: var(--st-pending-dot); }
.badge-open       { background: var(--st-open-bg); color: var(--st-open-fg); }
.badge-open .dot    { background: var(--st-open-dot); }
.badge-resolved   { background: var(--st-res-bg); color: var(--st-res-fg); }
.badge-resolved .dot{ background: var(--st-res-dot); }
.badge-unresolved { background: var(--st-unres-bg); color: var(--st-unres-fg); }
.badge-unresolved .dot{ background: var(--st-unres-dot); }
.badge-archived   { background: var(--st-arch-bg); color: var(--st-arch-fg); }
.badge-archived .dot{ background: var(--st-arch-dot); }
.badge-success    { background: var(--accent); color: #fff; }
.badge-success .dot{ background: #fff; opacity: .9; }
.dark .badge-success    { background: var(--accent); color: #04130d; }
.dark .badge-success .dot{ background: #04130d; opacity: .7; }

/* ---- clamped text with a Read more / Read less toggle (kit desc-clamp) ---- */
.desc-clamp {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; overflow: hidden;
}
.desc-clamp.is-open { -webkit-line-clamp: unset; overflow: visible; }

/* ---- official profile biography: clamps to 5 lines, expands via wevote--card--clamp ---- */
.prof-bio {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 5; overflow: hidden;
}
.prof-bio.is-open { -webkit-line-clamp: unset; overflow: visible; }
.prof-bio p + p { margin-top: 12px; }

/* ---- type pill (category) ---- */
.type-pill {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: .38em .6em; border-radius: 7px;
  background: var(--sunken); color: var(--muted);
  border: 1px solid var(--hairline);
}

/* ---- scrollbars ---- */
.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent; }
.scroll-thin::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
.scroll-thin::-webkit-scrollbar-thumb {
  background: var(--hairline-strong); border-radius: 99px;
  border: 2px solid transparent; background-clip: padding-box;
}
.scroll-thin::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ---- OTP segmented input ---- */
.otp { display: flex; gap: 10px; }
.otp input {
  width: 52px; height: 64px;
  text-align: center;
  font-family: "Open Sans", monospace;
  font-size: 28px; font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--hairline-strong);
  border-radius: 14px;
  caret-color: var(--accent);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.otp input::placeholder { color: var(--faint); opacity: .5; }
.otp input:hover { border-color: var(--faint); }
.otp input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}
.otp input.filled { border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 420px) {
  .otp { gap: 7px; }
  .otp input { width: 44px; height: 56px; font-size: 24px; border-radius: 12px; }
}

/* ---- chat bubble tails (subtle) ---- */
.bubble { position: relative; }

/* ---- striped image placeholder ---- */
.ph-stripe {
  background-image: repeating-linear-gradient(
    45deg, var(--hairline) 0, var(--hairline) 1px,
    transparent 1px, transparent 9px);
  background-color: var(--sunken);
}

/* ---- show-page cover band ----
   Branded neutral default for race / group / petition show pages.
   Reads only ink/surface tokens (emerald stays reserved for actions),
   so it works in light + dark with no image data. Drop a photo in by
   setting --cover-img: url("...") on the element. */
.show-cover {
  position: relative;
  background-color: var(--sunken);
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 12%, transparent) 1px, transparent 0),
    radial-gradient(140% 140% at 88% -30%, color-mix(in srgb, var(--ink) 22%, transparent) 0%, transparent 54%),
    linear-gradient(118deg, color-mix(in srgb, var(--ink) 20%, var(--sunken)) 0%, color-mix(in srgb, var(--ink) 7%, var(--sunken)) 62%);
  background-size: 20px 20px, 100% 100%, 100% 100%;
  border-bottom: 1px solid var(--hairline-strong);
}
/* photo variant — set --cover-img to a url() to override the texture */
.show-cover[style*="--cover-img"] {
  background-image: var(--cover-img);
  background-size: cover;
  background-position: center;
}
.show-cover.is-completed { filter: grayscale(.5); opacity: .85; }


/* ---- collapsible ---- */
.chev { transition: transform .25s cubic-bezier(.22,.61,.36,1); }
.is-open .chev { transform: rotate(180deg); }
.collapse-body {
  overflow: hidden;
  transition: grid-template-rows .28s cubic-bezier(.22,.61,.36,1),
              opacity .22s ease;
  display: grid; grid-template-rows: 1fr; opacity: 1;
}
.collapse-body.collapsed { grid-template-rows: 0fr; opacity: 0; }
.collapse-body > div { min-height: 0; }

/* filter bar: inner wrapper is a container so controls adapt to the COLUMN
   width (correct on mobile + narrow feed columns, not just the viewport).
   Kept off the sticky element itself so stickiness is unaffected. */
.fb-inner { container-type: inline-size; }
.fb-ballot-label { display: none; }
@container (min-width: 520px) { .fb-ballot-label { display: inline; } }

/* status segmented control (Upcoming / Past) */
.seg-status { display: inline-flex; flex: none; padding: 3px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--hairline); gap: 2px; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; cursor: pointer; transition: color .15s ease, background .15s ease, box-shadow .15s ease; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft); }

/* ---- hover lift ---- */
.lift { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

/* ---- brand wordmark (inline SVG fill:currentColor → follows --ink, adapts light/dark) ---- */
.wv-wordmark { color: var(--ink); line-height: 0; }
.wv-wordmark svg { height: 20px; width: auto; display: block; }

/* ---- details drawer (immersive layout) ---- */
.drawer-wrap { pointer-events: none; }
.drawer-wrap .drawer-backdrop { opacity: 0; transition: opacity .28s ease; }
.drawer-wrap .drawer-panel {
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.22,.61,.36,1);
}
.drawer-wrap.drawer-open { pointer-events: auto; }
.drawer-wrap.drawer-open .drawer-backdrop { opacity: 1; }
.drawer-wrap.drawer-open .drawer-panel { transform: translateX(0); }

/* ---- responsive left navigation (drawer below lg) ---- */
.nav-aside {
  position: fixed; top: 0; bottom: 0; left: 0;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}
.nav-open .nav-aside { transform: translateX(0); box-shadow: var(--shadow-pop); }
.nav-backdrop { opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) {
  .nav-aside { position: static; transform: none !important; transition: none; box-shadow: none !important; }
  .nav-backdrop { display: none !important; }
}
/* nav group chevron: points up when its section is expanded */
.nav-chev { transition: transform .2s ease; }
[data-nav-group][aria-expanded="true"] .nav-chev { transform: rotate(180deg); }

/* header popovers on mobile: the account menu anchors to the viewport with
   even margins; the notifications dropdown is suppressed entirely (the bell
   redirects to the full notifications page instead — see WV._wireNotifMenu) */
@media (max-width: 639px) {
  [data-user-menu-panel] { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; }
  [data-notif-menu-panel] { display: none !important; }
}

/* ---- floating chat widget (launcher + docked panel) ---- */
.widget-fab .fab-close { display: none; }
.widget-root.open .widget-fab .fab-open { display: none; }
.widget-root.open .widget-fab .fab-close { display: grid; }
.widget-panel {
  opacity: 0; pointer-events: none;
  transform: translateY(14px) scale(.985); transform-origin: bottom right;
  transition: opacity .2s ease, transform .27s cubic-bezier(.22,.61,.36,1);
  z-index: 60;
}
.widget-root.open .widget-panel { opacity: 1; pointer-events: auto; transform: none; }
.widget-fab { z-index: 61; }
@media (max-width: 639px) {
  .widget-root.open .widget-fab { opacity: 0; pointer-events: none; }
  .widget-panel { transform: translateY(100%); transform-origin: bottom center; }
  .widget-root.open .widget-panel { transform: none; }
}
.fab-ping {
  position: absolute; inset: 0; border-radius: 9999px;
  background: var(--accent); z-index: -1;
  animation: wv-ping 1.9s cubic-bezier(0,0,.2,1) infinite;
}
.widget-root.open .fab-ping { display: none; }

/* ---- typing indicator ---- */
.typing span {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--faint); margin: 0 1.5px;
  animation: wv-typing 1.2s infinite ease-in-out;
}
.typing span:nth-child(2){ animation-delay: .15s; }
.typing span:nth-child(3){ animation-delay: .3s; }

/* ---- skeleton shimmer ---- */
.skel {
  background: linear-gradient(100deg,
    var(--sunken) 30%, var(--hairline) 50%, var(--sunken) 70%);
  background-size: 200% 100%;
  animation: wv-shimmer 1.4s infinite linear;
  border-radius: 8px;
}

/* ---- success check (structure; motion gated in animations.css) ---- */
.success-check path { stroke-dasharray: 30; stroke-dashoffset: 0; }

/* ---- native select, kit-styled (chevron + reset appearance) ----
   Pair with Tailwind for size/colour: <select class="wv-select ...">. */
.wv-select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A766C' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.dark .wv-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239A968E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ---- home feed: filter drawer (slides down under the tab row) ----
   Ported from the kit (ui_kits/home/home.css). The drawer is in-flow and
   reveals via max-height; the leading-icon fields override .wv-select's base. */
.feed-drawer {
  overflow: hidden;
  max-height: 0; opacity: 0;
  transition: max-height .3s cubic-bezier(.22,.61,.36,1), opacity .22s ease;
}
.feed-drawer.is-open { max-height: 600px; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .feed-drawer { transition: none; } }

.feed-field { display: block; }
.feed-field__label {
  display: block; margin-bottom: 6px;
  font-family: "Open Sans", monospace;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
}
.feed-field__control { position: relative; display: block; }
.feed-field__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--faint); pointer-events: none;
}
.feed-field .wv-select {
  width: 100%; height: 44px;
  padding: 0 38px 0 36px; border-radius: 12px;
  background-color: var(--sunken);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 500; color: var(--ink);
  transition: background .15s ease, border-color .15s ease;
}
.feed-field .wv-select:hover { border-color: var(--hairline-strong); }
.feed-field .wv-select:focus { background-color: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }

/* ---- transient toast (bottom-centre confirmation) ----
   Toggle visibility via the .is-shown class from JS. */
.wv-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 70; padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--paper);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.wv-toast.is-shown { opacity: 1; }

/* ---- clamped text with a Read more / Read less toggle ---- */
.desc-clamp {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; overflow: hidden;
}
.desc-clamp.is-open { -webkit-line-clamp: unset; overflow: visible; }

/* ---- mobile search overlay (slide-down sheet under the header) ----
   Phones hide the header search field, so the search icon opens this
   glass drop-down. Mobile-only; controlled by .is-open. ---- */
.wv-search-overlay { position: fixed; inset: 0; z-index: 60; display: none; }
.wv-search-overlay.is-open { display: block; }
@media (min-width: 640px) { .wv-search-overlay { display: none !important; } }
.wv-search-overlay__backdrop {
  position: absolute; inset: 0; border: 0; padding: 0; cursor: default;
  background: rgba(8, 10, 12, .42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s ease;
}
.wv-search-overlay.is-open .wv-search-overlay__backdrop { opacity: 1; }
.wv-search-overlay__panel {
  position: absolute; top: 66px; left: 10px; right: 10px;
  border-radius: 18px; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 18px 50px -12px rgba(8, 10, 12, .35), 0 2px 8px rgba(8, 10, 12, .08);
  transform: translateY(-10px) scale(.99); opacity: 0;
  transition: transform .24s cubic-bezier(.22, .61, .36, 1), opacity .18s ease;
}
.wv-search-overlay.is-open .wv-search-overlay__panel { transform: none; opacity: 1; }
/* borderless search field — opt out of the global :focus-visible accent outline */
.wv-search-overlay__panel input:focus-visible { outline: none; }

/* ---- discovery rail: one scroller, no own scrollbar. The aside is sticky by
   default; the wevote--shell--rail controller flips it (top/free/bottom) so it
   rides the feed and parks at its edges. #rail must be the positioning context. */
#rail { position: relative; }
#rail > aside { position: sticky; top: 0; height: auto; max-height: none; overflow: visible; }

/* ---- reply parent peek: the "Replying to" chip expands the parent inline.
   The wevote--comments--reply-context controller toggles the panel + the
   chip's .pk-open class, which rotates the chevron. */
.reply-peek { transition: all .15s ease; cursor: pointer; }
.pk-chev { transition: transform .2s ease; }
.pk-open .pk-chev { transform: rotate(180deg); }

/* ---- comment media: fit within a 510×510 box at true ratio, never crop
   (kit comp-comment-media). The wrapper paints a sunken bg behind transparent
   PNGs; tapping opens the shared lightbox controller. */
.wv-comment-media { display: block; width: auto; height: auto; max-width: min(510px, 100%); max-height: 510px; }

/* ---- media carousel (one item at a time · arrows · dots · counter, driven by
   the generic `slide-carousel` controller; used by the shared media gallery) ---- */
.prop-carousel { position: relative; }
.prop-carousel__viewport {
  overflow: hidden; border-radius: 14px; border: 1px solid var(--hairline);
}
.prop-carousel__track {
  display: flex;
  transition: transform .38s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}
.prop-carousel__slide { flex: 0 0 100%; height: 200px; }
@media (min-width: 640px) {
  .prop-carousel__slide { height: 244px; }
}
@media (prefers-reduced-motion: reduce) { .prop-carousel__track { transition: none; } }

.prop-carousel__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--hairline-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  color: var(--ink); box-shadow: var(--shadow-soft); cursor: pointer;
  transition: background .15s ease, transform .15s ease, opacity .15s ease;
}
.prop-carousel__arrow:hover { background: var(--surface); }
.prop-carousel__arrow:active { transform: translateY(-50%) scale(.94); }
.prop-carousel__arrow--prev { left: 10px; }
.prop-carousel__arrow--next { right: 10px; }
.prop-carousel__arrow[hidden] { display: none; }

.prop-carousel__count {
  position: absolute; top: 10px; right: 10px;
  height: 22px; padding: 0 8px; display: inline-flex; align-items: center;
  border-radius: 999px; font-family: "Open Sans", monospace;
  font-size: 11px; font-weight: 600; line-height: 1;
  color: var(--ink); background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border: 1px solid var(--hairline);
}
.prop-carousel__dots {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.prop-carousel__dot {
  width: 7px; height: 7px; border-radius: 999px; border: 0; padding: 0;
  background: var(--hairline-strong); cursor: pointer;
  transition: width .2s ease, background .2s ease;
}
.prop-carousel__dot.is-on { width: 18px; background: var(--accent); }

/* ---- image lightbox (shared: comment / discussion media, proposal gallery) ----
   built by the `lightbox` Stimulus controller. Near-black blurred backdrop, the
   image centered with rounded corners + a soft shadow, circular close / prev /
   next buttons and a counter. The pop-in animation lives in animations.css. */
.lb { position: fixed; inset: 0; z-index: 90; background: rgba(8, 9, 11, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.lb-scroll { position: absolute; inset: 0; overflow: auto; display: grid; place-items: center; padding: 56px 20px; }
.lb-img { display: block; width: auto; height: auto; max-width: min(1100px, 100%); max-height: calc(100vh - 132px); border-radius: 12px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.lb-cap { margin: 14px 0 0; text-align: center; font-family: "Open Sans", monospace; font-size: 12px; letter-spacing: .04em; color: rgba(255, 255, 255, .6); }
.lb-btn { position: fixed; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; transition: background .15s ease; }
.lb-btn:hover { background: rgba(255, 255, 255, .16); }
.lb-btn svg { width: 20px; height: 20px; }
.lb-x { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-hint { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); font-family: "Open Sans", monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .42); }

/* ---- tabs (kit "Tabs") — one chassis, two looks. Behavior is the shared
   `tabs` Stimulus controller; this is look only. Default = segmented pills on a
   sunken track; `--underline` = light underline for tabs above a list. The icon
   hides on phones (shown sm+); modifiers map to the kit's per-screen tweaks
   (tall / uppercase state-show, accent-tinted home feed, scrolling search). */
.wv-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--sunken); border: 1px solid var(--hairline); }
.wv-tab {
  flex: 1 1 0; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 10px; border-radius: 10px;
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.wv-tab:hover { color: var(--ink); }
.wv-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft); }
.wv-tab__label { overflow: hidden; text-overflow: ellipsis; }
.wv-tab__count { font-size: 11px; font-weight: 600; line-height: 1; color: var(--faint); flex: none; }
.wv-tab.is-active .wv-tab__count { color: var(--accent); }
.wv-tab svg { width: 16px; height: 16px; flex: none; display: none; }
@media (min-width: 640px) { .wv-tab svg { display: inline-block; } }
/* Small screens: every tab takes its natural width and shares the bar; only the
   selected tab never shrinks, so when tabs are tight it keeps its full label while
   the others truncate. Works for any tab count (1, 2, 3, 4+) with no tuning. */
@media (max-width: 639.98px) {
  .wv-tab { flex: 1 1 auto; }
  .wv-tab.is-active { flex-shrink: 0; }
}

/* tall + uppercase — state show / follows */
.wv-tabs--tall .wv-tab { height: 40px; }
.wv-tabs--uppercase .wv-tab { text-transform: uppercase; letter-spacing: .05em; font-size: 12.5px; }

/* accent active tint — home feed */
.wv-tabs--accent .wv-tab.is-active { color: var(--accent-ink); }
.wv-tabs--accent .wv-tab.is-active svg { color: var(--accent); }

/* many tabs — search: keep equal widths when roomy, scroll when tight */
.wv-tabs--scroll { overflow-x: auto; }
.wv-tabs--scroll .wv-tab { flex: 1 0 auto; min-width: 5rem; }

/* underline look — proposals / user profile */
.wv-tabs--underline {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 0; padding: 0; background: transparent; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--hairline);
}
.wv-tabs--underline .wv-tab { position: relative; height: 48px; border-radius: 0; color: var(--faint); }
.wv-tabs--underline .wv-tab:hover { color: var(--muted); background: transparent; }
.wv-tabs--underline .wv-tab.is-active { color: var(--accent-ink); background: transparent; box-shadow: none; }
.wv-tabs--underline .wv-tab::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2.5px;
  border-radius: 999px 999px 0 0; background: var(--accent);
  transform: scaleX(0); transform-origin: center; opacity: 0;
  transition: transform .22s cubic-bezier(.22, .61, .36, 1), opacity .22s ease;
}
.wv-tabs--underline .wv-tab.is-active::after { transform: scaleX(1); opacity: 1; }

/* sticky + full-bleed wrapper — detail / show pages under the topbar */
.wv-tabs-sticky {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px; padding: 10px 16px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
@media (min-width: 640px) { .wv-tabs-sticky { margin: 0 -32px; padding: 10px 32px; } }
/* Index tab strips sit directly under the hero (no detail-page chrome above),
   so they hug tighter than the detail-page default — matches the profile tabs. */
.proposals-index .wv-tabs-sticky,
.spaces-index .wv-tabs-sticky { padding-top: 2px; padding-bottom: 2px; }

/* Search (/search) — header filter control + popover (ported from the search ui_kit).
   A small icon button in the page-head action slot opens an anchored popover of
   jurisdiction options; the dot marks a non-default filter as active. */
.search-ctl { position: relative; }
.search-ctl .search-ctl__dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid var(--surface);
  display: none;
}
.search-ctl.is-active .search-ctl__dot { display: block; }
.search-pop {
  position: absolute; right: 0; top: 46px;
  width: 260px; padding: 6px;
  border-radius: 14px; border: 1px solid var(--hairline-strong);
  background: var(--surface); box-shadow: var(--shadow-pop);
  z-index: 40;
}
.search-pop__list { max-height: 264px; overflow-y: auto; }
.search-pop__head {
  padding: 6px 8px 8px; font-size: 11px; font-family: 'Open Sans', monospace;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
}
.search-opt {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; border: 0; cursor: pointer;
  background: transparent; font-size: 13.5px; font-weight: 500;
  color: var(--ink); text-align: left; transition: background .12s ease;
}
.search-opt.hidden { display: none; }
.search-opt:hover { background: var(--sunken); }
.search-opt__check { margin-left: auto; color: var(--accent); opacity: 0; flex: none; }
.search-opt[aria-checked="true"] { color: var(--accent-ink); font-weight: 600; }
.search-opt[aria-checked="true"] .search-opt__check { opacity: 1; }

/* ---- Flash messages — semantic alert banners.
   Variant set via data-flash="success|error|warning|info|accent"; each maps to
   the kit's status tokens (soft tint + fg + dot), so light + dark come for free. ---- */
.wv-flash {
  --fl-bg: var(--st-res-bg); --fl-fg: var(--st-res-fg); --fl-dot: var(--st-res-dot);
  position: relative; display: flex; flex-direction: column;
  padding: 8px 12px 9px 14px; border-radius: 14px;
  background: var(--fl-bg);
  border: 1px solid color-mix(in srgb, var(--fl-dot) 30%, transparent);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}
.wv-flash[data-flash="success"] { --fl-bg: var(--st-res-bg);     --fl-fg: var(--st-res-fg);     --fl-dot: var(--st-res-dot); }
.wv-flash[data-flash="error"]   { --fl-bg: var(--st-unres-bg);   --fl-fg: var(--st-unres-fg);   --fl-dot: var(--st-unres-dot); }
.wv-flash[data-flash="warning"] { --fl-bg: var(--st-pending-bg); --fl-fg: var(--st-pending-fg); --fl-dot: var(--st-pending-dot); }
.wv-flash[data-flash="info"]    { --fl-bg: var(--st-open-bg);    --fl-fg: var(--st-open-fg);    --fl-dot: var(--st-open-dot); }
.wv-flash[data-flash="accent"]  { --fl-bg: var(--accent-soft);   --fl-fg: var(--accent-ink);    --fl-dot: var(--accent); }

/* head row: icon · title · dismiss — all on one centred line */
.wv-flash__head { display: flex; align-items: center; gap: 12px; min-height: 30px; }

/* leading icon chip */
.wv-flash__icon {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--fl-dot) 18%, transparent);
  color: var(--fl-fg);
}
.wv-flash__icon svg { width: 17px; height: 17px; }
.wv-flash__title { flex: 1; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--ink); text-wrap: pretty; }
/* body text + action align under the title (icon width + gap) */
.wv-flash__text  { margin: 1px 0 0 44px; font-size: 13px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.wv-flash__action {
  display: inline-flex; align-items: center; gap: 4px; margin: 10px 0 0 44px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--fl-fg);
  border-radius: 6px; transition: gap .15s ease, opacity .15s ease;
}
.wv-flash__action:hover { gap: 7px; opacity: .8; }
.wv-flash__action svg { width: 14px; height: 14px; }

/* dismiss — borderless icon, tints to the variant colour on hover */
.wv-flash__close {
  flex: none; width: 28px; height: 28px; padding: 0;
  border: 0; background: transparent; border-radius: 7px; cursor: pointer;
  display: grid; place-items: center;
  color: color-mix(in srgb, var(--fl-fg) 55%, transparent);
  transition: background .15s ease, color .15s ease;
}
.wv-flash__close:hover { background: color-mix(in srgb, var(--fl-dot) 15%, transparent); color: var(--fl-fg); }
.wv-flash__close:active { transform: translateY(1px); }
.wv-flash__close svg { width: 16px; height: 16px; }

/* dismissal animation (JS adds .wv-flash--out before removing) */
.wv-flash--out { opacity: 0; transform: translateY(-4px); transition: opacity .2s ease, transform .2s ease; }

/* floating stack (top-centre on desktop, full-width sheet on phones) ----
   banners mount here; each enters with .wv-flash--in. */
.wv-flash-host {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 80; width: min(440px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.wv-flash-host .wv-flash { pointer-events: auto; box-shadow: var(--shadow-pop); }
.wv-flash--in { animation: wv-flash-in .34s cubic-bezier(.22,.61,.36,1) both; }
@keyframes wv-flash-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (max-width: 639px) {
  .wv-flash-host { top: 10px; left: 10px; right: 10px; transform: none; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .wv-flash--in, .wv-flash--out { animation: none; transition: none; }
}

/* ---- topical chat (Ask) — reusable embeddable streaming chat ----
   tc-enter: soft fade-up for messages/cards as they land.
   tc-pulse: the "Researching…" dot while a turn streams. */
@keyframes tc-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tc-pulse   { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
@keyframes tc-blink   { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
/* Older-history batch slide-in (reusable across chat threads). Transform +
   opacity only (never height/margin) so the scroll-anchor math stays exact
   and prepending never jumps. */
@keyframes history-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.tc-enter { animation: tc-fade-up .35s cubic-bezier(.22,.61,.36,1) both; }
.history-enter { animation: history-in .4s cubic-bezier(.22,.61,.36,1) both; }
.tc-pulse { animation: tc-pulse 1.2s ease-in-out infinite; }
.tc-cursor { display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; vertical-align: -2px;
  border-radius: 1px; background: var(--accent); animation: tc-blink 1s steps(2, start) infinite; }
@media (prefers-reduced-motion: reduce) {
  .tc-enter, .history-enter, .tc-pulse, .tc-cursor { animation: none; }
}
