.admin-page.crm-focus-mode .crm-module .crm-nav {
  height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 18px);
  min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 18px);
}

/* CRM owns its scale from the first frame, including login and modal dialogs.
   Viewport lengths below and in CRM modules compensate for CSS zoom so the
   working rail and fullscreen sheets still fill the browser at actual size. */
html:has(body.admin-page) {
  --crm-ui-scale: 1;
  zoom: var(--crm-ui-scale);
}
@media screen and (min-width: 900px) {
  html:has(body.admin-page) { --crm-ui-scale: .75; }
}
.crm-login-employees > div { display: grid; gap: 10px; max-height: calc(45dvh / var(--crm-ui-scale, 1)); overflow-y: auto; padding: 3px; }
.crm-login-employees h2 { font-size: 22px; }
.crm-operation-employee-list article { flex-wrap: wrap; gap: 10px; }
.crm-operation-employee-list article select { min-width: 150px; max-width: 100%; }
.crm-receipt-stage[data-crm-receipt-stage-panel="supplier"] { width: min(784px, 100%); margin-inline: 0; align-content: center; }
.crm-receipt-stage[data-crm-receipt-stage-panel="supplier"] > header,
.crm-receipt-stage[data-crm-receipt-stage-panel="supplier"] .crm-receipt-supplier-picker { width: 100%; max-width: none; }

@media (min-width: 900px) {
  .admin-page.crm-focus-mode,
  .admin-page.crm-focus-mode .admin-shell,
  .admin-page.crm-focus-mode .admin-content { min-height: calc(100dvh / var(--crm-ui-scale, 1)); }
  .admin-page.crm-focus-mode .admin-main { min-height: calc(100dvh / var(--crm-ui-scale, 1)); padding-bottom: 0; }
  .admin-page.crm-focus-mode .crm-module:not([hidden]) { min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 18px); align-items: stretch; }
  .admin-page.crm-focus-mode .crm-stage { display: flex; min-height: 0; align-self: stretch; flex-direction: column; }
  .admin-page.crm-focus-mode .crm-view:not([hidden]) { display: flex; min-height: 100%; flex: 1; flex-direction: column; }
  .admin-page.crm-focus-mode .crm-workspace-panel:not([hidden]) {
    min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 202px);
    flex: 1;
    background: #fff;
  }
  .admin-page.crm-focus-mode .crm-sale-form {
    min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 202px);
    margin-bottom: 0;
    background: #fff;
  }
  .admin-page.crm-focus-mode .crm-sale-employee-screen { min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 278px); }
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-employee-screen:not([hidden]),
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-fulfillment-screen:not([hidden]),
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-customer-screen:not([hidden]),
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-payment-screen:not([hidden]) {
    display: flex;
    min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 278px);
    box-sizing: border-box;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: clamp(44px, calc(6dvh / var(--crm-ui-scale, 1)), 72px);
  }
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-employee-screen:not([hidden]),
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-fulfillment-screen:not([hidden]) {
    justify-content: center;
    padding-block: 24px;
  }
  /* Balance the space occupied by the page heading, tabs and sale steps above
     this screen so the choice is centered in the visible workspace. */
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-employee-screen:not([hidden]),
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-fulfillment-screen:not([hidden]) {
    padding-bottom: 302px;
  }
}

.crm-nav-head {
  display: grid;
  min-height: 108px;
  gap: 7px;
  align-content: center;
  padding: 13px 13px 11px;
}

.crm-nav-head img {
  display: block;
  width: 188px;
  max-width: 100%;
  height: 45px;
  object-fit: contain;
  object-position: left center;
}

