/* ============================================================
   Platform shell — the shared page layout of the "one app" family
   (account.html, admin.html, /apps/, the apps) and the shared
   components of DESIGN.md ("White City"). Tokens only, from
   /assets/tokens.css (linked before this file); logical
   properties, RTL first. The top bar, app launcher and account
   menu come from /assets/bz-shell.js (<bz-appbar>, <bz-apps>,
   <bz-account>, <bz-app-icon>). The public pages load this file
   too, for the one button system (.btn = .bz-btn).

   Page skeleton:
     <body class="bz-app">
       <a class="skip-link" href="#main">…</a>
       <bz-appbar app="account" label="החשבון שלי" label-en="My account"></bz-appbar>
       <div class="bz-layout">                       (.bz-layout--full: no side nav)
         <nav class="bz-nav" aria-label="…">
           <p class="bz-nav-caption">…</p>            (optional)
           <div class="bz-nav-group">                 (optional; flat here, a box in the phone list)
             <a class="bz-nav-item" href="#x" data-view="x" aria-current="page"><svg …/><span>Label</span></a>
             <a class="bz-nav-item" href="#y" data-view="y"><svg …/>
               <span class="bz-nav-text"><span>Label</span><span class="bz-nav-note">…</span></span></a>
             <a class="bz-nav-item bz-nav-phone" href="…">…</a>   (only in the phone list)
           </div>
           <button class="bz-nav-item" type="button" aria-current="true">…</button>
           <hr class="bz-nav-sep" />                  (optional)
         </nav>
         <main id="main" class="bz-main">
           <div class="bz-menu-slot"></div>          (phones: the nav as a list, on the landing
                                                       section; bz-phone-nav.js moves it here)
           <header class="bz-page-head"><h1>…</h1></header>
           <section class="bz-card bz-card--grouped">   (inset grouped: the head above a white plane)
             <div class="bz-card-head"><h2 class="bz-card-title">…</h2><div class="bz-card-actions">…</div></div>
             <ul class="bz-rows"><li class="bz-row"><span class="bz-row-k">…</span>
               <span class="bz-row-v">…</span><span class="bz-row-end">…</span></li></ul>
             <ul class="bz-tiles">  (items from BZShell.appTile(item))
           </section>
         </main>
       </div>
       <footer class="bz-foot">…</footer>
     </body>
   ============================================================ */

/* ---------- page ---------- */
body.bz-app {
  background: var(--color-surface-2);
  font-family: var(--font-body);
  color: var(--color-text);
  min-height: 100vh;
}
body.bz-app .skip-link { font-family: var(--font-body); font-size: var(--text-sm); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* English on a page written in Hebrew (bz-i18n.js): out of sight for the few
   milliseconds until its strings are swapped, so nothing flips on screen. */
html.bz-i18n-wait body { visibility: hidden; }

/* Reserve the bar's space before bz-shell.js has run (no layout jump). */
bz-appbar:not(:defined) {
  display: block; position: sticky; top: 0; z-index: 50;
  height: var(--appbar-height); background: var(--color-surface); border-block-end: 1px solid var(--color-line);
}
bz-lang:not(:defined), bz-apps:not(:defined), bz-account:not(:defined) { display: inline-block; width: var(--hit-min); height: var(--hit-min); }
bz-app-icon:not(:defined) { display: inline-block; width: var(--space-7); height: var(--space-7); border-radius: var(--radius-md); background: var(--color-surface-3); }

/* ---------- layout ---------- */
.bz-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
  width: 100%;
  max-width: var(--layout-max);
  margin-inline: auto;
  padding: var(--space-5);
  box-sizing: border-box;
}
.bz-layout--full { grid-template-columns: minmax(0, 1fr); max-width: 1120px; }
.bz-main { min-width: 0; }
.bz-main:focus { outline: none; }

/* ---------- side nav: capsule items, 44px; the current one a white capsule with a red start rule ---------- */
.bz-nav {
  position: sticky; top: calc(var(--appbar-height) + var(--space-5));
  display: flex; flex-direction: column; gap: var(--space-1);
  max-height: calc(100vh - var(--appbar-height) - var(--space-7)); overflow-y: auto;
}
.bz-nav-caption {
  margin: var(--space-4) 0 var(--space-1); padding-inline: var(--space-4);
  font-family: var(--font-body); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-2);
}
/* Tracked capitals for Latin only: in Hebrew they pull the letters apart. */
.bz-nav-caption:lang(en) { letter-spacing: .08em; text-transform: uppercase; }
.bz-nav-caption:first-child { margin-top: 0; }
.bz-nav-item {
  position: relative; display: flex; align-items: center; gap: var(--space-3);
  box-sizing: border-box; width: 100%; min-height: var(--hit-min); padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-capsule); background: transparent;
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-tight);
  color: var(--color-text); text-align: start; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.bz-nav-item > svg { width: 20px; height: 20px; flex: none; display: block; color: var(--color-text-2); }
.bz-nav-item:hover { background: var(--color-surface-3); }
.bz-nav-item:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.bz-nav-item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"], .is-active) {
  background: var(--color-surface); color: var(--color-text); font-weight: var(--weight-bold);
}
.bz-nav-item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"], .is-active) > svg { color: var(--color-text); }
@media (min-width: 900px) {
  .bz-layout > .bz-nav .bz-nav-item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"], .is-active)::before {
    content: ""; position: absolute; inset-inline-start: var(--space-1); inset-block: var(--space-3);
    width: 3px; border-radius: var(--radius-capsule); background: var(--color-accent);
  }
}
.bz-nav-count { margin-inline-start: auto; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-2); font-variant-numeric: tabular-nums; }
/* Groups and notes only matter in the phone list (below): here the nav stays flat. */
.bz-nav-group { display: contents; }
.bz-nav-note, .bz-nav-phone, .bz-backbar { display: none; }

/* ---------- page head: the screen's one h1, in Rubik ---------- */
.bz-page-head { margin: var(--space-1) 0 var(--space-5); }
.bz-page-head h1 {
  font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-semibold);
  line-height: var(--leading-tight); letter-spacing: 0; color: var(--color-text);
}
@media (min-width: 900px) { .bz-page-head h1 { font-size: var(--text-2xl); } }
.bz-lede { margin-top: var(--space-2); max-width: 70ch; font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text-2); }
.bz-page-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-5); flex-wrap: wrap; }
.bz-page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- cards: a calm white plane, a hairline, no shadow ---------- */
.bz-card {
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-card);
  padding: var(--card-pad); margin-bottom: var(--space-5); min-width: 0; box-shadow: var(--shadow-card);
}
.bz-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.bz-card-head h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: var(--leading-tight); letter-spacing: 0; color: var(--color-text); }
.bz-card-head p, .bz-card-sub { margin-top: var(--space-1); font-size: var(--text-sm); line-height: var(--leading-body); color: var(--color-text-2); }
.bz-card-head > :last-child:not(:first-child) { margin-inline-start: auto; }
.bz-card > :last-child { margin-bottom: 0; }
.bz-card--danger { border-color: var(--color-danger-line); }

