/* RBHS accessibility + RTL layer (m1130, 2026-11-22). Loaded by templates/base.html right after rbhs-kit.css and
 * injected into every other HTML page by rbhs_a11y_m1130.py (login, Vault/Photo Sync shells ...).
 * Kill switch: ?a11y=0 on any page (stored in localStorage rbhs.a11y), or backup_state/a11y_m1130/config.json {"enabled":false}.
 * Tokens (dark shell; the web has no light theme):  --a11y-focus  focus ring (>= 3:1 on every shell surface)
 *                                                    --a11y-muted  secondary text (>= 4.5:1 on --panel/--panel2/#0b1220)  */
:root{--a11y-focus:#7dd3fc;--a11y-muted:#9db4c8;--a11y-target:44px}

/* ---- 1. keyboard focus: ONE visible ring on everything (replaces m381's outline:none) ---- */
html body *:focus-visible{outline:2px solid var(--a11y-focus)!important;outline-offset:2px!important}
html body :is(input,select,textarea):focus-visible{outline-offset:1px!important}
html body :is(main#rbhsMain,[tabindex="-1"]):focus-visible{outline:none!important}
html body .rbhs-skip:focus-visible{outline-offset:2px!important}
/* the old module rule that painted a 1px inset ring only */
html body .side nav a:focus-visible,html body aside nav a:focus-visible{box-shadow:none!important}

/* ---- 2. skip link + screen-reader helpers ---- */
.rbhs-skip{position:fixed;inset-inline-start:12px;top:-80px;z-index:2147483000;background:#0b1220;color:#e6f2ff;border:2px solid var(--a11y-focus);
  border-radius:10px;padding:11px 18px;font:600 14px/1.2 system-ui,-apple-system,sans-serif;text-decoration:none;transition:top .12s ease}
.rbhs-skip:focus,.rbhs-skip:focus-visible{top:12px}
.rbhs-sr{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ---- 3. reduced motion (OS setting): stop every decorative animation, keep state changes instant ---- */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;animation-delay:0s!important;
    transition-duration:.01ms!important;transition-delay:0s!important;scroll-behavior:auto!important}
}
html[data-motion="reduce"] *,html[data-motion="reduce"] *::before,html[data-motion="reduce"] *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;
  transition-duration:.01ms!important;scroll-behavior:auto!important}

/* ---- 4. touch targets >= 44 px for primary controls (coarse pointers, or My Settings > Density = comfortable).
        Dense admin tables keep their compact controls (everything inside a <table> is excluded). ---- */
@media (pointer:coarse){
  html:not([data-density="compact"]) :is(.side nav a,.side nav summary,.side-pinned a,.k-out,.rbhs-theme-toggle,.k-burger,#rbhsEnableNotifBtn,.rbhs-gsearch input,
    main :is(button,select,textarea,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]),summary,[role=button],[role=tab],[role=switch],a.backup-btn,a.k-btn,a.btn,.k-chip,.pills a,.seg button):not(table *)){min-height:var(--a11y-target)}
  html:not([data-density="compact"]) :is(.k-out,.k-burger,.rbhs-theme-toggle,#rbhsEnableNotifBtn){min-width:var(--a11y-target)}
  html:not([data-density="compact"]) :is(.k-out,.k-burger){display:inline-flex;align-items:center;justify-content:center}
  html:not([data-density="compact"]) :is(.bl-ib,.ac-ib,.m016-day-add,.m016-delete,.m016-share,.cs-x,.media-icon-btn,.media-action-icon,.media-step-btn,.rbhs-cx-pin,.rbhsDockRadioPlay,.k-tb-search,.rbhs-m158c-trash,.k-ib,.k-ico,.dg-ib,a.vth-tab,.vth-tab,.rbhs-install-banner-close,main a[class*="btn"],main button[class*="btn"]):not(table *){min-width:var(--a11y-target);min-height:var(--a11y-target)}
  html:not([data-density="compact"]) :is(input[type=checkbox],input[type=radio]){min-width:24px;min-height:24px}
  html:not([data-density="compact"]) .rbhs-install-banner-close{min-width:44px;min-height:44px}
}
html[data-density="comfortable"] :is(.side nav a,.side nav summary,.side-pinned a,.k-out,.rbhs-theme-toggle,.k-burger,
  main :is(button,select,textarea,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]),summary,[role=button],[role=tab],[role=switch],a.backup-btn,a.k-btn,a.btn,.k-chip,.pills a,.seg button):not(table *)){min-height:var(--a11y-target)}
html[data-density="comfortable"] :is(.k-out,.k-burger){display:inline-flex;align-items:center;justify-content:center;min-width:var(--a11y-target)}

/* a button squeezed to 28 px wide by its row (Home > active sessions) must keep its label on one line */
.backup-btn.bad{white-space:nowrap;flex:0 0 auto}

