/* ── glass: every sheet and every drop down panel ─────────────────────
   Founder, 13 Nov 2026 (reference: the "My Workspace" sheet): real frosted
   glass, not a translucent fill. What makes it read as glass and not as a
   grey box with opacity:

   - the blur and a saturation boost on what is UNDER the panel only
     (backdrop-filter), so the colours behind come through softened;
   - a low alpha tint, light in light mode and dark in dark;
   - a thin edge that catches the light, brighter along the top;
   - a faint grain, so the surface has a texture of its own;
   - a soft shadow, and a large radius on the top corners.

   The screen behind is NOT blurred or darkened by the scrim any more: only
   what sits under the panel is frosted, so the page stays clear around it.
   That is also the cheaper choice: one blurred layer the size of the
   sheet, never a blur over the whole screen or over a scrolling list.

   Where the browser cannot blur, or the person asked for less
   transparency, the panel falls back to a solid surface (bottom of file).

   Classes, so any panel can wear it:
     .glass        the frosted surface (Sheet and DropMenu put it on)
     .glass-card   a second, lighter layer of glass on the glass (a group of rows)
     .glass-row    one row in a .glass-card, hairline between rows
     .glass-check  the lime circle with a dark tick, for the chosen row
     .glass-pill   the long lime button at the foot of a sheet
   ─────────────────────────────────────────────────────────────────── */

:root {
  /* A fine grain, dark specks for the light glass. */
  --gl-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --gl-blur: blur(32px) saturate(170%);
  /* The same glass with the colour behind taken out, for a small card that
     opens over a bright one (the bell's card over the green revenue card):
     shapes still frost through, the green does not tint it. */
  --gl-blur-plain: blur(32px) saturate(15%);
  --gl-tint: rgba(255, 255, 255, 0.6);
  --gl-solid: #f7f8f8;
  --gl-edge: rgba(255, 255, 255, 0.7);
  --gl-edge-top: rgba(255, 255, 255, 0.95);
  --gl-hi: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --gl-shadow: 0 -10px 40px rgba(15, 20, 18, 0.14), 0 -1px 6px rgba(15, 20, 18, 0.05);
  --gl-drop-shadow: 0 14px 36px rgba(15, 20, 18, 0.16), 0 2px 8px rgba(15, 20, 18, 0.06);
  --gl-inner: rgba(255, 255, 255, 0.55);
  --gl-inner-edge: rgba(255, 255, 255, 0.85);
  --gl-inner-sh: 0 1px 2px rgba(15, 20, 18, 0.04), 0 6px 18px rgba(15, 20, 18, 0.05);
  --gl-hair: rgba(15, 20, 18, 0.08);
  --gl-fill: rgba(15, 20, 18, 0.05);
  --gl-sel: rgba(255, 255, 255, 0.9);
  --gl-btn: rgba(255, 255, 255, 0.7);
  --gl-btn-edge: rgba(15, 20, 18, 0.06);
  --gl-grab: rgba(15, 20, 18, 0.18);
  /* Only a breath of shade: enough to say the screen is paused, not enough
     to hide it. */
  --gl-scrim: rgba(12, 18, 16, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --gl-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --gl-tint: rgba(52, 56, 58, 0.46);
    --gl-solid: #1d2021;
    --gl-edge: rgba(255, 255, 255, 0.07);
    --gl-edge-top: rgba(255, 255, 255, 0.2);
    --gl-hi: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --gl-shadow: 0 -12px 48px rgba(0, 0, 0, 0.5);
    --gl-drop-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    --gl-inner: rgba(255, 255, 255, 0.06);
    --gl-inner-edge: rgba(255, 255, 255, 0.08);
    --gl-inner-sh: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --gl-hair: rgba(255, 255, 255, 0.08);
    --gl-fill: rgba(255, 255, 255, 0.07);
    --gl-sel: rgba(255, 255, 255, 0.13);
    --gl-btn: rgba(255, 255, 255, 0.1);
    --gl-btn-edge: rgba(255, 255, 255, 0.1);
    --gl-grab: rgba(255, 255, 255, 0.28);
    --gl-scrim: rgba(0, 0, 0, 0.12);
  }
}
:root[data-theme="dark"] {
  --gl-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --gl-tint: rgba(52, 56, 58, 0.46);
  --gl-solid: #1d2021;
  --gl-edge: rgba(255, 255, 255, 0.07);
  --gl-edge-top: rgba(255, 255, 255, 0.2);
  --gl-hi: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --gl-shadow: 0 -12px 48px rgba(0, 0, 0, 0.5);
  --gl-drop-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --gl-inner: rgba(255, 255, 255, 0.06);
  --gl-inner-edge: rgba(255, 255, 255, 0.08);
  --gl-inner-sh: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --gl-hair: rgba(255, 255, 255, 0.08);
  --gl-fill: rgba(255, 255, 255, 0.07);
  --gl-sel: rgba(255, 255, 255, 0.13);
  --gl-btn: rgba(255, 255, 255, 0.1);
  --gl-btn-edge: rgba(255, 255, 255, 0.1);
  --gl-grab: rgba(255, 255, 255, 0.28);
  --gl-scrim: rgba(0, 0, 0, 0.12);
}