/* Inset grouped (Apple's settings lists): the head is a section header ABOVE the plane — semibold, muted, no
   capitals — and the rest of the card sits on the plane, drawn by ::before behind every child after the head.
   The plane's inner padding is --card-pad; rows inside are separated by hairlines. */
.bz-card--grouped {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start;
  padding: 0 var(--card-pad) var(--card-pad); background: none; border: 0; border-radius: 0; box-shadow: none;
  margin-bottom: var(--space-6);
}
/* Absolutely placed against grid line 2 (under the head) down to the card's bottom edge, full width; it takes no
   part in the auto-placement of the children. */
.bz-card--grouped::before {
  content: ""; position: absolute; z-index: -1; grid-row-start: 2; grid-row-end: auto; grid-column: auto;
  inset: calc(-1 * var(--card-pad)) 0 0 0;
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-card);
}
.bz-card--grouped:not(:has(> .bz-card-head:not([hidden])))::before { grid-row-start: 1; }
.bz-card--grouped:not(:has(> .bz-card-head:not([hidden]))) { padding-block-start: var(--card-pad); }
.bz-card--grouped > .bz-card-head {
  min-height: var(--hit-min); margin: 0 0 calc(var(--card-pad) + var(--space-2));
  padding-inline: 0;
}
.bz-card--grouped > .bz-card-head :is(h2, .bz-card-title) {
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  line-height: var(--leading-tight); color: var(--color-text-2);
}
.bz-card--grouped > .bz-card-head .bz-card-sub { font-size: var(--text-sm); }
.bz-card--grouped.bz-card--danger::before { border-color: var(--color-danger-line); }
/* Nothing under the head is shown (a folded card, a form not opened yet): the head becomes one row on the plane. */
.bz-card--grouped:has(> .bz-card-head):not(:has(> .bz-card-head ~ :not([hidden]))) {
  padding: var(--space-1) var(--card-pad); background: var(--color-surface);
  border: 1px solid var(--color-line); border-radius: var(--radius-card); margin-bottom: var(--space-3);
}
.bz-card--grouped:has(> .bz-card-head):not(:has(> .bz-card-head ~ :not([hidden])))::before { display: none; }
.bz-card--grouped:has(> .bz-card-head):not(:has(> .bz-card-head ~ :not([hidden]))) > .bz-card-head { margin: 0; }
.bz-card--grouped:has(> .bz-card-head):not(:has(> .bz-card-head ~ :not([hidden]))) > .bz-card-head :is(h2, .bz-card-title) {
  font-size: var(--text-md); color: var(--color-text);
}
.bz-card--grouped > :last-child { margin-bottom: 0; }
/* A section header above a group outside a card (a list of cards). */
.bz-group-title {
  margin: var(--space-6) 0 var(--space-2); padding-inline: var(--card-pad);
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-2);
}

/* ---------- rows (settings-style list): 52px, hairlines from the label on ---------- */
.bz-rows { list-style: none; margin: 0; padding: 0; }
.bz-row {
  display: flex; align-items: center; gap: var(--space-2) var(--space-4);
  min-height: 52px; padding: var(--space-3) 0; box-sizing: border-box;
}
.bz-row + .bz-row { border-top: 1px solid var(--color-line-soft); }
.bz-row-k { flex: 0 0 180px; font-size: var(--text-sm); color: var(--color-text-2); }
.bz-row-v { flex: 1 1 auto; min-width: 0; font-size: var(--text-md); color: var(--color-text); overflow-wrap: anywhere; }
.bz-row-end { flex: none; margin-inline-start: auto; display: flex; align-items: center; gap: var(--space-2); color: var(--color-text-2); }
/* A row that navigates: the whole row is the target, a chevron at its end (and its value before it). */
a.bz-row, button.bz-row {
  width: calc(100% + 2 * var(--card-pad)); margin-inline: calc(-1 * var(--card-pad)); padding-inline: var(--card-pad);
  border: 0; background: transparent; color: inherit; font: inherit; text-align: start;
  text-decoration: none; cursor: pointer; transition: background-color var(--motion-fast) var(--motion-ease);
}
a.bz-row:hover, button.bz-row:hover { background: var(--color-surface-2); }
a.bz-row:focus-visible, button.bz-row:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(-1 * var(--focus-width)); }
.bz-row-chev { width: 20px; height: 20px; flex: none; color: var(--color-text-2); }
[dir="rtl"] .bz-row-chev { transform: scaleX(-1); }

/* ---------- app tiles (the launcher's look): neutral, the current one marked by weight ---------- */
.bz-tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2);
}
.bz-tiles > li { display: flex; min-width: 0; }
.bz-tile {
  flex: 1; min-width: 0; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-4) var(--space-2) var(--space-3); border-radius: var(--radius-md);
  color: var(--color-text); text-decoration: none; text-align: center;
  font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.3;
  transition: background-color var(--motion-fast) var(--motion-ease);
}
.bz-tile:hover { background: var(--color-surface-2); }
.bz-tile:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.bz-tile[aria-current="page"] { background: var(--color-surface-2); font-weight: var(--weight-bold); }
.bz-tile-name {
  max-width: 100%; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ---------- big app cards (apps directory) ---------- */
.bz-appcards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--space-4);
}
.bz-appcard {
  position: relative; display: flex; align-items: flex-start; gap: var(--space-4);
  min-width: 0; padding: var(--space-5); box-sizing: border-box;
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-card);
  transition: border-color var(--motion-fast) var(--motion-ease);
}
.bz-appcard:hover { border-color: var(--color-field-line); }
.bz-appcard-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.bz-appcard-name { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: 1.3; letter-spacing: 0; color: var(--color-text); }
.bz-appcard-link { color: inherit; text-decoration: none; }
/* The whole card is the link's hit area; the name alone is its accessible name. */
.bz-appcard-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.bz-appcard-link:focus-visible { outline: none; }
.bz-appcard-link:focus-visible::after { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); border-radius: var(--radius-card); }
.bz-appcard-tag { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text); line-height: 1.4; }
.bz-appcard-desc { font-size: var(--text-sm); line-height: var(--leading-body); color: var(--color-text-2); }
.bz-appcard-meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.bz-appcard-url { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-2); unicode-bidi: isolate; }
.bz-appcard-go {
  flex: none; width: 20px; height: 20px; margin-top: var(--space-1); color: var(--color-text-2);
  transition: transform var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.bz-appcard:hover .bz-appcard-go { color: var(--color-text); transform: translateX(3px); }
[dir="rtl"] .bz-appcard-go { transform: scaleX(-1); }
[dir="rtl"] .bz-appcard:hover .bz-appcard-go { transform: scaleX(-1) translateX(3px); }
.bz-appcard > bz-app-icon { margin-top: 2px; }

/* ---------- chip / tag: a capsule ---------- */
.bz-chip {
  display: inline-flex; align-items: center; min-height: 24px; box-sizing: border-box; padding-inline: var(--space-2) var(--space-3);
  border-radius: var(--radius-capsule); background: var(--color-surface-2); border: 1px solid var(--color-line);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text); line-height: 1;
}

