/* v0.31.5 – Handyansicht auf aktuellem Stand: Fokusmodus für offene Bereiche (Firma, Anrufe, Kalender, …).
   Ein offener Bereich bekommt den ganzen Bildschirm; der Chat liegt hinter dem Sprechblasen-Knopf unten rechts. */
#v315ChatBtn, .rail .v315-only { display: none; }

@media (max-width: 780px) {
  /* Kurzwege im Handymenü (am PC liegen Anrufe/Firma/Kalender unter „Module“) */
  html body.v315m .rail .v315-only:not([hidden]) { display: flex !important; }

  /* --- Fokusmodus: Chat, Untertitel und Terminal-Knopf aus dem Weg --- */
  html body.v315m.v315-focus:not(.v315-chat) .comms-heading,
  html body.v315m.v315-focus:not(.v315-chat) #feed,
  html body.v315m.v315-focus:not(.v315-chat) #chatForm,
  html body.v315m.v315-focus:not(.v315-chat) #chatHistoryArrow,
  html body.v315m.v315-focus #holoSubtitle,
  html body.v315m.v315-focus .v17-term-btn { display: none !important; }

  html body.v315m.v315-focus #v315ChatBtn {
    display: grid; place-items: center; position: fixed; right: 10px; bottom: max(8px, env(safe-area-inset-bottom));
    width: 44px; height: 44px; z-index: 62; appearance: none; cursor: pointer;
    border: 1px solid rgba(var(--rgb), .45); background: rgba(5, 11, 18, .88); color: var(--accent);
    font-size: 19px; backdrop-filter: blur(8px); box-shadow: 0 0 18px rgba(var(--rgb), .18);
  }
  html body.v315m.v315-focus.v315-chat #v315ChatBtn { background: var(--accent); color: #04121c; }
  #v315ChatBtn.has-new::after {
    content: ""; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%;
    background: #ff6b7a; box-shadow: 0 0 8px #ff6b7a;
  }
  /* Chat über dem Bereich: Hintergrund gehört zum Chat selbst (sonst läge er über dem Chat) */
  html body.v315m.v315-focus.v315-chat #commsSection::before {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 60%; z-index: 0; pointer-events: auto;
    background: linear-gradient(180deg, rgba(5, 10, 16, .92), #05090f 12%); border-top: 1px solid rgba(var(--rgb), .3);
  }
  html body.v315m.v315-focus.v315-chat #commsSection { z-index: 30 !important; }
  html body.v315m.v315-focus.v315-chat .comms-heading { display: none !important; }
  html body.v315m.v315-focus.v315-chat #feed {
    display: flex !important; visibility: visible !important; opacity: 1 !important; pointer-events: auto !important;
    position: fixed !important; left: 14px !important; right: 14px !important; top: 42% !important; bottom: 170px !important;
    width: auto !important; height: auto !important; z-index: 12 !important; transform: none !important; -webkit-mask-image: none !important; mask-image: none !important;
  }
  html body.v315m.v315-focus.v315-chat #chatForm {
    display: block !important; visibility: visible !important; opacity: 1 !important; pointer-events: auto !important;
    position: fixed !important; left: 12px !important; right: 12px !important; bottom: 62px !important; top: auto !important;
    width: auto !important; z-index: 13 !important; transform: none !important;
  }
  html body.v315m.v315-focus.v315-chat #companyPanel { z-index: 10 !important; }

  /* --- Fenster (Anrufe, Kalender, Entscheidungen, …): ganze Höhe, untereinander, senkrecht scrollen --- */
  html body.v315m.v315-holo #holoStage {
    position: fixed !important; inset: 118px 10px 64px 10px !important; top: 118px !important; left: 10px !important; right: 10px !important;
    bottom: 64px !important; height: auto !important; width: auto !important; display: block !important;
    overflow-x: hidden !important; overflow-y: auto !important; scroll-snap-type: none !important;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 0 24px !important; pointer-events: auto !important;
    -webkit-mask-image: none !important; mask-image: none !important;
  }
  html body.v315m.v315-holo #holoStage .holo-w {
    position: relative !important; left: auto !important; top: auto !important; width: auto !important; height: auto !important;
    max-height: none !important; min-height: 0 !important; margin: 0 0 14px !important; flex: none !important; transform: none !important;
  }
  html body.v315m.v315-holo #holoStage .holo-w .holo-body { max-height: none !important; overflow: visible !important; }
  html body.v315m.v315-holo #holoStage .holo-w.type-map .holo-body,
  html body.v315m.v315-holo #holoStage .holo-w.type-browser .holo-body { height: 62vh !important; overflow: hidden !important; }

  /* --- Firma: Reiter und Werkzeuge waagerecht wischbar statt abgeschnitten --- */
  html body.v315m .office-tabs {
    overflow-x: auto !important; white-space: nowrap !important; flex-wrap: nowrap !important; scrollbar-width: none;
    right: 12px !important; width: auto !important; max-width: none !important; pointer-events: auto !important;
  }
  html body.v315m .office-tabs::-webkit-scrollbar, html body.v315m #officeWorldControls::-webkit-scrollbar { display: none; }
  html body.v315m .office-tabs > * { flex: 0 0 auto !important; }
  html body.v315m .office-tabs, html body.v315m #officeWorldControls {
    -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent);
  }
  html body.v315m #officeWorldControls:not([hidden]) {
    display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; scrollbar-width: none; gap: 6px; pointer-events: auto !important;
  }
  html body.v315m #officeWorldControls > * { flex: 0 0 auto !important; }
  html body.v315m.v17-scene-on .office-topline { display: none !important; }
}
