/* =====================================================================
   elSpinat Suite · layout on small displays (all pages)
   Loaded AFTER the module CSS.

   Width             Layout
   > 1100 px         wide rail (desktop, tablet landscape)
   701–1100 px       narrow rail with icons (tablet portrait, phone landscape)
   ≤ 700 px          phone: header with menu, rail as a drawer,
                     bottom bar with the main views (data-mnav)
   Elements are built by /shared/suite.js (mobileShell)
   ===================================================================== */
.mbar,.mnav,.drawer-bg{display:none}

/* ---------- iPhone/iPad: navigation clear of status bar, notch and home indicator (all widths) ----------
   The pages use viewport-fit=cover and the status bar style «black» (since 1.25, before «black-translucent»):
   iOS then starts the page BELOW the status bar in the installed app – independent of whether
   env(safe-area-inset-*) is reported correctly (it differs between iOS versions).
   The insets remain for the notch / Dynamic Island in landscape (left/right) and the home indicator (bottom);
   the rail grows by the inset instead of losing width. */
.rail{padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom));
  padding-left:calc(10px + env(safe-area-inset-left));flex-basis:calc(200px + env(safe-area-inset-left));width:calc(200px + env(safe-area-inset-left))}
.rail.slim{padding-left:calc(6px + env(safe-area-inset-left));flex-basis:calc(56px + env(safe-area-inset-left));width:calc(56px + env(safe-area-inset-left))}
.stage{padding-right:env(safe-area-inset-right)}
/* iPadOS 26 windowed apps: the window controls (top left) cover the page and are not reported as an inset */
html.ios-app .rail{padding-top:max(36px,env(safe-area-inset-top))}
@media (max-width:1100px){
  .rail{padding-left:calc(6px + env(safe-area-inset-left));flex-basis:calc(56px + env(safe-area-inset-left));width:calc(56px + env(safe-area-inset-left))}
}