/* ---------- avatar (BZShell.avatar): white initials on the person's identity colour (DESIGN.md › App identity) ---------- */
.bz-avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-app-account); color: var(--color-on-strong);
  font-weight: var(--weight-bold); line-height: 1; user-select: none;
}

/* ---------- states ---------- */
.bz-empty {
  grid-column: 1 / -1; margin: 0; padding: var(--space-7) var(--space-5); text-align: center;
  border: 1px dashed var(--color-field-line); border-radius: var(--radius-card); color: var(--color-text-2); font-size: var(--text-md);
}
.bz-skel {
  display: block; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-3) 0%, var(--color-surface-2) 50%, var(--color-surface-3) 100%);
  background-size: 200% 100%; animation: bz-skel 1.4s ease-in-out infinite;
}
@keyframes bz-skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.bz-skel--icon { flex: none; width: 56px; height: 56px; border-radius: var(--radius-md); }
.bz-skel--title { width: 45%; height: 16px; margin-top: var(--space-1); }
.bz-skel--line { width: 85%; height: 12px; margin-top: var(--space-3); }
.bz-skel--line + .bz-skel--line { width: 60%; margin-top: var(--space-2); }
.bz-appcard--skel:hover { border-color: var(--color-line); }
.bz-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- footer: quiet, its links 44px targets ---------- */
.bz-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-5);
  width: 100%; max-width: var(--layout-max); margin-inline: auto; padding: var(--space-2) var(--space-5) var(--space-6); box-sizing: border-box;
  font-size: var(--text-sm); color: var(--color-text-2);
}
.bz-layout--full + .bz-foot { max-width: 1120px; }
.bz-foot nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-2); }
.bz-foot a { display: inline-flex; align-items: center; justify-content: center; min-height: var(--hit-min); min-width: var(--hit-min); padding-inline: var(--space-1); color: var(--color-text-2); text-decoration: none; }
.bz-foot a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- narrow screens: nav becomes a sticky strip of capsules ---------- */
@media (max-width: 899px) {
  .bz-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding: 0 var(--space-4) var(--space-5); }
  .bz-layout--full { padding-top: var(--space-4); }
  /* (the strip is the nav in its own place; the phone list in .bz-menu-slot is styled below) */
  .bz-layout > .bz-nav {
    position: sticky; top: calc(var(--appbar-height) - 1px); z-index: 40;
    flex-direction: row; gap: var(--space-2); max-height: none;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    margin-inline: calc(-1 * var(--space-4)); padding: var(--space-2) var(--space-4);
    background: var(--color-surface-2); border-block-end: 1px solid var(--color-line);
    scrollbar-width: none; scroll-padding-inline: var(--space-4);
  }
  .bz-layout > .bz-nav::-webkit-scrollbar { display: none; }
  .bz-layout > .bz-nav .bz-nav-item { width: auto; flex: none; padding: 0 var(--space-4); gap: var(--space-2); }
  .bz-layout > .bz-nav .bz-nav-item:not([aria-current="page"]):not([aria-current="true"]):not([aria-selected="true"]):not(.is-active) { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line); }
  /* the current pill: a light red tint with red text, never an ink fill (DESIGN.md › Selection) */
  .bz-layout > .bz-nav .bz-nav-item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"], .is-active) { background: var(--color-accent-soft); color: var(--color-accent-text); box-shadow: inset 0 0 0 1px var(--color-accent-line); }
  .bz-layout > .bz-nav .bz-nav-item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"], .is-active) > svg { color: var(--color-accent-text); }
  .bz-layout > .bz-nav .bz-nav-item > svg { width: 18px; height: 18px; }
  .bz-nav-caption { display: none; }
  .bz-layout > .bz-nav .bz-nav-count { margin-inline-start: 2px; }
  .bz-foot { padding-inline: var(--space-4); }
}
@media (max-width: 599px) {
  .bz-card, .bz-group-title { --card-pad: var(--space-4); }
  .bz-row { flex-wrap: wrap; }
  .bz-row-k { flex-basis: 100%; }
  .bz-appcard { padding: var(--space-4); gap: var(--space-3); }
  .bz-tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* ---------- phones: a list of sections, and a back bar inside one ---------- */
/* bz-phone-nav.js sets body.bz-phone-landing / .bz-phone-section below 720px.
   On the landing section the nav sits in .bz-menu-slot as inset-grouped boxes (like
   the iPhone's Settings); inside a section a sticky "‹ name" bar leads back. */
@media (max-width: 719px) {
  body.bz-phone-landing .bz-layout { padding-top: var(--space-4); }
  body.bz-phone-section .bz-nav { display: none; }
  body.bz-phone-section .bz-backbar {
    display: flex; align-items: center; position: sticky; top: calc(var(--appbar-height) - 1px); z-index: 40;
    min-height: 52px; margin: 0 calc(-1 * var(--space-4)) var(--space-2); padding: var(--space-1) var(--space-2); box-sizing: border-box;
    background: var(--color-surface-2); border-block-end: 1px solid var(--color-line);
  }
  .bz-back {
    display: inline-flex; align-items: center; gap: 2px; min-height: var(--hit-min); max-width: 100%; box-sizing: border-box;
    padding-inline: var(--space-2) var(--space-3); border-radius: var(--radius-capsule);
    color: var(--color-text); text-decoration: none; font-size: var(--text-md); font-weight: var(--weight-bold); line-height: 1.25;
  }
  .bz-back:hover, .bz-back:active { background: var(--color-surface-3); }
  .bz-back:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(-1 * var(--focus-width)); }
  .bz-back-ic { flex: none; width: 24px; height: 24px; color: var(--color-accent-text); }
  [dir="rtl"] .bz-back-ic { transform: scaleX(-1); }
  .bz-back-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.bz-phone-section .bz-main > .bz-page-head:first-of-type, body.bz-phone-section .bz-main > section > .bz-page-head:first-child { margin-top: var(--space-2); }

  .bz-menu-slot:empty { display: none; }
  .bz-menu-slot .bz-nav {
    position: static; display: flex; flex-direction: column; gap: var(--space-4);
    max-height: none; overflow: visible; margin: 0 0 var(--space-4); padding: 0;
    background: none; border: 0;
  }
  .bz-menu-slot .bz-nav-group {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-card);
  }
  /* A group with nothing to show (e.g. only the landing item) takes no room. */
  .bz-menu-slot .bz-nav-group:not(:has(> .bz-nav-item:not([hidden]):not([aria-current="page"]))) { display: none; }
  .bz-menu-slot .bz-nav-item {
    position: relative; width: 100%; min-height: 52px; padding: var(--space-2) var(--space-4); gap: var(--space-3);
    border-radius: 0; background: var(--color-surface); box-shadow: none; color: var(--color-text);
    font-size: var(--text-md); font-weight: var(--weight-medium); white-space: normal;
  }
  .bz-menu-slot .bz-nav-item[aria-current="page"], .bz-menu-slot .bz-nav-item[hidden] { display: none; }
  .bz-menu-slot .bz-nav-phone:not([hidden]) { display: flex; }
  /* Hairline between rows, from the label on (not under the icon). */
  .bz-menu-slot .bz-nav-item:not([aria-current="page"]):not([hidden]) ~ .bz-nav-item::before {
    content: ""; position: absolute; top: 0; inset-inline: calc(var(--space-4) + 32px + var(--space-3)) 0; height: 1px; background: var(--color-line-soft);
  }
  .bz-menu-slot .bz-nav-item:hover, .bz-menu-slot .bz-nav-item:active { background: var(--color-surface-2); }
  .bz-menu-slot .bz-nav-item:focus-visible { outline-offset: calc(-1 * var(--focus-width)); border-radius: 0; }
  .bz-menu-slot .bz-nav-item > svg {
    width: 32px; height: 32px; padding: var(--space-2); box-sizing: border-box; border-radius: var(--radius-sm);
    background: var(--color-surface-2); color: var(--color-text);
  }
  .bz-menu-slot .bz-nav-item > span:not(.bz-nav-count) { flex: 1 1 auto; min-width: 0; }
  .bz-menu-slot .bz-nav-text { display: flex; flex-direction: column; gap: 2px; }
  .bz-menu-slot .bz-nav-note:not([hidden]) { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.35; color: var(--color-text-2); }
  .bz-menu-slot .bz-nav-note[data-tone="warn"] { color: var(--color-warn); }
  .bz-menu-slot .bz-nav-count { margin-inline-start: 0; font-size: var(--text-sm); }
  /* "go" chevron at the end of each row */
  .bz-menu-slot .bz-nav-item::after {
    content: ""; flex: none; width: 8px; height: 8px; margin-inline: 2px var(--space-1);
    border-inline-start: 2px solid var(--color-field-line); border-bottom: 2px solid var(--color-field-line); transform: rotate(135deg);
  }
  [dir="ltr"] .bz-menu-slot .bz-nav-item::after { transform: rotate(-135deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bz-nav-item, .bz-tile, .bz-appcard, .bz-appcard-go, a.bz-row, button.bz-row { transition: none; }
  .bz-skel { animation: none; }
}

/* ============================================================
   Primitives (DESIGN.md › Components). Tokens only (tokens.css);
   RTL first (logical properties only); the same in dir="ltr".
   Every state on one page: /design/primitives.html.

     <button class="bz-btn bz-btn--primary">שמירה</button>          kinds: --primary (one per section) --secondary
                                                                     --plain (old: --quiet) --danger --danger-solid
     <a class="btn btn-primary">…</a>                                the same button under its old names (.btn,
                                                                     .btn-primary, .btn-ghost, .btn-sm, .btn-danger…)
     <button class="bz-btn bz-btn--secondary bz-btn--sm">…</button>  sizes: md (44px) and --sm (36px + a hit slop to 44)
     <button class="bz-btn …" aria-busy="true">…</button>             busy: the same width, a spinner
     <button class="bz-btn bz-btn--quiet bz-btn--icon" aria-label="…"><svg …/></button>
     <span class="bz-chip bz-chip--ok">מחובר</span>                 --ok --warn --danger --info --muted (dot + word)
     <div class="bz-tabs" role="tablist"><button class="bz-tab" role="tab" aria-selected="true">…
       <span class="bz-tab-n">3</span></button>…</div>                (or aria-current / .is-active)
     <section class="bz-card"><div class="bz-card-head">
       <div class="bz-card-heading"><h2 class="bz-card-title">…</h2><span class="bz-chip …">…</span></div>
       <div class="bz-card-actions">…</div></div>
       <div class="bz-card-body">…</div></section>
     <div class="bz-field"><label class="bz-field-label" for="x">…</label>
       <input class="bz-input" id="x" aria-describedby="x-h x-e" />
       <p class="bz-field-hint" id="x-h">…</p><p class="bz-field-error" id="x-e"></p></div>
     <div class="bz-banner bz-banner--warn"><p class="bz-banner-text">…</p><a class="bz-btn …">…</a></div>
     <div class="bz-secret">…</div>                                   built by /assets/bz-secret.js
   ============================================================ */

/* ---------- button: ONE system, a capsule (.bz-btn and the old .btn names are the same component) ----------
   The old .btn family is an alias (public pages, auth, account, admin); Pocket Calc (.hc) keeps its own dense
   .btn until its own pass. Base rules use :where() so a page's one-class tweak (e.g. .btn.header-cta) still wins. */
.bz-btn, .btn:where(:not(.hc *)) {
  --_fg: var(--color-text); --_bg: transparent; --_bd: var(--color-field-line);
  --_fg-h: var(--color-text); --_bg-h: var(--color-surface-2); --_bd-h: var(--color-text);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  box-sizing: border-box; min-height: var(--control-height); min-width: var(--control-height); margin: 0;
  padding: 0 var(--space-5); border: 1px solid var(--_bd); border-radius: var(--radius-capsule);
  background: var(--_bg); color: var(--_fg);
  font-family: var(--font-body); font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-tight);
  letter-spacing: 0; text-align: center; text-decoration: none; white-space: nowrap; vertical-align: middle;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
/* The hit area: at least 44 x 44 whatever the visual (small buttons, icon buttons). */
.bz-btn::before, .btn:where(:not(.hc *))::before {
  content: ""; position: absolute;
  inset-block: min(0px, calc((100% - var(--hit-min)) / 2)); inset-inline: min(0px, calc((100% - var(--hit-min)) / 2));
}
:is(.bz-btn, .btn:where(:not(.hc *))):hover { background: var(--_bg-h); border-color: var(--_bd-h); color: var(--_fg-h); }
:is(.bz-btn, .btn:where(:not(.hc *))):active { background: var(--color-surface-3); }
:is(.bz-btn, .btn:where(:not(.hc *))):focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
:is(.bz-btn, .btn:where(:not(.hc *))) > svg { flex: none; width: 18px; height: 18px; }
/* small: a 36px visual, the hit slop above takes it to 44 */
:is(.bz-btn--sm, .btn-sm):where(:not(.hc *)) { min-height: var(--control-height-sm); min-width: var(--control-height-sm); padding-inline: var(--space-4); font-size: var(--text-sm); gap: var(--space-1); }
:is(.bz-btn--sm, .btn-sm):where(:not(.hc *)) > svg { width: 16px; height: 16px; }
.btn-lg:where(:not(.hc *)) { padding-inline: var(--space-6); }
.bz-btn--icon { padding-inline: 0; }
/* primary: the one tinted action of a section */
.bz-btn--primary, .btn-primary:where(:not(.hc *)) {
  --_fg: var(--color-on-accent); --_bg: var(--color-accent); --_bd: var(--color-accent);
  --_fg-h: var(--color-on-accent); --_bg-h: var(--color-accent-hover); --_bd-h: var(--color-accent-hover);
}
:is(.bz-btn--primary, .btn-primary:where(:not(.hc *))):active { background: var(--color-accent-hover); color: var(--color-on-accent); }
/* secondary (the default): an outline. Old names: .btn-ghost, .btn-outline-light */
.bz-btn--secondary, :is(.btn-ghost, .btn-outline-light):where(:not(.hc *)) { --_bg: var(--color-surface); }
/* plain: text only */
.bz-btn--plain, .bz-btn--quiet, .btn-plain:where(:not(.hc *)) { --_bg: transparent; --_bd: transparent; --_bg-h: var(--color-surface-3); --_bd-h: transparent; }
/* danger: crimson outline (with an icon in the markup where it fits); a fill only inside a confirmation */
.bz-btn--danger, :is(.btn-danger, .btn-danger-ghost):where(:not(.hc *)) {
  --_fg: var(--color-danger); --_bg: var(--color-surface); --_bd: var(--color-danger);
  --_fg-h: var(--color-danger); --_bg-h: var(--color-danger-soft); --_bd-h: var(--color-danger);
}
:is(.bz-btn--danger, .btn-danger:where(:not(.hc *))):active { background: var(--color-danger-soft); }
.bz-btn--danger-solid {
  --_fg: var(--color-on-accent); --_bg: var(--color-danger); --_bd: var(--color-danger);
  --_fg-h: var(--color-on-accent); --_bg-h: var(--color-text); --_bd-h: var(--color-text);
}
.bz-btn--danger-solid:active { background: var(--color-text); color: var(--color-surface); }
:is(.bz-btn, .btn:where(:not(.hc *))):is(:disabled, [aria-disabled="true"]) {
  cursor: not-allowed; opacity: .5; background: var(--_bg); border-color: var(--_bd); color: var(--_fg);
}
/* Busy: the label stays (it keeps the width) but is not seen; a spinner in its place. */
.bz-btn[aria-busy="true"] { color: transparent; pointer-events: none; cursor: progress; opacity: 1; }
.bz-btn[aria-busy="true"] > * { visibility: hidden; }
.bz-btn[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; box-sizing: border-box;
  border: 2px solid var(--_fg); border-inline-end-color: transparent; border-radius: var(--radius-capsule);
  animation: bz-spin .7s linear infinite;
}
@keyframes bz-spin { to { transform: rotate(360deg); } }

/* ---------- status chip (the kinds; a bare .bz-chip above keeps its look) ---------- */
.bz-chip:is(.bz-chip--ok, .bz-chip--warn, .bz-chip--danger, .bz-chip--info, .bz-chip--muted) {
  gap: var(--space-1); min-height: 24px; padding-inline: var(--space-2) var(--space-3); box-sizing: border-box; flex: none;
  border: 1px solid var(--_chip-bd, var(--color-line)); border-radius: var(--radius-capsule);
  background: var(--_chip-bg, var(--color-surface-2)); color: var(--_chip-fg, var(--color-text-2));
  font-family: var(--font-body); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1;
  letter-spacing: 0; word-spacing: .12em; /* Assistant's space nearly vanishes at 12px */
  white-space: nowrap; vertical-align: middle;
}
.bz-chip:is(.bz-chip--ok, .bz-chip--warn, .bz-chip--danger, .bz-chip--info, .bz-chip--muted)::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: var(--radius-capsule); background: currentColor;
}
.bz-chip--ok { --_chip-fg: var(--color-ok); --_chip-bg: var(--color-ok-soft); --_chip-bd: var(--color-ok-line); }
.bz-chip--warn { --_chip-fg: var(--color-warn); --_chip-bg: var(--color-warn-soft); --_chip-bd: var(--color-warn-line); }
.bz-chip--danger { --_chip-fg: var(--color-danger); --_chip-bg: var(--color-danger-soft); --_chip-bd: var(--color-danger-line); }
.bz-chip--info { --_chip-fg: var(--color-info); --_chip-bg: var(--color-info-soft); --_chip-bd: var(--color-info-line); }
/* (.bz-chip--muted: the defaults, text-2 on surface-2.) */