/* ── the surface ── */
.glass {
  background-color: var(--gl-tint);
  /* The grain is a background, so it stays put while the rows scroll. */
  background-image: var(--gl-grain);
  background-size: 160px 160px;
  -webkit-backdrop-filter: var(--gl-blur);
  backdrop-filter: var(--gl-blur);
  border: 1px solid var(--gl-edge);
  border-top-color: var(--gl-edge-top);
  box-shadow: var(--gl-hi), var(--gl-drop-shadow);
  /*
   * EVERYTHING ON THE GLASS IS GLASS TOO (founder, 13 Nov 2026: the Help
   * sheet read as a solid dark box because its card of rows was --card).
   * Inside a glass panel the app's surface tokens become layers of the same
   * glass, so a card, a field, a chip or a chosen row that a sheet's content
   * draws with --card, --bg, --fill, --sel or --line turns translucent with
   * no change to that content's own CSS. Change these here and every panel
   * follows.
   */
  --card: var(--gl-inner);
  --bg: var(--gl-inner);
  --fill: var(--gl-fill);
  --sel: var(--gl-sel);
  --line: var(--gl-hair);
}

/* ── a bottom sheet (ui/Sheet.tsx) ── */
.sheet.glass {
  border-bottom: 0;
  border-radius: 1.75rem 1.75rem 0 0;
  box-shadow: var(--gl-hi), var(--gl-shadow);
}
/* TO THE VERY BOTTOM (founder, 13 Nov 2026: the Help sheet stopped short and
   left a black band under it on his phone). On a phone the sheet layer is
   pinned to the window, not to the app's frame, so it reaches the bottom
   edge even where the frame's 100dvh stops above the system bar; the
   sheet's own bottom padding already includes the safe-area inset. The
   width still follows the frame. */
.frame > .sheetwrap:not(.dialog):not(.panel) {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: calc(27.5 * var(--fix));
  margin: 0 auto;
}
/* The handle stays sticky but no longer paints a solid strip across the
   glass. */
.sheet.glass .sheethead {
  background: transparent;
}
.sheet.glass .grabber {
  width: 2.25rem;
  height: 0.3125rem;
  border-radius: 0.25rem;
  background: var(--gl-grab);
  margin: 0.5rem auto 0.625rem;
}

