.topbar {
  height: 82px;
  min-height: 82px;
  justify-content: flex-start;
}

.brand {
  min-width: 0;
  gap: 20px;
}

.brand-logo-frame {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 205px;
  height: 52px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: #f5f7f9;
  box-shadow: 0 2px 8px rgba(2, 8, 16, 0.18);
}

.brand-logo {
  position: absolute;
  top: -87px;
  left: -84px;
  display: block;
  width: 355px;
  max-width: none;
  height: auto;
  filter: brightness(1.32) contrast(1.18) saturate(0.95);
}

.brand-title {
  display: block;
  color: #eef8ff;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.admin-logout {
  margin-inline-start: auto;
}

.admin-logout button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: #dce9f1;
  cursor: pointer;
}

.admin-logout button:hover {
  border-color: rgba(96, 213, 255, 0.42);
  background: rgba(96, 213, 255, 0.08);
}

.admin-logout button:focus-visible {
  border-color: rgba(96, 213, 255, 0.7);
  outline: 3px solid rgba(96, 213, 255, 0.2);
  outline-offset: 3px;
}

.movements-list {
  display: grid;
  gap: 13px;
  max-height: 535px;
  overflow: auto;
}

.movement-item {
  display: flex;
  gap: 11px;
}

.movement-item > i {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  background: #5df5c610;
  color: var(--mint);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-style: normal;
}

.movement-item > div {
  flex: 1;
  border-bottom: 1px solid #ffffff09;
  padding-bottom: 12px;
}

.movement-item strong {
  display: block;
  font-size: 11px;
  line-height: 1.6;
}

.movement-item span {
  display: block;
  color: #b8cbd8;
  font-size: 10px;
  margin-top: 2px;
}

.movement-item time {
  display: block;
  color: #61798c;
  font-size: 9px;
  margin-top: 3px;
}

#inventoryStats {
  grid-template-columns: repeat(2, 1fr);
}

.stock-numbers {
  grid-template-columns: repeat(2, 1fr);
}

.stock-numbers div:last-child {
  border-left: 0;
}

.stock-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(93, 245, 198, 0.3);
  border-radius: 10px;
  background: rgba(93, 245, 198, 0.08);
  color: var(--mint);
  cursor: pointer;
}

.stock-edit-btn span {
  font-size: 15px;
  line-height: 1;
}

.stock-edit-btn b {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-edit-btn:hover,
.stock-edit-btn:focus-visible {
  border-color: rgba(93, 245, 198, 0.58);
  background: rgba(93, 245, 198, 0.14);
  outline: none;
}

.products-panel-head {
  gap: 16px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.add-product-btn {
  min-height: 39px;
  padding: 9px 15px;
  gap: 7px;
  border-radius: 11px;
  white-space: nowrap;
}

.add-product-btn > span {
  color: inherit;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: normal;
  line-height: 1;
}

.add-product-btn:focus-visible {
  outline: 3px solid rgba(96, 213, 255, 0.72);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(93, 245, 198, 0.1);
}

.refresh-inventory-btn {
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
}

.refresh-inventory-btn:hover,
.refresh-inventory-btn:focus-visible {
  border-color: rgba(93, 245, 198, 0.45);
  background: rgba(93, 245, 198, 0.08);
  outline: none;
}

.product-modal-card {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  direction: rtl;
  text-align: right;
}

.product-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.product-form-grid label {
  min-width: 0;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-error {
  min-height: 20px;
  margin: -2px 0 0;
  color: var(--bad);
  font-size: 11px;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
  min-height: 46px;
  gap: 7px;
}

.modal-actions .btn-primary > span:first-child {
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.modal-open {
  overflow: hidden;
}

.product-modal-card button:disabled {
  pointer-events: none;
}

.product-modal-card .modal-close:disabled {
  opacity: 0.45;
}

@media (max-width: 760px) {
  .topbar {
    height: 72px;
    min-height: 72px;
    padding: 10px 18px;
    flex-wrap: nowrap;
  }

  .brand {
    gap: 14px;
  }

  .brand-logo-frame {
    width: 185px;
    height: 48px;
  }

  .brand-logo {
    top: -78px;
    left: -76px;
    width: 320px;
  }

  .brand-title {
    font-size: 18px;
  }

  .admin-logout button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
  }

  #inventoryStats {
    grid-template-columns: 1fr 1fr;
  }

  .stock-edit-btn {
    padding: 7px 9px;
  }

  .product-modal-card {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 22px;
    border-radius: 20px;
  }
}

@media (max-width: 480px) {
  .brand {
    gap: 12px;
  }

  .brand-logo-frame {
    width: 168px;
    height: 44px;
  }

  .brand-logo {
    top: -71px;
    left: -69px;
    width: 290px;
  }

  .brand-title {
    font-size: 16px;
  }

  .admin-logout button {
    width: 52px;
    padding: 8px;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  .admin-logout button::before {
    content: "خروج";
    color: #dce9f1;
    font-size: 11px;
  }

  #inventoryStats {
    grid-template-columns: 1fr;
  }

  .product-top {
    display: grid;
    grid-template-columns: 43px minmax(0, 1fr);
    grid-template-areas:
      "avatar info"
      "action action";
    align-items: center;
  }

  .product-avatar {
    grid-area: avatar;
  }

  .product-top > div:nth-child(2) {
    grid-area: info;
    min-width: 0;
  }

  .stock-edit-btn {
    grid-area: action;
    justify-self: start;
    margin-top: 4px;
  }

  .stock-edit-btn b {
    font-size: 9px;
  }

  .products-panel-head {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .panel-actions {
    width: 100%;
  }

  .add-product-btn {
    flex: 1;
    min-height: 44px;
  }

  .refresh-inventory-btn {
    width: 44px;
    height: 44px;
  }

  .product-modal-card {
    padding: 20px 17px;
  }

  .product-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-field-wide {
    grid-column: auto;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }
}