/* ---------- segmented tabs: a capsule track, capsule items (concentric by shape); at most 5 ---------- */
.bz-tabs {
  display: inline-flex; align-items: stretch; gap: 2px; width: max-content; max-width: 100%; box-sizing: border-box;
  padding: var(--space-1); border: 0; border-radius: var(--radius-capsule); background: var(--color-surface-3);
  overflow-x: auto; scrollbar-width: none;
}
.bz-tabs::-webkit-scrollbar { display: none; }
.bz-tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); flex: none;
  box-sizing: border-box; min-height: var(--control-height-sm); margin: 0; padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-capsule); background: transparent; color: var(--color-text-2);
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-tight);
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
/* the track's padding is part of each item's target (36 + 2 x 4 = 44) */
.bz-tab::before { content: ""; position: absolute; inset-block: calc(-1 * var(--space-1)); inset-inline: 0; }
.bz-tab:hover { color: var(--color-text); }
.bz-tab:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: 1px; }
.bz-tab:is([aria-selected="true"], [aria-current="page"], [aria-current="true"], .is-active) {
  background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-raised);
}
.bz-tab-n { font-family: var(--font-mono); font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--color-text-2); }
.bz-tabs--block { display: flex; width: auto; }
.bz-tabs--block > .bz-tab { flex: 1 1 0; }

