/* Liquid glass (pass 91). Loaded after every other style sheet, so it only refines: material, navigation shape, sheets, desktop layout.
   It never changes the accent colour (everything tinted is mixed from --indigo) and it steps aside for high contrast.

   How it is organised
   1. Material     tokens for the glass itself (thin and thick), light and dark, and the three graphics levels
   2. Backdrop     the soft light behind the app, so glass has something to blur
   3. Chrome       top bar, side bar, menus, toasts, banners: the few surfaces that really blur what is behind them
   4. Content      cards, buttons, fields: translucent fill and a lit edge, no blur (hundreds of blurred cards would cost battery for no gain)
   5. Phone        shared rules, then iPhone (floating tab capsule, floating sheets) and Android (edge to edge bar, labels, squircle capture)
   6. Wide         tablets and desktop: a floating glass side bar and a search pill in the top bar
   7. Fallbacks    reduced motion, no backdrop-filter, high contrast, forced colours, print

   The platform comes from data-os on <html> (src/lib/device.js, set before first paint). Layout always follows the width, never the platform. */

/* ============ 1. Material ============ */
:root {
  --lg-blur: 24px; --lg-sat: 1.7; --lg-bright: 1.04;
  --lg-filter: blur(var(--lg-blur)) saturate(var(--lg-sat)) brightness(var(--lg-bright));
  /* How much of the surface colour stays: thin glass (bars) and thick glass (sheets, menus, banners). Lite and off raise these. */
  --lg-a: 64%; --lg-a2: 38%; --lg-ka: 90%; --lg-ka2: 84%;
  --lg-tint: color-mix(in srgb, var(--sheet) var(--lg-a), transparent);
  --lg-tint-2: color-mix(in srgb, var(--sheet) var(--lg-a2), transparent);
  --lg-thick: color-mix(in srgb, var(--sheet) var(--lg-ka), transparent);
  --lg-thick-2: color-mix(in srgb, var(--sheet) var(--lg-ka2), transparent);
  /* The lit edge and the shadow */
  --lg-spec: rgba(255, 255, 255, .78);
  --lg-rim-hi: rgba(255, 255, 255, .95);
  --lg-rim-lo: rgba(255, 255, 255, .5);
  --lg-hair: rgba(20, 44, 32, .1);
  --lg-lift: 0 16px 38px -14px rgba(18, 44, 32, .34), 0 3px 10px -4px rgba(18, 44, 32, .12);
  --lg-soft: 0 1px 2px rgba(18, 44, 32, .05), 0 12px 26px -18px rgba(18, 44, 32, .26);
  --lg-glow: color-mix(in srgb, var(--indigo) 38%, transparent);
  --lg-card: linear-gradient(180deg, color-mix(in srgb, var(--sheet) 90%, transparent), color-mix(in srgb, var(--sheet) 68%, transparent));
  /* Motion: a quick settle with a small overshoot, the way a drop of water finds its place */
  --lg-spring: cubic-bezier(.34, 1.32, .5, 1);
  --lg-gap: 10px;       /* space between a floating glass panel and the screen edge */
  --tb: 56px;           /* height of the top bar */
}
:root[data-theme=dark] {
  --lg-spec: rgba(255, 255, 255, .1);
  --lg-rim-hi: rgba(255, 255, 255, .27);
  --lg-rim-lo: rgba(255, 255, 255, .07);
  --lg-hair: rgba(255, 255, 255, .09);
  --lg-lift: 0 18px 42px -14px rgba(0, 0, 0, .8), 0 3px 12px -4px rgba(0, 0, 0, .5);
  --lg-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 28px -18px rgba(0, 0, 0, .75);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme=system] {
    --lg-spec: rgba(255, 255, 255, .1);
    --lg-rim-hi: rgba(255, 255, 255, .27);
    --lg-rim-lo: rgba(255, 255, 255, .07);
    --lg-hair: rgba(255, 255, 255, .09);
    --lg-lift: 0 18px 42px -14px rgba(0, 0, 0, .8), 0 3px 12px -4px rgba(0, 0, 0, .5);
    --lg-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 28px -18px rgba(0, 0, 0, .75);
  }
}

