
#standard-size-maintenance-host {
  display: contents;
}

.item-master-screen {
  width: min(100%, 1180px);
  display: none;
  background: #ffffff;
  border: 1px solid rgba(31, 111, 139, 0.14);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(22, 34, 42, 0.12);
  overflow: hidden;
}

.item-master-screen:target { display: block; }
body:has(.item-master-screen:target) .dashboard { display: none; }

.standard-size-screen {
  position: fixed !important;
  inset: 0;
  z-index: 22;
  width: 100%;
  display: none;
  place-items: center;
  background: rgba(0, 23, 38, 0.24);
  border: 0;
  padding: 24px;
}

.standard-size-screen:target,
.standard-size-screen.standard-size-maintenance-active-fallback { display: grid; }

body:has(.standard-size-screen:target) #inventory,
/* :where() gate ignores the fallback once another route is :target (stale until hashchange runs). */
body:has(.standard-size-screen.standard-size-maintenance-active-fallback):where(:not(:has(:target:not(#standard-size-maintenance)))) #inventory { display: none !important; }

.standard-size-body {
  width: min(500px, 94vw);
  padding: 24px 32px 28px;
  border: 1px solid #c8e1e8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(0, 40, 55, 0.18);
}

.standard-size-form-title { margin: 0 0 16px; text-align: center; font-size: 16px; font-weight: 700; }
.standard-size-grid { display: grid; grid-template-columns: 64px 140px 140px; grid-template-rows: auto auto; grid-auto-flow: column; gap: 6px; align-items: end; justify-content: center; font-size: 13px; }
.standard-size-grid label { text-align: center; font-weight: 700; color: #000; }
.standard-size-grid .ts-wrapper { width: 140px; }
.standard-size-grid .ts-control,
.standard-size-grid .ts-control input,
.standard-size-grid .ts-dropdown { font-size: inherit; font-family: inherit; font-weight: inherit; line-height: inherit; color: inherit; }
.standard-size-grid .ts-control { min-height: 28px; border: 1px solid #bdd5df; border-radius: 6px; padding: 3px 8px; background: #ffffff; box-shadow: none; cursor: text; }
.standard-size-grid .ts-control input { min-height: unset; border: 0; padding: 0; background: transparent; }
.standard-size-grid .ts-control .item { font-size: inherit; font-family: inherit; font-weight: 700; line-height: inherit; }
.standard-size-grid .ts-dropdown { z-index: 9999; border: 1px solid #bdd5df; border-radius: 6px; }
.standard-size-grid .ts-dropdown .option { padding: 4px 8px; }
.standard-size-grid .ts-dropdown .option:hover,
.standard-size-grid .ts-dropdown .option.active { background: #eaf3f7; color: inherit; }

.barcode-row { display: grid; grid-template-columns: 92px 1fr 126px; gap: 8px; align-items: center; max-width: none; margin: 8px auto 0; width: 398px; font-size: 14px; }
.standard-size-buttons { display: grid; grid-template-columns: repeat(2, 34px); gap: 6px; justify-content: end; }
.standard-size-buttons .small-button { width: 34px; height: 34px; min-height: 34px; display: inline-grid; place-items: center; border-radius: 9px; font-size: 18px; font-weight: 700; line-height: 1; }
.standard-size-buttons .delete { color: #a51d2d; background: #fff0f2; border-color: #f0c7ce; position: absolute; top: 12px; left: 12px; }
.standard-size-buttons .undo { color: #4d5b66; background: #f5fafb; border-color: #c8e1e8; }
#deleteStandardSizeButton,
#standardSizeCloseButton,
#finishStandardSizeButton { font-size: 12px; }
#deleteStandardSizeButton::before,
#standardSizeCloseButton::before,
#finishStandardSizeButton::before { font-size: 18px; }
#deleteStandardSizeButton::before { content: "\1F5D1"; }
#standardSizeCloseButton::before { content: "\21b6"; }
#finishStandardSizeButton::before { content: "\2713"; }

@media (max-width: 767px) {
  .mobile-shell-active .standard-size-screen {
    inset: var(--mobile-shell-header-height, 52px) 0 var(--mobile-shell-nav-height, 56px);
    z-index: 1050;
    align-items: start;
    padding: 12px 14px;
    background: #eef6f7;
    overflow: auto;
  }

  .mobile-shell-active .standard-size-body {
    position: relative;
    width: min(100%, 640px);
    max-height: none;
    margin: 0 auto;
    padding: 14px;
    border-radius: 12px;
    box-shadow: none;
    overflow: visible;
  }

  .mobile-shell-active .standard-size-form-title {
    margin: 0 44px 12px 0;
    text-align: left;
    font-size: 17px;
    line-height: 1.25;
  }

  .mobile-shell-active .standard-size-grid,
  .mobile-shell-active .barcode-row {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    align-items: stretch;
    justify-content: stretch;
    font-size: 12px;
  }

  .mobile-shell-active .standard-size-grid label,
  .mobile-shell-active .barcode-row > label { text-align: left; font-weight: 700; color: #52606d; }

  .mobile-shell-active .standard-size-grid input,
  .mobile-shell-active .standard-size-grid select,
  .mobile-shell-active .barcode-row input,
  .mobile-shell-active .standard-size-grid .ts-wrapper { width: 100%; max-width: 100%; box-sizing: border-box; }

  .mobile-shell-active .standard-size-grid input,
  .mobile-shell-active .barcode-row input,
  .mobile-shell-active .standard-size-grid .ts-control {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #bdd5df;
    border-radius: 8px;
    box-sizing: border-box;
    background: #fff;
    font-size: 14px;
  }

  .mobile-shell-active .barcode-row { margin-top: 10px; }
  .mobile-shell-active .barcode-row > input { display: none; }
  .mobile-shell-active .barcode-row > label { display: none; }

  .mobile-shell-active .standard-size-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
  }

  .mobile-shell-active .standard-size-buttons .small-button {
    position: static;
    width: 36px;
    height: 36px !important;
    min-height: 36px !important;
    border-radius: 8px;
  }

  .mobile-shell-active #standardSizeCloseButton {
    position: absolute;
    top: 10px;
    right: 12px;
    left: auto;
  }

  .mobile-shell-active #standardSizeCloseButton::before { content: "\2190"; }
  .mobile-shell-active #deleteStandardSizeButton { margin-right: auto; }
}

@media (max-width: 520px) {
  .standard-size-screen { padding: 8px; }
  .standard-size-body { width: 100%; max-height: calc(100vh - 16px); padding: 22px 16px 18px; overflow: auto; }
  .standard-size-grid,
  .barcode-row { grid-template-columns: 1fr; width: 100%; max-width: 100%; }
  .standard-size-grid { grid-template-rows: none; grid-auto-flow: row; align-items: stretch; row-gap: 2px; }
  .standard-size-grid label { text-align: left; }
  .standard-size-grid .ts-wrapper { width: 100%; }
  .standard-size-buttons { justify-content: start; }

  .mobile-shell-active .standard-size-screen { padding: 12px 10px; }
  .mobile-shell-active .standard-size-body { padding: 14px; overflow: visible; }
  .mobile-shell-active .standard-size-buttons { justify-content: flex-end; }
}