/* ---------- card parts (inside .bz-card / .bz-card-head above) ---------- */
.bz-card-heading { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); min-width: 0; }
.bz-card-head .bz-card-title, .bz-card-title {
  margin: 0; font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-medium);
  line-height: var(--leading-tight); letter-spacing: 0; color: var(--color-text);
}
.bz-card-head .bz-card-title--sm, .bz-card-title--sm { font-size: var(--text-md); }
.bz-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-inline-start: auto; }
.bz-card-body { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.bz-card-body > * { margin: 0; }

/* ---------- field: 44px, a hairline at 3:1, the focus halo ---------- */
.bz-field { display: flex; flex-direction: column; gap: var(--space-2); max-width: var(--layout-form); min-width: 0; }
.bz-field-label { font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.4; color: var(--color-text); }
.bz-input {
  box-sizing: border-box; width: 100%; min-height: var(--control-height); margin: 0; padding: 0 var(--space-3);
  border: 1px solid var(--color-field-line); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-body); font-size: var(--text-md); line-height: var(--leading-tight);
  transition: border-color var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
}
textarea.bz-input { min-height: calc(var(--control-height) * 2); padding-block: var(--space-2); line-height: var(--leading-body); resize: vertical; }
.bz-input:hover { border-color: var(--color-text-2); }
.bz-input:focus { outline: none; border-color: var(--color-accent); box-shadow: var(--focus-field); }
.bz-input[dir="ltr"] { text-align: left; }
.bz-input:disabled, .bz-input[readonly] { background: var(--color-surface-2); color: var(--color-text-2); }
.bz-input[aria-invalid="true"] { border-color: var(--color-danger); box-shadow: 0 0 0 1px var(--color-danger); }
.bz-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 1px var(--color-danger), var(--focus-field); }
.bz-input--mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.bz-field-hint { margin: 0; font-size: var(--text-sm); line-height: 1.45; color: var(--color-text-2); }
.bz-field-error { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.45; color: var(--color-danger); }
.bz-field-error::before {
  content: "!"; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 2px;
  border-radius: var(--radius-capsule); background: var(--color-danger); color: var(--color-on-accent);
  font-size: var(--text-xs); font-weight: var(--weight-bold); line-height: 1;
}
.bz-field-error:empty, .bz-field-error[hidden] { display: none; }
/* An input with a button inside its end (show / hide, copy). Give the group the input's dir. */
.bz-input-group { position: relative; display: flex; min-width: 0; }
.bz-input-group > .bz-input { flex: 1 1 auto; padding-inline-end: calc(var(--control-height) + var(--space-1)); }
.bz-input-group > .bz-input-btn {
  position: absolute; inset-block: var(--space-1); inset-inline-end: var(--space-1); min-height: 0; min-width: var(--control-height-sm);
}