/* Graphics levels (data-gfx, see lib/device.js). Everything below reads these tokens, so a level is just a different set of numbers. */
:root[data-gfx=lite] { --lg-blur: 12px; --lg-sat: 1.2; --lg-bright: 1; --lg-a: 80%; --lg-a2: 62%; --lg-ka: 94%; --lg-ka2: 90%; }
:root[data-gfx=off], :root[data-contrast=high] {
  --lg-filter: none; --lg-a: 100%; --lg-a2: 100%; --lg-ka: 100%; --lg-ka2: 100%;
  --lg-spec: transparent; --lg-rim-hi: transparent; --lg-rim-lo: var(--rule); --lg-hair: var(--rule);
  --lg-card: var(--sheet);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --lg-a: 94%; --lg-a2: 90%; --lg-ka: 97%; --lg-ka2: 95%; }
}
@media (prefers-contrast: more) {
  :root { --lg-filter: none; --lg-a: 100%; --lg-a2: 100%; --lg-ka: 100%; --lg-ka2: 100%; --lg-spec: transparent; --lg-card: var(--sheet); }
}

/* The glass recipe: a lit corner, the tinted body, the blur, and the edge. Surfaces below add only their own shape and shadow. */
:is(.shell .topbar, .shell .bottom-bar, .shell .side, .ui-dlg, .menu-pop, .ck, .update-bar, .shell .pagenav) {
  background:
    radial-gradient(140% 120% at 0% 0%, var(--lg-spec), transparent 55%),
    linear-gradient(165deg, var(--lg-tint), var(--lg-tint-2));
  -webkit-backdrop-filter: var(--lg-filter);
  backdrop-filter: var(--lg-filter);
  color: var(--ink);
}
:is(.ui-dlg, .menu-pop, .ck, .update-bar) { --lg-tint: var(--lg-thick); --lg-tint-2: var(--lg-thick-2); }
/* Glass inside glass cannot see the page (a blurred parent is the backdrop root), so a menu that opens from a bar is nearly solid instead. */
.shell :is(.topbar, .side) .menu-pop { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--sheet) 96%, transparent); }

/* ============ 2. Backdrop ============ */
.shell { isolation: isolate; }
.app-aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.app-aurora i { position: absolute; width: 64vmax; height: 64vmax; border-radius: 50%; opacity: .6; }
.app-aurora i:nth-child(1) { left: -22vmax; top: -24vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--indigo) 24%, transparent), transparent); }
.app-aurora i:nth-child(2) { right: -26vmax; top: 6vh; background: radial-gradient(closest-side, var(--tint2), transparent); }
.app-aurora i:nth-child(3) { left: 8vw; bottom: -36vmax; background: radial-gradient(closest-side, var(--tint3), transparent); opacity: .5; }
:root[data-theme=dark] .app-aurora i { opacity: .55; }
:root[data-gfx=off] .app-aurora, :root[data-contrast=high] .app-aurora { display: none; }

/* ============ 3. Chrome ============ */
/* Top bar: clear at rest, an edge line once content has moved under it. */
.shell .topbar { border-bottom: 1px solid transparent; transition: border-color .25s, box-shadow .25s; }
:root[data-scrolled] .shell .topbar { border-bottom-color: var(--lg-hair); box-shadow: 0 12px 24px -22px rgba(18, 44, 32, .55); }

