* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f1f4f9;
  color: #1f2937;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 20px;
}

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  padding: 16px;
  margin-bottom: 16px;
}

h1, h2, h3 {
  margin: 0 0 10px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #374151;
}

input, select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: #3b82f6;
}

button, .btn {
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary {
  background: #64748b;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.table-wrap table {
  width: 100%;
  min-width: 100%;
  min-width: 980px;
  border: 1px solid #dbe3ee;
  background: #fff;
}

.location-table-wrap table {
  min-width: 760px;
}

.user-table-wrap table {
  min-width: 1400px;
}

th, td {
  border: 1px solid #e5e7eb;
  padding: 10px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.table-wrap th,
.table-wrap td {
  white-space: nowrap;
}

th {
  background: #f8fafc;
  font-weight: 700;
}

.action-cell {
  white-space: nowrap;
}

.action-cell form {
  display: inline-block;
  margin: 0 0 0 6px;
}

.action-cell .btn,
.action-cell button {
  padding: 6px 10px;
  font-size: 12px;
}

.error {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.success {
  background: #dcfce7;
  color: #166534;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.mobile-shell {
  max-width: 430px;
  margin: 0 auto;
}

.mobile-shell .card {
  border-radius: 18px;
  padding: 16px;
}

.mobile-shell h2 {
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 12px;
}

.mobile-shell h3 {
  font-size: 30px;
}

.mobile-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-login-info {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.4;
  color: #334155;
}

.mobile-btn-row-gap {
  margin-top: 18px;
}

.mobile-form-card .btn,
.mobile-header-card .btn {
  padding: 9px 16px;
  font-size: 14px;
}

.mobile-form-card #openScannerBtn,
.mobile-form-card #openBarcodeScannerBtn {
  margin-bottom: 0;
}

.mobile-intrans-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.mobile-intrans-actions .btn,
.mobile-intrans-actions button {
  margin-bottom: 0;
  height: 52px;
  min-height: 52px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
  vertical-align: top;
}

.mobile-intrans-actions #openScannerBtn,
.mobile-intrans-actions button[type="submit"] {
  appearance: none;
  -webkit-appearance: none;
}

.mobile-scanner-wrap {
  margin: 10px 0;
}

.mobile-scanner-reader {
  width: 100%;
  max-width: 360px;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mobile-photo-preview {
  margin-top: 10px;
}

.mobile-photo-preview img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #d1d5db;
}

.mobile-draft-table th,
.mobile-draft-table td {
  font-size: 13px;
}

.mobile-submit-row {
  margin-top: 10px;
}

.mobile-popup-panel {
  max-width: 430px;
  text-align: center;
  border-radius: 24px;
  padding: 28px 24px;
}

.mobile-success-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 22px;
  border: 6px solid #dff3d6;
  border-radius: 999px;
  color: #8ed36e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62px;
  font-weight: 700;
  line-height: 1;
}

.mobile-confirm-icon {
  border-color: #dbeafe;
  color: #60a5fa;
}

.mobile-popup-title {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 700;
}

.mobile-popup-message {
  margin: 0 0 22px;
  font-size: 18px;
  color: #667085;
}

.mobile-popup-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mobile-popup-actions-center {
  justify-content: center;
}

.mobile-popup-actions .btn,
.mobile-popup-actions button {
  min-width: 0;
  width: auto;
  min-height: 58px;
  border-radius: 16px;
  font-size: 18px;
  line-height: 1.2;
  padding: 0 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tag {
  color: #475569;
  font-size: 13px;
}

img.thumb {
  max-width: 100px;
  border-radius: 8px;
}

.hidden {
  display: none;
}

.user-mgmt-page {
  max-width: 100%;
}

.user-mgmt-page .card {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.user-mgmt-page label {
  color: #374151;
}

.user-mgmt-page input,
.user-mgmt-page select {
  background: #fff;
  color: #1f2937;
  border: 1px solid #d1d5db;
}

.user-mgmt-page th,
.user-mgmt-page td {
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
}

.user-mgmt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.user-header-info {
  min-width: 320px;
  text-align: left;
}

.user-header-info h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.user-header-line {
  display: grid;
  grid-template-columns: 110px 14px 1fr;
  gap: 8px;
  font-size: 16px;
  line-height: 1.25;
}

.user-form-card {
  transition: all 0.2s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-panel {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  color: #111827;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.25);
  padding: 16px;
}

.modal-panel label {
  color: #374151;
}

.modal-panel input,
.modal-panel select {
  background: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
}

.modal-header {
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.mobile-product-card {
  display: block;
  text-decoration: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  color: #1f2937;
}

.mobile-product-title {
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 4px;
}

.mobile-highlight {
  border-radius: 18px;
  background: #f8fafc;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.mobile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mobile-value {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
  color: #0f172a;
  margin-bottom: 10px;
}

.permission-checklist {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.permission-checklist label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #0f172a;
}

.role-pill,
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.role-pill {
  background: #eef2ff;
  color: #3730a3;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.perm-pill {
  display: inline-block;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
}

.perm-enabled {
  background: #dcfce7;
  color: #166534;
}

.perm-disabled {
  background: #f1f5f9;
  color: #64748b;
}

.inventory-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(7, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.inventory-filter-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.product-upload-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: 14px;
}

.product-upload-form input[type="file"] {
  margin: 0;
  width: auto;
  background: #fff;
}

@media (max-width: 700px) {
  .permission-checklist {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1200px) {
  .inventory-filter-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .container {
    padding: 10px 12px;
  }

  .card {
    padding: 12px;
    border-radius: 12px;
  }

  .user-mgmt-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-header-info {
    min-width: 100%;
  }

  .user-header-info h3 {
    font-size: 20px;
  }

  .user-header-line {
    grid-template-columns: 90px 14px 1fr;
    font-size: 15px;
  }

  .nav {
    gap: 6px;
  }

  .nav .btn {
    padding: 8px 10px;
    font-size: 13px;
  }

  .inventory-filter-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .table-wrap table {
    min-width: 900px;
  }

  .location-table-wrap table {
    min-width: 700px;
  }

  .user-table-wrap table {
    min-width: 1250px;
  }
}

@media (max-width: 520px) {
  .mobile-shell h2 {
    font-size: 26px;
  }

  .mobile-shell h3 {
    font-size: 24px;
  }

  .user-header-info h3 {
    font-size: 22px;
  }

  .user-header-line {
    grid-template-columns: 72px 12px 1fr;
    font-size: 16px;
  }

  .inventory-filter-grid {
    grid-template-columns: 1fr;
  }

  th, td {
    white-space: nowrap;
    font-size: 13px;
  }

  .table-wrap table {
    min-width: 840px;
  }

  .location-table-wrap table {
    min-width: 680px;
  }

  .user-table-wrap table {
    min-width: 1180px;
  }
}