/* ---- 5. reflow at 320 px / 400 % zoom: nothing may force sideways scrolling of the page ---- */
html,body{max-width:100%}
.main,main.main,.shell>main{min-width:0}
main img,main video,main canvas,main iframe{max-width:100%}
main pre,main code{overflow-wrap:anywhere}
main pre{overflow:auto;max-width:100%}
main :is(h1,h2,h3,p,li,td,th,dd,dt,label,summary){overflow-wrap:anywhere}
@media (max-width:480px){
  main :is(.home-eyebrow,.page-hero,.top>div){min-width:0;max-width:100%}
  main table{max-width:100%}
  .rbhs-m035-ai-panel{max-width:calc(100vw - 16px)}
  /* Home at 320 px: the ops grid squeezed the map card to 30 px and the backup card forced 354 px (audit A13) */
  html body .home-ops-grid,html body .home-status-grid{grid-template-columns:minmax(0,1fr)!important}
  html body .home-ops-grid>*{grid-column:1!important;grid-row:auto!important}
  .home-ops-grid>*,.home-status-grid>*,.home-backup-compact,.home-backup-dots{min-width:0;max-width:100%}
  .home-backup-dots{flex-wrap:wrap}
  html body main :is(.home-eyebrow,.home-user-presence small,.home-user-presence b,.home-user-presence span,.home-user-logon *){white-space:normal;overflow-wrap:anywhere}
  .home-user-logon,.home-user-logon .card-head,.home-user-presence{min-width:0;max-width:100%}
  .k-topbar{min-width:0}.k-tb-title{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
/* wide tables get their own scroller, which must be reachable by keyboard (axe: scrollable-region-focusable) */
.rbhs-scroll-region{overflow:auto;max-width:100%}

/* ---- 6. contrast: the page-specific greys that measured under 4.5:1 on the dark shell ---- */
.mr-b.dup,.mr-card .dup{color:#f0a066!important}
.mr-toggle-pending{opacity:1!important}
.mr-toggle-pending,.mr-toggle-pending .mr-sw{color:var(--a11y-muted)}
.mr-toggle{color:#a9b6c6!important}
.mr-chip.on,.mr-fl.on,button.on.mr-chip{background:#1f6feb!important}
.ac-st .chip.below_floor,.chip.below_floor{color:#aab4c6!important}
.dg-id,.dg-ib2 .dg-id{color:#9aa5b8!important}
.mys{--mu:#9aa5b8!important}
html body [data-media-open]>small,html body .media-item small,html body #mediaBrowser div[data-media-open] small,html body #mediaBrowser .media-item small{color:#9fb0c6!important}
html body .m016-day.m016-out{opacity:1!important}
html body .m016-day.m016-out .m016-day-num span{color:#8d98ab!important}
html body .dg-hrow small,html body .dg-hrow.on small{color:#a3adbf!important}
.rbhs-muted,.k-mute{color:var(--a11y-muted)}

/* ---- 7. right-to-left: the page is mirrored at <html dir=rtl>; kit/shell borders and arrows follow the direction ---- */
html[dir=rtl] .side{border-right:0;border-left:1px solid var(--line,rgba(125,211,252,.22))}
html[dir=rtl] .side nav{padding-right:0;padding-left:2px}
html[dir=rtl] :is(.chev,.k-chev,.nav-chev,.k-arrow,[data-flip]){transform:scaleX(-1)}
html[dir=rtl] .rbhs-skip{inset-inline-start:12px}
html[dir=rtl] :is(.k-toasts,.rbhs-toast-stack){left:16px;right:auto}
html[dir=rtl] .rbhs-m035-ai-bubble{right:auto;left:18px}
html[dir=rtl] .rbhs-m035-ai-panel{right:auto;left:18px}

/* ---- 8. what m381 kept: no grey tap flash on sidebar links (the focus ring above is unaffected) ---- */
.side nav a,aside nav a{-webkit-tap-highlight-color:transparent}
html body [data-media-open]>small,html body #mediaBrowser .media-item small{opacity:1!important}
html body.mx26 #mediaBrowser .media-item.rbhs-cx-folder>small,html body.mx26 #mediaBrowser .media-item>small,html body #mediaBrowser .media-item.rbhs-cx-folder>small{opacity:1!important;color:#a9b8cc!important}

/* RTL: the sidebar group chevron points toward the content (left), open state still points down; sub-menu indent moves to the right */
html[dir=rtl].theme-2026 .side nav summary::after{margin-left:0;margin-right:auto;transform:rotate(135deg)}
html[dir=rtl].theme-2026 .side nav details[open]>summary::after{transform:rotate(45deg)}
html[dir=rtl].theme-2026 .side nav .nav-group-items{margin:2px 19px 6px 0}
html[dir=rtl] .nav-group summary::after{margin-left:0;margin-right:auto}
html[dir=rtl].theme-2026 .side nav .nav-group-items{padding-left:0;padding-right:9px;border-left:0;border-right:1px solid var(--t-ln,rgba(125,211,252,.22))}

/* 2026-11-29 (iPhone Safari): masked password characters rendered as stacked junk glyphs. WebKit draws the mask bullet from the
   field's PRIMARY font; the login stack starts with the self-hosted Heebo subset ("RBHS Hebrew"), which has no U+2022/U+25CF, so its
   .notdef glyph was drawn instead of a dot. Password fields use the system UI font (always has the bullet) everywhere. */
input[type="password"],html body input[type="password"]{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",system-ui,Roboto,"Helvetica Neue",Arial,sans-serif!important;letter-spacing:normal}
/* 2026-11-29: the floating AI button (bottom-right) covered the last row of long pages on phones (Vault Explorer's last vault could not
   be tapped): leave room under the content for it, including the iPhone home-indicator safe area. */
@media (max-width:760px){
  html:not(.k-off) body:has(#rbhsM035AiBubble) .main{padding-bottom:calc(112px + env(safe-area-inset-bottom,0px))!important}
}
/* 2026-11-29 Home pfSense list: keep the time on one line on phones (same rule is in templates/home.html; live there from the next reload). */
.pfsense-card .pfx-time{white-space:nowrap}
@media(max-width:560px){.pfsense-card .pfx-row{grid-template-columns:auto minmax(0,1fr) auto auto}}