/* Menus, toasts, banners */
.menu-pop { border: 0; border-radius: 18px; box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-lift); }
.toast {
  border-radius: 20px; color: var(--paper);
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  -webkit-backdrop-filter: var(--lg-filter); backdrop-filter: var(--lg-filter);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 0 0 1px rgba(255, 255, 255, .06), var(--lg-lift);
}
.toast-act { border-radius: 12px; }
.ck, .update-bar { border: 0; box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-lift); }
.ck { border-radius: 28px; }
.ck-badge { box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px color-mix(in srgb, var(--indigo) 20%, transparent); }
.update-bar { border-radius: 20px; }
.shell .pagenav { border: 0; border-radius: 999px; box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-lift); }

/* Dialogs and sheets */
.ui-dlg { border: 0; border-radius: 28px; box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-lift); }
.ui-dlg::backdrop { background: rgba(14, 26, 19, .3); -webkit-backdrop-filter: blur(6px) saturate(1.2); backdrop-filter: blur(6px) saturate(1.2); }
:root[data-gfx=lite] .ui-dlg::backdrop { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
:root[data-gfx=off] .ui-dlg::backdrop, :root[data-contrast=high] .ui-dlg::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10, 16, 12, .55); }
:root[data-theme=dark] .ui-dlg::backdrop { background: rgba(0, 0, 0, .5); }
.ui-dlg[open] { animation: lgPop .34s var(--lg-spring); }
.ui-dlg.closing { animation: lgOut .16s ease-in forwards; }
.ui-grab::after { background: color-mix(in srgb, var(--ink) 22%, transparent); }
.ui-item:hover, .ui-item.on, .ui-cancel { background: color-mix(in srgb, var(--ink) 6%, transparent); }
@keyframes lgPop { from { opacity: 0; transform: scale(.94) translateY(8px); } }
@keyframes lgOut { to { opacity: 0; transform: scale(.97); } }
@keyframes lgSheetUp { from { opacity: .4; transform: translateY(40px) scale(.98); } }
@keyframes lgSheetOut { to { transform: translateY(110%); } }

/* ============ 4. Content ============ */
/* Cards: translucent body, a lit top edge, a soft shadow. No blur on purpose. */
:is(.hm-card, .hm-chip, .hm-group, .ask-hero, .nb, .clip, .stat, .t-card, .plancard, .fcard, .yourplan, .pub-cards article) {
  background: var(--lg-card);
  border-color: color-mix(in srgb, var(--ink) 7%, transparent);
  box-shadow: inset 0 1px 0 var(--lg-rim-hi), var(--lg-soft);
}
.hm-chip { background: color-mix(in srgb, var(--c) 13%, var(--sheet)); box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 8px 18px -12px color-mix(in srgb, var(--c) 55%, transparent); }
.hm-card.is-first { background: linear-gradient(160deg, color-mix(in srgb, var(--indigo) 14%, var(--sheet)), var(--lg-card)); border-color: color-mix(in srgb, var(--indigo) 22%, transparent); }
.ask-hero { box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 14px 30px -18px var(--lg-glow), var(--lg-soft); }
.ask-hero .qa-i { background: linear-gradient(160deg, color-mix(in srgb, var(--indigo) 84%, #fff), var(--indigo)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 14px -6px var(--lg-glow); }

/* Buttons: the same liquid sheen on every primary button; ghost buttons are small glass. */
.btn:not(.ghost):not(.danger):not(.ck-soft) { background-color: var(--indigo); background-image: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 55%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 8px 18px -10px var(--lg-glow); }
.btn.ghost { background: var(--lg-card); border-color: color-mix(in srgb, var(--ink) 9%, transparent); box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 1px 2px rgba(18, 44, 32, .05); }
.btn:active { transform: scale(.975); transition-duration: .08s; }

/* Fields */
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  background: color-mix(in srgb, var(--sheet) 72%, transparent);
  border-color: color-mix(in srgb, var(--ink) 11%, transparent);
  box-shadow: inset 0 1px 2px rgba(18, 44, 32, .06);
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):focus, select:focus, textarea:focus { background: var(--sheet); box-shadow: var(--ring); }

/* A light that follows the pointer (set by lib/device.js, only for a mouse or trackpad). */
@media (hover: hover) and (pointer: fine) {
  :root[data-gfx=full] :is(.hm-card, .hm-chip, .hm-group, .ask-hero, .nb, .clip, .stat, .t-card, .plancard, .fcard, .yourplan):hover {
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--lg-rim-hi) 60%, transparent), transparent 62%), var(--lg-card);
  }
  .hm-chip:hover { background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--lg-rim-hi) 60%, transparent), transparent 62%), color-mix(in srgb, var(--c) 13%, var(--sheet)); }
}
/* Two columns that never push past the edge of the screen (a long line used to stretch the second column). */
.hm-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hm-cols > * { min-width: 0; }
@media (max-width: 47.99rem) { .hm-cols { grid-template-columns: minmax(0, 1fr); } }