/* On a phone: the title in the middle, the round X top left. */
.sheetwrap:not(.dialog):not(.panel) .sheet.glass .sheettitle {
  text-align: center;
  padding: 0.25rem 2.75rem 0;
  min-height: 2rem;
}
.sheetwrap:not(.dialog):not(.panel) .sheet.glass .sheettitle.withicon {
  justify-content: center;
}
.sheetwrap:not(.dialog):not(.panel) .sheet.glass .sheethead .sheetx {
  position: absolute;
  top: 1.25rem;
  left: 1.125rem;
  right: auto;
  margin: 0;
  width: 2rem;
  height: 2rem;
}
.sheet.glass .sheetx {
  background: var(--gl-btn);
  border: 1px solid var(--gl-btn-edge);
  box-shadow: var(--gl-hi);
  color: var(--t1);
}
.sheet.glass .sheetx svg {
  width: 1rem;
  height: 1rem;
}

/* A dialog and a side panel (from 840px up) wear the same glass, rounded
   all round. */
.sheetwrap.dialog > .sheet.glass {
  border-bottom: 1px solid var(--gl-edge);
  border-radius: 1.75rem;
  box-shadow: var(--gl-hi), var(--gl-drop-shadow);
}
.sheetwrap.panel > .sheet.glass {
  border-right: 0;
  border-bottom: 1px solid var(--gl-edge);
  border-radius: 1.75rem 0 0 1.75rem;
  box-shadow: var(--gl-hi), var(--gl-drop-shadow);
}

/* ── a drop down menu (ui/DropMenu.tsx) ── */
.dropmenu.glass {
  border-radius: 1.125rem;
  box-shadow: var(--gl-hi), var(--gl-drop-shadow);
}
.dropmenu.glass .droprow.act:hover,
.dropmenu.glass .droprow.act:focus-visible {
  background: var(--gl-inner);
}

/* ── the other panels on the one glass ──
   Each sets only its shape; the surface, edge and shadow are .glass. */
.gv-sheet.glass {
  border-bottom: 0;
  box-shadow: var(--gl-hi), var(--gl-shadow);
}
.sa-hover.glass,
.droppanel.glass,
.pf-card.glass {
  box-shadow: var(--gl-hi), var(--gl-drop-shadow);
}

/* The bell's card: plain glass, no colour from the card under it (founder,
   13 Nov 2026: "no green"). */
.sa-hover.glass {
  -webkit-backdrop-filter: var(--gl-blur-plain);
  backdrop-filter: var(--gl-blur-plain);
}
/* Its close button: a small round glass button inside the header row. */
.sa-hover.glass header .sa-x {
  background: var(--gl-btn);
  border: 1px solid var(--gl-btn-edge);
  box-shadow: var(--gl-hi);
}

