.mobile-menu-button,
.mobile-bottom-nav,
.mobile-sidebar-overlay {
  display: none;
}

[hidden] {
  display: none !important;
}

.compact-stats .stat-card {
  min-height: 108px;
}

.compact-form {
  margin-top: 8px;
}

.page-note {
  margin-right: auto;
  color: #7d8798;
  font-size: 12px;
}

.cell-sub {
  display: block;
  margin-top: 3px;
  color: #99a2b0;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
}

.sidebar nav {
  overflow-y: auto;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 5px 0;
}

.profile-actions button {
  padding: 6px 4px;
  border: 0;
  border-radius: 6px;
  background: #f5f7fa;
  color: #7b8595;
  font: 10px 'Noto Sans SC';
  cursor: pointer;
}

.profile-actions button:hover {
  background: #edf3ff;
  color: #2864e8;
}

.badge.warn {
  background: #fff6dd;
  color: #b87608;
}

.badge.neutral {
  background: #eef1f5;
  color: #6f7988;
}

.badge.sale {
  background: #e9f9f4;
  color: #138f70;
}

.badge.other {
  background: #f0f2f6;
  color: #6d7583;
}

.alert.info-alert .alert-symbol {
  background: #edf3ff;
  color: #2f6df3;
}

.alert.high-alert .alert-symbol {
  background: #f1eaff;
  color: #8057d8;
}

.empty-row {
  padding: 28px 10px;
  text-align: center;
  color: #99a2b0;
}

.count-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px solid #e6ebf3;
  border-radius: 9px;
  background: #f8faff;
}

.count-session-head b,
.count-session-head small {
  display: block;
}

.count-session-head small {
  margin-top: 3px;
  color: #8b95a6;
}

.live-pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7f8f2;
  color: #168c70;
  font-size: 11px;
  font-weight: 600;
}

#barcodeReader {
  overflow: hidden;
  min-height: 0;
  border-radius: 10px;
  background: #0a1220;
}

#barcodeReader video {
  border-radius: 10px;
}

.scanner-actions {
  display: flex;
  gap: 9px;
  margin: 12px 0;
}

.manual-scan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px auto;
  gap: 8px;
}

.manual-scan input {
  min-width: 0;
  height: 38px;
  border: 1px solid #dce3ed;
  border-radius: 7px;
  padding: 0 10px;
  font: 13px 'Noto Sans SC';
}

.scanner-tip {
  margin-top: 10px;
  line-height: 1.6;
}

.complete-count {
  width: 100%;
  margin-top: 18px;
}

.count-adjust {
  width: 72px;
  height: 30px;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  padding: 0 7px;
}

.difference-positive {
  color: #169b79;
  font-weight: 600;
}

.difference-negative {
  color: #df6b4c;
  font-weight: 600;
}

.rank-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #eef3ff;
  color: #3068e7;
  font-weight: 700;
}

.rank-number.top {
  background: #fff2d7;
  color: #ad7005;
}

.alert-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ed624f;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
}

#alertShortcut {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

#alertShortcut svg {
  display: block;
}

.live-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 5px;
  color: #168c70;
  font-size: 10px;
  font-weight: 500;
  vertical-align: 2px;
}

.live-status-dot::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #25b78e;
  box-shadow: 0 0 0 4px #25b78e1c;
  content: "";
}

.dashboard-alert-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.dashboard-alert-metrics button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e9edf3;
  border-radius: 8px;
  background: #fafbfc;
  color: #657084;
  cursor: pointer;
}

.dashboard-alert-metrics small {
  font-size: 10px;
}

.dashboard-alert-metrics b {
  color: #273650;
  font-family: 'DM Mono', monospace;
  font-size: 17px;
}

.dashboard-replenishment-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 11px;
  border: 1px solid #ffdfc7;
  border-radius: 9px;
  background: #fff8f1;
}

.dashboard-replenishment-banner .banner-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #f28a47;
  color: #fff;
  font-weight: 700;
}

.dashboard-replenishment-banner div {
  min-width: 0;
  flex: 1;
}

.dashboard-replenishment-banner b,
.dashboard-replenishment-banner small {
  display: block;
}

.dashboard-replenishment-banner small {
  overflow: hidden;
  margin-top: 2px;
  color: #8b735f;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-alert-panel #alerts .alert {
  padding: 10px 0;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 12px;
  height: 205px;
  margin-top: 18px;
  padding: 12px 8px 0;
  border-bottom: 1px solid #e8ecf2;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 44px, #edf0f4 45px);
}

.trend-bars > p {
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
}

.trend-day {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  height: 100%;
  min-width: 0;
}

.trend-columns {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  height: 155px;
}

.trend-column {
  width: min(15px, 42%);
  min-height: 2px;
  border-radius: 5px 5px 2px 2px;
}

.trend-column.in {
  background: #3978f5;
}

.trend-column.out {
  background: #41c3a1;
}