/* ---------- banner: icon + one sentence + at most one action ---------- */
.bz-banner {
  --_fg: var(--color-info); --_bg: var(--color-info-soft); --_bd: var(--color-info-line); --_icon: "i";
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  box-sizing: border-box; margin: 0; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--_bd); border-radius: var(--radius-md); background: var(--_bg); color: var(--color-text);
  font-size: var(--text-md); line-height: var(--leading-body);
}
.bz-banner::before {
  content: var(--_icon); flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: var(--radius-capsule); background: var(--_fg); color: var(--color-on-accent);
  font-family: var(--font-body); font-size: var(--text-xs); font-weight: var(--weight-bold); line-height: 1;
}
.bz-banner-text { flex: 1 1 16em; min-width: 0; margin: 0; }
.bz-banner-text b, .bz-banner-text strong { font-weight: var(--weight-semibold); }
.bz-banner > .bz-btn { flex: none; margin-inline-start: auto; }
.bz-banner--ok { --_fg: var(--color-ok); --_bg: var(--color-ok-soft); --_bd: var(--color-ok-line); --_icon: "✓"; }
.bz-banner--warn { --_fg: var(--color-warn); --_bg: var(--color-warn-soft); --_bd: var(--color-warn-line); --_icon: "!"; }
.bz-banner--danger { --_fg: var(--color-danger); --_bg: var(--color-danger-soft); --_bd: var(--color-danger-line); --_icon: "!"; }
/* (.bz-banner--info: the defaults.) */

/* ---------- toast: a banner that floats (one sentence, at most one action, a close button) ---------- */
.bz-toast {
  position: fixed; z-index: 70; inset-block-end: var(--space-5); inset-inline: 0; margin-inline: auto;
  display: flex; align-items: center; gap: var(--space-2);
  width: max-content; max-width: min(560px, calc(100vw - 2 * var(--space-4))); box-sizing: border-box;
  padding: var(--space-1); padding-inline-start: var(--space-4);
  background: var(--color-text); color: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay);
  font-size: var(--text-sm); line-height: 1.45;
}

/* ---------- menu (a row's overflow actions): items concentric with the menu (12 - 4 = 8) ---------- */
.bz-menu-anchor { position: relative; display: inline-flex; }
.bz-menu {
  position: absolute; z-index: 60; inset-block-start: calc(100% + var(--space-1)); inset-inline-end: 0;
  display: flex; flex-direction: column; min-width: 160px; box-sizing: border-box; padding: var(--space-1);
  border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-overlay);
}
.bz-menu[hidden] { display: none; }
.bz-menu-item {
  display: flex; align-items: center; gap: var(--space-2); box-sizing: border-box; width: 100%;
  min-height: var(--hit-min); margin: 0; padding: 0 var(--space-3); border: 0;
  border-radius: max(calc(var(--radius-md) - var(--space-1)), var(--radius-xs));
  background: transparent; color: var(--color-text); text-align: start; white-space: nowrap; cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-md); font-weight: var(--weight-regular); line-height: var(--leading-tight);
}
.bz-menu-item:hover { background: var(--color-surface-2); }
.bz-menu-item:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(-1 * var(--focus-width)); }
.bz-menu-item--danger { color: var(--color-danger); }
.bz-menu-item--danger:hover { background: var(--color-danger-soft); }

