/* The shell (v3.44): the top bar (back, breadcrumb, Mesazhet, Mondi), the sidebar with folding groups and the account
   menu at its foot, the phone drawer, the floating panels under the top bar (Mesazhet, Mondi) and their insides, and
   the public pages' top bar. Loaded after app.css: it replaces the old rail / top bar / round-button rules there.
   Tokens come from app.css (fallbacks here keep the shell whole if one is missing). */

:root {
  --topbar-h: 3.5rem;                       /* 56px: the top bar, and the sidebar's brand block beside it */
  --rail-w: 14.5rem;                        /* 232px: the sidebar */
  --shell-max: 76rem;                       /* the content column next to the sidebar (the top bar aligns with it) */
  --shell-ease: var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
  --shell-drawer: var(--ease-drawer, cubic-bezier(0.32, 0.72, 0, 1));
}
html { scroll-padding-top: calc(var(--topbar-h) + 0.75rem); }
.legacy-hidden { display: none !important; }

/* ---------- top bar: translucent, no line at rest, a hairline once the page scrolls ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar, 60);
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 1px 0 transparent;
  transition: box-shadow 150ms ease;
}
body.scrolled .topbar { box-shadow: 0 1px 0 var(--line); }
.topbar-inner {
  max-width: 72rem; margin: 0 auto;
  height: var(--topbar-h); min-height: 0;
  padding: 0 max(0.5rem, env(safe-area-inset-right, 0px)) 0 max(0.5rem, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
@media (min-width: 640px) { .topbar-inner { padding: 0 max(1.5rem, env(safe-area-inset-right, 0px)) 0 max(1.5rem, env(safe-area-inset-left, 0px)); } }
@media (min-width: 900px) { body.has-shell .topbar-inner { max-width: var(--shell-max); } }
.tb-lead { display: flex; align-items: center; gap: 0.25rem; min-width: 0; flex: 1 1 auto; }
.topbar-actions { display: flex; align-items: center; gap: 0.25rem; flex: 0 0 auto; }

/* the controls of the bar: ghost, square icons, one height */
.tb-icon, .tb-btn, .tb-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  height: 2.25rem; min-height: 0; padding: 0;
  border: 0; border-radius: var(--radius-s, 0.5rem);
  background: transparent; color: var(--fg); box-shadow: none;
  font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none;
  cursor: pointer; position: relative; flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, color 120ms ease;
}
.tb-icon { width: 2.25rem; }
.tb-btn { padding: 0 0.75rem 0 0.625rem; }
.tb-icon svg, .tb-btn svg { width: 1.125rem; height: 1.125rem; flex: 0 0 auto; }
.tb-icon:active, .tb-btn:active, .tb-back:active { transform: scale(0.97); background: var(--panel-2); }
.tb-icon[aria-expanded="true"], .tb-btn[aria-expanded="true"] { background: var(--panel-2); }
@media (hover: hover) and (pointer: fine) {
  .tb-icon:hover, .tb-btn:hover, .tb-back:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
}
.tb-icon:focus-visible, .tb-btn:focus-visible, .tb-back:focus-visible, .tb-crumb-link:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--fg) 35%, transparent)); }
.tb-icon[hidden], .tb-btn[hidden], .tb-back[hidden] { display: none; }
/* touch screens: 44px targets (the bar is 56px tall) */
@media (pointer: coarse) {
  .tb-icon { width: 2.75rem; height: 2.75rem; }
  .tb-btn, .tb-back { height: 2.75rem; }
}

/* the way back: a chevron and the name of where it goes, like iOS ("‹ Klientët") */
.tb-back { height: 2rem; padding: 0 0.625rem 0 0.25rem; gap: 0.125rem; margin-left: -0.25rem; color: var(--fg); max-width: 14rem; }
.tb-back svg { width: 1.125rem; height: 1.125rem; flex: 0 0 auto; }
.tb-back-label { overflow: hidden; text-overflow: ellipsis; }
@media (pointer: coarse) { .tb-back { height: 2.75rem; } }

