@layer reset, tokens, base, components, project;

@layer tokens {
  :root {
    color-scheme: light;
    --vb-bg: #f7f7f8;
    --vb-surface: #ffffff;
    --vb-surface-2: #f1f2f4;
    --vb-border: #e3e5e9;
    --vb-border-strong: #cdd1d7;
    --vb-text: #15171c;
    --vb-text-muted: #5b6270;
    --vb-text-faint: #8a909c;
    --vb-accent: #4f5bd5;
    --vb-accent-hover: var(--vb-accent);
    --vb-accent-soft: var(--vb-surface-2);
    --vb-accent-contrast: #ffffff;
    --vb-success: #12805c;
    --vb-success-soft: var(--vb-surface-2);
    --vb-warning: #96580a;
    --vb-warning-soft: var(--vb-surface-2);
    --vb-danger: #c0301d;
    --vb-danger-soft: var(--vb-surface-2);
    --vb-danger-contrast: #ffffff;
    --vb-info: #1d6bb0;
    --vb-info-soft: var(--vb-surface-2);
    --vb-radius-sm: 6px;
    --vb-radius: 8px;
    --vb-radius-lg: 12px;
    --vb-radius-pill: 999px;
    --vb-shadow-sm: 0 1px 2px rgb(16 18 24 / 6%);
    --vb-shadow: 0 4px 16px rgb(16 18 24 / 10%);
    --vb-focus: 0 0 0 2px var(--vb-surface), 0 0 0 4px var(--vb-accent);
    --vb-space-1: 4px;
    --vb-space-2: 8px;
    --vb-space-3: 12px;
    --vb-space-4: 16px;
    --vb-space-5: 20px;
    --vb-space-6: 24px;
    --vb-space-7: 32px;
    --vb-space-8: 48px;
    --vb-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --vb-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --vb-text-xs: 12px;
    --vb-text-sm: 13px;
    --vb-text-md: 14px;
    --vb-text-lg: 16px;
    --vb-text-xl: 20px;
    --vb-text-2xl: 24px;
    --vb-weight-medium: 550;
    --vb-weight-semibold: 600;
    --vb-weight-bold: 650;
    --vb-leading: 1.5;
    --vb-ease: cubic-bezier(.2, .6, .2, 1);
    --vb-dur: 140ms;
    --vb-control-height-sm: 30px;
    --vb-control-height: 36px;
    --vb-control-height-lg: 44px;
    --vb-container-width: 960px;
    --vb-button-radius: var(--vb-radius);
    --vb-button-weight: var(--vb-weight-medium);
    --vb-button-padding-x: var(--vb-space-4);
    --vb-input-radius: var(--vb-radius);
    --vb-input-height: var(--vb-control-height);
    --vb-input-bg: var(--vb-surface);
    --vb-input-border: var(--vb-border-strong);
    --vb-card-radius: var(--vb-radius-lg);
    --vb-card-padding: var(--vb-space-5);
    --vb-card-bg: var(--vb-surface);
    --vb-card-border: var(--vb-border);
    --vb-card-shadow: var(--vb-shadow-sm);
    --vb-badge-radius: var(--vb-radius-pill);
    --vb-badge-height: 20px;
    --vb-alert-radius: var(--vb-radius);
    --vb-table-row-hover: var(--vb-surface-2);
    --vb-empty-icon-size: 48px;
    --vb-empty-icon-radius: var(--vb-radius-lg);
    --vb-auth-width: 400px;
    --vb-auth-radius: var(--vb-radius-lg);
    --vb-auth-shadow: var(--vb-shadow);
    --vb-sidebar-width: 248px;
    --vb-sidebar-bg: var(--vb-surface);
    --vb-sidebar-border: var(--vb-border);
    --vb-topbar-height: 56px;
    --vb-sticky-top: 0px;
    --vb-brand-logo-height: 28px;
    --vb-brand-logo-width: 180px;
    --vb-brand-preview-height: 56px;
    --vb-brand-preview-bg: #ffffff;
    --vb-brand-preview-dark-bg: #14161b;
    --vb-auth-logo-height: 48px;
    --vb-sidebar-header-height: var(--vb-topbar-height);
    --vb-sidebar-footer-height: var(--vb-topbar-height);
    --vb-popmenu-width: 15rem;
    --vb-inbox-width: 22rem;
    --vb-bell-count-size: 1.125rem;
    --vb-topbar-bg: var(--vb-surface);
    --vb-nav-item-radius: var(--vb-radius);
    --vb-nav-item-active-bg: var(--vb-accent-soft);
    --vb-nav-item-active-text: var(--vb-accent);
    --vb-nav-sub-indent: 9px;
    --vb-content-padding: var(--vb-space-6);
    --vb-widget-min-width: 280px;
    --vb-tabs-indicator: 2px;
    --vb-columns-min: 20rem;
    --vb-filter-search-min: 16rem;
    --vb-filter-select-min: 10rem;
    --vb-spinner-width: 2px;
    --vb-changelog-line: 2px;
    --vb-tabs-gap: var(--vb-space-1);
    --vb-tabs-border: var(--vb-border);
    --vb-tabs-fade: 2.5rem;
    --vb-tab-color: var(--vb-text-muted);
    --vb-tab-hover-color: var(--vb-text);
    --vb-tab-active-color: var(--vb-accent);
    --vb-tab-padding-x: var(--vb-space-3);
    --vb-tab-padding-y: var(--vb-space-2);
    --vb-tab-radius: var(--vb-radius);
    --vb-tabpanel-gap: var(--vb-space-5);
    --vb-overlay: rgb(0 0 0 / 45%);
    --vb-topbar-name-width: 160px;
    --vb-toast-width: 360px;
    --vb-avatar-size: 32px;
    --vb-avatar-radius: var(--vb-radius-pill);
    --vb-avatar-size-lg: 96px;
    --vb-richtext-min-height: 160px;
    --vb-cropper-width: 320px;
    --vb-cropper-radius: var(--vb-radius);
    --vb-uploader-thumb: 48px;
    --vb-modal-width: 480px;
    --vb-modal-width-sm: 400px;
    --vb-modal-width-lg: 820px;
    --vb-modal-radius: var(--vb-radius-lg);
    --vb-modal-shadow: var(--vb-shadow);
    --vb-picker-width: 520px;
    --vb-picker-height: 80vh;
    --vb-picker-sheet-height: 75vh;
    --vb-picker-radius: var(--vb-radius-lg);
    --vb-picker-image-size: 28px;
    --vb-picker-trigger-image-size: 22px;
    --vb-drawer-height: 50vh;
    --vb-drawer-height-full: 92vh;
    --vb-drawer-radius: var(--vb-radius-lg);
    --vb-drawer-handle-color: var(--vb-border-strong);
    --vb-drawer-handle-width: 36px;
    --vb-drawer-duration: 280ms;
    --vb-drawer-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --vb-drawer-handle-height: 4px;
    --vb-safe-top: env(safe-area-inset-top, 0px);
    --vb-safe-right: env(safe-area-inset-right, 0px);
    --vb-safe-bottom: env(safe-area-inset-bottom, 0px);
    --vb-safe-left: env(safe-area-inset-left, 0px);
    --vb-app-width: 30rem;
    --vb-app-backdrop: color-mix(in srgb, var(--vb-text) 7%, var(--vb-bg));
    --vb-app-hero-bg: var(--vb-accent);
    --vb-app-hero-text: var(--vb-accent-contrast);
    --vb-app-hero-radius: 1.75rem;
    --vb-app-sheet-radius: 1.75rem;
    --vb-app-bar-bg: var(--vb-bg);
    --vb-app-tabs-height: 4rem;
    --vb-app-tabs-radius: var(--vb-radius-pill);
    --vb-app-tabs-bg: var(--vb-surface);
    --vb-app-shortcut-size: 4.25rem;
    --vb-app-avatar-size: 2.75rem;
    --vb-app-icon-size: 22px;
    --vb-app-shortcut-icon-size: 24px;
    --vb-app-done-icon-size: 28px;
    --vb-app-avatar-size-lg: 6rem;
    --vb-app-group-bg: color-mix(in srgb, var(--vb-text) 7%, var(--vb-bg));
    --vb-app-group-radius: var(--vb-radius-lg);
    --vb-app-row-height: 3.5rem;
    --vb-app-page-enter: 280ms;
    --vb-permgroup-column-min: 18rem;
    --vb-log-context-height: 20rem;
    --vb-theme-preview-width: 26rem;
    --vb-theme-swatch-width: 3.5rem;
    --vb-phone-country-width: 7rem;
    --vb-location-min: 14rem;
    --vb-focus-content-width: 960px;
    --vb-focus-header-bg: var(--vb-surface);
    --vb-toast-radius: var(--vb-radius);
    --vb-switch-width: 40px;
    --vb-switch-height: 22px;
    --vb-progress-height: 8px;
    --vb-qr-light: #ffffff;
    --vb-scan-view-bg: #000000;
    --vb-scan-frame-color: #ffffff;
    --vb-scan-frame-width: 3px;
    --vb-install-icon-size: 72px;
    --vb-install-icon-radius: 22%;
    --vb-link-color: var(--vb-accent);
    --vb-link-hover-color: var(--vb-link-color);
    --vb-link-decoration: underline;
    --vb-link-hover-decoration: underline;
    --vb-link-underline-offset: var(--vb-space-1);
  }
  @supports (color: color-mix(in oklab, red, blue)) {
    :root {
      --vb-accent-hover: color-mix(in oklab, var(--vb-accent) 88%, black);
      --vb-accent-soft: color-mix(in oklab, var(--vb-accent) 14%, var(--vb-surface));
      --vb-success-soft: color-mix(in oklab, var(--vb-success) 14%, var(--vb-surface));
      --vb-warning-soft: color-mix(in oklab, var(--vb-warning) 14%, var(--vb-surface));
      --vb-danger-soft: color-mix(in oklab, var(--vb-danger) 14%, var(--vb-surface));
      --vb-info-soft: color-mix(in oklab, var(--vb-info) 14%, var(--vb-surface));
      --vb-link-hover-color: color-mix(in oklab, var(--vb-link-color) 88%, black);
    }
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --vb-bg: #0b0c0f;
      --vb-surface: #14161b;
      --vb-surface-2: #1b1e24;
      --vb-border: #262a32;
      --vb-border-strong: #353a44;
      --vb-text: #e9ebef;
      --vb-text-muted: #9ca3af;
      --vb-text-faint: #6f7683;
      --vb-accent: #8c96ff;
      --vb-accent-contrast: #0b0c0f;
      --vb-success: #4fd1a1;
      --vb-warning: #f0b45a;
      --vb-danger: #ff8c7e;
      --vb-danger-contrast: #0b0c0f;
      --vb-info: #6cb6f2;
      --vb-shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
      --vb-shadow: 0 8px 24px rgb(0 0 0 / 50%);
      --vb-overlay: rgb(0 0 0 / 60%);
    }
    @supports (color: color-mix(in oklab, red, blue)) {
      :root:not([data-theme="light"]) {
        --vb-accent-hover: color-mix(in oklab, var(--vb-accent) 88%, black);
        --vb-accent-soft: color-mix(in oklab, var(--vb-accent) 14%, var(--vb-surface));
        --vb-success-soft: color-mix(in oklab, var(--vb-success) 14%, var(--vb-surface));
        --vb-warning-soft: color-mix(in oklab, var(--vb-warning) 14%, var(--vb-surface));
        --vb-danger-soft: color-mix(in oklab, var(--vb-danger) 14%, var(--vb-surface));
        --vb-info-soft: color-mix(in oklab, var(--vb-info) 14%, var(--vb-surface));
        --vb-link-hover-color: color-mix(in oklab, var(--vb-link-color) 88%, black);
      }
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --vb-bg: #0b0c0f;
    --vb-surface: #14161b;
    --vb-surface-2: #1b1e24;
    --vb-border: #262a32;
    --vb-border-strong: #353a44;
    --vb-text: #e9ebef;
    --vb-text-muted: #9ca3af;
    --vb-text-faint: #6f7683;
    --vb-accent: #8c96ff;
    --vb-accent-contrast: #0b0c0f;
    --vb-success: #4fd1a1;
    --vb-warning: #f0b45a;
    --vb-danger: #ff8c7e;
    --vb-danger-contrast: #0b0c0f;
    --vb-info: #6cb6f2;
    --vb-shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --vb-shadow: 0 8px 24px rgb(0 0 0 / 50%);
    --vb-overlay: rgb(0 0 0 / 60%);
  }
  @supports (color: color-mix(in oklab, red, blue)) {
    :root[data-theme="dark"] {
      --vb-accent-hover: color-mix(in oklab, var(--vb-accent) 88%, black);
      --vb-accent-soft: color-mix(in oklab, var(--vb-accent) 14%, var(--vb-surface));
      --vb-success-soft: color-mix(in oklab, var(--vb-success) 14%, var(--vb-surface));
      --vb-warning-soft: color-mix(in oklab, var(--vb-warning) 14%, var(--vb-surface));
      --vb-danger-soft: color-mix(in oklab, var(--vb-danger) 14%, var(--vb-surface));
      --vb-info-soft: color-mix(in oklab, var(--vb-info) 14%, var(--vb-surface));
      --vb-link-hover-color: color-mix(in oklab, var(--vb-link-color) 88%, black);
    }
  }
}
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
  img, svg, video { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  table { border-collapse: collapse; }
}

@layer base {
  body {
    min-height: 100vh;
    background: var(--vb-bg);
    color: var(--vb-text);
    font-family: var(--vb-font);
    font-size: var(--vb-text-md);
    line-height: var(--vb-leading);
    -webkit-font-smoothing: antialiased;
  }
  h1 { font-size: var(--vb-text-xl); line-height: 1.3; font-weight: var(--vb-weight-bold); letter-spacing: -0.01em; }
  h2 { font-size: var(--vb-text-lg); line-height: 1.35; font-weight: var(--vb-weight-semibold); }
  h3 { font-size: var(--vb-text-md); font-weight: var(--vb-weight-semibold); }
  a { color: var(--vb-link-color); text-decoration-line: var(--vb-link-decoration); text-underline-offset: var(--vb-link-underline-offset); }
  a:hover { color: var(--vb-link-hover-color); text-decoration-line: var(--vb-link-hover-decoration); }
  :focus-visible { outline: none; box-shadow: var(--vb-focus); border-radius: var(--vb-radius-sm); }
  ::selection { background: var(--vb-accent-soft); }

  .vb-visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  }
}