/* ── the second layer: a card of rows on the glass ── */
.glass-card {
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
  background: var(--gl-inner);
  border: 1px solid var(--gl-inner-edge);
  box-shadow: var(--gl-inner-sh);
  overflow: hidden;
}
.glass-row {
  all: unset;
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(12 * var(--px));
  min-height: calc(64 * var(--px));
  padding: calc(12 * var(--px)) calc(14 * var(--px));
  color: var(--t1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* The hairline starts where the words start, as in the reference. */
.glass-row + .glass-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(66 * var(--px));
  right: calc(14 * var(--px));
  height: 1px;
  background: var(--gl-hair);
}
.glass-row:active {
  background: var(--gl-hair);
}
.glass-row:disabled {
  opacity: 0.6;
  cursor: default;
}
.glass-row:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: -2px;
  border-radius: 1.25rem;
}
.glass-row .tx {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--px));
}
.glass-row .tx b {
  /* A row's title weight from the type scale (Remy#247). */
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.glass-row .tx .sub {
  color: var(--t2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The chosen row: a filled lime circle with a dark tick. */
.glass-check {
  flex: none;
  width: calc(22 * var(--px));
  height: calc(22 * var(--px));
  border-radius: 50%;
  background: var(--lime);
  color: var(--on-lime);
  display: grid;
  place-items: center;
}
.glass-check svg {
  width: 62%;
  height: 62%;
}

/* The long lime button at the foot of a sheet. */
.glass-pill {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  border-radius: var(--r-pill);
  background: var(--lime);
  color: var(--on-lime);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(8 * var(--px));
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px rgba(0, 0, 0, 0.12);
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms cubic-bezier(0.32, 0.72, 0, 1);
}
.glass-pill:active {
  transform: scale(0.98);
}
.glass-pill:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
}
.glass-pill svg {
  width: calc(18 * var(--px));
  height: calc(18 * var(--px));
}

/* ── where glass is not possible, or not wanted: a solid surface ── */
/* ── the head of a chat (founder, 13 Nov 2026): Ask Remy's bar and a customer chat's bar, over the doodle wallpaper.
   The same frosted surface as a sheet, a hairline at its foot instead of an edge all round; the messages scroll
   under it (styles/controls.css places it). ── */
:root .thd.dwp > :is(.asknav, .thnav) {
  background-color: var(--gl-tint);
  background-image: var(--gl-grain);
  background-size: 160px 160px;
  -webkit-backdrop-filter: var(--gl-blur);
  backdrop-filter: var(--gl-blur);
  border-bottom: 1px solid var(--gl-hair);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  :root .thd.dwp > :is(.asknav, .thnav) {
    background-color: var(--gl-solid);
  }
}
@media (prefers-reduced-transparency: reduce) {
  .glass,
  :root .thd.dwp > :is(.asknav, .thnav) {
    background-color: var(--gl-solid);
    background-image: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .glass-card {
    background: var(--fill);
  }
}

/* ── the glass picker (ui/GlassPicker.tsx): in place of the phone's own select, date and time dialogs ── */
.gp-list {
  max-height: min(62dvh, calc(52 * var(--px) * 11));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.gp-list .glass-row + .glass-row::before {
  left: calc(14 * var(--px));
}
.gp-opt {
  min-height: calc(52 * var(--px));
}
.gp-opt[aria-selected="true"] .tx b {
  font-weight: 700;
}
.gp-off {
  flex: none;
  width: calc(22 * var(--px));
  height: calc(22 * var(--px));
}
/* The trigger in place of a <select>: it takes the look of the field it sits in. */
.gsel {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: var(--fs-input);
  color: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.gsel:disabled {
  opacity: 0.5;
  cursor: default;
}
.gsel:focus-visible,
.gtime:focus-visible,
.gdate:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  border-radius: 6px;
}
.gtime,
.gdate {
  cursor: pointer;
  caret-color: transparent;
}
/* A month of days. */
.gd-cal {
  padding: calc(10 * var(--px)) calc(10 * var(--px)) calc(12 * var(--px));
}
.gd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(2 * var(--px)) calc(8 * var(--px));
}
.gd-head b {
  font-size: var(--fs-row);
  font-weight: 600;
}
.gd-nav {
  all: unset;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gl-btn);
  border: 1px solid var(--gl-btn-edge);
  color: var(--t1);
  cursor: pointer;
}
.gd-nav svg {
  width: 14px;
  height: 14px;
}
.gd-nav.prev svg {
  transform: rotate(180deg);
}
.gd-nav:disabled {
  opacity: 0.35;
  cursor: default;
}
.gd-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: calc(4 * var(--px)) 0;
  justify-items: center;
}
.gd-wd {
  font-size: var(--fs-label);
  color: var(--t2);
  padding: calc(4 * var(--px)) 0;
}
.gd-day {
  all: unset;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--t1);
  cursor: pointer;
}
.gd-day.today {
  box-shadow: inset 0 0 0 1.5px var(--gl-hair), inset 0 0 0 1.5px var(--t3);
}
.gd-day.on {
  background: var(--lime);
  color: var(--on-lime);
  font-weight: 700;
  box-shadow: none;
}
.gd-day:disabled {
  color: var(--t3);
  opacity: 0.45;
  cursor: default;
}
.gd-day:focus-visible,
.gd-nav:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 1px;
}
.gd-clear {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-top: calc(10 * var(--px));
  min-height: 44px;
  text-align: center;
  font-weight: 600;
  color: var(--t2);
  cursor: pointer;
}
.mn-split .gsel.gsel {
  display: flex;
  align-items: center;
}