/* ---------- saved secret row (/assets/bz-secret.js) ---------- */
/* Set: name · chip · •••• last4 · meta | החלפה · בדיקה · ⋯ (הסרה). Not set: name · chip | הוספה.
   Editing: one password field with show/hide, שמירה, ביטול. Rows in a list share hairlines. */
.bz-secret {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  box-sizing: border-box; min-height: 64px; padding-block: var(--space-3); min-width: 0;
}
.bz-secret + .bz-secret { border-top: 1px solid var(--color-line-soft); }
.bz-secret-main { flex: 1 1 14em; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bz-secret-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-2); min-width: 0; }
.bz-secret-name { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: 1.35; color: var(--color-text); overflow-wrap: anywhere; }
.bz-secret-info { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--space-3); min-width: 0; }
.bz-secret-last4 {
  font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.5; color: var(--color-text);
  direction: ltr; unicode-bidi: isolate; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.bz-secret-meta { font-size: var(--text-sm); line-height: 1.5; color: var(--color-text-2); }
.bz-secret-actions { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-inline-start: auto; }
.bz-secret [hidden] { display: none; }
.bz-secret-editor { flex: 1 1 100%; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.bz-secret-edit-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--space-2); }
.bz-secret-edit-row > .bz-input-group { flex: 1 1 18em; max-width: var(--layout-form); }
.bz-secret-edit-row > .bz-btn { flex: none; }
.bz-secret-confirm {
  flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  box-sizing: border-box; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-danger-line); border-radius: var(--radius-sm); background: var(--color-danger-soft);
}
.bz-secret-confirm-q { flex: 1 1 12em; margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-text); }
.bz-secret-status { flex: 1 1 100%; margin: 0; font-size: var(--text-sm); line-height: 1.45; color: var(--color-text-2); }
.bz-secret-status:empty { display: none; }
.bz-secret-status[data-tone="ok"] { color: var(--color-ok); }
.bz-secret-status[data-tone="danger"] { color: var(--color-danger); }
.bz-secret[data-state="editing"] .bz-secret-info { display: none; }

/* (Phones and touch need nothing extra: every control is 44px and every field 16px everywhere.) */
@media (max-width: 599px) {
  .bz-secret-actions { margin-inline-start: 0; }
  .bz-secret-edit-row > .bz-input-group { flex-basis: 100%; max-width: none; }
  .bz-secret-confirm-q { flex-basis: 100%; }
  .bz-banner > .bz-btn { margin-inline-start: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bz-btn, .btn, .bz-tab, .bz-input { transition: none; }
  .bz-btn[aria-busy="true"]::after { animation-duration: 2s; }
}
@media (forced-colors: active) {
  .bz-tab:is([aria-selected="true"], [aria-current="page"], [aria-current="true"], .is-active) { outline: 2px solid CanvasText; }
  .bz-chip:is(.bz-chip--ok, .bz-chip--warn, .bz-chip--danger, .bz-chip--info, .bz-chip--muted)::before { background: CanvasText; }
}

/* ============================================================
   More primitives (D2b): the parts the screens had each built for
   themselves. Same rules as above: tokens only, logical properties,
   RTL first. The overflow menu's behaviour: /assets/bz-ui.js.

     <input type="checkbox" role="switch" class="bz-switch" />          on/off (green + the knob's side)
     <label class="bz-check"><input type="checkbox" /><span class="bz-check-text">…</span></label>
     <div class="bz-tabs bz-seg" role="radiogroup" aria-label="…">        one of a few (radios in the tabs look)
       <label class="bz-tab"><input type="radio" name="x" value="a" /><span>…</span></label>…</div>
       (or <button class="bz-tab" role="radio" aria-checked="true"> / aria-pressed="true")
     <select class="bz-input bz-select">…</select>                      a select with a chevron
     <details class="bz-fold"><summary>…</summary><div class="bz-fold-body">…</div></details>
     <dialog class="bz-dialog"><form class="bz-dialog-body">            centred; a bottom sheet under 600px
       <h2 class="bz-dialog-title">the question</h2><p class="bz-dialog-text">…</p>
       <div class="bz-dialog-actions"><button class="bz-btn bz-btn--primary">…</button>
       <button class="bz-btn bz-btn--secondary">ביטול</button></div></form></dialog>
   ============================================================ */

/* ---------- switch (input type=checkbox role=switch) ---------- */
.bz-switch {
  -webkit-appearance: none; appearance: none; flex: none; box-sizing: border-box; margin: 0; vertical-align: middle;
  width: 40px; height: 24px; border-radius: var(--radius-capsule); cursor: pointer;
  background-color: var(--color-field-line);
  background-image: radial-gradient(circle at 12px 50%, var(--color-surface) 8px, transparent 8.6px);
  transition: background-color var(--motion-fast) var(--motion-ease);
}
.bz-switch:checked { background-color: var(--color-ok); background-image: radial-gradient(circle at calc(100% - 12px) 50%, var(--color-surface) 8px, transparent 8.6px); }
[dir="rtl"] .bz-switch { background-image: radial-gradient(circle at calc(100% - 12px) 50%, var(--color-surface) 8px, transparent 8.6px); }
[dir="rtl"] .bz-switch:checked { background-image: radial-gradient(circle at 12px 50%, var(--color-surface) 8px, transparent 8.6px); }
/* On, but something it needs is missing: amber (the reason is said next to it). */
.bz-switch--warn:checked { background-color: var(--color-warn); }
.bz-switch:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.bz-switch:disabled { cursor: default; opacity: .4; }

/* ---------- checkbox line: the whole line is the target ---------- */
.bz-check {
  display: flex; align-items: center; gap: var(--space-3); min-width: 0; min-height: var(--hit-min); box-sizing: border-box;
  font-size: var(--text-md); line-height: 1.45; color: var(--color-text); cursor: pointer;
}
.bz-check > input:not(.bz-switch) { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--color-text); cursor: pointer; }
.bz-check > input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.bz-check > input:disabled { cursor: default; }
.bz-check:has(> input:disabled) { cursor: default; color: var(--color-text-2); }
.bz-check-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* Several lines in a list: hairlines between them. */
.bz-checks { display: flex; flex-direction: column; min-width: 0; }
.bz-checks > .bz-check + .bz-check { border-top: 1px solid var(--color-line-soft); }

