/* Handy-Ansicht (unter 760 px). Wird als letzte Datei geladen; ab 761 px (iPad, Computer) ändert sie nichts. */
.handybar{display:none}
@media screen and (max-width:760px){
  html{font-size:14.5px;-webkit-text-size-adjust:100%}
  html,body{overflow-x:clip}
  input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important} /* sonst zoomt das iPhone beim Antippen */
  #wurzel{padding-bottom:calc(74px + env(safe-area-inset-bottom))}
  main#seite{padding-left:.75rem!important;padding-right:.75rem!important;min-width:0;max-width:100vw}
  main#seite *{min-width:0}

  /* ---------- Kopf: eine schmale Zeile mit Standort bzw. Seitenreitern ---------- */
  html body .kopfleiste,html body.mitleiste:not(.leiste-aus) .kopfleiste,html body.rechte-breit.mitleiste:not(.leiste-aus) .kopfleiste{margin:0!important;width:100%;max-width:100vw;justify-content:stretch;padding:calc(.4rem + env(safe-area-inset-top)) .6rem .4rem!important;top:0!important;gap:.4rem;flex-wrap:nowrap!important;pointer-events:auto;background:color-mix(in srgb,var(--bg) 82%,transparent)!important;backdrop-filter:blur(20px) saturate(160%)!important;-webkit-backdrop-filter:blur(20px) saturate(160%)!important}
  .kopfleiste .kp-links,.kopfleiste #darst,.kopfleiste #chatknopf,.kopfleiste #glocke,.kopfleiste #ich,.kopfleiste .suchknopf{display:none!important}
  html body .kopfleiste .krumen{display:none}
  html body .kopfleiste .krumen:has(.seitenpfeile:not(.leer)){display:flex;flex:none!important;height:44px;order:0}
  html body .kopfleiste .kp-dock{order:1!important;flex:1 1 0%!important;width:auto!important;margin-left:0!important;min-width:0;height:44px;margin:0;padding:.2rem;justify-content:flex-start;overflow:hidden}
  .kp-dock .menue{flex:1 1 auto;min-width:0;overflow-x:auto!important;scrollbar-width:none;margin:0;-webkit-overflow-scrolling:touch}
  .kp-dock .menue::-webkit-scrollbar{display:none}
  .kp-dock .menue:has(>a:only-child){display:none} /* ein einzelner Reiter wiederholt nur die Überschrift */
  .kp-dock .menue:has(>a:only-child)+.standort{max-width:100%}
  .kp-dock .menue a,.kp-dock .menue a.aktiv{height:36px;padding:0 .85rem;font-size:.86rem;flex:none}
  .kp-dock .standort{flex:1 1 auto;min-width:0}
  .kp-dock .menue:has(>a:nth-child(2))+.standort{flex:0 1 auto;max-width:44%}
  .kp-dock .standort .std-btn,.kp-dock .standort select{height:36px;width:100%!important;max-width:100%;padding-left:2.2rem;padding-right:.7rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  .kp-dock .std-pin{left:.7rem}
  .kp-dock .ghost.thema{width:36px;height:36px;flex:none;order:9;margin-left:auto}

  /* ---------- Leiste unten ---------- */
  .handybar{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;left:.5rem;right:.5rem;bottom:calc(.45rem + env(safe-area-inset-bottom));z-index:35;height:60px;padding:.25rem;border-radius:22px;background:color-mix(in srgb,var(--karte) 86%,transparent);border:1px solid color-mix(in srgb,var(--tinte) 12%,transparent);backdrop-filter:blur(24px) saturate(170%);-webkit-backdrop-filter:blur(24px) saturate(170%);box-shadow:0 16px 34px -16px rgba(0,0,0,.55)}
  .handybar button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:0;background:transparent;color:var(--grau);font:600 10.5px var(--text);border-radius:17px;padding:0;cursor:pointer}
  .handybar button svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .handybar button.aktiv{color:var(--tinte);background:color-mix(in srgb,var(--rose) 22%,transparent)}
  .handybar button:active{transform:scale(.94)}
  .handybar i{position:absolute;top:3px;left:calc(50% + 6px);min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--alarm);color:#fff;font:700 10px/17px var(--text);font-style:normal;text-align:center}
  .handybar i:empty{display:none}
  body.kiosk .handybar,body.terminal .handybar{display:none}
  body.kiosk #wurzel,body.terminal #wurzel{padding-bottom:0}
  body:has(.scrim) .handybar,body:has(.blatt) .handybar,body:has(#seite .chat) .handybar{display:none}
  body:has(#seite .chat) #wurzel{padding-bottom:0}
  #demo-hinweis{bottom:calc(72px + env(safe-area-inset-bottom))!important;font-size:10.5px!important;padding:3px 10px!important;white-space:nowrap;opacity:.85}
  #toasts{left:.6rem;right:.6rem;max-width:none}

  /* ---------- Unterseiten (zweite Leiste am Computer): hier eine Reihe zum Wischen unter dem Kopf ---------- */
  body .rt-bar{position:fixed!important;top:calc(52px + env(safe-area-inset-top))!important;left:0!important;right:0!important;bottom:auto!important;width:auto!important;height:46px!important;max-height:46px!important;z-index:29!important;display:flex!important;flex-direction:row!important;align-items:center;gap:.4rem!important;padding:0 .6rem!important;overflow-x:auto!important;overflow-y:hidden!important;border:0!important;border-radius:0!important;margin:0!important;box-shadow:none!important;transform:none!important;animation:none!important;background:color-mix(in srgb,var(--bg) 86%,transparent)!important;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);scrollbar-width:none}
  body .rt-bar::-webkit-scrollbar{display:none}
  body .rt-bar>h3,body .rt-bar>h4,body .rt-bar .rt-av,body .rt-bar small{display:none!important}
  body .rt-bar .rt-item{flex:none!important;width:auto!important;display:flex!important;align-items:center;height:34px;padding:0 .8rem!important;margin:0!important;border-radius:999px!important;white-space:nowrap;border:1px solid color-mix(in srgb,var(--tinte) 14%,transparent)!important;animation:none!important;opacity:1!important;transform:none!important}
  body .rt-bar .rt-item b{font-size:.82rem;font-weight:600;white-space:nowrap}
  body .rt-bar .rt-item.an{background:color-mix(in srgb,var(--rose) 32%,transparent)!important;border-color:transparent!important}
  body.rechte-breit main#seite{padding-top:48px}
  body .rt-weg,body:has(.scrim) .rt-bar{display:none!important}

  /* ---------- Seitenkopf: Titel oben, darunter die Werkzeuge ---------- */
  .kopfzeile{display:flex!important;flex-wrap:wrap!important;align-items:center;gap:.5rem!important;margin:.6rem 0 .8rem!important;position:static}
  .kopfzeile>*{position:static!important;margin-left:0!important;margin-right:0!important}
  .kopfzeile>.kz-titel,.kopfzeile>h1,.kopfzeile>h2{order:-1;flex:1 1 100%;min-width:100%!important}
  .kz-text{flex:1 1 auto}
  .kopfzeile h1,.kopfzeile h2{font-size:1.55rem!important;line-height:1.05}
  .kopfzeile .werkzeug{flex:1 1 100%;width:100%;margin:0!important;display:flex;flex-wrap:wrap!important;justify-content:flex-start;align-items:center;gap:.45rem}
  .kopfzeile .werkzeug input[type=search],.kopfzeile .werkzeug input[type=text]{flex:1 1 100%;width:100%!important;order:-1}
  .kopfzeile .btn{padding:.45rem .75rem!important;font-size:.88rem!important;letter-spacing:.04em;white-space:nowrap}
  .reiter{max-width:100%;overflow-x:auto;scrollbar-width:none;flex-wrap:nowrap}
  .reiter::-webkit-scrollbar{display:none}
  .reiter>*{flex:none;white-space:nowrap}

  /* ---------- Karten, Kennzahlen, Raster ---------- */
  .karte{padding:.85rem!important;border-radius:18px!important}
  .raster{gap:.55rem!important}
  .raster:not(.kpis){grid-template-columns:minmax(0,1fr)!important}
  .raster.kpis,.fm-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .kpi,.fi-kpi,.ue-kpi{padding:.75rem!important;border-radius:16px!important;overflow:hidden}
  .kpi .zahl{font-size:1.75rem!important;overflow-wrap:anywhere}
  .kpi .lab,.ue-kpi .lab{letter-spacing:.06em;overflow-wrap:anywhere;hyphens:auto}
  .kpi-ic{width:34px!important;height:34px!important;margin-top:.4rem!important}
  .zwei,.drei,.spalten,.raster-2,.raster-3,.au-grid-k,.hc-raster,.nb-ab{grid-template-columns:minmax(0,1fr)!important}
  .leer{padding:1.4rem .9rem!important}
  .btn{min-height:40px}

  .lb-raster{grid-template-columns:minmax(0,1fr)!important}
  .lb-filiale{min-width:0!important;width:100%}

  /* ---------- Tabellen und breite Inhalte schieben sich in ihrem Kasten, nicht die ganze Seite ---------- */
  .tabelle-rahmen,.tw,.karte:has(>table),.karte:has(>.tabelle){overflow-x:auto;-webkit-overflow-scrolling:touch}
  table.tabelle{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  table.tabelle th,table.tabelle td{padding:.5rem .55rem!important}
  code,pre{overflow-wrap:anywhere;white-space:pre-wrap;word-break:break-all}
  select{max-width:100%}
  img,canvas,video,svg{max-width:100%}

  /* ---------- Startseite: kurzer Kopf, Apps als Symbolraster ---------- */
  .st{gap:.8rem!important}
  .st-hero{padding:1rem!important;border-radius:22px!important;gap:.7rem!important;display:flex!important;flex-direction:column;align-items:stretch}
  .st-hero h1{font-size:1.75rem!important;line-height:1.05;margin:.2rem 0 .55rem!important}
  .st-datum{font-size:.68rem!important}
  .st-uhr,.st-suche{display:none!important} /* Uhr zeigt das Handy selbst, Suche ist unten in der Leiste */
  .st-hr{width:100%;gap:.4rem!important}
  .st-aufg{display:flex!important;gap:.45rem!important;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;width:100%}
  .st-aufg::-webkit-scrollbar{display:none}
  .st-a{flex:0 0 78%;scroll-snap-align:start;padding:.55rem .75rem!important;min-height:52px}
  .st-a span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:.8rem}
  .st-bereich>header{margin:.2rem 0 .5rem!important}
  .st-bereich h2{font-size:1rem!important}
  .st-raster{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:.6rem .35rem!important}
  .st-app{display:flex!important;flex-direction:column;align-items:center;justify-content:flex-start;gap:.35rem!important;padding:.1rem!important;background:none!important;border:0!important;box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;min-height:0!important;text-align:center;position:relative}
  .st-app::before,.st-app::after{display:none!important}
  .st-app .st-ic{width:56px!important;height:56px!important;border-radius:17px!important;flex:none;display:grid;place-items:center}
  .st-app .st-ic svg{width:25px!important;height:25px!important}
  .st-app .st-t{width:100%;text-align:center}
  .st-app .st-t b{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:.7rem!important;line-height:1.2;font-weight:600;hyphens:auto;overflow-wrap:anywhere}
  .st-app .st-t small,.st-app .st-bald{display:none!important}
  .st-app .st-n{position:absolute!important;top:-4px!important;right:calc(50% - 34px)!important;left:auto!important}

  .aufg-fenster{position:fixed!important;left:.6rem!important;right:.6rem!important;top:auto!important;bottom:calc(74px + env(safe-area-inset-bottom))!important;width:auto!important;max-width:none!important;max-height:68dvh;overflow-y:auto;transform:none!important;background:color-mix(in srgb,var(--bg) 94%,transparent)!important}
  body .rt-bar .rt-item.an b{color:var(--tinte)!important}
  .st-app .st-t b{font-size:.66rem!important}

  body.rechte-breit .kp-dock .menue{display:none} /* die Unterseiten stehen schon in der Reihe darunter */
  body.rechte-breit .kp-dock .menue+.standort{max-width:100%!important;flex:1 1 auto!important}
  html body .bn.ue-oben .ue-kpi:nth-of-type(n){grid-column:span 3!important}

  /* ---------- Fenster: von unten, volle Breite ---------- */
  .blatt{left:0!important;right:0!important;bottom:0!important;top:auto!important;width:100%!important;max-width:100%!important;max-height:94dvh!important;border-radius:22px 22px 0 0!important;overflow-y:auto}
  .blatt .rumpf{padding:.9rem .9rem calc(1.4rem + env(safe-area-inset-bottom))!important}
  .formular,.felder,form .zeile-2,form .raster-2{grid-template-columns:minmax(0,1fr)!important}
  .formular>.voll,.felder>.voll{grid-column:1/-1}
}

/* Öffentliche Demo auf dem Handy: nur der Hinweis (siehe demoNurGross in app.js) */
.nur-gross{min-height:100dvh;display:grid;place-items:center;padding:2rem 1.4rem;text-align:center}
.nur-gross>div{display:flex;flex-direction:column;align-items:center;gap:1rem;max-width:22rem}
.nur-gross svg{width:132px;height:auto;fill:none;stroke:var(--rose);stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.nur-gross h1{font:700 2rem/1.1 var(--kopf);text-transform:uppercase;letter-spacing:.02em;margin:.4rem 0 0}
.nur-gross p{color:var(--grau);line-height:1.55;margin:0}
.nur-gross .btn{width:100%;margin-top:.6rem}
.nur-gross .ng-zurueck{color:var(--tinte);font-weight:600;font-size:.95rem;padding:.4rem}
.nur-gross small{color:var(--grau);opacity:.75}
