/* AvtoMaydon v26 — dialogs behave like full-screen pages, on desktop and mobile. */
dialog.v18-release-dialog[open],
dialog.v20-employee-dialog[open],
dialog.v17-photo-dialog[open] {
  box-sizing: border-box !important;
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

/* Keep the native dialog hidden until showModal() opens it. */
dialog.v18-release-dialog:not([open]),
dialog.v20-employee-dialog:not([open]),
dialog.v17-photo-dialog:not([open]) { display: none !important; }

dialog.v18-release-dialog[open],
dialog.v20-employee-dialog[open] { background: #f5faf7 !important; }

dialog.v18-release-dialog::backdrop,
dialog.v20-employee-dialog::backdrop,
dialog.v17-photo-dialog::backdrop { background: rgba(0,23,17,.78); }

/* Releasing a vehicle is a serious action: keep confirmation fully visible. */
.v18-release-dialog[open] .v18-modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  box-sizing: border-box;
  width: 100%;
  min-height: 90px;
  padding: 23px max(22px,calc((100vw - 960px)/2)) !important;
}
.v18-release-dialog[open] .v18-modal-head h2 { max-width: 770px; }
.v18-release-dialog[open] .v18-modal-close { width: 45px; height: 45px; }
.v18-release-dialog[open] .v18-modal-body {
  box-sizing: border-box;
  width: min(100%,960px);
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(20px,4vw,42px) 22px max(28px,env(safe-area-inset-bottom)) !important;
}
.v18-release-dialog[open] .v18-modal-identity,
.v18-release-dialog[open] .v18-modal-stats,
.v18-release-dialog[open] .v18-modal-total { min-width: 0; }
.v18-release-dialog[open] .v18-modal-actions { flex-wrap: wrap; }
.v18-release-dialog[open] .v18-modal-actions button { min-height: 48px; }

/* Employee editor: full-bleed header, readable form, persistent actions. */
.v20-employee-dialog[open] .v20-dialog-heading {
  box-sizing: border-box;
  position: sticky;
  top: 0;
  width: 100%;
  min-height: 94px;
  padding: 22px max(22px,calc((100vw - 1120px)/2)) !important;
  border-radius: 0 !important;
  z-index: 4;
}
.v20-employee-dialog[open] .v20-dialog-heading > button {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
}
.v20-employee-dialog[open] #v20EmployeeForm { box-sizing: border-box; width: 100%; }
.v20-employee-dialog[open] .v20-dialog-body {
  box-sizing: border-box;
  width: min(100%,1120px);
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(20px,4vw,40px) 22px !important;
}
.v20-employee-dialog[open] .v20-dialog-actions {
  box-sizing: border-box;
  position: sticky;
  bottom: 0;
  z-index: 3;
  width: 100%;
  padding: 18px max(22px,calc((100vw - 1120px)/2)) max(18px,env(safe-area-inset-bottom)) !important;
  box-shadow: 0 -9px 24px rgba(11,69,44,.06);
}
.v20-employee-dialog[open] .v20-dialog-fields { min-width: 0; }
.v20-employee-dialog[open] .v20-dialog-actions button { min-height: 48px; }

/* Gallery: dark, edge-to-edge viewer with properly contained images. */
.v17-photo-dialog[open] {
  background: #061b17 !important;
  color: #fff !important;
  overflow-y: hidden !important;
}
.v17-photo-dialog[open] .v17-dialog-top {
  box-sizing: border-box;
  min-height: 75px;
  padding: max(15px,env(safe-area-inset-top)) clamp(15px,3vw,32px);
}
.v17-photo-dialog[open] .v17-dialog-top button { width: 44px; height: 44px; }
.v17-photo-dialog[open] .v17-dialog-image {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  height: calc(100dvh - 75px);
  min-height: 0;
  padding: 10px clamp(8px,2vw,24px) max(10px,env(safe-area-inset-bottom));
  grid-template-columns: 46px minmax(0,1fr) 46px;
  gap: clamp(3px,1.5vw,12px);
}
.v17-photo-dialog[open] .v17-dialog-image img {
  box-sizing: border-box;
  display: block;
  min-height: 0 !important;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 105px) !important;
  object-fit: contain;
  margin: auto;
}

@media (max-width: 600px) {
  .v18-release-dialog[open] .v18-modal-head,
  .v20-employee-dialog[open] .v20-dialog-heading {
    padding: max(16px,env(safe-area-inset-top)) 15px 16px !important;
  }
  .v18-release-dialog[open] .v18-modal-body,
  .v20-employee-dialog[open] .v20-dialog-body {
    padding: 18px 15px 28px !important;
  }
  .v18-release-dialog[open] .v18-modal-stats { grid-template-columns: 1fr !important; }
  .v18-release-dialog[open] .v18-modal-actions { flex-direction: column-reverse !important; }
  .v18-release-dialog[open] .v18-modal-actions button { width: 100% !important; }
  .v20-employee-dialog[open] .v20-dialog-fields { grid-template-columns: 1fr !important; }
  .v20-employee-dialog[open] .v20-dialog-actions {
    flex-direction: column-reverse;
    padding: 13px 15px max(15px,env(safe-area-inset-bottom)) !important;
  }
  .v20-employee-dialog[open] .v20-dialog-actions button { width: 100%; justify-content: center; }
  .v17-photo-dialog[open] .v17-dialog-image {
    grid-template-columns: 36px minmax(0,1fr) 36px;
    padding: 5px;
  }
  .v17-photo-dialog[open] .v17-dialog-image button { width: 36px; min-height: 45px; }
}