/* Search label and shortcut hint exist only for the wide top bar */
.top-search-t, .top-search-k { display: none; }

/* ============ 5. Phone (under 48rem) ============ */
@media (max-width: 47.99rem) {
  :root { --bb-h: calc(64px + env(safe-area-inset-bottom, 0px) * .5 + 22px); }
  .shell, .toasts { --bb: var(--bb-h); }
  .shell .work:not(:has(.pdfview)) { padding-bottom: calc(var(--bb-h) + 1.5rem); }
  .toasts { bottom: calc(var(--bb-h) + 4px); }
  .ck { bottom: calc(var(--bb-h) + 2px); }
  .update-bar { bottom: calc(var(--bb-h) + 10px); }

  /* While typing, the tab bar steps out of the way. */
  .shell .bottom-bar { transition: transform .38s var(--lg-spring), opacity .2s; }
  :root[data-kb=open] .shell .bottom-bar { transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; }
  :root[data-kb=open] .toasts { bottom: 12px; }

  /* The menu drawer is a floating glass panel, inset from every edge. */
  .shell .side {
    top: max(var(--lg-gap), env(safe-area-inset-top, 0px)); bottom: max(var(--lg-gap), env(safe-area-inset-bottom, 0px)); left: var(--lg-gap);
    height: auto; max-height: none; width: min(20rem, calc(100vw - var(--lg-gap) * 2));
    padding: .35rem .6rem 1rem; border: 0; border-radius: 30px;
    transform: translateX(calc(-100% - var(--lg-gap) * 2)); transition: transform .42s var(--lg-spring), visibility 0s linear .42s;
    box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-lift);
  }
  .shell .side.open { transform: none; transition: transform .42s var(--lg-spring); }
  .shell .side-head { padding-top: .8rem; border-bottom-color: var(--lg-hair); }
  .scrim { background: rgba(14, 26, 19, .28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  :root[data-gfx=lite] .scrim, :root[data-gfx=off] .scrim { -webkit-backdrop-filter: none; backdrop-filter: none; }

  /* ---- iPhone (and any other phone-sized window): a floating tab capsule ---- */
  .shell .bottom-bar {
    left: max(var(--lg-gap), env(safe-area-inset-left, 0px)); right: max(var(--lg-gap), env(safe-area-inset-right, 0px));
    bottom: calc(env(safe-area-inset-bottom, 0px) * .5 + 8px); height: 64px; padding: 6px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border: 0; border-radius: 32px; overflow: hidden; /* WebKit draws square corners on a blurred rounded box without this */
    box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-lift);
  }
  .shell .bb { position: relative; z-index: 1; height: 100%; min-height: 0; border-radius: 26px; gap: 0; }
  .shell .bb-i, .shell .bb.active .bb-i { width: auto; height: auto; background: none; transform: none; }
  .shell .bb.active, .shell .bb[aria-expanded=true] { color: var(--indigo); }
  .shell .bb:active .bb-i { transform: scale(.9); }
  .shell .bb-cap .dot {
    width: 48px; height: 48px; margin: 0; border: 0;
    background: linear-gradient(160deg, color-mix(in srgb, var(--indigo) 82%, #fff), var(--indigo));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 4px rgba(0, 0, 0, .12), 0 8px 18px -6px var(--lg-glow);
  }
  /* The glass bubble that glides to the tab you are on (AppShell sets --i, the tab number). */
  .bb-glider {
    position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 5); border-radius: 26px; pointer-events: none; opacity: 0;
    background: radial-gradient(120% 120% at 20% 0%, var(--lg-spec), transparent 60%), color-mix(in srgb, var(--indigo) 12%, transparent);
    box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), 0 6px 16px -8px var(--lg-glow);
    transform: translateX(calc(var(--i, 0) * 100%)) scale(.7); will-change: transform;
    transition: transform .55s var(--lg-spring), opacity .25s;
  }
  .bottom-bar.has-active .bb-glider { opacity: 1; transform: translateX(calc(var(--i, 0) * 100%)); }

  /* Sheets float on iPhone: inset, rounded on every corner, a gap above the home indicator. */
  .ui-dlg { margin: auto var(--lg-gap) calc(var(--lg-gap) + env(safe-area-inset-bottom, 0px)); width: calc(100% - var(--lg-gap) * 2); border-radius: 34px; padding-bottom: 0; }
  .ui-dlg[open] { animation: lgSheetUp .46s var(--lg-spring); }
  .ui-dlg.closing { animation: lgSheetOut .2s ease-in forwards; }
  .ui-dlg:has(.plugins-sheet) { width: calc(100% - var(--lg-gap) * 2); max-width: none; }

  /* Inputs at 16px, so iOS never zooms the page when one is focused. */
  :where(.work, .ui-dlg, .dlg) :where(input, select, textarea) { font-size: max(16px, .98rem); }

  /* Press feedback */
  .shell a, .shell button { -webkit-tap-highlight-color: transparent; }

  /* ---- Android: an edge to edge bar, visible labels, a squircle capture button, a state layer instead of a bubble ---- */
  :root[data-os=android] { --bb-h: calc(80px + env(safe-area-inset-bottom, 0px)); }
  :root[data-os=android] .toasts { bottom: calc(var(--bb-h) + 8px); }
  :root[data-os=android] .shell .bottom-bar {
    left: 0; right: 0; bottom: 0; height: var(--bb-h); padding: 12px 8px env(safe-area-inset-bottom, 0px);
    border-radius: 26px 26px 0 0; overflow: visible;
    box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 -12px 30px -18px rgba(18, 44, 32, .35);
  }
  :root[data-os=android] .bb-glider { display: none; }
  :root[data-os=android] .shell .bb { height: auto; gap: 5px; justify-content: flex-start; min-height: 48px; border-radius: 16px; }
  :root[data-os=android] .shell .bb-l { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; clip-path: none; font: 500 .72rem/1 var(--sans); letter-spacing: .01em; }
  :root[data-os=android] .shell .bb-i { position: relative; overflow: hidden; width: 64px; height: 32px; border-radius: 16px; }
  :root[data-os=android] .shell .bb.active .bb-i { background: color-mix(in srgb, var(--indigo) 22%, transparent); }
  :root[data-os=android] .shell .bb-i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle, currentColor 0, transparent 70%); opacity: 0; transform: scale(.4); transition: opacity .45s, transform .45s; }
  :root[data-os=android] .shell .bb:active .bb-i::after { opacity: .18; transform: scale(1); transition-duration: .1s; }
  :root[data-os=android] .shell .bb:active .bb-i { transform: none; }
  :root[data-os=android] .shell .bb-cap { justify-content: center; }
  :root[data-os=android] .shell .bb-cap .dot { width: 58px; height: 58px; margin-top: -1.5rem; border-radius: 20px; }
  :root[data-os=android] .shell .bb-cap:active .dot { transform: scale(.94); }
  /* Sheets sit on the bottom edge on Android, with a rounded top. */
  :root[data-os=android] .ui-dlg { margin: auto 0 0; width: 100%; border-radius: 28px 28px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (max-width: 40rem) {
  /* Dialogs turn into sheets at 40rem (global.css); keep the handle visible on glass. */
  .ui-dlg:not(:has(.ui-grab)) { padding-top: .2rem; }
}

/* ============ 6. Tablet and desktop (48rem and wider) ============ */
@media (min-width: 48rem) {
  .shell { --bb: 0px; grid-template-columns: 15.5rem minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .shell > .topbar { grid-column: 1 / -1; }
  .shell .bottom-bar, .shell .scrim { display: none; }
  .shell .top-only { display: inline-flex; }
  .toasts { --bb: 0px; bottom: 1.4rem; }
  .shell .work { max-width: none; width: 100%; padding: 1.6rem 1.8rem 3rem; }
  .fab { bottom: 5.2rem; }

  /* The side bar is a floating glass panel under the top bar. */
  .shell .side {
    position: sticky; top: calc(var(--tb) + 6px); height: calc(100dvh - var(--tb) - 16px); width: auto; margin: 6px 0 10px var(--lg-gap);
    z-index: 6; transform: none; visibility: visible; transition: none;
    padding: .5rem .5rem 1rem; border: 0; border-radius: 26px;
    box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px var(--lg-rim-lo), var(--lg-soft);
  }
  .shell .side-head { display: none; }
  .shell .side a.active {
    color: var(--indigo);
    background: linear-gradient(180deg, var(--lg-spec), transparent), color-mix(in srgb, var(--indigo) 14%, transparent);
    box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px color-mix(in srgb, var(--indigo) 18%, transparent), 0 5px 14px -8px var(--lg-glow);
  }
  /* The search field in the top bar is a wide pill on desktop, an icon on tablets. */

  /* Dialogs stay centred. */
  .ui-dlg { margin: auto; }
}
@media (min-width: 60rem) {
  .shell { grid-template-columns: 16rem minmax(0, 1fr); }
  .shell .work { max-width: 62rem; margin-inline: auto; padding: 2.2rem 3.2rem 4rem; }
  .work:has(.sheet.w-full), :root[data-width=full] .work:not(:has(.sheet.w-half)) { max-width: none; }
  .shell .topbar a.icon-btn.top-only {
    display: inline-flex; align-items: center; flex-wrap: nowrap; white-space: nowrap;
    width: auto; min-width: min(21rem, 30vw); height: 38px; padding: 0 .45rem 0 .8rem; gap: .6rem; justify-content: flex-start; place-items: unset; border-radius: 999px;
    color: var(--soft); font: 400 .9rem var(--sans); text-decoration: none;
    background: var(--lg-card); box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
  }
  .shell .topbar a.icon-btn.top-only:hover { background: var(--lg-card) !important; color: var(--ink); }
  .shell .topbar a.icon-btn.top-only svg { width: 18px !important; height: 18px !important; flex: none; }
  .top-search-t { display: inline; line-height: 1; }
  .top-search-k { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: auto; padding: 0 .4rem; border-radius: 8px; font: 500 .75rem var(--mono); color: var(--soft); background: color-mix(in srgb, var(--ink) 6%, transparent); }
  .shell .topbar .btn.top-only { height: 38px; min-height: 38px; border-radius: 999px; padding: 0 1rem; }

  /* Hover is for mouse and trackpad: a quiet light under the pointer. */
  .shell .side a:hover:not(.active), .shell .side-btn:hover, .shell .side-fold > summary:hover {
    background: radial-gradient(130px circle at var(--mx, 50%) var(--my, 50%), var(--lg-spec), transparent 70%), color-mix(in srgb, var(--ink) 5%, transparent);
  }
  :root[data-os=mac] .shell .topbar, :root[data-os=windows] .shell .topbar { padding-inline: 1rem; }
}
@media (min-width: 90rem) { .shell .work { max-width: 70rem; } }
/* The text on a wide screen never needs to be wider than a calm column; the 'Full page' choice still wins (rule above). */

/* ============ 7. Fallbacks ============ */
@media (prefers-reduced-motion: reduce) {
  .bb-glider, .shell .side, .shell .bottom-bar, .ui-dlg[open], .ui-dlg.closing { transition: none; animation: none; }
}
:root[data-motion=reduce] .bb-glider, :root[data-motion=reduce] .shell .side { transition: none; }
@media (forced-colors: active) {
  :is(.shell .topbar, .shell .bottom-bar, .shell .side, .ui-dlg, .menu-pop, .ck, .update-bar, .toast) { background: Canvas; border: 1px solid CanvasText; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bb-glider { background: Highlight; opacity: .3; }
  .app-aurora { display: none; }
}
@media print { .app-aurora { display: none; } }


/* Primary buttons on the public site: a solid green box with a soft liquid highlight, white label. */
:root .site-head .btn:not(.ghost):not(.danger),
:root .hx-home .btn:not(.ghost):not(.danger),
:root .site-foot .btn:not(.ghost):not(.danger),
:root .foot-cta .btn:not(.ghost):not(.danger),
:root .pub-cta .btn:not(.ghost):not(.danger) {
  background-color: #1F5A3F;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .26) 0%, rgba(255, 255, 255, 0) 52%), linear-gradient(135deg, #2E7A55, #174A33);
  color: #fff;
  border: 1px solid #143E2B;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), inset 0 -1px 0 rgba(0, 0, 0, .18), 0 12px 24px -12px rgba(23, 74, 51, .75);
}
:root .site-head .btn:not(.ghost):not(.danger):active,
:root .hx-home .btn:not(.ghost):not(.danger):active,
:root .site-foot .btn:not(.ghost):not(.danger):active { filter: brightness(.95); }
:root[data-theme=dark] .site-head .btn:not(.ghost):not(.danger),
:root[data-theme=dark] .hx-home .btn:not(.ghost):not(.danger),
:root[data-theme=dark] .site-foot .btn:not(.ghost):not(.danger),
:root[data-theme=dark] .foot-cta .btn:not(.ghost):not(.danger),
:root[data-theme=dark] .pub-cta .btn:not(.ghost):not(.danger) { background-color: #2E7A55; color: #fff; border-color: #3E9068; }

/* ================= Pass 93: Bricolage weights, no hand cursor, the Ask AI box, live voice ================= */
/* Lighter, neater type: bold text is semi-bold, not heavy. */
b, strong, th, h1, h2, h3, h4, h5, h6 { font-weight: 600; }
/* The app never shows the pointing hand (links included, which browsers give a hand by default). */
:where(a, button, summary, label, select, [role="button"], [role="tab"], [role="menuitem"], [role="option"], input[type="checkbox"], input[type="radio"], input[type="range"], input[type="file"], .btn) { cursor: default; }

/* ---- The Ask AI box: one soft rounded card, no coloured outline ---- */
.ai-bar.nc-bar {
  gap: .1rem; padding: .65rem .65rem .6rem; border-radius: 28px;
  border: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  background: color-mix(in srgb, var(--sheet) 94%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(18px); backdrop-filter: saturate(1.5) blur(18px);
  box-shadow: 0 14px 32px -16px rgba(18, 36, 28, .3), 0 2px 6px -2px rgba(18, 36, 28, .08);
  transition: border-color .2s, box-shadow .2s;
}
.ai-bar.nc-bar:focus-within {
  border-color: color-mix(in srgb, var(--ink) 15%, transparent);
  box-shadow: 0 18px 38px -16px rgba(18, 36, 28, .36), 0 2px 8px -2px rgba(18, 36, 28, .1);
}
.ai-bar textarea, .ai-bar textarea:focus, .ai-bar textarea:focus-visible { outline: none; box-shadow: none; border: 0; background: none; }
.ai-bar textarea { min-height: 46px; padding: .4rem .6rem .45rem; font-size: 1.05rem; line-height: 1.5; }
.ai-bar textarea::placeholder { color: color-mix(in srgb, var(--soft) 75%, transparent); }
.ai-bar .ai-strip { padding: .1rem .35rem .3rem; }

/* Chips: one quiet row that scrolls sideways instead of wrapping */
.ai-bar .ai-chips { flex-wrap: nowrap; gap: .35rem; margin: 0 -.15rem; padding: .1rem .15rem .25rem; overflow-x: auto; scrollbar-width: none; }
.ai-bar .ai-chips::-webkit-scrollbar { display: none; }
.ai-bar .ai-chips .nc-chip { flex: none; min-height: 30px; padding: 0 .75rem; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--soft); font: 500 .78rem var(--sans); }
.ai-bar .ai-chips .nc-chip.on { background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink); }

/* Tools row */
.ai-bar .ai-tools { gap: .3rem; align-items: center; }
.ai-bar .ai-tool { width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); transition: background-color .15s, transform .12s; }
.ai-bar .ai-tool:hover, .ai-bar .ai-tool[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 11%, transparent); }
.ai-bar .ai-tool:active { transform: scale(.93); }
.ai-bar .ai-tool.warn { color: var(--margin); }
.ai-bar .ai-model { min-height: 34px; max-width: 8.5rem; padding: 0 .8rem; border-radius: 999px; background: transparent; color: var(--soft); font: 500 .86rem var(--sans); }
.ai-bar .ai-model:hover, .ai-bar .ai-model[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.ai-bar .ai-tools .etb { width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--soft); }
.ai-bar .ai-tools .etb:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
:root .ai-bar .nc-send.btn:not(.ghost) { background-image: none; width: 38px; height: 38px; min-height: 38px; border: 0; border-radius: 50%; background: var(--ink); color: var(--paper); box-shadow: none; transition: background-color .2s, color .2s, transform .15s; }
:root .ai-bar .nc-send.btn:not(.ghost):active { transform: scale(.92); }
:root .ai-bar .nc-send.btn:not(.ghost).idle { background: color-mix(in srgb, var(--ink) 10%, transparent); color: color-mix(in srgb, var(--ink) 40%, transparent); }
:root .ai-bar .nc-send.btn:not(.ghost):disabled { opacity: .5; }

/* ---- Live voice: the box becomes a waveform row while you speak ---- */
.vp { display: flex; align-items: center; gap: .65rem; padding: .25rem .1rem .15rem; animation: vp-in .3s cubic-bezier(.2, .8, .2, 1); }
.vp[hidden] { display: none; }
.vp-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; transition: transform .12s, background-color .15s; }
.vp-btn:active { transform: scale(.92); }
.vp-cancel { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.vp-done { background: var(--ink); color: var(--paper); }
.vp-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.vp-wave { display: block; width: 100%; height: 44px; color: var(--indigo); }
.vp-meta { display: flex; align-items: center; justify-content: center; gap: .45rem; color: var(--soft); font: 500 .78rem var(--sans); }
.vp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--margin); animation: vp-pulse 1.3s ease-in-out infinite; }
.vp.hearing .vp-dot { animation-duration: .7s; }
.vp-time { font-variant-numeric: tabular-nums; }
.ai-bar.listening .ai-chips, .ai-bar.listening .ai-tools, .ai-bar.listening .ai-strip { display: none; }
.ai-bar.listening textarea { min-height: 0; max-height: 4.6rem; color: var(--soft); font-size: .96rem; }
.ai-bar.listening textarea:placeholder-shown { display: none; }
@keyframes vp-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes vp-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .vp, .vp-dot { animation: none; } }