/* where you are: "Grupi / Faqja" */
.tb-crumb { display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; }
.tb-back:not([hidden]) + .tb-crumb { margin-left: 0.5rem; padding-left: 0.75rem; border-left: 1px solid var(--line); height: 1.25rem; }
.tb-crumb-group { color: var(--muted); }
.tb-crumb-sep { color: var(--faint, var(--muted)); }
.tb-crumb-link { color: var(--muted); text-decoration: none; border-radius: 0.25rem; }
@media (hover: hover) and (pointer: fine) { .tb-crumb-link:hover { color: var(--fg); } }
.tb-crumb-page { color: var(--fg); font-weight: 500; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* the unread count on Mesazhet */
.tb-badge {
  position: absolute; top: 0.125rem; right: 0.0625rem;
  min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  font-size: 0.625rem; font-weight: 600; line-height: 1rem; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.tb-badge[hidden] { display: none; }
.tb-mondi svg { width: 1rem; height: 1rem; }

/* the menu button: phones and tablets only, the sidebar is always there from 900px */
.tb-menu { margin-left: 0; }
@media (min-width: 900px) { .tb-menu { display: none; } }

/* phones: [☰] [‹ back] [the page's name] … [Mesazhet] [Mondi] */
@media (max-width: 639px) {
  .tb-lead { gap: 0; }
  .tb-crumb-group, .tb-crumb-group + .tb-crumb-sep, .tb-crumb-link, .tb-crumb-link + .tb-crumb-sep { display: none; }
  .tb-back:not([hidden]) + .tb-crumb { margin-left: 0.25rem; padding-left: 0; border-left: 0; }
  .tb-crumb { padding-left: 0.25rem; }
  .tb-crumb-page { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
  .tb-back { padding-right: 0.5rem; max-width: 7.5rem; margin-left: 0; }
  .tb-mondi { width: 2.5rem; padding: 0; }
  .tb-mondi svg { width: 1.125rem; height: 1.125rem; }
  .tb-mondi-label { display: none; }
}
@media (max-width: 379px) { .tb-back-label { display: none; } .tb-back { padding: 0; width: 2.75rem; } }

/* ---------- the public pages' bar: the logo small, the way back at its left when a page is behind, the theme ---------- */
/* a public page sets --pub-col on <body> (its content's width) so the bar's edges line up with it */
.topbar-public .topbar-inner { max-width: var(--pub-col, 72rem); }
.topbar-public .brand-link { flex: none; display: inline-flex; align-items: center; min-width: 0; }
.topbar-public .logo { height: 1.5rem; width: auto; max-width: none; flex: none; object-fit: contain; }
.topbar-public .tb-back:not([hidden]) + .brand-link { margin-left: 0.5rem; padding-left: 0.75rem; border-left: 1px solid var(--line); height: 1.5rem; }
.topbar-public .sp-who { font-size: 0.8125rem; color: var(--muted); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 479px) { .topbar-public .sp-who { display: none; } }

/* ---------- the sidebar: fixed from 900px, a drawer below ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: var(--z-rail, 70);
  width: var(--rail-w);
  display: flex; flex-direction: column;
  background: var(--sidebar, var(--bg));
  border-right: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sidebar:focus { outline: none; }
.sidebar-top {
  flex: none; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 0.5rem 0 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.sidebar-brand {
  display: inline-flex; align-items: center; gap: 0.625rem; min-width: 0;
  margin-left: -0.25rem; padding: 0.25rem; border-radius: var(--radius-s, 0.5rem);
  color: var(--fg); text-decoration: none; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap;
}
.sidebar-brand img { width: 1.75rem; height: 1.75rem; border-radius: 0.4375rem; flex: none; display: block; }
.sidebar-brand:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sidebar-close { display: none; }
.sidebar-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.25rem 0.5rem 0.75rem; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.sidebar-group-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; height: 1.75rem; margin-top: 0.625rem; padding: 0 0.5rem;
  border: 0; border-radius: 0.375rem; background: none; color: var(--muted);
  font: inherit; font-size: 0.75rem; font-weight: 500; text-align: left; cursor: pointer;
}
.sidebar-group:first-child .sidebar-group-btn { margin-top: 0.125rem; }
.sidebar-group-btn svg { width: 0.75rem; height: 0.75rem; flex: none; opacity: 0.8; transition: transform 150ms var(--shell-ease); }
.sidebar-group[data-open="false"] .sidebar-group-btn svg { transform: rotate(-90deg); }
@media (hover: hover) and (pointer: fine) { .sidebar-group-btn:hover { color: var(--fg); } }
.sidebar-group-btn:focus-visible { outline: none; box-shadow: var(--focus-ring-inset, inset 0 0 0 2px color-mix(in srgb, var(--fg) 45%, transparent)); }
.sidebar-items { display: grid; grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows 150ms var(--shell-ease), opacity 150ms var(--shell-ease); }
/* the list clips while it folds; it reaches into the sidebar's gutter so the current page's marker is not cut off */
.sidebar-items > ul { overflow: hidden; min-height: 0; margin-left: -0.5rem; padding-left: 0.5rem; }
.sidebar-group[data-open="false"] .sidebar-items { grid-template-rows: 0fr; opacity: 0; }

.sidebar-list { list-style: none; margin: 0; padding: 0.125rem 0 0; display: grid; gap: 1px; }
.sidebar-group.plain .sidebar-list { padding-top: 0.25rem; }
.sidebar-list a {
  position: relative; display: flex; align-items: center; gap: 0.625rem;
  height: 2.125rem; padding: 0 0.5rem; border-radius: var(--radius-s, 0.5rem);
  color: var(--text-2, var(--muted)); text-decoration: none; font-size: 0.875rem; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, color 120ms ease;
}
.sidebar-list a svg { width: 1rem; height: 1rem; flex: none; color: var(--muted); }
.sidebar-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-list a[aria-current="page"] { color: var(--fg); background: var(--panel-2); }
.sidebar-list a[aria-current="page"] svg { color: var(--fg); }
/* the brand's one accent: the current page's marker on the sidebar's edge */
.sidebar-list a[aria-current="page"]::before { content: ''; position: absolute; left: -0.5rem; top: 0.5rem; bottom: 0.5rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-list a:active { background: var(--panel-2); }
@media (hover: hover) and (pointer: fine) { .sidebar-list a:not([aria-current="page"]):hover { background: color-mix(in srgb, var(--fg) 4%, transparent); color: var(--fg); } }
.sidebar-list a:focus-visible { outline: none; box-shadow: var(--focus-ring-inset, inset 0 0 0 2px color-mix(in srgb, var(--fg) 45%, transparent)); }
.sidebar-count { flex: none; min-width: 1.125rem; height: 1.125rem; padding: 0 0.3125rem; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 0.6875rem; font-weight: 600; line-height: 1.125rem; text-align: center; font-variant-numeric: tabular-nums; }
.sidebar-count[hidden] { display: none; }

/* the account at the foot */
.sidebar-foot { flex: none; position: relative; padding: 0.5rem; border-top: 1px solid var(--line); }
.acct { position: relative; }
.acct-btn {
  display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 2.75rem; padding: 0.375rem 0.5rem;
  border: 0; border-radius: var(--radius-s, 0.5rem); background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color 120ms ease;
}
.acct-btn[aria-expanded="true"], .acct-btn:active { background: var(--panel-2); }
@media (hover: hover) and (pointer: fine) { .acct-btn:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); } }
.acct-btn:focus-visible { outline: none; box-shadow: var(--focus-ring-inset, inset 0 0 0 2px color-mix(in srgb, var(--fg) 45%, transparent)); }
.acct-btn > svg { width: 0.875rem; height: 0.875rem; color: var(--muted); flex: none; }
.acct-avatar { width: 1.75rem; height: 1.75rem; flex: none; border-radius: 999px; display: grid; place-items: center; background: var(--panel); color: var(--fg); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em; box-shadow: inset 0 0 0 1px var(--line-strong); }
.acct-who { display: grid; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.acct-who b { font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-who small { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn.is-skeleton .acct-avatar { background: var(--panel-2); box-shadow: none; }
.acct-btn.is-skeleton b, .acct-btn.is-skeleton small { display: block; height: 0.625rem; width: 7rem; border-radius: 999px; background: var(--panel-2); margin: 0.1875rem 0; }
.acct-btn.is-skeleton small { width: 4rem; }

.acct-menu {
  position: absolute; left: 0; bottom: calc(100% + 0.375rem); z-index: var(--z-popover, 90);
  width: 15.5rem; max-height: calc(100dvh - 5rem); overflow-y: auto;
  padding: 0.375rem; display: grid;
  background: var(--raised, var(--panel)); color: var(--fg);
  border-radius: var(--radius, 0.75rem);
  box-shadow: var(--shadow-pop, 0 8px 24px -8px rgba(0, 0, 0, 0.14), 0 0 0 1px var(--ring));
  transform-origin: bottom left;
}
.acct-menu:focus { outline: none; }
.acct-menu[hidden] { display: none; }
.acct-menu[data-state="enter"], .acct-menu[data-state="leave"] { opacity: 0; transform: scale(0.96); }
.acct-menu[data-state="open"] { opacity: 1; transform: none; transition: opacity 150ms var(--shell-ease), transform 150ms var(--shell-ease); }
.acct-menu[data-state="leave"] { transition: opacity 100ms ease, transform 100ms ease; }
.acct-head { display: grid; gap: 0.125rem; padding: 0.5rem 0.5rem 0.625rem; }
.acct-head b { font-size: 0.875rem; font-weight: 600; }
.acct-head span { font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.acct-row { display: grid; gap: 0.375rem; padding: 0.375rem 0.5rem 0.5rem; }
.acct-label { font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.acct-seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; border-radius: var(--radius-s, 0.5rem); background: var(--panel-2); }
.acct-seg-btn { height: 1.75rem; border: 0; border-radius: 0.375rem; background: none; color: var(--text-2, var(--muted)); font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer; white-space: nowrap; padding: 0 0.25rem; }
.acct-seg-btn[aria-checked="true"] { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-1, 0 1px 2px rgba(0, 0, 0, 0.06)), 0 0 0 1px var(--ring); }
/* in the dark the chosen segment is the lighter one, as on iOS */
:root[data-theme="dark"] .acct-seg-btn[aria-checked="true"] { background: color-mix(in srgb, var(--fg) 13%, var(--panel-2)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .acct-seg-btn[aria-checked="true"] { background: color-mix(in srgb, var(--fg) 13%, var(--panel-2)); } }
.acct-seg-btn:focus-visible, .acct-step-btn:focus-visible { outline: none; box-shadow: var(--focus-ring-inset, inset 0 0 0 2px color-mix(in srgb, var(--fg) 45%, transparent)); }
.acct-step { display: grid; grid-template-columns: 2rem 1fr 2rem; align-items: center; height: 2rem; padding: 2px; border-radius: var(--radius-s, 0.5rem); background: var(--panel-2); }
.acct-step-btn { height: 1.75rem; display: grid; place-items: center; border: 0; border-radius: 0.375rem; background: none; color: var(--fg); cursor: pointer; padding: 0; }
.acct-step-btn svg { width: 0.875rem; height: 0.875rem; }
.acct-step-btn:disabled { color: var(--faint, var(--muted)); cursor: default; }
@media (hover: hover) and (pointer: fine) { .acct-step-btn:not(:disabled):hover, .acct-seg-btn:not([aria-checked="true"]):hover { background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--fg); } }
.acct-level { text-align: center; font-size: 0.8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.acct-sep { height: 1px; margin: 0.25rem -0.375rem; background: var(--line); }
.acct-item {
  display: flex; align-items: center; gap: 0.625rem; width: 100%; height: 2.125rem; padding: 0 0.5rem;
  border: 0; border-radius: 0.375rem; background: none; color: var(--fg);
  font: inherit; font-size: 0.875rem; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.acct-item svg { width: 1rem; height: 1rem; color: var(--muted); flex: none; }
.acct-item:focus-visible { outline: none; background: var(--panel-2); }
.acct-item:active { background: var(--panel-2); }
@media (hover: hover) and (pointer: fine) { .acct-item:hover { background: var(--panel-2); } }
.acct-item.danger, .acct-item.danger svg { color: var(--bad-fg); }
.acct-ver { margin: 0; padding: 0.375rem 0.5rem 0.25rem; font-size: 0.6875rem; color: var(--faint, var(--muted)); }
@media (pointer: coarse) {
  .acct-item { height: 2.75rem; }
  .acct-seg-btn, .acct-step-btn { height: 2.5rem; }
  .acct-step { height: 2.75rem; grid-template-columns: 2.75rem 1fr 2.75rem; }
  .sidebar-group-btn { height: 2.75rem; margin-top: 0.25rem; }
}

/* the page beside it: the column is reserved from the first paint (body.has-shell in the HTML) */
@media (min-width: 900px) {
  body.has-shell { padding-left: var(--rail-w); }
  body.has-shell .page, body.has-shell .wrap { max-width: var(--shell-max); }
  .sidebar-backdrop { display: none; }
}

/* below 900px: a drawer over the page, from the left and back the same way */
@media (max-width: 899px) {
  .sidebar {
    width: min(18.75rem, 86vw); z-index: var(--z-rail, 70);
    transform: translateX(-100%); visibility: hidden;
    transition: transform 280ms var(--shell-drawer), visibility 0s linear 280ms;
    box-shadow: none; border-right: 0;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform 300ms var(--shell-drawer), visibility 0s; box-shadow: var(--shadow-modal, 0 24px 56px -16px rgba(0, 0, 0, 0.28)); }
  .sidebar-top { padding-right: 0.5rem; }
  .sidebar-close { display: inline-flex; }
  .sidebar-list a { height: 2.75rem; font-size: 0.9375rem; }
  .sidebar-list a svg { width: 1.125rem; height: 1.125rem; }
  .sidebar-group-btn { height: 2.25rem; font-size: 0.8125rem; }
  .sidebar-list a[aria-current="page"]::before { left: -0.5rem; }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: calc(var(--z-rail, 70) - 1);
    background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity 280ms ease, visibility 0s linear 280ms;
  }
  .sidebar-backdrop.open { opacity: 1; visibility: visible; transition: opacity 300ms ease, visibility 0s; }
  body.rail-open { overflow: hidden; }
  .acct-menu { width: calc(100% + 0rem); }
}

/* ---------- floating panels (Mesazhet, Mondi): under the top bar at the right, anchored to their button ---------- */
.float-panel {
  position: fixed; z-index: var(--z-panel, 80);
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 0.5rem); right: 0.75rem;
  width: min(25rem, calc(100vw - 1.5rem));
  height: min(42rem, calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - 1.25rem));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--raised, var(--panel)); color: var(--fg);
  border-radius: var(--radius-l, 1rem);
  box-shadow: var(--shadow-modal, 0 24px 56px -16px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--ring));
  transform-origin: top right;
}
.float-panel[hidden] { display: none; }
.float-panel[data-state="enter"], .float-panel[data-state="leave"] { opacity: 0; transform: translateY(-4px) scale(0.97); }
.float-panel[data-state="open"] { opacity: 1; transform: none; transition: opacity 180ms var(--shell-ease), transform 180ms var(--shell-ease); }
.float-panel[data-state="leave"] { transition: opacity 120ms ease, transform 120ms ease; }
.float-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; height: 100%; }

/* phones: a sheet from the bottom, nearly full height, the page dimmed behind it */
dialog.float-sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; padding: 0; border: 0;
  width: 100%; max-width: none; height: calc(100dvh - 0.75rem - env(safe-area-inset-top, 0px)); max-height: none;
  background: var(--raised, var(--panel)); color: var(--fg);
  border-radius: var(--radius-l, 1rem) var(--radius-l, 1rem) 0 0;
  box-shadow: var(--shadow-modal, 0 24px 56px -16px rgba(0, 0, 0, 0.28));
  overflow: hidden; overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
dialog.float-sheet:not([open]) { display: none; }
dialog.float-sheet[open] { display: flex; flex-direction: column; animation: shell-sheet-in 300ms var(--shell-drawer); }
dialog.float-sheet.is-closing { transform: translateY(100%); transition: transform 160ms ease-in; }
dialog.float-sheet::backdrop { background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
@keyframes shell-sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Mesazhet: the conversation list, a conversation, the composer ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; height: 100%; }
/* the messages page; the driver's page keeps its own height (.drv-chat .chat) */
.chat--page { height: min(44rem, calc(100dvh - 15rem)); min-height: 28rem; }
@media (max-width: 639px) { .chat--page { height: calc(100dvh - 12rem); } }
.chat-head { display: flex; align-items: center; gap: 0.25rem; min-height: 3.5rem; padding: 0.5rem 0.5rem 0.5rem 1rem; border-bottom: 1px solid var(--line); background: transparent; flex: 0 0 auto; }
.chat-head .chat-back:not([hidden]) { margin-left: -0.5rem; }
.chat-head .btn-icon { width: 2rem; min-width: 2rem; height: 2rem; min-height: 2rem; border: 0; background: transparent; box-shadow: none; color: var(--fg); }
@media (pointer: coarse) { .chat-head .btn-icon { width: 2.75rem; min-width: 2.75rem; height: 2.75rem; min-height: 2.75rem; } }
@media (hover: hover) and (pointer: fine) { .chat-head .btn-icon:hover { background: var(--panel-2); } }
.chat-head .btn-icon svg { width: 1.125rem; height: 1.125rem; }
.chat-headtext { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.0625rem; }
.chat-title { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list, .chat-newwrap { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0.5rem; }
.chat-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0.25rem 0.25rem 0.5rem; }
.chat-items { display: grid; gap: 1px; }
.chat-item { display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 3.5rem; padding: 0.5rem; border: 0; border-radius: 0.625rem; background: transparent; color: var(--fg); text-align: left; font: inherit; cursor: pointer; transition: background-color 120ms ease; }
.chat-item:active { background: var(--panel-2); transition-duration: 0s; }
@media (hover: hover) and (pointer: fine) { .chat-item:hover { background: var(--panel-2); } }
.chat-item:focus-visible { outline: none; box-shadow: var(--focus-ring-inset, inset 0 0 0 2px color-mix(in srgb, var(--fg) 45%, transparent)); }
.chat-avatar { flex: 0 0 2.25rem; width: 2.25rem; height: 2.25rem; border-radius: 999px; background: var(--panel-2); color: var(--fg); display: grid; place-items: center; font-size: 0.75rem; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.chat-avatar.group { background: var(--panel-2); color: var(--text-2, var(--muted)); }
.chat-avatar svg { width: 1rem; height: 1rem; }
.chat-item-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.0625rem; }
.chat-item-title { display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-size: 0.875rem; font-weight: 500; }
.chat-item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item.unread .chat-item-name { font-weight: 600; }
.chat-tag { flex: none; font-size: 0.75rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); background: var(--panel-2); padding: 0.0625rem 0.375rem; border-radius: 999px; }
.chat-item-sub { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-sub { color: var(--fg); font-weight: 500; }
.chat-item-side { display: grid; justify-items: end; gap: 0.25rem; flex: 0 0 auto; align-self: start; padding-top: 0.125rem; }
.chat-item-time { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-count { display: inline-grid; place-items: center; min-width: 1.125rem; height: 1.125rem; padding: 0 0.3125rem; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 0.6875rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.chat-empty { display: grid; justify-items: center; gap: 0.75rem; margin: 0; padding: 2rem 1rem; color: var(--muted); font-size: 0.875rem; text-align: center; }
.chat-empty p { margin: 0; }
/* a new conversation: plain rows, one scroll, the button always in reach */
.chat-new { display: grid; gap: 0.75rem; padding: 0.25rem; min-height: 100%; align-content: start; }
.chat-new .user-pick { display: grid; gap: 0; max-height: none; overflow: visible; }
.chat-new .set-row { display: flex; align-items: center; justify-content: space-between; flex-direction: row-reverse; gap: 0.75rem; min-height: 2.75rem; padding: 0.375rem 0.25rem; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; cursor: pointer; }
.chat-new .set-row:last-child { border-bottom: 0; }
.chat-new .set-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; }
.chat-new .set-row b { font-weight: 500; }
.chat-new .set-row input { width: 1.125rem; height: 1.125rem; margin: 0; flex: none; accent-color: var(--fg); }
.chat-new .dlg-actions { position: sticky; bottom: -0.5rem; margin: 0 -0.75rem -0.75rem; padding: 0.625rem 0.75rem; background: var(--raised, var(--panel)); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 0.5rem; }
.chat--page .chat-new .dlg-actions { background: var(--panel); }
.chat-thread { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-status:empty { display: none; }
.chat-monitor { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--panel-2); color: var(--text-2, var(--muted)); font-size: 0.8125rem; font-weight: 500; }
.chat-monitor svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
.chat-monitor .btn { margin-left: auto; }
.msgs { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.msg-day { align-self: center; font-size: 0.75rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); padding: 0.75rem 0 0.25rem; }
.msg { display: grid; gap: 0.125rem; max-width: 85%; }
.msg.me { align-self: flex-end; justify-items: end; }
.msg.other { align-self: flex-start; }
.msg-name { font-size: 0.75rem; font-weight: 500; color: var(--muted); padding: 0.25rem 0.5rem 0; }
.msg-bubble { padding: 0.5rem 0.75rem; border-radius: 1.125rem; background: var(--panel-2); border: 0; color: var(--fg); font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.msg.me .msg-bubble { background: var(--primary); color: var(--primary-fg); border-bottom-right-radius: 0.375rem; }
.msg.other .msg-bubble { border-bottom-left-radius: 0.375rem; }
.msg.deleted .msg-bubble { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
/* a field problem stands apart from the talk: a warm fill and the line icon in the warning colour; a solved one in green */
.msg.is-problem .msg-bubble { background: var(--warn-bg); color: var(--fg); }
.msg.is-problem .msg-sys-icon { color: var(--warn-fg); }
.msg.is-resolved .msg-sys-icon { color: var(--ok-fg); }
.msg.me.msg-sys .msg-sys-icon { color: inherit; }
/* in the dark the other side's bubble and the question to Mondi lift off the panel's raised surface */
:root[data-theme="dark"] :is(.msg.other:not(.is-problem) .msg-bubble, .is-user .mira-text) { background: color-mix(in srgb, var(--fg) 9%, var(--raised)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.msg.other:not(.is-problem) .msg-bubble, .is-user .mira-text) { background: color-mix(in srgb, var(--fg) 9%, var(--raised)); } }
.msg-meta { display: flex; align-items: center; gap: 0.25rem; min-height: 1.25rem; font-size: 0.6875rem; color: var(--muted); padding: 0 0.5rem; font-variant-numeric: tabular-nums; }
/* deleting a message: on hover or focus on a desk, after a tap on the message on a phone */
.msg-del { width: 1.5rem; height: 1.5rem; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; border-radius: 999px; opacity: 0; transition: opacity 120ms ease; cursor: pointer; padding: 0; }
.msg-del svg { width: 0.875rem; height: 0.875rem; }
.msg:hover .msg-del, .msg.show-tools .msg-del, .msg-del:focus-visible { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .msg-del:hover { color: var(--bad-fg); background: var(--bad-bg, var(--panel-2)); } }
.msg-del:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* one composer for both panels: a pill with a round send key */
.composer, .mira-form { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.625rem 0.75rem calc(0.625rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: transparent; flex: 0 0 auto; }
.composer textarea, .mira-form textarea {
  flex: 1 1 auto; min-width: 0; min-height: 2.25rem; max-height: 8.25rem; margin: 0;
  padding: 0.5rem 0.875rem; border: 1px solid var(--line-strong); border-radius: 1.125rem;
  background: var(--field-bg, var(--panel)); color: var(--fg); font: inherit; font-size: var(--fs-body, 0.875rem); line-height: 1.4; resize: none; box-shadow: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.composer textarea::placeholder, .mira-form textarea::placeholder { color: var(--faint, var(--muted)); }
.composer textarea:focus, .composer textarea:focus-visible, .mira-form textarea:focus, .mira-form textarea:focus-visible { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 10%, transparent); }
@media (pointer: coarse) { .composer textarea, .mira-form textarea { font-size: 16px; min-height: 2.5rem; padding-top: 0.5625rem; } }
.chat-send, .mira-send { flex: 0 0 auto; width: 2.25rem; min-width: 2.25rem; height: 2.25rem; min-height: 2.25rem; padding: 0; border-radius: 999px; }
.chat-send svg, .mira-send svg { width: 1rem; height: 1rem; }
@media (pointer: coarse) { .chat-send, .mira-send { width: 2.75rem; min-width: 2.75rem; height: 2.75rem; min-height: 2.75rem; } }
/* on a touch screen: 44px for the message box, and a 44px reach around the small delete key */
@media (pointer: coarse) {
  .composer textarea, .mira-form textarea { min-height: 2.75rem; }
  .msg-del { position: relative; }
  .msg-del::after { content: ''; position: absolute; inset: -0.625rem; }
}
.chat-card { padding: 0; overflow: hidden; }
.chat-page .chat-card { border-radius: var(--radius-l, 1rem); }

/* ---------- Mondi ---------- */
.mira-face { border-radius: 999px; display: block; object-fit: cover; background: var(--panel-2); flex: 0 0 auto; }
.mira-head { display: flex; align-items: center; gap: 0.625rem; min-height: 3.5rem; padding: 0.5rem 0.5rem 0.5rem 1rem; border-bottom: 1px solid var(--line); background: transparent; flex: 0 0 auto; }
.mira-head-face { width: 1.75rem; height: 1.75rem; border: 0; box-shadow: inset 0 0 0 1px var(--line); }
/* his mark: the top bar's monochrome sparkle in the round frame */
.mira-mark { display: grid; place-items: center; color: var(--fg); }
.mira-mark svg { width: 1rem; height: 1rem; }
.mira-id { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.mira-id b { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.mira-id span { font-size: 0.75rem; color: var(--muted); }
.mira-tool { width: 2rem; min-width: 2rem; height: 2rem; min-height: 2rem; padding: 0; border: 0; background: transparent; box-shadow: none; color: var(--fg); }
.mira-tool svg { width: 1.125rem; height: 1.125rem; }
@media (hover: hover) and (pointer: fine) { .mira-tool:hover { background: var(--panel-2); } }
@media (pointer: coarse) { .mira-tool { width: 2.75rem; min-width: 2.75rem; height: 2.75rem; min-height: 2.75rem; } }
.mira-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1rem; display: grid; gap: 1rem; align-content: start; overscroll-behavior: contain; }
.mira-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; min-width: 0; }
.mira-msg.is-user { align-items: flex-end; }
.mira-text { max-width: 100%; min-width: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: var(--fs-body, 0.875rem); line-height: 1.55; overflow-wrap: anywhere; color: var(--fg); }
.is-mira .mira-text { background: none; border: 0; }
.mira-hello .mira-text { color: var(--text-2, var(--muted)); }
.is-user .mira-text { max-width: 85%; padding: 0.5rem 0.75rem; border-radius: 1.125rem; border-bottom-right-radius: 0.375rem; background: var(--panel-2); color: var(--fg); white-space: pre-wrap; }
.is-error .mira-text { color: var(--bad-fg); border: 0; }
.mira-text p { margin: 0 0 0.5rem; }
.mira-text ul, .mira-text ol { margin: 0 0 0.5rem; padding-left: 1.15rem; display: grid; gap: 0.25rem; }
.mira-text > :last-child { margin-bottom: 0; }
.mira-text .mira-h { font-weight: 600; margin-top: 0.25rem; }
.mira-text b { font-weight: 600; }
.mira-status { color: var(--muted); display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.mira-status::before { content: ''; flex: 0 0 auto; width: 0.875rem; height: 0.875rem; border: 2px solid var(--line-strong); border-top-color: var(--fg); border-radius: 50%; animation: mira-spin 0.9s linear infinite; }
.mira-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; padding: 0 1rem 0.75rem; }
.mira-chips[hidden] { display: none; }
.mira-chip { display: inline-flex; align-items: center; height: 2rem; padding: 0 0.75rem; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--fg); font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: background-color 120ms ease; }
.mira-chip:active { transform: scale(0.97); background: var(--panel-2); }
@media (hover: hover) and (pointer: fine) { .mira-chip:hover { background: var(--panel-2); } }
.mira-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (pointer: coarse) { .mira-chip { height: 2.75rem; } }
.mira-foot { margin: 0; padding: 0 1rem 0.75rem; font-size: 0.75rem; color: var(--muted); display: grid; gap: 0.125rem; }
.mira-usage[hidden] { display: none; }

/* ---------- Profili im (shell.js): the account's email and the code by email at sign-in ---------- */
dialog.acp-dlg { gap: 1rem; }
@media (min-width: 768px) { dialog.acp-dlg { width: min(100% - 2rem, 32rem); } }
.acp-body { display: grid; gap: 1rem; min-width: 0; }
.acp-head { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.acp-avatar { width: 2.5rem; height: 2.5rem; flex: none; font-size: 0.875rem; }
.acp-who { display: grid; min-width: 0; }
.acp-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp-who span { font-size: var(--fs-meta, 0.8125rem); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp-rows { border: 1px solid var(--line); border-radius: var(--radius, 0.75rem); }
.acp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 0.875rem 1rem; }
.acp-row + .acp-row { border-top: 1px solid var(--line); }
.acp-ico { width: 2rem; height: 2rem; border-radius: var(--radius-s, 0.5rem); display: grid; place-items: center; background: var(--panel-2); color: var(--text-2); }
.acp-ico svg { width: 1rem; height: 1rem; }
.acp-text { display: grid; gap: 0.125rem; min-width: 0; }
.acp-text b { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.acp-text > span { font-size: var(--fs-meta, 0.8125rem); color: var(--muted); overflow-wrap: anywhere; text-wrap: pretty; }
.acp-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.acp-actions:empty { display: none; }
.acp-muted { margin: 0; color: var(--text-2); font-size: var(--fs-body, 0.875rem); line-height: 1.5; text-wrap: pretty; }
.acp-muted a { color: var(--fg); }
.acp-form { display: grid; gap: 1rem; }
.acp-title { margin: 0; font-size: var(--fs-section, 1rem); font-weight: 600; }
.acp-form .hint { margin: 0; }
.acp-code { text-align: center; font-size: 1.25rem !important; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
dialog.acp-dlg .dlg-actions { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }
dialog.acp-dlg .dlg-spacer { flex: 1; }
@media (max-width: 479px) {
  .acp-row { grid-template-columns: auto minmax(0, 1fr); }
  .acp-actions { grid-column: 1 / -1; }
  .acp-actions > .btn { flex: 1 1 0; }
  dialog.acp-dlg .dlg-actions .dlg-spacer { display: none; }
  dialog.acp-dlg .dlg-actions { flex-wrap: wrap; }
  dialog.acp-dlg .dlg-actions > .btn { flex: 1 1 0; }
}

/* ---------- the location gate (geo.js): the page behind blurs, a card asks, an arrow points to the browser's question ---------- */
dialog.geo-gate {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: var(--fg);
  display: none; place-items: center; overflow: hidden;
}
dialog.geo-gate[open] { display: grid; }
dialog.geo-gate::backdrop {
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  opacity: 1;
  transition: opacity 260ms ease, -webkit-backdrop-filter 700ms ease, backdrop-filter 700ms ease;
  @starting-style { opacity: 0; -webkit-backdrop-filter: blur(0) saturate(100%); backdrop-filter: blur(0) saturate(100%); }
}
dialog.geo-gate.is-leaving::backdrop { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
dialog.geo-gate.is-leaving .geo-card, dialog.geo-gate.is-leaving .geo-wait, dialog.geo-gate.is-leaving .geo-point { opacity: 0; transform: scale(0.98); transition: opacity 200ms ease, transform 200ms ease; }
.geo-card {
  width: min(100% - 2rem, 26rem); padding: 1.5rem; border-radius: var(--radius-l, 1rem);
  background: var(--raised); box-shadow: var(--shadow-modal);
  display: grid; gap: 0.75rem; justify-items: start;
  animation: geo-rise 360ms var(--ease-drawer, ease) both;
}
.geo-card[hidden] { display: none; }
.geo-mark { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--fg); margin-bottom: 0.25rem; }
.geo-mark svg { width: 1.375rem; height: 1.375rem; }
.geo-card h2 { margin: 0; font-size: var(--fs-dialog, 1.125rem); line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; text-wrap: balance; }
.geo-body { margin: 0; color: var(--text-2); font-size: var(--fs-body, 0.875rem); line-height: 1.5; }
.geo-steps { margin: 0; padding: 0 0 0 1.25rem; display: grid; gap: 0.375rem; font-size: var(--fs-body, 0.875rem); line-height: 1.45; }
.geo-steps::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.geo-note { margin: 0; color: var(--muted); font-size: var(--fs-meta, 0.8125rem); line-height: 1.45; }
.geo-actions { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.geo-quit { color: var(--muted); }
.geo-primary { min-width: 11rem; }
/* while the browser asks: a quiet line, and the arrow at the place the question appears */
.geo-wait { position: absolute; left: 50%; bottom: calc(2rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 0.625rem; padding: 0.625rem 1rem; border-radius: 999px;
  background: var(--raised); box-shadow: var(--shadow-pop); font-size: var(--fs-body, 0.875rem); white-space: nowrap; max-width: calc(100% - 2rem); }
.geo-wait[hidden], .geo-point[hidden] { display: none; }
.geo-point[data-where="bottom"] ~ .geo-wait { bottom: auto; top: calc(1.25rem + env(safe-area-inset-top, 0px)); }
.geo-wait-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--fg); animation: geo-pulse 1.2s ease-in-out infinite; }
.geo-point { position: absolute; display: grid; justify-items: center; gap: 0.5rem; text-align: center; animation: geo-in 300ms ease both; }
.geo-point-arrow { width: 3.25rem; height: 3.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: var(--bg); box-shadow: var(--shadow-pop); animation: geo-nudge 1.1s ease-in-out infinite; }
.geo-point-arrow svg { width: 1.625rem; height: 1.625rem; transform: rotate(var(--geo-rot, 0deg)); }
.geo-point-label { font-weight: 600; font-size: var(--fs-body, 0.875rem); padding: 0.375rem 0.75rem; border-radius: 999px; background: var(--raised); box-shadow: var(--shadow-pop); }
.geo-point[data-where="top-left"] { top: 1.25rem; left: 1.25rem; justify-items: start; text-align: left; --geo-rot: -45deg; --geo-dx: -6px; --geo-dy: -6px; }
.geo-point[data-where="top"] { top: 1.25rem; left: 50%; transform: translateX(-50%); --geo-rot: 0deg; --geo-dy: -8px; }
.geo-point[data-where="bottom"] { bottom: calc(30% + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); --geo-rot: 180deg; --geo-dy: 8px; }
.geo-point[data-where="center"] { top: 14%; left: 50%; transform: translateX(-50%); --geo-rot: 180deg; --geo-dy: 8px; }
@keyframes geo-nudge { 0%, 100% { translate: 0 0; } 50% { translate: var(--geo-dx, 0) var(--geo-dy, -8px); } }
@keyframes geo-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }
@keyframes geo-rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes geo-in { from { opacity: 0; } to { opacity: 1; } }
html.geo-locked { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  dialog.geo-gate::backdrop { transition: opacity 150ms ease; }
  .geo-card, .geo-point { animation: none; }
  .geo-point-arrow, .geo-wait-dot { animation: none; }
}
@media (prefers-reduced-transparency: reduce) { dialog.geo-gate::backdrop { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (pointer: coarse) { .geo-primary, .geo-quit { min-height: 2.75rem; } }

/* ---------- the shell's motion respects the reader ---------- */
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar.open, .sidebar-backdrop, .sidebar-backdrop.open { transition: opacity 150ms ease, visibility 0s linear 150ms; }
  .sidebar.open, .sidebar-backdrop.open { transition: opacity 150ms ease, visibility 0s; }
  .sidebar { transform: none; opacity: 0; }
  .sidebar.open { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-items, .sidebar-group-btn svg { transition: none; }
  .float-panel[data-state], .acct-menu[data-state] { transform: none !important; }
  dialog.float-sheet[open] { animation: shell-fade 150ms ease; }
  dialog.float-sheet.is-closing { transform: none; }
  .mira-status::before { animation: none; }
  .tb-icon:active, .tb-btn:active, .tb-back:active, .mira-chip:active { transform: none; }
}
@keyframes shell-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sidebar-backdrop, dialog.float-sheet::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, 0.5); }
}
@media (prefers-contrast: more) {
  .topbar { box-shadow: 0 1px 0 var(--line-strong); background: var(--bg); }
  .sidebar, .sidebar-foot { border-color: var(--line-strong); }
  .float-panel, .acct-menu { box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-modal, none); }
  .tb-icon:focus-visible, .tb-btn:focus-visible, .tb-back:focus-visible { box-shadow: 0 0 0 2px var(--fg); }
}

/* ---------- print: the page alone ---------- */
@media print {
  .sidebar, .sidebar-backdrop, .topbar, .float-panel, .float-sheet, .acct-menu, .legacy-hidden { display: none !important; }
  body.has-shell { padding-left: 0 !important; }
  body.has-shell .page, body.has-shell .wrap { max-width: none; }
}

/* ---------- v3.56: "Alarm", the administrator's entry at the end of the menu: a button, red, opens the alarm sheet ---------- */
.sidebar-list .sidebar-alarm {
  position: relative; display: flex; align-items: center; gap: 0.625rem; width: 100%;
  height: 2.125rem; padding: 0 0.5rem; border: 0; border-radius: var(--radius-s, 0.5rem);
  background: transparent; color: var(--bad-fg); font: inherit; font-size: 0.875rem; font-weight: 600; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, color 120ms ease;
}
.sidebar-list .sidebar-alarm svg { width: 1rem; height: 1rem; flex: none; color: var(--bad-fg); }
.sidebar-list .sidebar-alarm:active, .sidebar-list .sidebar-alarm[aria-expanded="true"] { background: var(--bad-bg); }
/* the sheet is open: the red marker on the sidebar's edge, where the current page's would be */
.sidebar-list .sidebar-alarm[aria-expanded="true"]::before { content: ''; position: absolute; left: -0.5rem; top: 0.5rem; bottom: 0.5rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--danger); }
@media (hover: hover) and (pointer: fine) { .sidebar-list .sidebar-alarm:hover { background: var(--bad-bg); } }
.sidebar-list .sidebar-alarm:focus-visible { outline: none; box-shadow: var(--focus-ring-inset, inset 0 0 0 2px color-mix(in srgb, var(--fg) 45%, transparent)); }
@media (max-width: 899px) { .sidebar-list .sidebar-alarm { height: 2.75rem; font-size: 0.9375rem; } .sidebar-list .sidebar-alarm svg { width: 1.125rem; height: 1.125rem; } }