/* Components consume tokens ONLY (see src/Ui/Tokens.php). No raw colours, radii, sizes or fonts here:
   tests/ui_theme_test.php fails the build if a literal sneaks in. */
@layer components {
  /* ---- layout primitives ---- */
  .vb-stack { display: flex; }
  .vb-stack--column { flex-direction: column; }
  .vb-stack--row { flex-direction: row; }
  .vb-stack--wrap { flex-wrap: wrap; }
  .vb-gap-1 { gap: var(--vb-space-1); } .vb-gap-2 { gap: var(--vb-space-2); } .vb-gap-3 { gap: var(--vb-space-3); }
  .vb-gap-4 { gap: var(--vb-space-4); } .vb-gap-5 { gap: var(--vb-space-5); } .vb-gap-6 { gap: var(--vb-space-6); }
  .vb-gap-7 { gap: var(--vb-space-7); } .vb-gap-8 { gap: var(--vb-space-8); }
  .vb-stack.vb-align-start { align-items: flex-start; } .vb-stack.vb-align-center { align-items: center; }
  .vb-stack.vb-align-end { align-items: flex-end; } .vb-stack.vb-align-stretch { align-items: stretch; }
  .vb-stack.vb-align-between { justify-content: space-between; align-items: center; }
  .vb-align-text-left { text-align: left; } .vb-align-text-right { text-align: right; } .vb-align-text-center { text-align: center; }

  /* ---- icon ---- */
  .vb-icon { flex: none; }

  /* ---- button ---- */
  .vb-button {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--vb-space-2);
    height: var(--vb-control-height); padding: 0 var(--vb-button-padding-x);
    border: 1px solid transparent; border-radius: var(--vb-button-radius);
    font-size: var(--vb-text-md); font-weight: var(--vb-button-weight); line-height: 1; text-decoration: none; white-space: nowrap;
    transition: background var(--vb-dur) var(--vb-ease), border-color var(--vb-dur) var(--vb-ease), transform var(--vb-dur) var(--vb-ease);
  }
  .vb-button:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(1px); }
  .vb-button:disabled, .vb-button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
  .vb-button--sm { height: var(--vb-control-height-sm); padding: 0 var(--vb-space-3); font-size: var(--vb-text-sm); }
  .vb-button--lg { height: var(--vb-control-height-lg); padding: 0 var(--vb-space-6); font-size: var(--vb-text-lg); }
  .vb-button--block { width: 100%; }
  .vb-button--icon { width: var(--vb-control-height); padding: 0; flex: none; }
  .vb-button--icon.vb-button--sm { width: var(--vb-control-height-sm); }
  .vb-button--icon.vb-button--lg { width: var(--vb-control-height-lg); }
  /* a number on the button (what waits behind it, e.g. the trash): an icon button grows to fit it */
  .vb-button--icon.vb-button--counted { width: auto; min-width: var(--vb-control-height); padding: 0 var(--vb-space-2); gap: var(--vb-space-1); }
  .vb-button__count {
    min-width: var(--vb-space-5); padding: 0 var(--vb-space-1); border-radius: var(--vb-radius-pill); text-align: center;
    font-size: var(--vb-text-sm); font-weight: var(--vb-weight-semibold); line-height: 1.4;
    background: var(--vb-surface-2); color: var(--vb-text-muted); font-variant-numeric: tabular-nums;
  }
  /* form buttons sit at the end (right) of the form at their natural width; two sit side by side.
     On narrow screens they go full width and stack, which is easier to hit with a thumb. */
  .vb-stack--column > .vb-button { align-self: flex-start; }
  .vb-form > .vb-button, .vb-form .vb-stack--column > .vb-button { align-self: flex-end; }
  .vb-form .vb-stack--row:has(> .vb-button) { flex-wrap: wrap; justify-content: flex-end; }
  @media (max-width: 560px) {
    .vb-form > .vb-button, .vb-form .vb-stack--column > .vb-button, .vb-stack--column > .vb-button { align-self: stretch; }
    .vb-form .vb-stack--row:has(> .vb-button) { flex-direction: column; align-items: stretch; }
    .vb-form .vb-stack--row > .vb-button { width: 100%; }
  }
  /* pending submit: spinner + the button's "loading" text, disabled so it cannot be sent twice */
  .vb-spinner {
    flex: none; width: 1em; height: 1em; border-radius: var(--vb-radius-pill); box-sizing: border-box;
    border: var(--vb-spinner-width) solid currentColor; border-right-color: transparent; animation: vb-spin .7s linear infinite;
  }
  @keyframes vb-spin { to { transform: rotate(360deg); } }
  .vb-button.is-loading:disabled { opacity: .85; cursor: progress; }
  .vb-button--primary { background: var(--vb-accent); color: var(--vb-accent-contrast); }
  .vb-button--primary:hover { background: var(--vb-accent-hover); }
  .vb-button--secondary { background: var(--vb-surface); color: var(--vb-text); border-color: var(--vb-border-strong); }
  .vb-button--secondary:hover { background: var(--vb-surface-2); }
  .vb-button--ghost { background: transparent; color: var(--vb-text-muted); }
  .vb-button--ghost:hover { background: var(--vb-surface-2); color: var(--vb-text); }
  .vb-button--danger { background: var(--vb-danger); color: var(--vb-danger-contrast); }
  .vb-button--danger:hover { filter: brightness(1.08); }

  /* ---- link ---- */

  /* ---- badge ---- */
  .vb-badge {
    display: inline-flex; align-items: center; gap: var(--vb-space-1); height: var(--vb-badge-height); padding: 0 var(--vb-space-2);
    border-radius: var(--vb-badge-radius); font-size: var(--vb-text-xs); font-weight: var(--vb-weight-semibold); line-height: 1; white-space: nowrap;
    background: var(--vb-surface-2); color: var(--vb-text-muted);
  }
  .vb-badge--success { background: var(--vb-success-soft); color: var(--vb-success); }
  .vb-badge--warning { background: var(--vb-warning-soft); color: var(--vb-warning); }
  .vb-badge--danger  { background: var(--vb-danger-soft);  color: var(--vb-danger); }
  .vb-badge--info    { background: var(--vb-info-soft);    color: var(--vb-info); }

  /* ---- alert ---- */
  .vb-alert {
    display: flex; gap: var(--vb-space-3); padding: var(--vb-space-3) var(--vb-space-4);
    border-radius: var(--vb-alert-radius); border: 1px solid var(--vb-border); font-size: var(--vb-text-sm);
  }
  .vb-alert__body { display: flex; flex-direction: column; gap: calc(var(--vb-space-1) / 2); }
  .vb-alert__title { font-weight: var(--vb-weight-semibold); }
  .vb-alert--info    { background: var(--vb-info-soft);    color: var(--vb-info);    border-color: transparent; }
  .vb-alert--success { background: var(--vb-success-soft); color: var(--vb-success); border-color: transparent; }
  .vb-alert--warning { background: var(--vb-warning-soft); color: var(--vb-warning); border-color: transparent; }
  .vb-alert--danger  { background: var(--vb-danger-soft);  color: var(--vb-danger);  border-color: transparent; }
  .vb-trash-notice .vb-alert__body > span { display: flex; flex-direction: column; align-items: flex-start; gap: var(--vb-space-2); }

  /* ---- card ---- */
  .vb-card {
    background: var(--vb-card-bg); border: 1px solid var(--vb-card-border);
    border-radius: var(--vb-card-radius); box-shadow: var(--vb-card-shadow);
    /* a card's body grows to fill the card, so cards sharing a row have the same height */
    display: flex; flex-direction: column;
  }
  .vb-stack--row > .vb-card { align-self: stretch; }
  .vb-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--vb-columns-min)), 1fr)); }
  .vb-columns__cell { min-width: 0; display: flex; flex-direction: column; gap: var(--vb-space-3); }
  .vb-card__header {
    display: flex; align-items: center; justify-content: space-between; gap: var(--vb-space-3);
    padding: var(--vb-space-4) var(--vb-card-padding); border-bottom: 1px solid var(--vb-card-border);
  }
  .vb-card__title { font-size: var(--vb-text-lg); font-weight: var(--vb-weight-semibold); }
  .vb-card__actions { display: flex; gap: var(--vb-space-2); }
  .vb-card__body { padding: var(--vb-card-padding); flex: 1 1 auto; }
  .vb-card--flush .vb-card__body { padding: 0; }
  .vb-card__footer {
    padding: var(--vb-space-3) var(--vb-card-padding); border-top: 1px solid var(--vb-card-border);
    background: var(--vb-surface-2); border-radius: 0 0 var(--vb-card-radius) var(--vb-card-radius);
  }

  /* ---- forms ---- */
  .vb-form { display: flex; flex-direction: column; gap: var(--vb-space-4); }
  .vb-field { display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-field__label { font-size: var(--vb-text-sm); font-weight: var(--vb-weight-medium); }
  .vb-field__required { color: var(--vb-danger); }
  .vb-field__help { font-size: var(--vb-text-xs); color: var(--vb-text-muted); }
  .vb-field__error { font-size: var(--vb-text-xs); color: var(--vb-danger); font-weight: var(--vb-weight-medium); }
  .vb-input {
    width: 100%; height: var(--vb-input-height); padding: 0 var(--vb-space-3);
    background: var(--vb-input-bg); color: var(--vb-text);
    border: 1px solid var(--vb-input-border); border-radius: var(--vb-input-radius);
    transition: border-color var(--vb-dur) var(--vb-ease), box-shadow var(--vb-dur) var(--vb-ease);
  }
  .vb-input::placeholder { color: var(--vb-text-faint); }
  /* file inputs: the browser's grey control is replaced by a dropzone-like field with a real button (no markup change) */
  .vb-input[type="file"] {
    height: auto; padding: var(--vb-space-2); cursor: pointer; color: var(--vb-text-muted);
    border-style: dashed; background: var(--vb-surface-2);
  }
  .vb-input[type="file"]:hover { border-color: var(--vb-accent); }
  .vb-input[type="file"]::file-selector-button {
    margin-inline-end: var(--vb-space-3); padding: var(--vb-space-2) var(--vb-space-4); cursor: pointer;
    font: inherit; font-weight: var(--vb-weight-medium); color: var(--vb-accent);
    background: var(--vb-accent-soft); border: 1px solid transparent; border-radius: var(--vb-input-radius);
    transition: background var(--vb-dur) var(--vb-ease), color var(--vb-dur) var(--vb-ease);
  }
  .vb-input[type="file"]:hover::file-selector-button { background: var(--vb-accent); color: var(--vb-accent-contrast); }
  .vb-input:hover { border-color: var(--vb-text-faint); }
  .vb-input:focus { outline: none; border-color: var(--vb-accent); box-shadow: var(--vb-focus); }
  .vb-input:disabled { background: var(--vb-surface-2); cursor: not-allowed; }
  .vb-input[aria-invalid="true"] { border-color: var(--vb-danger); }
  /* password with the "show password" button inside the field (Input + vbox-password.js) */
  .vb-reveal { position: relative; display: block; }
  .vb-reveal:has(> .vb-reveal__toggle:not([hidden])) > .vb-input { padding-inline-end: var(--vb-input-height); }
  .vb-reveal__toggle {
    position: absolute; inset-block: 0; inset-inline-end: 0; width: var(--vb-input-height);
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    background: none; border: 0; border-radius: var(--vb-input-radius); color: var(--vb-text-muted); cursor: pointer;
  }
  .vb-reveal__toggle[hidden] { display: none; }
  .vb-reveal__toggle:hover { color: var(--vb-text); }
  .vb-reveal__toggle:focus-visible { outline: none; box-shadow: var(--vb-focus); }
  .vb-reveal__toggle[aria-pressed="true"] .vb-reveal__icon--show,
  .vb-reveal__toggle[aria-pressed="false"] .vb-reveal__icon--hide { display: none; }
  .vb-reveal__icon { display: inline-flex; }

  /* ---- stat ---- */
  .vb-stat { display: flex; flex-direction: column; gap: calc(var(--vb-space-1) / 2); }
  .vb-stat__label { font-size: var(--vb-text-sm); color: var(--vb-text-muted); }
  .vb-stat__value { font-size: var(--vb-text-2xl); font-weight: var(--vb-weight-bold); letter-spacing: -0.02em; line-height: 1.2; }
  .vb-stat__hint { font-size: var(--vb-text-xs); color: var(--vb-text-muted); }
  .vb-tone--success { color: var(--vb-success); } .vb-tone--danger { color: var(--vb-danger); } .vb-tone--warning { color: var(--vb-warning); }

  /* ---- table ---- */
  .vb-table-wrap { overflow-x: auto; }
  .vb-table { width: 100%; font-size: var(--vb-text-sm); }
  .vb-table__th {
    padding: var(--vb-space-2) var(--vb-space-4); font-weight: var(--vb-weight-semibold); color: var(--vb-text-muted);
    border-bottom: 1px solid var(--vb-border); white-space: nowrap;
  }
  .vb-table__td { padding: var(--vb-space-3) var(--vb-space-4); border-bottom: 1px solid var(--vb-border); vertical-align: middle; }
  .vb-table tbody tr:last-child .vb-table__td { border-bottom: 0; }
  .vb-table tbody tr:hover { background: var(--vb-table-row-hover); }

  /* ---- empty state ---- */
  .vb-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--vb-space-2); padding: var(--vb-space-8) var(--vb-space-5); }
  .vb-empty__icon {
    display: grid; place-items: center; width: var(--vb-empty-icon-size); height: var(--vb-empty-icon-size);
    border-radius: var(--vb-empty-icon-radius); background: var(--vb-surface-2); color: var(--vb-text-muted);
  }
  .vb-empty__title { font-size: var(--vb-text-lg); }
  .vb-empty__text { color: var(--vb-text-muted); max-width: 42ch; }
  .vb-empty__action { margin-top: var(--vb-space-2); }

  /* ---- auth layout ---- */
  .vb-auth { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: var(--vb-space-6); padding: var(--vb-space-4); }
  .vb-auth__brand { display: flex; justify-content: center; max-width: var(--vb-auth-width); }
  .vb-auth__card {
    width: 100%; max-width: var(--vb-auth-width); padding: var(--vb-space-7);
    background: var(--vb-card-bg); border: 1px solid var(--vb-card-border);
    border-radius: var(--vb-auth-radius); box-shadow: var(--vb-auth-shadow);
    display: flex; flex-direction: column; gap: var(--vb-space-4);
  }
  .vb-auth__links { display: flex; justify-content: space-between; gap: var(--vb-space-3); font-size: var(--vb-text-sm); }
  .vb-muted { color: var(--vb-text-muted); font-size: var(--vb-text-sm); }

  /* ---- select / textarea ---- */
  .vb-select { appearance: none; padding-right: var(--vb-space-7); cursor: pointer; }
  .vb-textarea { height: auto; min-height: calc(var(--vb-input-height) * 2); padding-top: var(--vb-space-2); padding-bottom: var(--vb-space-2); line-height: var(--vb-leading); resize: vertical; }

  /* ---- checkbox / switch ---- */
  .vb-check, .vb-switch { display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-check__label { display: inline-flex; align-items: center; gap: var(--vb-space-2); font-size: var(--vb-text-md); cursor: pointer; }
  .vb-check__input { width: var(--vb-space-4); height: var(--vb-space-4); accent-color: var(--vb-accent); }
  .vb-switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  .vb-switch__track {
    position: relative; flex: none; width: var(--vb-switch-width); height: var(--vb-switch-height);
    background: var(--vb-border-strong); border-radius: var(--vb-radius-pill);
    transition: background var(--vb-dur) var(--vb-ease);
  }
  .vb-switch__track::after {
    content: ""; position: absolute; top: var(--vb-space-1); left: var(--vb-space-1);
    width: calc(var(--vb-switch-height) - var(--vb-space-2)); height: calc(var(--vb-switch-height) - var(--vb-space-2));
    background: var(--vb-surface); border-radius: var(--vb-radius-pill);
    transition: transform var(--vb-dur) var(--vb-ease);
  }
  .vb-switch__input:checked + .vb-switch__track { background: var(--vb-accent); }
  .vb-switch__input:checked + .vb-switch__track::after { transform: translateX(calc(var(--vb-switch-width) - var(--vb-switch-height))); }
  .vb-switch__input:focus-visible + .vb-switch__track { box-shadow: var(--vb-focus); }
  .vb-switch__input:disabled + .vb-switch__track { opacity: .5; }

  /* ---- breadcrumb ---- */
  .vb-breadcrumb__list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vb-space-2); margin: 0; padding: 0; list-style: none; font-size: var(--vb-text-sm); color: var(--vb-text-muted); }
  .vb-breadcrumb__item + .vb-breadcrumb__item::before { content: "/"; margin-right: var(--vb-space-2); color: var(--vb-text-faint); }
  .vb-breadcrumb__link { color: var(--vb-text-muted); text-decoration: none; }
  .vb-breadcrumb__link:hover { color: var(--vb-text); }
  .vb-breadcrumb__item [aria-current="page"] { color: var(--vb-text); font-weight: var(--vb-weight-medium); }

  /* ---- avatar ---- */
  .vb-avatar {
    display: inline-grid; place-items: center; flex: none;
    width: var(--vb-avatar-size); height: var(--vb-avatar-size); border-radius: var(--vb-avatar-radius);
    background: var(--vb-accent-soft); color: var(--vb-accent);
    font-size: var(--vb-text-xs); font-weight: var(--vb-weight-semibold); object-fit: cover;
  }

  /* ---- tabs ---- */
  /* the rule under the strip is an inset shadow, so the active tab's indicator sits ON it without negative margins
     (which made a scroll container grow a vertical scrollbar) */
  .vb-tabs { display: flex; gap: var(--vb-tabs-gap); box-shadow: inset 0 -1px 0 var(--vb-tabs-border); overflow-x: auto; overflow-y: hidden; }
  /* a strip wider than its box (vbox-tabs.js): it scrolls without a bar and the side with more tabs fades out.
     Without the script the browser's bar stays, so the hidden tabs are still discoverable */
  :root[data-js] .vb-tabs { scrollbar-width: none; }
  :root[data-js] .vb-tabs::-webkit-scrollbar { display: none; }
  .vb-tabs[data-more-end] { mask-image: linear-gradient(to right, black calc(100% - var(--vb-tabs-fade)), transparent); }
  .vb-tabs[data-more-start] { mask-image: linear-gradient(to left, black calc(100% - var(--vb-tabs-fade)), transparent); }
  .vb-tabs[data-more-start][data-more-end] {
    mask-image: linear-gradient(to right, transparent, black var(--vb-tabs-fade), black calc(100% - var(--vb-tabs-fade)), transparent);
  }
  .vb-tabs__tab {
    display: inline-flex; align-items: center; gap: var(--vb-space-2);
    padding: var(--vb-tab-padding-y) var(--vb-tab-padding-x); color: var(--vb-tab-color); text-decoration: none; white-space: nowrap;
    border-bottom: var(--vb-tabs-indicator) solid transparent; font-weight: var(--vb-weight-medium);
    cursor: pointer;
  }
  .vb-tabs__tab:hover { color: var(--vb-tab-hover-color); }
  .vb-tabs__tab--active, .vb-tabs__tab--active:hover { color: var(--vb-tab-active-color); border-bottom-color: var(--vb-tab-active-color); }
  .vb-tabs__tab--disabled { opacity: 0.5; cursor: not-allowed; }
  .vb-tabs__badge {
    min-width: var(--vb-space-5); padding: 0 var(--vb-space-1); border-radius: var(--vb-radius-pill); text-align: center;
    font-size: var(--vb-text-sm); font-weight: var(--vb-weight-semibold); background: var(--vb-surface-2); color: var(--vb-text-muted);
  }
  .vb-tabs__badge--success { background: var(--vb-success-soft); color: var(--vb-success); }
  .vb-tabs__badge--warning { background: var(--vb-warning-soft); color: var(--vb-warning); }
  .vb-tabs__badge--danger { background: var(--vb-danger-soft); color: var(--vb-danger); }
  .vb-tabs__badge--info { background: var(--vb-info-soft); color: var(--vb-info); }
  .vb-tabset { display: flex; flex-direction: column; gap: var(--vb-tabpanel-gap); }
  .vb-tabpanel { display: flex; flex-direction: column; gap: var(--vb-space-4); min-width: 0; }
  /* client mode: the script is what hides panels, so without it every panel simply stays visible */
  :root[data-js] .vb-tabset[data-vb-tabset] > .vb-tabpanel:not(.is-active) { display: none; }
  .vb-tabset--pills > .vb-tabs { box-shadow: none; gap: var(--vb-tabs-gap); }
  .vb-tabset--pills .vb-tabs__tab { border-bottom: 0; border-radius: var(--vb-tab-radius); }
  .vb-tabset--pills .vb-tabs__tab--active, .vb-tabset--pills .vb-tabs__tab--active:hover { background: var(--vb-accent-soft); }

  /* ---- pagination ---- */
  .vb-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vb-space-1); font-size: var(--vb-text-sm); }
  .vb-pagination__item, .vb-pagination__gap {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: var(--vb-control-height-sm); height: var(--vb-control-height-sm); padding: 0 var(--vb-space-2);
    border-radius: var(--vb-button-radius); color: var(--vb-text); text-decoration: none;
  }
  .vb-pagination__item:hover { background: var(--vb-surface-2); }
  .vb-pagination__item--current { background: var(--vb-accent); color: var(--vb-accent-contrast); }
  .vb-pagination__item--current:hover { background: var(--vb-accent-hover); }
  .vb-pagination__item--disabled { color: var(--vb-text-faint); }

  /* ---- page header ---- */
  .vb-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--vb-space-4); flex-wrap: wrap; }
  .vb-page-header__desc { margin-top: var(--vb-space-1); color: var(--vb-text-muted); }
  .vb-page-header__actions { display: flex; gap: var(--vb-space-2); }

  /* ---- modal ---- */
  .vb-modal {
    width: min(var(--vb-modal-width), calc(100vw - var(--vb-space-6)));
    padding: 0; border: 1px solid var(--vb-border); border-radius: var(--vb-modal-radius);
    background: var(--vb-surface); color: var(--vb-text); box-shadow: var(--vb-modal-shadow);
  }
  .vb-modal--sm { width: min(var(--vb-modal-width-sm), calc(100vw - var(--vb-space-6))); }
  .vb-modal--lg { width: min(var(--vb-modal-width-lg), calc(100vw - var(--vb-space-6))); }
  /* a long form: the header (title + X) and the footer stay, only the body scrolls */
  .vb-modal[open] { display: flex; flex-direction: column; }
  .vb-modal::backdrop { background: var(--vb-overlay); }
  .vb-modal__header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--vb-space-3); padding: var(--vb-space-4) var(--vb-space-5); border-bottom: 1px solid var(--vb-border); }
  .vb-modal__title { font-size: var(--vb-text-lg); }
  .vb-modal__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--vb-space-5); }
  .vb-modal__footer { flex: none; display: flex; justify-content: flex-end; gap: var(--vb-space-2); padding: var(--vb-space-3) var(--vb-space-5); border-top: 1px solid var(--vb-border); background: var(--vb-surface-2); }
  /* phone: a window covers the screen like the focus screen; a confirmation (sm) stays a box */
  @media (max-width: 640px) {
    .vb-modal:not(.vb-modal--sm) {
      width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0;
    }
    /* the visible area (vbox-sheet.js): with the keyboard open the footer with the buttons stays above it */
    .vb-modal[open]:not(.vb-modal--sm) { inset: var(--vbs-vv-top, 0px) 0 auto; height: var(--vbs-vv-height, 100%); }
    .vb-modal:not(.vb-modal--sm) > .vb-modal__header,
    .vb-modal:not(.vb-modal--sm) > .vb-modal__form > .vb-modal__header { padding-top: calc(var(--vb-space-4) + var(--vb-safe-top)); }
    .vb-modal:not(.vb-modal--sm) .vb-modal__footer { padding-bottom: calc(var(--vb-space-3) + var(--vb-safe-bottom)); }
    html[data-vb-keyboard] .vb-modal .vb-modal__footer { padding-bottom: var(--vb-space-3); }
    .vb-modal:not(.vb-modal--sm) > * { padding-left: calc(var(--vb-space-5) + var(--vb-safe-left)); padding-right: calc(var(--vb-space-5) + var(--vb-safe-right)); }
  }
  /* a window whose content is a form (vbox-app.js ui.modal): the form holds the body and the footer's buttons */
  .vb-modal__form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .vb-modal > .vb-modal__form { padding: 0; }

  /* ---- drawer (vbox-app.js ui.drawer, the picker's sheet): rises from the bottom on phones, a centred panel on wide screens ---- */
  .vb-drawer {
    width: min(var(--vb-picker-width), calc(100vw - var(--vb-space-6))); max-height: var(--vb-picker-height);
    padding: 0; border: 1px solid var(--vb-border); border-radius: var(--vb-drawer-radius);
    background: var(--vb-surface); color: var(--vb-text); box-shadow: var(--vb-modal-shadow);
  }
  .vb-drawer[open] { display: flex; flex-direction: column; }
  .vb-drawer::backdrop { background: var(--vb-overlay); }
  .vb-drawer__handle { display: none; }
  .vb-drawer__header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--vb-space-3); padding: var(--vb-space-4) var(--vb-space-5); border-bottom: 1px solid var(--vb-border); }
  .vb-drawer__title { font-size: var(--vb-text-lg); }
  /* the title takes the focus when a window opens (screen readers announce it): no ring for that */
  .vb-modal__title:focus-visible, .vb-drawer__title:focus-visible { box-shadow: none; }
  .vb-drawer__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--vb-space-5); }
  .vb-drawer__footer { flex: none; display: flex; justify-content: flex-end; gap: var(--vb-space-2); padding: var(--vb-space-3) var(--vb-space-5); border-top: 1px solid var(--vb-border); background: var(--vb-surface-2); }
  .vb-drawer > .vb-modal__form { padding: 0; }
  @media (max-width: 640px) {
    .vb-drawer, .vb-picker__sheet {
      inset: auto 0 var(--vbs-keyboard, 0px); width: 100%; max-width: 100%; margin: 0;
      max-height: calc(var(--vbs-vv-height, 100vh) - var(--vb-safe-top) - var(--vb-space-4));
      border-bottom: 0; border-radius: var(--vb-drawer-radius) var(--vb-drawer-radius) 0 0;
      transform: translateY(var(--vbs-drag, 0px)); transition: transform var(--vb-drawer-duration) var(--vb-drawer-ease), height var(--vb-dur) var(--vb-ease);
    }
    /* it rises in from the bottom when it opens, and slides down before it closes (vbox-sheet.js slideOut adds
       .is-closing); the backdrop darkens and clears with it. With "less motion" on the device it just appears */
    @starting-style { .vb-drawer[open], .vb-picker__sheet[open] { transform: translateY(100%); } }
    .vb-drawer.is-closing, .vb-picker__sheet.is-closing { transform: translateY(100%); }
    .vb-drawer::backdrop, .vb-picker__sheet::backdrop { transition: background-color var(--vb-drawer-duration) var(--vb-drawer-ease); }
    @starting-style { .vb-drawer[open]::backdrop, .vb-picker__sheet[open]::backdrop { background-color: transparent; } }
    .vb-drawer.is-closing::backdrop, .vb-picker__sheet.is-closing::backdrop { background-color: transparent; }
    @media (prefers-reduced-motion: reduce) {
      .vb-drawer, .vb-picker__sheet, .vb-drawer::backdrop, .vb-picker__sheet::backdrop { transition: none; }
    }
    .vb-drawer.is-dragging, .vb-picker__sheet.is-dragging { transition: none; }
    .vb-drawer[data-stop="half"] { height: var(--vb-drawer-height); }
    .vb-drawer[data-stop="full"] { height: var(--vb-drawer-height-full); }
    .vb-drawer__handle {
      display: block; flex: none; align-self: stretch; height: var(--vb-space-5); padding: 0; border: 0; background: none; cursor: grab; touch-action: none;
    }
    .vb-drawer__handle::before {
      content: ""; display: block; width: var(--vb-drawer-handle-width); height: var(--vb-drawer-handle-height); margin: var(--vb-space-2) auto 0;
      border-radius: var(--vb-radius-pill); background: var(--vb-drawer-handle-color);
    }
    .vb-drawer__header, .vb-picker__sheet .vb-picker__head { touch-action: none; }
    .vb-drawer:has(.vb-drawer__handle) .vb-drawer__header, .vb-picker__sheet:has(.vb-drawer__handle) .vb-picker__head { padding-top: var(--vb-space-1); }
    .vb-drawer__body:last-child, .vb-drawer .vb-drawer__footer { padding-bottom: calc(var(--vb-space-3) + var(--vb-safe-bottom)); }
    html[data-vb-keyboard] .vb-drawer .vb-drawer__footer, html[data-vb-keyboard] .vb-drawer__body:last-child { padding-bottom: var(--vb-space-3); }
    .vb-drawer__footer > .vb-button { flex: 1; }
  }

  /* ---- endless list (vbox-app.js ui.infiniteList) ---- */
  .vb-infinite__list { display: flex; flex-direction: column; gap: var(--vb-space-2); margin: 0; padding: 0; list-style: none; }
  .vb-infinite__item { min-width: 0; }
  .vb-infinite__sentinel { height: 1px; }
  .vb-infinite__state { display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); padding: var(--vb-space-4) 0; color: var(--vb-text-muted); font-size: var(--vb-text-sm); text-align: center; }
  .vb-infinite__state > [hidden], .vb-infinite__empty[hidden] { display: none; }
  .vb-infinite__status:empty { display: none; }
  .vb-infinite__empty { padding: var(--vb-space-6) 0; text-align: center; }

  /* ---- the app's edges (docs/app.md §6): the margins of the notch and the gesture bar, the keyboard ---- */
  .vb-safe-top { padding-top: var(--vb-safe-top); }
  .vb-safe-bottom { padding-bottom: var(--vb-safe-bottom); }
  .vb-safe-x { padding-left: var(--vb-safe-left); padding-right: var(--vb-safe-right); }
  html[data-vb-keyboard] .vb-hide-on-keyboard { display: none; }

  /* ---- in the app a window covers the screen at any width, like a page (docs/app.md §6.1); a confirmation (sm) stays
     a box. On a wide screen its content keeps to the app's column (--vb-app-width) while the bars span the screen.
     No animation: it shows and goes at once (the dashboard's windows are unchanged) ---- */
  html[data-vb-app] .vb-modal:not(.vb-modal--sm) {
    width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--vb-bg);
  }
  html[data-vb-app] .vb-modal[open]:not(.vb-modal--sm) { inset: var(--vbs-vv-top, 0px) 0 auto; height: var(--vbs-vv-height, 100%); }
  html[data-vb-app] .vb-modal:not(.vb-modal--sm) .vb-modal__header,
  html[data-vb-app] .vb-modal:not(.vb-modal--sm) .vb-modal__body,
  html[data-vb-app] .vb-modal:not(.vb-modal--sm) .vb-modal__footer {
    padding-left: max(calc(var(--vb-space-5) + var(--vb-safe-left)), calc((100% - var(--vb-app-width)) / 2 + var(--vb-space-5)));
    padding-right: max(calc(var(--vb-space-5) + var(--vb-safe-right)), calc((100% - var(--vb-app-width)) / 2 + var(--vb-space-5)));
  }
  html[data-vb-app] .vb-modal:not(.vb-modal--sm) .vb-modal__header { padding-top: calc(var(--vb-space-4) + var(--vb-safe-top)); background: var(--vb-app-bar-bg); }
  html[data-vb-app] .vb-modal:not(.vb-modal--sm) .vb-modal__footer { padding-bottom: calc(var(--vb-space-3) + var(--vb-safe-bottom)); }
  html[data-vb-app][data-vb-keyboard] .vb-modal .vb-modal__footer { padding-bottom: var(--vb-space-3); }

  /* ---- the app's screens (vbox-app.js ui.page, ui.tabScreen, ui.welcome, ui.list…; docs/app.md §6.4). The classes
     listed there as public may be restyled by a project in @layer project; the rest is internal ---- */
  /* one column, like a phone; on a computer or a tablet, centred over the backdrop */
  .vb-app-screen {
    position: relative; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
    max-width: var(--vb-app-width); margin: 0 auto; background: var(--vb-bg); color: var(--vb-text);
  }
  @media (min-width: 40rem) {
    html[data-vb-app] body:has(.vb-app-screen) { background: var(--vb-app-backdrop); }
    .vb-app-screen { box-shadow: var(--vb-shadow); }
  }
  /* the title takes the focus when a screen opens (screen readers announce it): no ring for that */
  .vb-app-screen h1:focus { box-shadow: none; outline: none; }

  /* round icon buttons (header, page bar) */
  .vb-app-iconbutton {
    width: var(--vb-app-avatar-size); height: var(--vb-app-avatar-size); flex: none; display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border: 0; border-radius: var(--vb-radius-pill); background: transparent; color: inherit; text-decoration: none; cursor: pointer;
    transition: background var(--vb-dur) var(--vb-ease);
  }
  .vb-app-iconbutton:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
  .vb-app-iconbutton svg { width: var(--vb-app-icon-size); height: var(--vb-app-icon-size); }

  /* the avatar: the photo or the initials */
  .vb-app-avatar {
    width: var(--vb-app-avatar-size); height: var(--vb-app-avatar-size); flex: none; display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden; border-radius: var(--vb-radius-pill); background: var(--vb-accent); color: var(--vb-accent-contrast);
    font-weight: var(--vb-weight-semibold); text-decoration: none;
  }
  .vb-app-avatar--lg { width: var(--vb-app-avatar-size-lg); height: var(--vb-app-avatar-size-lg); font-size: var(--vb-text-xl); }
  .vb-app-avatar img { width: 100%; height: 100%; object-fit: cover; }

  /* a service's main screen: the header (coloured or plain), the content, the services' bar */
  .vb-app-hero {
    padding: calc(var(--vb-space-3) + var(--vb-safe-top)) calc(var(--vb-space-5) + var(--vb-safe-right)) var(--vb-space-6) calc(var(--vb-space-5) + var(--vb-safe-left));
    background: var(--vb-app-hero-bg); color: var(--vb-app-hero-text); border-radius: 0 0 var(--vb-app-hero-radius) var(--vb-app-hero-radius);
  }
  .vb-app-hero--plain { background: transparent; color: var(--vb-text); border-radius: 0; padding-bottom: var(--vb-space-2); }
  .vb-app-hero__bar { display: flex; align-items: center; gap: var(--vb-space-2); }
  .vb-app-hero__end { margin-left: auto; display: flex; gap: var(--vb-space-1); }
  .vb-app-hero .vb-app-avatar { background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; }
  .vb-app-hero__title { margin: var(--vb-space-5) 0 0; font-size: var(--vb-text-xl); font-weight: var(--vb-weight-semibold); color: inherit; }
  .vb-app-content {
    flex: 1; display: flex; flex-direction: column; gap: var(--vb-space-6);
    padding: var(--vb-space-5) calc(var(--vb-space-5) + var(--vb-safe-right)) var(--vb-space-8) calc(var(--vb-space-5) + var(--vb-safe-left));
  }
  .vb-app-tabscreen .vb-app-content { padding-bottom: calc(var(--vb-app-tabs-height) + var(--vb-space-8) + var(--vb-safe-bottom)); }
  .vb-app-bell { position: relative; }
  .vb-app-bell__count {
    position: absolute; top: calc(var(--vb-space-1) / 2); right: calc(var(--vb-space-1) / 2); min-width: var(--vb-bell-count-size); height: var(--vb-bell-count-size); padding: 0 var(--vb-space-1);
    display: inline-flex; align-items: center; justify-content: center; border-radius: var(--vb-radius-pill);
    background: var(--vb-danger); color: var(--vb-danger-contrast); font-size: var(--vb-text-xs); line-height: 1;
  }
  .vb-app-bell__count[hidden] { display: none; }

  /* the services' bar: floating (a pill) or fixed (along the bottom); hidden while the keyboard is open */
  .vb-app-tabs {
    position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: calc(var(--vb-space-4) + var(--vb-safe-bottom));
    width: max-content; max-width: calc(min(100vw, var(--vb-app-width)) - var(--vb-space-8));
  }
  .vb-app-tabs__list {
    display: flex; gap: var(--vb-space-1); margin: 0; padding: var(--vb-space-1); list-style: none;
    border-radius: var(--vb-app-tabs-radius); background: var(--vb-app-tabs-bg); border: 1px solid var(--vb-border); box-shadow: var(--vb-shadow);
  }
  .vb-app-tabs__link {
    min-width: var(--vb-app-tabs-height); height: calc(var(--vb-app-tabs-height) - var(--vb-space-2)); padding: 0 var(--vb-space-4);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--vb-space-1) / 2);
    border-radius: var(--vb-app-tabs-radius); color: var(--vb-text-muted); text-decoration: none; font-size: var(--vb-text-xs);
  }
  .vb-app-tabs__link[aria-current="page"] { background: var(--vb-accent-soft); color: var(--vb-accent); font-weight: var(--vb-weight-semibold); }
  .vb-app-tabs__icon { display: inline-flex; }
  .vb-app-tabs__label { white-space: nowrap; }
  .vb-app-tabs--icons .vb-app-tabs__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .vb-app-tabs--fixed { bottom: 0; width: min(100vw, var(--vb-app-width)); max-width: none; }
  .vb-app-tabs--fixed .vb-app-tabs__list {
    justify-content: space-around; padding: var(--vb-space-1) var(--vb-space-2) calc(var(--vb-space-1) + var(--vb-safe-bottom));
    border-width: 1px 0 0; border-radius: 0; box-shadow: none;
  }
  .vb-app-tabs--fixed .vb-app-tabs__link { flex: 1; padding: 0 var(--vb-space-2); border-radius: var(--vb-radius); }
  .vb-app-tabscreen:has(.vb-app-tabs--fixed) .vb-app-content { padding-bottom: calc(var(--vb-app-tabs-height) + var(--vb-space-5) + var(--vb-safe-bottom)); }

  /* a page over everything: Back and the title at the top (it stays), the content below; enters from the right */
  .vb-app-bar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--vb-space-2);
    padding: calc(var(--vb-space-2) + var(--vb-safe-top)) calc(var(--vb-space-3) + var(--vb-safe-right)) var(--vb-space-2) calc(var(--vb-space-3) + var(--vb-safe-left));
    background: var(--vb-app-bar-bg); color: var(--vb-text);
  }
  .vb-app-bar__title { flex: 1; min-width: 0; margin: 0; text-align: center; font-size: var(--vb-text-md); font-weight: var(--vb-weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vb-app-bar__start, .vb-app-bar__end { flex: none; display: flex; align-items: center; gap: var(--vb-space-1); min-width: var(--vb-app-avatar-size); }
  .vb-app-bar__end { justify-content: flex-end; }
  .vb-app-page__body {
    flex: 1; display: flex; flex-direction: column; gap: var(--vb-space-4);
    padding: var(--vb-space-4) calc(var(--vb-space-5) + var(--vb-safe-right)) calc(var(--vb-space-8) + var(--vb-safe-bottom)) calc(var(--vb-space-5) + var(--vb-safe-left));
  }
  .vb-app-page__footer {
    position: sticky; bottom: 0; display: flex; flex-direction: column; gap: var(--vb-space-2); background: var(--vb-bg); border-top: 1px solid var(--vb-border);
    padding: var(--vb-space-3) calc(var(--vb-space-5) + var(--vb-safe-right)) calc(var(--vb-space-3) + var(--vb-safe-bottom)) calc(var(--vb-space-5) + var(--vb-safe-left));
  }
  html[data-vb-keyboard] .vb-app-page__footer { padding-bottom: var(--vb-space-3); }
  .vb-app-page--enter { animation: vb-app-push var(--vb-app-page-enter) cubic-bezier(0.2, 0.8, 0.2, 1); }
  @keyframes vb-app-push { from { transform: translateX(32%); opacity: 0; } to { transform: none; opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .vb-app-page--enter { animation: none; } }

  /* the sign-in screen: the brand and a title on the coloured top, the content on a sheet over it, a foot */
  .vb-app-welcome__hero {
    display: flex; flex-direction: column; justify-content: flex-end; gap: var(--vb-space-2); min-height: 16rem;
    padding: calc(var(--vb-space-6) + var(--vb-safe-top)) calc(var(--vb-space-6) + var(--vb-safe-right)) calc(var(--vb-space-6) + var(--vb-app-sheet-radius)) calc(var(--vb-space-6) + var(--vb-safe-left));
    background: var(--vb-app-hero-bg); color: var(--vb-app-hero-text);
  }
  .vb-app-welcome__brand { margin-bottom: auto; font-size: var(--vb-text-lg); }
  .vb-app-welcome__title { margin: 0; font-size: calc(var(--vb-text-xl) * 1.2); font-weight: var(--vb-weight-bold); line-height: 1.15; color: inherit; }
  .vb-app-welcome__subtitle { margin: 0; opacity: 0.85; }
  .vb-app-welcome__sheet {
    flex: 1; display: flex; flex-direction: column; gap: var(--vb-space-4); margin-top: calc(-1 * var(--vb-app-sheet-radius));
    padding: var(--vb-space-6) calc(var(--vb-space-6) + var(--vb-safe-right)) calc(var(--vb-space-6) + var(--vb-safe-bottom)) calc(var(--vb-space-6) + var(--vb-safe-left));
    border-radius: var(--vb-app-sheet-radius) var(--vb-app-sheet-radius) 0 0; background: var(--vb-bg);
  }
  .vb-app-welcome--flat .vb-app-welcome__hero { padding-bottom: var(--vb-space-6); }
  .vb-app-welcome--flat .vb-app-welcome__sheet { margin-top: 0; border-radius: 0; }
  .vb-app-welcome__foot { margin-top: auto; padding-top: var(--vb-space-6); display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); text-align: center; }

  /* grouped lists: rows on one rounded surface */
  .vb-app-list { margin: 0; padding: 0; list-style: none; border-radius: var(--vb-app-group-radius); background: var(--vb-app-group-bg); overflow: hidden; }
  .vb-app-list > li + li { border-top: 1px solid var(--vb-border); }
  .vb-app-row {
    width: 100%; min-height: var(--vb-app-row-height); display: flex; align-items: center; gap: var(--vb-space-3); padding: var(--vb-space-3) var(--vb-space-4);
    border: 0; background: none; color: var(--vb-text); font: inherit; text-align: left; text-decoration: none;
  }
  a.vb-app-row, button.vb-app-row { cursor: pointer; }
  a.vb-app-row:hover, button.vb-app-row:hover { background: color-mix(in srgb, var(--vb-text) 4%, transparent); }
  .vb-app-row:focus-visible { box-shadow: inset 0 0 0 calc(var(--vb-space-1) / 2) var(--vb-accent); outline: none; }
  .vb-app-row__icon {
    width: 2.25rem; height: 2.25rem; flex: none; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--vb-radius-pill); background: var(--vb-accent-soft); color: var(--vb-accent);
  }
  .vb-app-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .vb-app-row__label { font-weight: var(--vb-weight-medium); overflow: hidden; text-overflow: ellipsis; }
  .vb-app-row__value { color: var(--vb-text-muted); font-size: var(--vb-text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vb-app-row__end { flex: none; display: inline-flex; align-items: center; color: var(--vb-text-muted); }
  .vb-app-row__chevron { flex: none; display: inline-flex; color: var(--vb-text-faint); }
  .vb-app-row__check { flex: none; display: inline-flex; color: var(--vb-accent); }
  .vb-app-row[aria-checked="false"] .vb-app-row__check { visibility: hidden; }
  .vb-app-row--danger, .vb-app-row--danger .vb-app-row__icon { color: var(--vb-danger); }
  .vb-app-row--danger .vb-app-row__icon { background: var(--vb-danger-soft); }

  /* a section: its title above a list, cards or anything */
  .vb-app-section { display: flex; flex-direction: column; gap: var(--vb-space-3); }
  .vb-app-section__title { margin: 0; font-size: var(--vb-text-lg); font-weight: var(--vb-weight-semibold); }

  /* shortcuts: circles that scroll sideways, each snapping into place */
  .vb-app-shortcuts {
    display: flex; gap: var(--vb-space-4); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    margin: 0 calc(-1 * var(--vb-space-5)); padding: var(--vb-space-1) var(--vb-space-5); scroll-padding-inline: var(--vb-space-5);
  }
  .vb-app-shortcuts::-webkit-scrollbar { display: none; }
  .vb-app-shortcuts > * { scroll-snap-align: start; }
  .vb-app-shortcut { position: relative; width: var(--vb-app-shortcut-size); display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); color: var(--vb-text); text-decoration: none; }
  .vb-app-shortcut__circle {
    width: var(--vb-app-shortcut-size); height: var(--vb-app-shortcut-size); display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--vb-radius-pill); background: var(--vb-app-group-bg); transition: background var(--vb-dur) var(--vb-ease);
  }
  .vb-app-shortcut:hover .vb-app-shortcut__circle { background: var(--vb-accent-soft); }
  .vb-app-shortcut:focus-visible { box-shadow: none; outline: none; }
  .vb-app-shortcut:focus-visible .vb-app-shortcut__circle { box-shadow: var(--vb-focus); }
  .vb-app-shortcut__circle svg { width: var(--vb-app-shortcut-icon-size); height: var(--vb-app-shortcut-icon-size); }
  .vb-app-shortcut__label { font-size: var(--vb-text-sm); font-weight: var(--vb-weight-medium); text-align: center; line-height: 1.2; }
  .vb-app-shortcut__badge {
    position: absolute; top: 0; right: calc(var(--vb-space-1) / -2); padding: 0 var(--vb-space-2); border-radius: var(--vb-radius-pill);
    background: var(--vb-accent); color: var(--vb-accent-contrast); font-size: var(--vb-text-xs); font-weight: var(--vb-weight-semibold); line-height: 1.5;
  }

  /* a card, the whole of it a link or a button */
  .vb-app-card {
    display: flex; align-items: center; gap: var(--vb-space-3); padding: var(--vb-space-4) var(--vb-space-5); border: 0;
    border-radius: var(--vb-app-group-radius); background: var(--vb-app-group-bg); color: var(--vb-text); font: inherit; text-align: left; text-decoration: none;
  }
  a.vb-app-card, button.vb-app-card { cursor: pointer; }
  .vb-app-card--accent { background: var(--vb-accent-soft); }
  .vb-app-card__icon { flex: none; display: inline-flex; color: var(--vb-accent); }
  .vb-app-card__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-app-card__title { font-weight: var(--vb-weight-semibold); }
  .vb-app-card__desc { color: var(--vb-text-muted); font-size: var(--vb-text-sm); }
  .vb-app-card__chevron { flex: none; display: inline-flex; color: var(--vb-text-faint); }

  /* the end of a step that goes on outside the app, an empty state, an expired link */
  .vb-app-done { display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); padding: var(--vb-space-6) 0; text-align: center; }
  .vb-app-done__icon {
    width: 4rem; height: 4rem; display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--vb-space-2);
    border-radius: var(--vb-radius-pill); background: var(--vb-accent-soft); color: var(--vb-accent);
  }
  .vb-app-done--success .vb-app-done__icon { background: var(--vb-success-soft); color: var(--vb-success); }
  .vb-app-done--danger .vb-app-done__icon { background: var(--vb-danger-soft); color: var(--vb-danger); }
  .vb-app-done--muted .vb-app-done__icon { background: var(--vb-app-group-bg); color: var(--vb-text-muted); }
  .vb-app-done__icon svg { width: var(--vb-app-done-icon-size); height: var(--vb-app-done-icon-size); }
  .vb-app-done__title { font-size: var(--vb-text-lg); }
  .vb-app-done__text { margin: 0; color: var(--vb-text-muted); }

  /* a text link of the app (no underline, the accent) */
  .vb-app-link { color: var(--vb-accent); font-weight: var(--vb-weight-semibold); text-decoration: none; }
  .vb-app-link:hover { text-decoration: underline; }

  /* the theme editor's preview of the app's pieces (⋯ › Tema › App): in place, never fixed to the screen */
  .vb-app-preview { overflow: hidden; border: 1px solid var(--vb-border); border-radius: var(--vb-radius-lg); background: var(--vb-bg); color: var(--vb-text); }
  .vb-app-preview .vb-app-screen { min-height: 0; box-shadow: none; }
  .vb-app-preview .vb-app-tabs { position: static; transform: none; margin: 0 auto var(--vb-space-4); }
  .vb-app-preview .vb-app-content { padding-bottom: var(--vb-space-4); }

  /* ---- filter bar (Ui::filterBar): search grows, selects and buttons keep their size, wraps on phones ---- */
  .vb-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vb-space-3); }
  .vb-filterbar > * { flex: 0 0 auto; }
  .vb-filterbar > .vb-input:not(.vb-select) { flex: 1 1 var(--vb-filter-search-min); width: auto; min-width: 0; }
  .vb-filterbar > .vb-select { width: auto; min-width: var(--vb-filter-select-min); }

  /* ---- focus screen (Ui::focus): the record takes the whole viewport, phone and desktop alike ---- */
  .vb-focus {
    position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0;
    padding: 0; border: 0; border-radius: 0; background: var(--vb-bg); color: var(--vb-text);
  }
  .vb-focus[open] { display: flex; flex-direction: column; }
  .vb-focus::backdrop { background: var(--vb-overlay); }
  html:has(.vb-focus[open]) { overflow: hidden; }
  .vb-focus__content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .vb-focus__header {
    position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: var(--vb-space-3);
    padding: var(--vb-space-3) max(var(--vb-space-4), calc((100% - var(--vb-focus-content-width)) / 2));
    background: var(--vb-focus-header-bg); border-bottom: 1px solid var(--vb-border);
  }
  .vb-focus__heading { flex: 1; min-width: 0; }
  .vb-focus__title { font-size: var(--vb-text-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
  /* the title only receives focus programmatically (screen readers start there); it is not a control: no ring */
  .vb-focus__title:focus-visible { box-shadow: none; }
  .vb-focus__subtitle { font-size: var(--vb-text-sm); color: var(--vb-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vb-focus__actions { display: flex; gap: var(--vb-space-2); }
  .vb-focus__body {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: var(--vb-space-5) max(var(--vb-space-4), calc((100% - var(--vb-focus-content-width)) / 2)) var(--vb-space-8);
  }
  .vb-focus__loading { display: flex; align-items: center; justify-content: center; gap: var(--vb-space-3); padding: var(--vb-space-8) 0; color: var(--vb-text-muted); }

  /* ---- password requirements (Ui::passwordField): icon + text, never colour alone ---- */
  .vb-pwrules { display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-pwrules__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-pwrules__item { display: flex; align-items: center; gap: var(--vb-space-2); font-size: var(--vb-text-xs); color: var(--vb-text-muted); }
  .vb-pwrules__icon { display: inline-flex; }
  .vb-pwrules__icon--on, .vb-pwrules__state--on { display: none; }
  .vb-pwrules__item.is-met { color: var(--vb-success); }
  .vb-pwrules__item.is-met .vb-pwrules__icon--on, .vb-pwrules__item.is-met .vb-pwrules__state--on { display: inline-flex; }
  .vb-pwrules__item.is-met .vb-pwrules__icon--off, .vb-pwrules__item.is-met .vb-pwrules__state--off { display: none; }
  /* without JavaScript nothing marks the list: it is plain help, so no "unmet" crosses */
  .vb-pwrules:not([data-live]) .vb-pwrules__icon--off { visibility: hidden; }
  .vb-pwrules:not([data-live]) .vb-pwrules__state--off { display: none; }

  /* ---- toast ---- */
  .vb-toast-region { position: fixed; right: calc(var(--vb-space-4) + var(--vb-safe-right)); bottom: calc(var(--vb-space-4) + var(--vb-safe-bottom) + var(--vbs-keyboard, 0px)); z-index: 50; display: flex; flex-direction: column; gap: var(--vb-space-2); max-width: min(var(--vb-toast-width), calc(100vw - var(--vb-space-6))); }
  /* shown as a manual popover (top layer, above modal dialogs): undo the UA popover box */
  .vb-toast-region[popover] { inset: auto var(--vb-space-4) var(--vb-space-4) auto; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; }
  .vb-toast-region[popover]:not(:popover-open) { display: none; }
  .vb-toast {
    display: flex; align-items: center; gap: var(--vb-space-3); padding: var(--vb-space-3) var(--vb-space-4);
    background: var(--vb-surface); color: var(--vb-text); border: 1px solid var(--vb-border); border-radius: var(--vb-toast-radius);
    box-shadow: var(--vb-shadow); font-size: var(--vb-text-sm);
  }
  .vb-toast--success svg { color: var(--vb-success); } .vb-toast--danger svg { color: var(--vb-danger); }
  .vb-toast--warning svg { color: var(--vb-warning); } .vb-toast--info svg { color: var(--vb-info); }

  /* ---- app (PWA) notice: new version, offline, how to install (vbox-pwa.js) ---- */
  .vb-pwa-bar {
    position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--vb-space-4) + var(--vb-safe-bottom) + var(--vbs-keyboard, 0px));
    display: flex; align-items: center; gap: var(--vb-space-3); width: max-content; max-width: calc(100vw - var(--vb-space-6));
    padding: var(--vb-space-2) var(--vb-space-2) var(--vb-space-2) var(--vb-space-4);
    background: var(--vb-surface); color: var(--vb-text); border: 1px solid var(--vb-border); border-radius: var(--vb-toast-radius);
    box-shadow: var(--vb-shadow); font-size: var(--vb-text-sm);
  }
  .vb-pwa-bar[hidden] { display: none; }
  /* "install the app" only where the browser can (vbox-pwa.js marks <html>) */
  html:not([data-vb-installable]) [data-vb-install] { display: none; }
  .vb-pwa-bar[data-tone="offline"] { border-color: var(--vb-warning); }
  .vb-pwa-bar__text { flex: 1 1 auto; }
  .vb-pwa-bar__close {
    flex: none; width: var(--vb-control-height-sm); height: var(--vb-control-height-sm); border: 0; border-radius: var(--vb-radius-pill);
    background: transparent; color: var(--vb-text-muted); font-size: var(--vb-text-lg); line-height: 1; cursor: pointer;
  }
  .vb-pwa-bar__close:hover { background: var(--vb-surface-2); color: var(--vb-text); }
  .vb-pwa-bar[data-tone="install"] { flex-wrap: wrap; }

  /* ---- QR code (Ui::qr): always dark on light, also in the dark theme (readers fail on inverted codes) ---- */
  .vb-qr { display: inline-flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); margin: 0; max-width: 100%; }
  .vb-qr__code { display: block; line-height: 0; padding: var(--vb-space-1); background: var(--vb-qr-light); border-radius: var(--vb-radius); }
  .vb-qr__code svg { max-width: 100%; height: auto; }
  .vb-qr__caption { font-size: var(--vb-text-sm); color: var(--vb-text-muted); text-align: center; max-width: 32ch; }
  .vb-qr__text { font-size: var(--vb-text-sm); word-break: break-all; text-align: center; }

  /* ---- camera window of vbox-qr.js ---- */
  .vb-qr-scan {
    width: min(28rem, calc(100vw - var(--vb-space-6))); padding: var(--vb-space-4); border: 1px solid var(--vb-border);
    border-radius: var(--vb-radius-lg, var(--vb-radius)); background: var(--vb-surface); color: var(--vb-text); box-shadow: var(--vb-shadow);
  }
  .vb-qr-scan::backdrop { background: var(--vb-overlay); }
  .vb-qr-scan__title { margin: 0 0 var(--vb-space-3); font-size: var(--vb-text-lg); }
  .vb-qr-scan__view { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--vb-radius); background: var(--vb-scan-view-bg); }
  .vb-qr-scan__view[hidden] { display: none; }
  .vb-qr-scan__video { width: 100%; height: 100%; object-fit: cover; }
  .vb-qr-scan__frame { position: absolute; inset: 18%; border: var(--vb-scan-frame-width) solid var(--vb-scan-frame-color); border-radius: var(--vb-radius); box-shadow: 0 0 0 100vmax var(--vb-overlay); }
  .vb-qr-scan__status { margin: var(--vb-space-3) 0; font-size: var(--vb-text-sm); color: var(--vb-text-muted); }
  .vb-qr-scan__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--vb-space-2); }
  @media (max-width: 480px) {
    .vb-qr-scan { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  }

  /* ---- install page ({scope}instalar, Vbox\App\AppInstallPage) ---- */
  .vb-install { display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); text-align: center; }
  .vb-install__icon { width: var(--vb-install-icon-size); height: var(--vb-install-icon-size); border-radius: var(--vb-install-icon-radius); }
  .vb-install__title { margin: 0; font-size: var(--vb-text-xl, 1.375rem); }
  .vb-install__lead { margin: 0; color: var(--vb-text-muted); }
  .vb-install__platforms { display: flex; flex-direction: column; gap: var(--vb-space-2); }
  .vb-install__platform { border: 1px solid var(--vb-border); border-radius: var(--vb-radius); padding: var(--vb-space-3) var(--vb-space-4); }
  .vb-install__platform > summary { cursor: pointer; font-weight: var(--vb-weight-semibold); }
  .vb-install__platform[open] > summary { margin-bottom: var(--vb-space-2); }
  .vb-install__platform .vb-qr { display: flex; margin: var(--vb-space-3) auto 0; }
  .vb-install__steps { margin: 0; padding-left: var(--vb-space-5); display: flex; flex-direction: column; gap: var(--vb-space-2); font-size: var(--vb-text-sm); }
  .vb-install__url { display: block; padding: var(--vb-space-2); border-radius: var(--vb-radius); background: var(--vb-surface-2); word-break: break-all; font-size: var(--vb-text-sm); }

  /* ---- entity admin ---- */
  .vb-row-actions { display: flex; justify-content: flex-end; gap: var(--vb-space-2); }
  .vb-row-actions .vb-form { display: inline-flex; }

  /* ---- progress / uploader ---- */
  .vb-progress { width: 100%; height: var(--vb-progress-height); border: 0; border-radius: var(--vb-radius-pill); overflow: hidden; background: var(--vb-surface-2); accent-color: var(--vb-accent); }
  .vb-progress::-webkit-progress-bar { background: var(--vb-surface-2); }
  .vb-progress::-webkit-progress-value { background: var(--vb-accent); }
  .vb-progress::-moz-progress-bar { background: var(--vb-accent); }
  /* bar of Ui::uploader: a plain track + fill, so the failed state can be shown (a native <progress> cannot) */
  .vb-meter { position: relative; width: 100%; height: var(--vb-progress-height); border-radius: var(--vb-radius-pill); overflow: hidden; background: var(--vb-surface-2); }
  .vb-meter[hidden] { display: none; }
  .vb-meter__bar { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--vb-accent); transition: width .2s ease; }
  .vb-meter--danger .vb-meter__bar { background: var(--vb-danger); }
  @media (prefers-reduced-motion: reduce) { .vb-meter__bar { transition: none; } }

  .vb-uploader { display: flex; flex-direction: column; gap: var(--vb-space-2); min-width: 0; }
  .vb-uploader__drop {
    display: flex; align-items: center; gap: var(--vb-space-3); padding: var(--vb-space-4);
    border: 1px dashed var(--vb-border); border-radius: var(--vb-radius); background: var(--vb-surface);
    transition: border-color .15s ease, background-color .15s ease;
  }
  .vb-uploader__drop--over { border-color: var(--vb-accent); background: var(--vb-accent-soft); }
  .vb-uploader__drop--compact { padding: var(--vb-space-2) var(--vb-space-3); }
  .vb-uploader__drop:focus-within { box-shadow: var(--vb-focus); }
  .vb-uploader__drop-icon { display: inline-flex; flex: none; color: var(--vb-text-muted, currentColor); }
  .vb-uploader__drop-text { min-width: 0; }
  .vb-uploader__choose { color: var(--vb-link-color, var(--vb-accent)); font-weight: var(--vb-weight-semibold); cursor: pointer; text-decoration: var(--vb-link-decoration, underline); text-underline-offset: var(--vb-link-underline-offset, .15em); }
  .vb-uploader__rules { margin: var(--vb-space-1) 0 0; font-size: var(--vb-text-sm); }
  .vb-uploader__total { display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-uploader__total[hidden], .vb-uploader__list[hidden] { display: none; }
  .vb-uploader__total-text { font-size: var(--vb-text-sm); font-weight: var(--vb-weight-semibold); }
  .vb-uploader__list { display: flex; flex-direction: column; gap: var(--vb-space-2); margin: 0; padding: 0; list-style: none; }
  .vb-uploader__icon { display: inline-flex; }
  .vb-upitem {
    display: flex; align-items: flex-start; gap: var(--vb-space-3); padding: var(--vb-space-2) var(--vb-space-3);
    border: 1px solid var(--vb-border); border-radius: var(--vb-radius); background: var(--vb-surface);
  }
  .vb-upitem[data-state="failed"], .vb-upitem[data-state="rejected"] { border-color: var(--vb-danger); }
  .vb-upitem__thumb {
    display: flex; align-items: center; justify-content: center; flex: none; width: var(--vb-uploader-thumb);
    min-height: calc(var(--vb-uploader-thumb) * .75); max-height: calc(var(--vb-uploader-thumb) * 1.33);
    overflow: hidden; border-radius: var(--vb-radius-sm); background: var(--vb-surface-2); color: var(--vb-text-muted, currentColor);
  }
  .vb-cropper--circle .vb-upitem__thumb { border-radius: var(--vb-radius-pill); }
  .vb-upitem__thumb img { width: 100%; height: 100%; object-fit: cover; }
  .vb-upitem__main { display: flex; flex-direction: column; gap: var(--vb-space-1); flex: 1; min-width: 0; }
  .vb-upitem__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vb-space-1) var(--vb-space-2); min-width: 0; }
  .vb-upitem__name { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--vb-weight-semibold); }
  .vb-upitem__size { font-size: var(--vb-text-sm); }
  .vb-upitem__title { height: var(--vb-control-height-sm); }
  .vb-upitem__title[aria-invalid="true"] { border-color: var(--vb-danger); }
  .vb-upitem__error { margin: 0; font-size: var(--vb-text-sm); color: var(--vb-danger); }
  .vb-upitem__error[hidden] { display: none; }
  .vb-upitem__actions { display: flex; flex: none; gap: var(--vb-space-1); }
  .vb-upitem__danger:hover { color: var(--vb-danger); }
  .vb-attach-cell { display: inline-flex; align-items: center; gap: var(--vb-space-2); }
  .vb-attach-cell__thumb { width: var(--vb-control-height-sm); height: var(--vb-control-height-sm); object-fit: cover; border-radius: var(--vb-radius-sm); background: var(--vb-surface-2); }
  .vb-upitem__handle { flex: none; cursor: grab; touch-action: none; color: var(--vb-text-muted); }
  .vb-upitem__handle[hidden] { display: none; }
  .vb-upitem--dragging { position: relative; z-index: 1; box-shadow: var(--vb-shadow); border-color: var(--vb-accent); }
  .vb-upitem--dragging .vb-upitem__handle { cursor: grabbing; }
  @media (max-width: 480px) {
    .vb-uploader__drop { flex-direction: column; align-items: flex-start; }
    .vb-upitem { flex-wrap: wrap; }
    .vb-upitem__main { flex-basis: calc(100% - var(--vb-uploader-thumb) - var(--vb-space-3)); }
    .vb-upitem__actions { width: 100%; justify-content: flex-end; }
  }

  /* ---- search box (search-as-you-type) ---- */
  .vb-search { position: relative; display: block; flex: 1; min-width: 0; }
  .vb-search .vb-input { width: 100%; }
  .vb-search__panel {
    position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + var(--vb-space-1));
    max-height: calc(var(--vb-control-height) * 8); overflow-y: auto;
    background: var(--vb-surface); border: 1px solid var(--vb-border); border-radius: var(--vb-radius); box-shadow: var(--vb-shadow);
  }
  .vb-search__panel[hidden] { display: none; }
  .vb-search__item { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--vb-space-1) var(--vb-space-2); padding: var(--vb-space-2) var(--vb-space-3); cursor: pointer; }
  .vb-search__item + .vb-search__item { border-top: 1px solid var(--vb-border); }
  .vb-search__item:hover, .vb-search__item[aria-selected="true"] { background: var(--vb-accent-soft); }
  .vb-search__title { font-weight: var(--vb-weight-semibold); }
  .vb-search__tag { font-size: var(--vb-text-xs, var(--vb-text-sm)); }
  .vb-search__snippet { flex-basis: 100%; font-size: var(--vb-text-sm); overflow-wrap: anywhere; }
  .vb-search__snippet mark { background: var(--vb-warning-soft); color: inherit; border-radius: var(--vb-radius-sm); padding: 0 var(--vb-space-1); }
  .vb-search__note { padding: var(--vb-space-3); font-size: var(--vb-text-sm); }

  /* ---- rich text (editor + rendered content) ---- */
  .vb-prose { line-height: var(--vb-leading, 1.6); overflow-wrap: anywhere; }
  .vb-prose > * + * { margin-top: var(--vb-space-3); }
  .vb-prose p { margin: 0; }
  .vb-prose ul, .vb-prose ol { margin: 0; padding-left: var(--vb-space-6); }
  .vb-prose ul { list-style: disc; } .vb-prose ol { list-style: decimal; }
  .vb-prose li + li { margin-top: var(--vb-space-1); }
  .vb-prose code { font-family: var(--vb-font-mono); font-size: var(--vb-text-sm); overflow-wrap: anywhere; }

  /* ---- version history (Sobre): one entry per "## X.Y.Z" of a CHANGELOG ---- */
  .vb-changelog { display: grid; gap: var(--vb-space-5); }
  .vb-changelog__title { margin: 0; font-size: var(--vb-text-lg); font-weight: var(--vb-weight-semibold); }
  .vb-changelog__entry { padding-left: var(--vb-space-4); border-left: var(--vb-changelog-line) solid var(--vb-border); }
  .vb-changelog__entry--current { border-left-color: var(--vb-accent); }
  .vb-changelog__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vb-space-2); margin: 0 0 var(--vb-space-2); }
  .vb-changelog__version { font-weight: var(--vb-weight-semibold); }
  .vb-richtext { display: flex; flex-direction: column; gap: var(--vb-space-2); }
  /* the toolbar sticks to the top while the editor is on screen (a long text keeps it reachable); it leaves with the editor */
  .vb-richtext__toolbar {
    display: flex; flex-wrap: wrap; gap: var(--vb-space-1); position: sticky; top: var(--vb-sticky-top); z-index: 5;
    padding: var(--vb-space-1) 0; background: var(--vb-surface);
  }
  .vb-modal, .vb-focus { --vb-sticky-top: 0px; }
  .vb-richtext__btn svg { display: block; }
  .vb-richtext__toolbar[hidden], .vb-richtext__link[hidden], .vb-richtext__editor[hidden], .vb-richtext__source[hidden] { display: none; }
  .vb-richtext__btn { min-width: var(--vb-control-height-sm); font-weight: var(--vb-weight-semibold, 600); }
  .vb-richtext__btn[aria-pressed="true"] { background: var(--vb-accent-soft); color: var(--vb-accent); }
  .vb-richtext__link { display: flex; align-items: center; gap: var(--vb-space-2); }
  .vb-richtext__link .vb-input { flex: 1; min-width: 0; }
  .vb-richtext__editor {
    min-height: var(--vb-richtext-min-height); padding: var(--vb-space-3); background: var(--vb-surface);
    border: 1px solid var(--vb-border); border-radius: var(--vb-input-radius);
  }
  .vb-richtext--invalid .vb-richtext__editor { border-color: var(--vb-danger); }

  /* ---- image cropper ---- */
  .vb-cropper { display: flex; flex-direction: column; gap: var(--vb-space-3); }
  .vb-cropper__row { display: flex; align-items: center; gap: var(--vb-space-4); }
  .vb-cropper__pick { display: flex; flex-direction: column; align-items: flex-start; gap: var(--vb-space-2); min-width: 0; }
  .vb-filepick { cursor: pointer; }
  .vb-filepick__input:focus-visible + .vb-filepick { box-shadow: var(--vb-focus); }
  .vb-cropper__img-current { width: var(--vb-avatar-size-lg); height: var(--vb-avatar-size-lg); flex: none; object-fit: cover; }
  .vb-cropper__stage {
    position: relative; overflow: hidden; width: 100%; max-width: var(--vb-cropper-width);
    border: 1px solid var(--vb-border); border-radius: var(--vb-cropper-radius); background: var(--vb-surface-2);
    cursor: grab; touch-action: none; user-select: none;
  }
  .vb-cropper__stage:active { cursor: grabbing; }
  .vb-cropper__dialog { width: min(calc(var(--vb-cropper-width) + var(--vb-space-6) * 2), calc(100vw - var(--vb-space-6))); }
  .vb-cropper__body { display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-4); }
  .vb-cropper__body .vb-cropper__zoom { width: 100%; max-width: var(--vb-cropper-width); }
  .vb-cropper__img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
  /* circle: the stage stays rectangular (that is what is stored); a mask shows what a round avatar will keep */
  .vb-cropper--circle .vb-cropper__stage::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: var(--vb-radius-pill);
    box-shadow: 0 0 0 100vmax var(--vb-overlay);
  }
  .vb-cropper__zoom { display: flex; align-items: center; gap: var(--vb-space-3); }
  .vb-cropper__zoom input { flex: 1; accent-color: var(--vb-accent); }
  .vb-cropper__status--error { color: var(--vb-danger); }
  /* ---- picker (Ui::picker): select for long lists; a bottom sheet on phones, a centred panel on wider screens ---- */
  .vb-picker { display: block; min-width: 0; }
  .vb-picker > select[hidden], .vb-picker__trigger[hidden], .vb-picker [hidden] { display: none; }
  .vb-picker__trigger {
    display: flex; align-items: center; gap: var(--vb-space-2); text-align: left; cursor: pointer; font: inherit;
  }
  .vb-picker__trigger:disabled { cursor: not-allowed; }
  .vb-picker__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vb-picker__text.is-placeholder { color: var(--vb-text-faint); }
  .vb-picker__chevron { color: var(--vb-text-muted); }
  .vb-picker__trigger-img { width: var(--vb-picker-trigger-image-size); height: auto; flex: none; border-radius: var(--vb-radius-sm); }
  .vb-picker__sheet {
    width: min(var(--vb-picker-width), calc(100vw - var(--vb-space-6))); height: var(--vb-picker-height); max-height: var(--vb-picker-height);
    padding: 0; border: 1px solid var(--vb-border); border-radius: var(--vb-picker-radius);
    background: var(--vb-surface); color: var(--vb-text); box-shadow: var(--vb-modal-shadow);
  }
  .vb-picker__sheet[open] { display: flex; flex-direction: column; }
  .vb-picker__sheet::backdrop { background: var(--vb-overlay); }
  .vb-picker__head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--vb-space-3);
    padding: var(--vb-space-4) var(--vb-space-5); border-bottom: 1px solid var(--vb-border);
  }
  .vb-picker__heading { display: flex; flex-direction: column; gap: var(--vb-space-1); min-width: 0; }
  .vb-picker__title { font-size: var(--vb-text-lg); }
  .vb-picker__search { padding: var(--vb-space-3) var(--vb-space-5); }
  .vb-picker__list {
    flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0 var(--vb-space-5) var(--vb-space-2); list-style: none;
    display: flex; flex-direction: column; gap: var(--vb-space-2); overscroll-behavior: contain;
  }
  .vb-picker__option {
    display: flex; align-items: flex-start; gap: var(--vb-space-3); padding: var(--vb-space-3);
    border: 1px solid var(--vb-border); border-radius: var(--vb-radius); cursor: pointer;
    transition: background var(--vb-dur) var(--vb-ease);
  }
  .vb-picker__option:hover, .vb-picker__option.is-active { background: var(--vb-surface-2); }
  .vb-picker__option.is-active { border-color: var(--vb-accent); }
  .vb-picker__option[aria-selected="true"] { background: var(--vb-accent-soft); }
  .vb-picker__image { width: var(--vb-picker-image-size); height: auto; flex: none; border-radius: var(--vb-radius-sm); }
  .vb-picker__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-picker__option-title { font-weight: var(--vb-weight-medium); overflow-wrap: anywhere; }
  .vb-picker__option-desc { color: var(--vb-text-muted); font-size: var(--vb-text-sm); overflow-wrap: anywhere; }
  .vb-picker__tags { display: flex; flex-wrap: wrap; gap: var(--vb-space-1); }
  .vb-picker__tag {
    display: inline-flex; align-items: center; padding: 0 var(--vb-space-2); border: 1px solid var(--vb-border);
    border-radius: var(--vb-radius-sm); font-size: var(--vb-text-xs); color: var(--vb-text-muted);
  }
  .vb-picker__tag:first-child { background: var(--vb-surface-2); color: var(--vb-text); border-color: transparent; }
  .vb-picker__check { color: var(--vb-accent); margin-top: var(--vb-space-1); }
  .vb-picker__state { display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); padding: 0 var(--vb-space-5); }
  .vb-picker__status { color: var(--vb-text-muted); font-size: var(--vb-text-sm); text-align: center; }
  .vb-picker__status:empty { display: none; }
  .vb-picker__state:has(.vb-picker__status:empty):not(:has(button:not([hidden]))) { display: none; }
  .vb-picker__foot {
    display: flex; justify-content: flex-end; gap: var(--vb-space-2); padding: var(--vb-space-3) var(--vb-space-5);
    border-top: 1px solid var(--vb-border); background: var(--vb-surface-2);
  }
  @media (max-width: 640px) {
    /* the drawer's rules above (position, keyboard, drag) apply to it too; the width and the border are put back here
       because the sheet's own rule (wide screens) comes after them and would win: the screen's full width, no sides */
    .vb-picker__sheet {
      width: 100%; max-width: 100%; border-width: 1px 0 0;
      height: var(--vb-picker-sheet-height); max-height: min(var(--vb-picker-sheet-height), calc(var(--vbs-vv-height, 100vh) - var(--vb-safe-top) - var(--vb-space-4)));
      border-radius: var(--vb-picker-radius) var(--vb-picker-radius) 0 0;
    }
    .vb-picker__foot { padding-bottom: calc(var(--vb-space-3) + var(--vb-safe-bottom)); }
    html[data-vb-keyboard] .vb-picker__foot { padding-bottom: var(--vb-space-3); }
    .vb-picker__foot > .vb-button { flex: 1; }
  }

  /* ---- phone (Ui::phone): country button + number, joined ---- */
  /* country › state › city (Ui::location): side by side when there is room, one per line on phones */
  .vb-location {
    display: grid; gap: var(--vb-space-4); min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--vb-location-min)), 1fr));
  }
  .vb-location > [hidden] { display: none; }
  .vb-location > .vb-field { min-width: 0; }
  /* full address (Ui::address): one column when narrow; from 36rem of ITS width (a focus screen, a card), six tracks:
     País | CEP · Estado | Cidade · Logradouro | Número · Complemento | Bairro */
  .vb-address { container-type: inline-size; min-width: 0; }
  .vb-location--address { grid-template-columns: minmax(0, 1fr); }
  @container (min-width: 36rem) {
    .vb-location--address { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .vb-location--address > [data-part="country"], .vb-location--address > [data-part="postal_code"],
    .vb-location--address > [data-part="complement"], .vb-location--address > [data-part="district"] { grid-column: span 3; }
    .vb-location--address > [data-part="state"], .vb-location--address > [data-part="number"] { grid-column: span 2; }
    .vb-location--address > [data-part="city"], .vb-location--address > [data-part="street"] { grid-column: span 4; }
    /* Brazil only (no country picker): the CEP takes the whole first line */
    .vb-location--address.vb-location--br > [data-part="postal_code"] { grid-column: span 3; }
  }
  /* number and district are required only in Brazil: abroad their star goes away (vbox-location.js drops `required`) */
  .vb-location--address:not([data-country="BR"]) > [data-required-br] .vb-field__required { display: none; }
  .vb-address__no-number { margin-top: var(--vb-space-1); }
  .vb-address__cep-help { margin: 0; }
  .vb-address__status:empty { display: none; }
  .vb-address__status { display: flex; align-items: center; gap: var(--vb-space-2); margin: 0; }
  .vb-address__status[data-state="ok"] { color: var(--vb-success); }
  .vb-address__status[data-state="warn"] { color: var(--vb-warning); }
  .vb-phone { display: flex; min-width: 0; }
  .vb-phone > .vb-picker { flex: none; width: var(--vb-phone-country-width); }
  .vb-phone .vb-picker__trigger { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-width: 0; }
  .vb-phone .vb-picker__text { color: var(--vb-text-muted); font-size: var(--vb-text-sm); }
  .vb-phone__number { flex: 1; min-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
  /* ---- permission group (roles screen): a header ("mark the group" box · "2 de 5" · arrow) over its permissions, collapsed ---- */
  .vb-permgroups__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--vb-space-1) var(--vb-space-3); }
  .vb-permgroups__tools[hidden] { display: none; }
  .vb-permgroups__filter { flex: 1 1 var(--vb-filter-search-min); width: auto; min-width: 0; }
  .vb-permgroups__spacer { flex: 1 1 0; }
  [data-vb-filter-item][hidden], [data-vb-filter-group][hidden], [data-vb-filter-empty][hidden] { display: none; }
  /* section (roles screen): the core or one module; collapsed at start, opened while a filter is on */
  .vb-permsection { margin: 0; padding: var(--vb-space-3) var(--vb-space-3) var(--vb-space-3) var(--vb-space-4); border: 1px solid var(--vb-border); border-radius: var(--vb-radius); background: var(--vb-surface); }
  .vb-permsection__head { display: flex; align-items: center; gap: var(--vb-space-3); min-height: var(--vb-control-height-sm); }
  .vb-permsection__head > .vb-check { flex: 1; min-width: 0; font-weight: var(--vb-weight-semibold); font-size: var(--vb-text-lg); }
  .vb-permsection__body { display: flex; flex-direction: column; gap: var(--vb-space-3); margin-top: var(--vb-space-3); padding-top: var(--vb-space-3); border-top: 1px solid var(--vb-border); }
  .vb-permsection__body[hidden] { display: none; }
  .vb-permgroups.is-filtering .vb-permsection__body[hidden] { display: flex; }
  .vb-permgroups.is-filtering .vb-permgroup__toggle { visibility: hidden; }
  /* the entities of a module: a row per table, a column per action; each header has its "mark all" box */
  .vb-permgrid__table th, .vb-permgrid__table td { padding: var(--vb-space-2) var(--vb-space-3); border-bottom: 1px solid var(--vb-border); text-align: center; vertical-align: middle; }
  .vb-permgrid__table thead th { font-weight: var(--vb-weight-semibold); color: var(--vb-text-muted); white-space: nowrap; }
  .vb-permgrid__table thead th .vb-check__input { display: block; margin: var(--vb-space-1) auto 0; }
  .vb-permgrid__table tbody th { text-align: left; font-weight: var(--vb-weight-medium); }
  .vb-permgrid__table th.vb-permgrid__corner { text-align: left; vertical-align: bottom; }
  .vb-permgrid__table tbody tr:hover { background: var(--vb-surface-2); }
  .vb-permgrid__action { display: block; }
  .vb-permgrid__key { display: block; padding-left: calc(var(--vb-space-4) + var(--vb-space-2)); color: var(--vb-text-muted); font-family: var(--vb-font-mono); font-size: var(--vb-text-xs); }
  .vb-permgroup { margin: 0; padding: var(--vb-space-2) var(--vb-space-3) var(--vb-space-2) var(--vb-space-4); border: 1px solid var(--vb-border); border-radius: var(--vb-radius); }
  .vb-permgroup__head { display: flex; align-items: center; gap: var(--vb-space-3); min-height: var(--vb-control-height-sm); }
  .vb-permgroup__head > .vb-check { flex: 1; min-width: 0; font-weight: var(--vb-weight-semibold); }
  .vb-permgroup__count { flex: none; font-size: var(--vb-text-sm); white-space: nowrap; }
  .vb-permgroup__toggle { flex: none; }
  .vb-permgroup__toggle[hidden] { display: none; }
  .vb-permgroup__toggle svg { transition: transform .15s ease; }
  .vb-permgroup__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  @media (prefers-reduced-motion: reduce) { .vb-permgroup__toggle svg { transition: none; } }
  .vb-permgroup__items { padding: var(--vb-space-3) 0 var(--vb-space-2) var(--vb-space-5); margin-top: var(--vb-space-2); border-top: 1px solid var(--vb-border); }
  .vb-permgroup__items[hidden] { display: none; }
  .vb-permgroup__items > .vb-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--vb-permgroup-column-min)), 1fr)); column-gap: var(--vb-space-5); row-gap: var(--vb-space-2); }
  .vb-permgroups.is-filtering .vb-permgroup__items[hidden] { display: block; }
  /* inside a section the group is a plain block; with several groups it is a line that opens (its own arrow) */
  .vb-permsection .vb-permgroup { border: 0; padding: 0; }
  .vb-permsection .vb-permgroup__items { margin-top: var(--vb-space-1); padding-top: var(--vb-space-2); }
  /* the permission code under its label, aligned with the label text (after the box) */
  .vb-permgroup .vb-check .vb-field__help { padding-left: calc(var(--vb-space-4) + var(--vb-space-2)); font-family: var(--vb-font-mono); font-size: var(--vb-text-xs); }
  /* ---- technical log entry (/admin/system, Logs): message + the context in a <details> ---- */
  .vb-logentry { display: grid; gap: var(--vb-space-1); min-width: 0; }
  .vb-logentry__msg { overflow-wrap: anywhere; }
  .vb-logentry__more > summary { cursor: pointer; color: var(--vb-text-muted); font-size: var(--vb-text-sm); }
  .vb-logentry__more[open] > summary { margin-bottom: var(--vb-space-2); }
  .vb-logentry__ctx { margin: 0 0 var(--vb-space-2); padding: var(--vb-space-2) var(--vb-space-3); max-height: var(--vb-log-context-height); overflow: auto;
    background: var(--vb-surface-2); border-radius: var(--vb-radius); font-family: var(--vb-font-mono); font-size: var(--vb-text-xs);
    white-space: pre-wrap; overflow-wrap: anywhere; }

  /* ---- theme editor (/admin/theme): controls | preview; the preview stays in view while the controls scroll ---- */
  .vb-theme-editor { display: grid; gap: var(--vb-space-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
  .vb-theme-group[hidden] { display: none; }
  .vb-input[type="color"] { width: var(--vb-theme-swatch-width); padding: var(--vb-space-1); cursor: pointer; }
  .vb-theme-font-status { display: flex; align-items: center; gap: var(--vb-space-2); color: var(--vb-text-muted); font-size: var(--vb-text-sm); }
  @media (min-width: 1100px) {
    .vb-theme-editor { grid-template-columns: minmax(0, 1fr) minmax(0, var(--vb-theme-preview-width)); }
    .vb-theme-preview { position: sticky; top: calc(var(--vb-topbar-height) + var(--vb-space-4)); }
  }

}

/* Application frame (sidebar, topbar, content, widget grid). Tokens only. */
@layer components {
  .vb-container { max-width: var(--vb-container-width); margin: 0 auto; padding: var(--vb-space-7) var(--vb-space-4); display: flex; flex-direction: column; gap: var(--vb-space-5); }

  /* ---- skip link ---- */
  .vb-skip { position: absolute; left: var(--vb-space-2); top: -100%; z-index: 100; padding: var(--vb-space-2) var(--vb-space-3); background: var(--vb-surface); border-radius: var(--vb-radius); box-shadow: var(--vb-shadow); }
  .vb-skip:focus { top: var(--vb-space-2); }

  /* ---- frame ---- */
  .vb-shell { display: grid; grid-template-columns: var(--vb-sidebar-width) minmax(0, 1fr); min-height: 100vh; }
  .vb-shell__main { display: flex; flex-direction: column; min-width: 0; }

  /* three areas: header (brand + "⋯", same height as the topbar), content (the groups; scrolls), footer (account) */
  .vb-sidebar {
    position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; overflow: hidden;
    display: grid; grid-template-rows: var(--vb-sidebar-header-height) minmax(0, 1fr) auto;
    background: var(--vb-sidebar-bg); border-right: 1px solid var(--vb-sidebar-border);
  }
  .vb-sidebar__header {
    display: flex; align-items: center; gap: var(--vb-space-2); min-width: 0; padding: 0 var(--vb-space-3) 0 var(--vb-space-4);
    border-bottom: 1px solid var(--vb-border);
  }
  .vb-sidebar__brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--vb-space-2); padding: 0 var(--vb-space-2); font-weight: var(--vb-weight-bold); font-size: var(--vb-text-lg); }
  a.vb-sidebar__brand { color: inherit; text-decoration: none; }
  .vb-sidebar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vb-sidebar__brand svg { flex: none; color: var(--vb-accent); }
  .vb-sidebar__more { flex: none; }

  /* project logo (config/brand.php): one <img> per mode; the dark one shows when the page is dark (OS or theme toggle) */
  .vb-brand { display: inline-flex; align-items: center; min-width: 0; }
  .vb-brand__logo { display: block; width: auto; max-width: 100%; object-fit: contain; }
  .vb-brand--sidebar .vb-brand__logo { height: var(--vb-brand-logo-height); max-width: var(--vb-brand-logo-width); }
  .vb-brand--auth .vb-brand__logo { height: var(--vb-auth-logo-height); }
  /* /admin/brand: the current file on the background it will sit on (the dark logo on a dark surface in any mode) */
  .vb-brand-preview { display: inline-flex; align-items: center; justify-content: center; min-width: 4rem; height: var(--vb-brand-preview-height);
    padding: var(--vb-space-2) var(--vb-space-3); border: 1px solid var(--vb-border); border-radius: var(--vb-radius); background: var(--vb-brand-preview-bg); }
  .vb-brand-preview--dark { background: var(--vb-brand-preview-dark-bg); }
  .vb-brand-preview img { display: block; max-height: 100%; max-width: var(--vb-brand-logo-width); width: auto; }
  /* ⋯ › App: the icons made from one image, each in the shape a system cuts it into, and the screenshots */
  .vb-app-icons { display: flex; flex-wrap: wrap; gap: var(--vb-space-4); align-items: flex-end; }
  .vb-app-icon { display: flex; flex-direction: column; align-items: center; gap: var(--vb-space-2); font-size: var(--vb-text-xs); color: var(--vb-text-muted); }
  .vb-app-icon img { display: block; width: 4.5rem; height: 4.5rem; border: 1px solid var(--vb-border); }
  /* the shapes the systems cut (not the theme radius): clip-path, so the border goes with the cut */
  .vb-app-icon--circle img { clip-path: circle(50%); }
  .vb-app-icon--squircle img { clip-path: inset(0 round 30%); }
  .vb-app-icon--rounded img { clip-path: inset(0 round 18%); }
  .vb-app-icon--mono img { padding: var(--vb-space-2); clip-path: circle(50%); background: var(--vb-brand-preview-dark-bg); }
  .vb-app-shot img { display: block; max-height: 11rem; max-width: 100%; border: 1px solid var(--vb-border); border-radius: var(--vb-radius); }
  .vb-brand--duo .vb-brand__logo--dark { display: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .vb-brand--duo .vb-brand__logo--light { display: none; }
    :root:not([data-theme="light"]) .vb-brand--duo .vb-brand__logo--dark { display: block; }
  }
  :root[data-theme="dark"] .vb-brand--duo .vb-brand__logo--light { display: none; }
  :root[data-theme="dark"] .vb-brand--duo .vb-brand__logo--dark { display: block; }
  .vb-sidebar__more--active { color: var(--vb-nav-item-active-text); background: var(--vb-nav-item-active-bg); }
  .vb-sidebar__content { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: var(--vb-space-4); }
  .vb-sidebar__footer {
    display: flex; flex-direction: column; justify-content: center; min-height: var(--vb-sidebar-footer-height); padding: 0 var(--vb-space-4);
    border-top: 1px solid var(--vb-border);
  }
  .vb-nav { display: flex; flex-direction: column; gap: var(--vb-space-4); }
  .vb-nav__item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vb-nav__item svg { flex: none; }

  /* submenu: <details>, opens without JS; open by the server when the current page is inside it */
  .vb-nav__folder > summary { list-style: none; cursor: pointer; }
  .vb-nav__folder > summary::-webkit-details-marker { display: none; }
  .vb-nav__folder > summary > span { flex: 1; }
  .vb-nav__folder > summary > svg:last-child { color: var(--vb-text-faint); transition: transform var(--vb-dur) var(--vb-ease); }
  .vb-nav__folder[open] > summary > svg:last-child { transform: rotate(180deg); }
  .vb-nav__item--current { color: var(--vb-text); }
  .vb-nav__sub { display: flex; flex-direction: column; gap: var(--vb-space-1); margin: var(--vb-space-1) 0 0 calc(var(--vb-space-2) + var(--vb-nav-sub-indent)); padding-left: var(--vb-space-2); border-left: 1px solid var(--vb-border); }
  .vb-nav__item--sub { height: var(--vb-control-height-sm); }

  /* the "⋯" menu: a native popover, placed under the sidebar header (no JS needed to open or place it) */
  .vb-popmenu {
    position: fixed; inset: auto; top: calc(var(--vb-sidebar-header-height) - var(--vb-space-1)); left: var(--vb-space-3); margin: 0;
    width: min(var(--vb-popmenu-width), calc(100vw - 2 * var(--vb-space-3))); max-height: calc(100dvh - var(--vb-sidebar-header-height) - var(--vb-space-4)); overflow-y: auto;
    display: flex; flex-direction: column; gap: var(--vb-space-2); padding: var(--vb-space-2);
    background: var(--vb-surface); color: var(--vb-text); border: 1px solid var(--vb-border); border-radius: var(--vb-radius-lg); box-shadow: var(--vb-shadow);
  }
  .vb-popmenu:not(:popover-open) { display: none; }
  .vb-popmenu .vb-nav__group { padding-top: var(--vb-space-1); }
  /* the sections of the "⋯" menu (Menu::SECTIONS): a thin line between one and the next */
  .vb-popmenu .vb-nav__section + .vb-nav__group { padding-top: var(--vb-space-2); border-top: 1px solid var(--vb-border); }
  .vb-nav__section { display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-nav__group { padding: 0 var(--vb-space-2); font-size: var(--vb-text-xs); font-weight: var(--vb-weight-semibold); color: var(--vb-text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
  .vb-nav__item {
    display: flex; align-items: center; gap: var(--vb-space-3); height: var(--vb-control-height); padding: 0 var(--vb-space-2);
    border-radius: var(--vb-nav-item-radius); color: var(--vb-text-muted); text-decoration: none; font-weight: var(--vb-weight-medium);
    transition: background var(--vb-dur) var(--vb-ease), color var(--vb-dur) var(--vb-ease);
  }
  .vb-nav__item:hover { background: var(--vb-surface-2); color: var(--vb-text); }
  .vb-nav__item--active, .vb-nav__item--active:hover { background: var(--vb-nav-item-active-bg); color: var(--vb-nav-item-active-text); }

  .vb-topbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--vb-space-3);
    height: var(--vb-topbar-height); padding: 0 var(--vb-content-padding);
    background: var(--vb-topbar-bg); border-bottom: 1px solid var(--vb-border);
  }
  .vb-topbar__toggle { display: none; }
  .vb-topbar__crumbs { flex: 1; min-width: 0; }
  .vb-topbar__actions { display: flex; align-items: center; gap: var(--vb-space-2); }
  .vb-topbar__user { display: inline-flex; align-items: center; gap: var(--vb-space-2); font-size: var(--vb-text-sm); }
  .vb-topbar__name { max-width: var(--vb-topbar-name-width); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vb-topbar__actions .vb-form { display: inline-flex; }

  /* --vb-sticky-top: where sticky bars inside the content stop (under the sticky topbar); the focus screen and modals reset it */
  .vb-content { --vb-sticky-top: var(--vb-topbar-height); padding: var(--vb-content-padding); display: flex; flex-direction: column; gap: var(--vb-space-5); max-width: calc(var(--vb-container-width) + var(--vb-sidebar-width)); width: 100%; }

  /* ---- widget grid ---- */
  .vb-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--vb-widget-min-width), 1fr)); gap: var(--vb-space-4); }
  .vb-widget--lg { grid-column: 1 / -1; }
  .vb-widget--md { grid-column: span 2; }
  .vb-widget { min-width: 0; display: flex; }
  .vb-widget > .vb-card { flex: 1 1 auto; min-width: 0; } /* grid cells stretch; the card fills its cell */

  /* ---- responsive: below the desktop breakpoint the sidebar becomes a drawer (needs JS) ---- */
  @media (max-width: 880px) {
    .vb-shell { grid-template-columns: minmax(0, 1fr); }
    .vb-sidebar { position: static; height: auto; grid-template-rows: var(--vb-sidebar-header-height) auto auto; border-right: 0; border-bottom: 1px solid var(--vb-sidebar-border); }
    .vb-widget--md { grid-column: 1 / -1; }
    html[data-js] .vb-topbar__toggle { display: inline-flex; }
    html[data-js] .vb-sidebar {
      position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(var(--vb-sidebar-width), 86vw);
      height: auto; grid-template-rows: var(--vb-sidebar-header-height) minmax(0, 1fr) auto;
      transform: translateX(-100%); transition: transform var(--vb-dur) var(--vb-ease); border-bottom: 0; border-right: 1px solid var(--vb-sidebar-border);
    }
    html[data-js] body[data-nav-open] .vb-sidebar { transform: none; }
    .vb-topbar__name { display: none; }
  }
  .vb-scrim { display: none; }
  @media (max-width: 880px) {
    html[data-js] body[data-nav-open] .vb-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--vb-overlay); }
  }

  /* ---- the bell of the person's messages (Vbox\Messages\InboxView) ---- */
  .vb-bell { position: relative; }
  .vb-bell__count {
    position: absolute; top: 0; right: 0; min-width: var(--vb-bell-count-size); height: var(--vb-bell-count-size); padding: 0 var(--vb-space-1);
    display: inline-flex; align-items: center; justify-content: center; border-radius: var(--vb-radius-pill);
    background: var(--vb-danger); color: var(--vb-accent-contrast); font-size: var(--vb-text-xs); font-weight: var(--vb-weight-semibold); line-height: 1;
  }
  .vb-popmenu.vb-inbox { left: auto; right: var(--vb-space-3); top: calc(var(--vb-topbar-height) - var(--vb-space-1)); width: min(var(--vb-inbox-width), calc(100vw - 2 * var(--vb-space-3))); }
  .vb-inbox__head { display: flex; align-items: center; justify-content: space-between; gap: var(--vb-space-3); padding: var(--vb-space-1) var(--vb-space-2); font-size: var(--vb-text-sm); }
  .vb-inbox__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--vb-space-1); }
  .vb-inbox__item {
    display: grid; grid-template-columns: 1fr auto; gap: 0 var(--vb-space-3); padding: var(--vb-space-2); border-radius: var(--vb-radius);
    color: var(--vb-text); text-decoration: none; font-size: var(--vb-text-sm);
  }
  .vb-inbox__item:hover, .vb-inbox__item:focus-visible { background: var(--vb-surface-2); }
  .vb-inbox__title { grid-column: 1; font-weight: var(--vb-weight-medium); }
  .vb-inbox__item--unread .vb-inbox__title { font-weight: var(--vb-weight-semibold); }
  .vb-inbox__item--unread .vb-inbox__title::before { content: ""; display: inline-block; width: var(--vb-space-2); height: var(--vb-space-2); margin-right: var(--vb-space-2); border-radius: var(--vb-radius-pill); background: var(--vb-accent); vertical-align: middle; }
  .vb-inbox__body { grid-column: 1; color: var(--vb-text-muted); }
  .vb-inbox__time { grid-column: 2; grid-row: 1; color: var(--vb-text-faint); font-size: var(--vb-text-xs); white-space: nowrap; }
  .vb-inbox__empty { margin: 0; padding: var(--vb-space-3) var(--vb-space-2); color: var(--vb-text-muted); font-size: var(--vb-text-sm); }

  /* ---- /account/messages ---- */
  .vb-messages { display: flex; flex-direction: column; gap: var(--vb-space-3); }
  .vb-message { padding: var(--vb-space-4); border: 1px solid var(--vb-border); border-radius: var(--vb-radius-lg); background: var(--vb-surface); }
  .vb-message--unread { border-color: var(--vb-accent); }
  .vb-message__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--vb-space-3); }
  .vb-message__title { margin: 0; font-size: var(--vb-text-md, var(--vb-text-sm)); }
  .vb-message__time { color: var(--vb-text-faint); font-size: var(--vb-text-xs); white-space: nowrap; }
  .vb-message__body { margin: var(--vb-space-2) 0 0; white-space: normal; }
  .vb-message__actions { display: flex; flex-wrap: wrap; gap: var(--vb-space-2); margin-top: var(--vb-space-3); }
  .vb-message__actions .vb-form { display: inline-flex; }
}

