/* POI Mobile 1.1.0 — shared interaction layer; business UI remains app-owned. */
:root { --poi-mobile-css: 1; }

html.poi-mobile-ui {
  touch-action: pan-x pan-y;
  overflow-x: clip;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.poi-mobile-ui body {
  touch-action: pan-x pan-y;
  overflow-x: clip;
  max-width: 100%;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.poi-mobile-ui body .poi-mobile-field {
  font-size: 16px !important;
  min-height: 44px;
  scroll-margin: 24px;
}
html.poi-mobile-ui :is(button, [role=button], a.btn, a.button, a.pn-button, .poi-home, input[type=button], input[type=submit], select) {
  min-height: 44px !important;
}
html.poi-mobile-ui :is(#poi-dms, #app, #root) { min-width: 0; max-width: 100%; }
html.poi-mobile-ui :is(.dms-main, .shell > main, .workspace, #screen, #content, .pn-main) {
  min-width: 0;
}
html.poi-mobile-ui :is(h1, h2, h3, .pre, .ref-app-description, .pn-address, .detail-note) {
  overflow-wrap: anywhere;
}
html.poi-mobile-ui #poi-dms a.dms-app-card:hover { transform: none; }
html.poi-mobile-ui :is(.poi-popover, [data-slot=select-content]) {
  max-height: calc(var(--poi-visible-height, 100dvh) - 100px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
.poi-table-scroll {
  width: 100%; max-width: 100%; overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.poi-table-scroll > table { max-width: none; }
html.poi-mobile-ready.poi-mobile-drawer-open,
html.poi-mobile-ready.poi-mobile-drawer-open body { overflow-y: hidden; }

@media (max-width: 820px) {
  html.poi-mobile-ready :is(.dms-layout, .shell, .split, .pn-detail-grid, .lesson-layout) {
    min-width: 0;
  }
  html.poi-mobile-ui :is(.poi-brandbar, .poi-utility, .shell > main, .dms-main) {
    padding-left: max(17px, env(safe-area-inset-left, 0px));
    padding-right: max(17px, env(safe-area-inset-right, 0px));
  }
  html.poi-mobile-ui .poi-brandbar {
    height: auto;
    min-height: 65px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }
  html.poi-mobile-ui :is(.poi-brand, .poi-peugeot) { min-width: 0; }
  html.poi-mobile-ui .poi-brand { flex-shrink: 1; }
  html.poi-mobile-ui .poi-peugeot { flex-shrink: 0; max-width: 32%; }
  html.poi-mobile-ui .poi-utility { gap: 7px; }
  html.poi-mobile-ui .poi-mobile-toggle { width: 44px; flex-shrink: 0; }
  html.poi-mobile-ui :is(.poi-home, .poi-utility-right) { min-width: 0; }
  html.poi-mobile-ui .poi-utility-right { gap: 4px; }
  html.poi-mobile-ui .poi-profile-trigger { min-width: 44px; justify-content: center; }
  html.poi-mobile-ui :is(.dms-sidebar, .poi-ride-sidebar, #app .shell > aside) {
    height: var(--poi-visible-height, 100dvh);
    min-height: 0 !important;
    max-height: var(--poi-visible-height, 100dvh);
    overscroll-behavior-y: contain;
    padding-top: max(25px, env(safe-area-inset-top, 0px));
    padding-bottom: max(17px, env(safe-area-inset-bottom, 0px));
  }
  html.poi-mobile-ui #poi-dms .ref-card-top { flex-wrap: wrap; gap: 8px; }
  html.poi-mobile-ui #poi-dms .ref-app-category { min-width: 0; overflow-wrap: anywhere; }
  html.poi-mobile-ui #poi-dms :is(.ref-card-body, .ref-card-text) { min-width: 0; }
  html.poi-mobile-ui #poi-dms .dms-section-title { flex-wrap: wrap; gap: 8px; }
  html.poi-mobile-ui #poi-dms .dms-section-title span { text-align: left; max-width: 100%; }
  html.poi-mobile-ui :is(.topline, .detail-title, .task-main-actions, .pn-intro) { flex-wrap: wrap; }
  html.poi-mobile-ui body[data-poi-app=workspace] .document-viewer { max-width: 100%; }
  html.poi-mobile-ui body[data-poi-app=workspace] .document-viewer img { cursor: zoom-in; }
  html.poi-mobile-ui body[data-poi-app=workspace] .document-viewer iframe {
    max-height: max(180px, calc(var(--poi-visible-height, 100dvh) - 170px));
  }
  html.poi-mobile-ui .topline > :first-child { min-width: 0; }
  html.poi-mobile-ui :is(dialog[open], [role=dialog][data-state=open]):not(.poi-photo-viewer) {
    max-width: calc(100% - 24px);
    max-height: calc(var(--poi-visible-height, 100dvh) - 24px);
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
  html.poi-mobile-ui dialog[open]:not(.poi-photo-viewer) {
    position: fixed;
    top: calc(var(--poi-viewport-top, 0px) + var(--poi-visible-height, 100dvh) / 2);
    bottom: auto; left: 0; right: 0;
    margin: 0 auto;
    transform: translateY(-50%);
  }
  html.poi-mobile-ui [role=dialog][data-state=open] {
    top: calc(var(--poi-viewport-top, 0px) + var(--poi-visible-height, 100dvh) / 2);
  }
}

/* These readers use pixels already authorized and displayed by the app. */
.poi-preview-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 8px 0; }
.pdf-toolbar:has(.poi-preview-tools) { flex-wrap: wrap; }
.pdf-toolbar > .poi-preview-tools { flex-basis: 100%; padding: 0; }
.poi-preview-tools button, .poi-photo-viewer button {
  font: 500 13px/1.4 Arial, Helvetica, sans-serif;
  min-height: 44px; border: 1px solid #dfe5ed; border-radius: 7px;
  padding: 10px 13px; background: #fff; color: #17293b; cursor: pointer;
}
.poi-preview-tools button:focus-visible, .poi-photo-viewer :focus-visible {
  outline: 3px solid #00539b; outline-offset: 3px;
}
dialog.poi-photo-viewer {
  box-sizing: border-box; position: fixed;
  top: var(--poi-viewport-top, 0px); left: 0; right: 0; bottom: auto;
  margin: 0 auto; padding: 0; width: min(1100px, 100%);
  height: var(--poi-visible-height, 100dvh); max-width: 100%; max-height: none;
  border: 0; border-radius: 12px; background: #f4f5f9; color: #17293b;
  overflow: hidden; transform: none; font-family: Arial, Helvetica, sans-serif;
}
dialog.poi-photo-viewer[open] { display: flex; flex-direction: column; }
dialog.poi-photo-viewer::backdrop { background: #101c3acc; }
.poi-viewer-header {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(17px, env(safe-area-inset-right, 0px)) 14px max(17px, env(safe-area-inset-left, 0px));
  background: #0b1f63; color: #fff;
}
.poi-viewer-header h2 {
  font: 600 16px/1.45 Arial, Helvetica, sans-serif; margin: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.poi-viewer-header button { flex: none; min-width: 44px; padding: 8px; }
.poi-viewer-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; user-select: none; }
.poi-viewer-stage canvas { position: absolute; left: 50%; top: 50%; max-width: none; max-height: none; transform-origin: center; }
.poi-viewer-stage:focus-visible { outline-offset: -4px; }
.poi-viewer-controls {
  flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  padding: 12px max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: #fff; border-top: 1px solid #dfe5ed;
}
.poi-viewer-controls button { min-width: 44px; }
.poi-viewer-controls output { min-width: 52px; text-align: center; font-size: 13px; }
.poi-viewer-controls button:disabled { opacity: .45; cursor: default; }
.poi-viewer-page { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; }
.poi-viewer-page:empty { display: none; }
.poi-viewer-hint { margin: 0; padding: 0 12px 8px; background: #fff; text-align: center; font-size: 11px; color: #687b8e; }
@media (max-width: 820px) { dialog.poi-photo-viewer { border-radius: 0; } }
@media (prefers-reduced-motion: reduce) { .poi-photo-viewer * { scroll-behavior: auto !important; } }