.crm-nav-session {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.crm-nav-session span {
  overflow: hidden;
  color: #949ba7;
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-module .crm-nav .crm-nav-logout {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  color: #c7ccd5;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(255, 255, 255, .055);
}

.crm-module .crm-nav .crm-nav-logout:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
  background: rgba(239, 51, 64, .18);
}

.crm-nav-logout svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-history-preview-head {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 2px;
}

.crm-history-preview-head h3 { margin: 0; }
.crm-history-preview-head .button { min-height: 34px; padding: 0 12px; }

.crm-inventory-history-dialog {
  width: calc(100vw / var(--crm-ui-scale, 1));
  max-width: none;
  height: calc(100dvh / var(--crm-ui-scale, 1));
  max-height: none;
  margin: 0;
  padding: 0;
  color: #171a20;
  border: 0;
  border-radius: 0;
  background: #f4f5f7;
}

.crm-inventory-history-dialog::backdrop { background: rgba(11, 14, 19, .66); }
.crm-inventory-history-dialog > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  color: #fff;
  background: #17191f;
}
.crm-inventory-history-dialog > header > div { display: grid; gap: 3px; }
.crm-inventory-history-dialog > header span { color: #ff5b66; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.crm-inventory-history-dialog > header h2 { margin: 0; font-size: 25px; }
.crm-inventory-history-dialog > main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 50px; }
.crm-history-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; padding: 14px 17px; border: 1px solid #dfe3e8; border-radius: 12px; background: #fff; }
.crm-history-summary span { color: #727b87; font-size: 12px; }
.crm-history-list { overflow: hidden; padding: 0 18px; border: 1px solid #dfe3e8; border-radius: 14px; background: #fff; }
.crm-history-list .crm-row { padding: 16px 0; }
.crm-history-list .crm-row > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; }

@media (max-width: 1180px) {
  .admin-page.crm-focus-mode .crm-module .crm-nav { height: auto; min-height: 0; }
  .crm-nav-head { grid-column: 1 / -1; }
}

@media (min-width: 900px) {
  .admin-page.crm-focus-mode .crm-module:not([hidden]) {
    grid-template-columns: 208px minmax(0, 1fr);
    grid-template-areas: "rail context" "rail stage";
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 22px;
  }
  .admin-page.crm-focus-mode .crm-module .crm-nav {
    position: sticky;
    top: 18px;
    display: flex;
    margin: 0;
    height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 36px);
    min-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 36px);
    max-height: calc(calc(100dvh / var(--crm-ui-scale, 1)) - 36px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .admin-page.crm-focus-mode .crm-nav-head,
  .admin-page.crm-focus-mode .crm-nav-group { flex-shrink: 0; }
  .admin-page.crm-focus-mode .crm-module .crm-nav-group { border-left: 0; }
  .admin-page.crm-focus-mode .crm-sale-form > .crm-sale-payment-screen:not([hidden]) {
    padding-top: clamp(16px, calc(3dvh / var(--crm-ui-scale, 1)), 40px);
    padding-bottom: 24px;
  }
}

@media (max-width: 820px) {
  .admin-page.crm-focus-mode .crm-module .crm-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 4px;
    overflow: visible;
  }
  .crm-module .crm-nav-group:not([hidden]),
  .crm-module .crm-nav-group > div { display: contents; }
  .crm-module .crm-nav-group > p { display: none; }
  .crm-module .crm-nav button[data-crm-view] {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 7px 8px;
    white-space: normal;
    font-size: 11px;
  }
  .crm-module .crm-nav .crm-nav-head {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: auto;
    padding: 7px 9px;
  }
  .crm-nav-head img { width: 164px; height: 40px; }
  .crm-module .crm-nav .crm-nav-logout { flex-basis: 31px; width: 31px; min-height: 31px; }
  .crm-inventory-history-dialog > header { min-height: 68px; padding: 12px 14px; }
  .crm-inventory-history-dialog > main { width: calc(100% - 24px); padding-top: 14px; }
}

@media (max-width: 700px) {
  .crm-sale-path li {
    display: flex;
    min-height: 64px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 7px 2px;
    text-align: center;
  }
  .crm-sale-path li b { max-width: 100%; font-size: 10px; overflow-wrap: anywhere; }
}