@media (max-width:700px){
  :root{--mbar-h:52px;--mnav-h:58px;--m-rail:var(--rail,#1C2430);--m-acc:var(--acc,var(--accent,#1d5fa8))}

  /* Page layout: header on top (scrolls along), content, fixed bottom bar */
  html body{display:block;min-height:100dvh}
  body.has-mnav{padding-bottom:calc(var(--mnav-h) + env(safe-area-inset-bottom))}
  /* Modules with their own scroll area (KBPlaner): column layout over the full height */
  html body.app-fixed{display:flex;flex-direction:column;height:100dvh;min-height:0;overflow:hidden;padding-bottom:0}
  body.app-fixed .stage{flex:1;min-height:0;height:auto}
  body.app-fixed .mnav{position:static;flex:none}

  .mbar{display:flex;align-items:center;gap:8px;flex:none;height:calc(var(--mbar-h) + env(safe-area-inset-top));
    padding:env(safe-area-inset-top) 10px 0 max(4px,env(safe-area-inset-left));background:var(--m-rail);color:#fff;position:relative;z-index:20}
  .mbar-menu{width:44px;height:44px;border:0;background:transparent;border-radius:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;cursor:pointer}
  .mbar-menu span{display:block;width:20px;height:2px;border-radius:1px;background:#fff}
  .mbar-menu:active{background:rgba(255,255,255,.12)}
  .mbar-logo{width:24px;height:24px;flex:none}
  .mbar-t{flex:1;min-width:0;font-weight:600;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mbar-dot{width:44px;height:44px;border:0;background:transparent;display:grid;place-items:center;cursor:pointer;border-radius:10px}
  .mbar-dot i{width:10px;height:10px;border-radius:50%;background:#7F8A99}
  .mbar-dot.ok i{background:#4FBF85}.mbar-dot.busy i{background:#7BA4EA}.mbar-dot.warn i{background:#E3A94F}.mbar-dot.err i{background:#F07C86}
  .mbar-dot.none{visibility:hidden}

  /* Rail as a drawer: full labels, no keyboard shortcuts */
  html body .rail{position:fixed!important;top:0;left:0;bottom:0;height:100dvh!important;width:min(300px,86vw)!important;flex:none!important;
    padding:max(14px,env(safe-area-inset-top)) 12px max(14px,env(safe-area-inset-bottom))!important;overflow-y:auto;
    transform:translateX(-104%);visibility:hidden;transition:transform .22s ease,visibility 0s linear .22s;z-index:60}
  body.drawer .rail{transform:none;visibility:visible;transition:transform .22s ease;box-shadow:8px 0 30px rgba(0,0,0,.35)}
  html body .rail .rail-label{display:inline}
  html body .rail .rail-sec{display:block}
  html body .rail .rail-title,html body .rail .rail-board{display:flex}
  html body .rail .rail-status span,html body .rail .rail-save .btn,html body .rail .rail-user .who{display:block}
  html body .rail .rk,html body .rail #bSlim,html body .rail [data-act="slim"]{display:none}
  html body .rail .rail-btn{justify-content:flex-start;padding:10px;font-size:15px;min-height:44px}
  html body .rail .rail-brand{display:flex;justify-content:flex-start;padding:4px 6px 12px}
  html body .rail .appsw{display:grid;grid-template-columns:repeat(var(--n,6),minmax(0,1fr));justify-items:center;padding:6px;gap:4px 2px}
  html body .rail .appsw a.appsw-a{width:100%;max-width:40px;height:auto;border-radius:10px}
  html body .rail .appsw-i{width:75%;height:auto;border-radius:7px}
  html body .rail #calBox:not([hidden]){display:block}
  /* Tools menu: expands below its button inside the drawer instead of a popover */
  html body .rail .rail-menu{position:static;max-height:none;min-width:0;max-width:none;box-shadow:none;border:0;background:rgba(255,255,255,.04);margin:2px 0 6px;padding:4px}
  html body .rail .rail-more-btn .rk{display:inline;transform:rotate(0)}
  html body .rail .rail-more-btn.open .rk{transform:rotate(90deg)}
  .drawer-bg{display:block;position:fixed;inset:0;background:rgba(10,15,25,.45);opacity:0;pointer-events:none;transition:opacity .2s;z-index:55}
  body.drawer .drawer-bg{opacity:1;pointer-events:auto}
  body.drawer{overflow:hidden}

  /* Bottom bar: main views of the module */
  .mnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:40;height:calc(var(--mnav-h) + env(safe-area-inset-bottom));
    padding:0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);background:#fff;border-top:1px solid #d5dbe2;box-shadow:0 -2px 10px rgba(16,24,40,.06)}
  body:not(.has-mnav) .mnav{display:none}
  .mnav-b{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:none;font:inherit;font-size:11px;color:#5a6472;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .mnav-b .mnav-i{font-size:20px;line-height:1}
  .mnav-b .mnav-i.svg{display:grid;place-items:center;width:22px;height:22px}
  .mnav-b .mnav-i.svg svg{width:22px;height:22px}
  .mnav-b.on{color:var(--m-acc);font-weight:600}
  .mnav-b:active{background:#f2f4f7}

  .tbl-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}

  /* Messages above the bottom bar */
  body.has-mnav #toast{bottom:calc(var(--mnav-h) + 14px + env(safe-area-inset-bottom))}

  /* iOS zooms into input fields below 16 px automatically – prevent it */
  input:not([type=checkbox]):not([type=radio]):not([type=color]),select,textarea{font-size:16px}
}

/* ---------- Since 1.28: light header without controls at the top, bottom bar «Module» · views · «Mehr» ----------
   Nothing operable sits under the status bar / Dynamic Island any more; the module list lives in the sheet
   (nav.css .msheet), so it is hidden in the drawer. */
@media (max-width:700px){
  .mbar{background:var(--bg,var(--surface,#f3f5f7));color:var(--fg,var(--text,#1b2733));border-bottom:1px solid var(--line,var(--border,#d5dbe2));padding-left:max(14px,env(safe-area-inset-left))}
  .mbar-tt{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.15}
  .mbar-a{font-size:11px;font-weight:600;color:#1e7a45}
  .mbar-a:empty{display:none}
  .mbar-t{flex:none;font-size:17px}
  html body .rail .appnav{display:none}
  .mnav{background:var(--card,var(--surface,#fff));border-top-color:var(--line,var(--border,#d5dbe2))}
  .mnav-b{color:var(--mut,var(--muted,#5a6472));min-height:48px}
  .mnav-b .mnav-i.svg svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
  .mnav-mod{color:var(--fg,var(--text,#1b2733));font-weight:600}
  .mnav-more .mnav-i.svg svg{stroke-width:3}
  .mnav-b:active{background:var(--row,#f2f4f7)}
}
/* ---------- Since 1.28.1: bottom bar closer to the edge on iPhone ----------
   The full home-indicator inset (34 px) left an empty strip below the icons. The bar keeps only the part
   of the inset above the home indicator (inset − 16 px, about 18 px); without an inset nothing changes. */
@media (max-width:700px){
  :root{--mnav-sb:max(0px,calc(env(safe-area-inset-bottom) - 16px))}
  .mnav{height:calc(var(--mnav-h) + var(--mnav-sb));padding-bottom:var(--mnav-sb)}
  body.has-mnav{padding-bottom:calc(var(--mnav-h) + var(--mnav-sb))}
  body.has-mnav #toast{bottom:calc(var(--mnav-h) + 14px + var(--mnav-sb))}
}
/* Since 1.28.2: right after the start iOS 26 reports a viewport that is too short; theme.js sets --vgap
   (difference to the remembered correct height) until iOS corrects itself – the bars move down by it. */
@media (max-width:700px){
  html.vgap .mnav{bottom:calc(-1 * var(--vgap,0px))}
  html.vgap body.app-fixed{height:calc(100dvh + var(--vgap,0px))}
  html.vgap .msheet{bottom:calc(-1 * var(--vgap,0px))}
  html.vgap body.has-mnav #toast{bottom:calc(var(--mnav-h) + 14px + var(--mnav-sb) - var(--vgap,0px))}
}
@media print{.mbar,.mnav,.drawer-bg{display:none!important}}