.trend-day small {
  overflow: hidden;
  padding: 8px 0 5px;
  color: #8e98a8;
  font: 9px 'DM Mono', monospace;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-modal {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 34px);
  overflow-y: auto;
}

.transaction-product-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.transaction-product-select .secondary {
  height: 36px;
  padding: 0 11px;
  white-space: nowrap;
}

.transaction-scanner {
  padding: 12px;
  border: 1px solid #dfe6f1;
  border-radius: 9px;
  background: #f8faff;
}

#transactionBarcodeReader {
  overflow: hidden;
  border-radius: 9px;
  background: #0a1220;
}

#transactionBarcodeReader video {
  border-radius: 9px;
}

.transaction-scanner-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 10px;
}

.transaction-scanner-controls input {
  min-width: 0;
  height: 36px;
  border: 1px solid #dce3ed;
  border-radius: 7px;
  padding: 0 10px;
  font: 13px 'Noto Sans SC';
}

.transaction-scanner-controls .secondary {
  height: 36px;
}

#transactionScannerMessage {
  margin-top: 8px;
  line-height: 1.5;
}

.product-barcode-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.product-barcode-entry .secondary {
  height: 36px;
  padding: 0 11px;
  white-space: nowrap;
}

.field-help {
  color: #8b95a6;
  font-size: 11px;
  line-height: 1.45;
}

.product-editor-scanner {
  padding: 12px;
  border: 1px solid #dfe6f1;
  border-radius: 9px;
  background: #f8faff;
}

#productBarcodeReader {
  overflow: hidden;
  border-radius: 9px;
  background: #0a1220;
}

#productBarcodeReader video {
  border-radius: 9px;
}

.product-editor-scanner-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

#productEditorScannerMessage {
  margin-top: 8px;
  line-height: 1.5;
}

#productEditorScannerMessage.scanner-error {
  color: #d65245;
}

body:not(.can-catalog-manage) #addProduct,
body:not(.can-catalog-manage) #createProduct,
body:not(.can-catalog-manage) #createSupplier,
body:not(.can-catalog-manage) .catalog-edit,
body:not(.can-catalog-manage) .catalog-delete,
body:not(.can-inventory-operate) .transaction,
body:not(.can-inventory-operate) .restock-product,
body:not(.can-documents-cancel) .cancel-document,
body:not(.can-documents-cancel) .reverse-transaction {
  display: none !important;
}

.settings-grid {
  align-items: stretch;
}

.settings-grid .panel {
  margin: 0;
}

.settings-switches {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
}

.settings-switches label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid #e7ebf2;
  border-radius: 8px;
  background: #fafbfc;
  color: #536074;
  font-size: 12px;
}

.settings-switches input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.settings-hint {
  margin-top: 14px;
  line-height: 1.7;
}

.permission-table td {
  white-space: normal;
}

.settings-actions {
  position: sticky;
  bottom: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #e0e6ef;
  border-radius: 10px;
  background: #fffffff2;
  box-shadow: 0 8px 28px #17233a14;
  backdrop-filter: blur(12px);
}

.settings-actions span {
  margin-right: auto;
  color: #8d96a7;
  font-size: 11px;
}

@media (max-width: 700px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  main {
    padding-bottom: 92px;
  }

  .mobile-menu-button {
    display: inline-grid !important;
    place-items: center;
  }

  .sidebar {
    display: flex;
    z-index: 42;
    width: min(290px, 86vw);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 20px 0 60px #10213c38;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 41;
    background: #14213d73;
  }

  .mobile-sidebar-overlay.show {
    display: block;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 7px 7px max(7px, env(safe-area-inset-bottom));
    border-top: 1px solid #e2e7ef;
    background: #fffffff2;
    box-shadow: 0 -8px 30px #14213d13;
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-nav .nav-item {
    justify-content: center;
    display: grid;
    gap: 2px;
    padding: 5px 3px;
    text-align: center;
  }

  .mobile-bottom-nav .nav-item span {
    width: auto;
    font-size: 18px;
  }

  .mobile-bottom-nav .nav-item small {
    font-size: 10px;
  }

  .manual-scan {
    grid-template-columns: minmax(0, 1fr) 66px;
  }

  .manual-scan button {
    grid-column: 1 / -1;
  }

  .scan-layout {
    display: grid;
  }

  .dashboard-alert-metrics {
    gap: 6px;
  }

  .dashboard-alert-metrics button {
    display: grid;
    gap: 3px;
    justify-content: stretch;
    padding: 9px;
    text-align: left;
  }

  .transaction-scanner-controls {
    grid-template-columns: 1fr 1fr;
  }

  .transaction-scanner-controls input {
    grid-column: 1 / -1;
  }

  .product-barcode-entry {
    grid-template-columns: 1fr;
  }

  .product-barcode-entry .secondary {
    width: 100%;
  }
}