/* ---------- segmented choice: tabs with a selected state from aria (or a checked radio inside) ---------- */
.bz-tab:is([aria-pressed="true"], [aria-checked="true"], :has(> input:checked)) {
  background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-raised);
}
.bz-seg { margin: 0; }
.bz-seg > .bz-tab { position: relative; }
/* the radio covers its label: the label is the target, the radio keeps the keyboard and the name */
.bz-seg > .bz-tab > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.bz-seg > .bz-tab:has(> input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.bz-seg > .bz-tab:has(> input:disabled) { cursor: not-allowed; opacity: .5; background: transparent; }
.bz-seg > .bz-tab > input:disabled { cursor: not-allowed; }
/* filling the row: equal parts, and a long label wraps instead of scrolling */
.bz-seg--block, .bz-tabs.bz-seg--block { display: flex; width: auto; }
.bz-seg--block > .bz-tab { flex: 1 1 0; min-width: 0; padding-inline: var(--space-2); white-space: normal; text-align: center; }

/* ---------- select with a chevron (on a .bz-input) ---------- */
.bz-select {
  padding-inline-end: var(--space-7); cursor: pointer; -webkit-appearance: none; appearance: none;
  /* a chevron drawn from two gradients in --slate (no colour outside the tokens) */
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text-2) 50%), linear-gradient(135deg, var(--color-text-2) 50%, transparent 50%);
  background-repeat: no-repeat; background-size: 6px 6px, 6px 6px;
  background-position: right 20px center, right 14px center;
}
[dir="rtl"] .bz-select { background-position: left 14px center, left 20px center; }
.bz-select:disabled { cursor: default; }

/* ---------- disclosure (<details>): instructions, rarely used settings ---------- */
.bz-fold { border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); min-width: 0; }
.bz-fold > summary {
  display: flex; align-items: center; gap: var(--space-3); min-height: var(--hit-min); padding: var(--space-2) var(--space-3); box-sizing: border-box;
  border-radius: max(calc(var(--radius-md) - 1px), var(--radius-xs)); font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-text); cursor: pointer; list-style: none;
  transition: background-color var(--motion-fast) var(--motion-ease);
}
.bz-fold > summary::-webkit-details-marker { display: none; }
.bz-fold > summary::marker { content: ""; }
.bz-fold > summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin-inline-start: auto; margin-top: -4px;
  border-right: 2px solid var(--color-text-2); border-bottom: 2px solid var(--color-text-2); transform: rotate(45deg);
}
.bz-fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.bz-fold > summary:hover { background: var(--color-surface-2); }
.bz-fold > summary:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.bz-fold-body {
  display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-1) var(--space-3) var(--space-4);
  font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text);
}
.bz-fold-body > * { margin: 0; }

/* ---------- menu: more of it (bz-ui.js) ---------- */
.bz-menu-sep { flex: none; height: 1px; margin: var(--space-1) 0; background: var(--color-line-soft); }
a.bz-menu-item { text-decoration: none; }
/* a menu item that is a choice (role=menuitemcheckbox): a tick on the chosen one */
.bz-menu-item[aria-checked]::before { content: ""; flex: none; width: 1em; text-align: center; }
.bz-menu-item[aria-checked="true"] { font-weight: var(--weight-semibold); }
.bz-menu-item[aria-checked="true"]::before { content: "✓"; }
/* bz-ui.js: the end edge would leave the screen, so the start edge on the button instead */
.bz-menu.bz-menu--flip { inset-inline-end: auto; inset-inline-start: 0; }
/* One menu for a list that clips its rows (a table): its page places it against the viewport. */
.bz-menu.bz-menu--fixed { position: fixed; inset: auto; top: 0; left: 0; max-width: calc(100vw - var(--space-4)); }
/* the "⋯" button's dots: heavy enough to read as a control */
.bz-menu-btn > svg { stroke-width: 3; }
/* a menu's button while its menu is open */
.bz-btn--icon[aria-haspopup="menu"][aria-expanded="true"] { background: var(--color-surface-3); color: var(--color-text); }

/* ---------- saved secret row: read only (one overflow action, no editor) ---------- */
.bz-secret[data-readonly] { flex-wrap: nowrap; }
.bz-secret[data-readonly] .bz-secret-main { flex: 1 1 auto; }
.bz-secret[data-readonly] .bz-secret-actions { align-self: center; margin-inline-start: auto; }
.bz-secret[data-readonly] .bz-secret-last4 { white-space: normal; overflow-wrap: anywhere; }

/* ---------- dialog: the title is the question; a bottom sheet on phones ---------- */
.bz-dialog {
  width: min(480px, calc(100vw - 2 * var(--space-4))); max-width: none; max-height: calc(100dvh - var(--space-7)); box-sizing: border-box;
  margin: auto; padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text);
  box-shadow: var(--shadow-overlay); overflow: auto; overscroll-behavior: contain;
}
.bz-dialog--wide { width: min(640px, calc(100vw - 2 * var(--space-4))); }
.bz-dialog::backdrop { background: var(--color-scrim); }
.bz-dialog-body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
.bz-dialog-body > * { margin: 0; }
.bz-dialog-title {
  margin: 0; font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: 1.3;
  letter-spacing: 0; color: var(--color-text); overflow-wrap: anywhere;
}
.bz-dialog-text { margin: 0; font-size: var(--text-md); line-height: var(--leading-body); color: var(--color-text); overflow-wrap: anywhere; }
.bz-dialog-body > .bz-dialog-title + .bz-dialog-text { margin-top: calc(-1 * var(--space-2)); }
/* the action first, then ביטול */
.bz-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: var(--space-2); }
.bz-dialog-body > .bz-dialog-actions { margin-top: var(--space-1); }

/* An author display beats the UA's [hidden]: restate it for these parts. */
:is(.bz-check, .bz-checks, .bz-seg, .bz-fold, .bz-dialog-actions)[hidden], .bz-dialog [hidden] { display: none; }

@media (max-width: 599px) {
  .bz-dialog, .bz-dialog--wide {
    width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .bz-dialog-body {
    padding: var(--space-5) max(var(--space-4), env(safe-area-inset-right, 0px)) calc(var(--space-4) + env(safe-area-inset-bottom, 0px)) max(var(--space-4), env(safe-area-inset-left, 0px));
  }
  .bz-dialog-actions { flex-direction: column; align-items: stretch; }
  .bz-dialog-actions > :is(.bz-btn, .btn) { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .bz-switch, .bz-fold > summary { transition: none; }
}
@media (forced-colors: active) {
  .bz-tab:is([aria-pressed="true"], [aria-checked="true"], :has(> input:checked)) { outline: 2px solid CanvasText; }
  .bz-switch { forced-color-adjust: none; border: 1px solid CanvasText; }
}
