/* Database/admin workbench refinements. */
.security-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 16px;
  color: #7c2d12;
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.94));
  font-size: 0.88rem;
  box-shadow: 0 10px 24px rgba(180, 83, 9, 0.08);
}

.security-alert strong {
  flex: 0 0 auto;
  font-weight: 950;
}

.backup-action-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.backup-action-form label {
  min-width: min(260px, 100%);
}

.backup-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid rgba(222, 226, 232, 0.78);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.backup-table-wrap .data-table {
  min-width: 720px;
  margin: 0;
}

.backup-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.backup-actions form {
  margin: 0;
}

.database-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
  padding: 9px 12px;
  border: 1px solid rgba(214, 219, 230, 0.8);
  border-radius: 14px;
  background: #f8fafc;
  color: #475467;
  font-size: 0.82rem;
  font-weight: 850;
}

.database-pager > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

@media (max-width: 720px) {
  .security-alert,
  .backup-action-form,
  .backup-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .backup-table-wrap .data-table {
    min-width: 620px;
  }
}

/* Compact finance/ERP-style database view. */
.database-workbench {
  width: min(100% - 32px, 1680px);
  margin: 0 auto 48px;
}

.workbench-header {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 18px;
  align-items: end;
  padding: 12px 0 10px;
  border-bottom: 1px solid rgba(210, 216, 228, 0.8);
}

.workbench-header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 1.6vw, 1.8rem);
}

.database-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 14px;
  align-items: end;
}

.database-search label,
.bulk-edit-bar label,
.excel-upload-form label {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 800;
}

.database-search input,
.database-search select {
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid rgba(143, 151, 167, 0.55);
  border-radius: 0;
  background: transparent;
  color: #1d2939;
  font-weight: 800;
}

.database-module-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
  padding: 8px;
  border: 1px solid rgba(214, 219, 230, 0.85);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.05);
  backdrop-filter: blur(16px);
}

.database-module-tabs a {
  padding: 8px 14px;
  border-radius: 10px;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
}

.database-module-tabs a.is-active,
.database-module-tabs a:hover {
  color: #155eef;
  background: rgba(21, 94, 239, 0.09);
}

.excel-panel {
  margin: 12px 0 18px;
  padding: 14px;
  border: 1px solid rgba(214, 219, 230, 0.86);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.05);
}

.excel-panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.excel-panel-head h2 {
  margin: 0 0 4px;
  font-size: 1.02rem;
}

.excel-panel-head p,
.muted-text {
  color: #667085;
  line-height: 1.55;
}

.excel-actions,
.bulk-edit-bar,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.module-products > .excel-panel-head {
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(213, 221, 235, 0.95);
}

.module-products .excel-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
  width: 100%;
  margin-top: 12px;
}

.module-products .excel-actions > a,
.module-products .excel-actions > form {
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid rgba(214, 222, 235, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.module-products .excel-actions > a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.image-review-bulk-form {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  border: 1px solid rgba(214, 222, 235, 0.95);
  border-radius: 16px;
  background: #fff;
}

.bulk-edit-bar {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid rgba(221, 225, 235, 0.9);
  border-radius: 14px;
  background: #f8fafc;
}

.bulk-edit-bar input,
.bulk-edit-bar select {
  min-height: 30px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.table-shell.excel-shell {
  max-height: min(68vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(203, 210, 224, 0.95);
  border-radius: 14px;
  background: #fff;
}

.data-table[data-resizable-table] {
  table-layout: fixed;
}

.data-table[data-resizable-table] th {
  user-select: none;
}

.excel-table {
  min-width: 1480px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.76rem;
}

.excel-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(190, 199, 214, 0.9);
  background: #eef3ff;
  color: #1d2939;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-table tbody tr:nth-child(even) {
  background: #f7f8fb;
}

.excel-table tbody tr:hover {
  background: #edf4ff;
}

.excel-table td {
  max-width: 0;
  height: 32px;
  padding: 2px 5px;
  border-bottom: 1px solid rgba(228, 231, 236, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.excel-table input[type="text"],
.excel-table input[type="number"],
.excel-table textarea,
.excel-table select {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  height: 26px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #1f2937;
  font-size: 0.76rem;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-table textarea {
  min-width: 0;
  min-height: 26px;
  max-height: 26px;
  resize: none;
}

.excel-table textarea:focus {
  max-height: 88px;
  height: 64px;
  resize: vertical;
  white-space: normal;
  overflow: auto;
}

.excel-table input:focus,
.excel-table textarea:focus,
.excel-table select:focus {
  border-color: rgba(21, 94, 239, 0.55);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.12);
}

.excel-table .readonly-code-input {
  min-width: 118px;
  color: #475467;
  background: #f2f4f7;
  cursor: not-allowed;
}

.path-cell,
.status-cell,
.time-cell,
.table-links {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-import-preview {
  flex: 1 1 100%;
  display: grid;
  gap: 9px;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid rgba(21, 94, 239, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.96));
}

.product-import-preview[hidden] {
  display: none;
}

.product-import-preview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.product-import-preview-head strong {
  color: #1d2939;
  font-size: 0.88rem;
  font-weight: 950;
}

.product-import-preview-head span {
  color: #155eef;
  font-size: 0.76rem;
  font-weight: 850;
}

.product-import-preview-head span.is-error {
  color: #b42318;
}

.product-import-mapping {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 8px;
}

.product-import-mapping label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-import-mapping span {
  overflow: hidden;
  color: #475467;
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-import-mapping select {
  min-height: 30px;
  max-width: 100%;
  border: 1px solid rgba(203, 210, 224, 0.95);
  border-radius: 9px;
  background: #fff;
  color: #1d2939;
  font-size: 0.78rem;
  font-weight: 800;
}

.product-import-preview-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid rgba(203, 210, 224, 0.76);
  border-radius: 12px;
  background: #fff;
}

.product-import-preview-table {
  min-width: 860px;
  margin: 0;
  table-layout: fixed;
  font-size: 0.76rem;
}

.product-import-preview-table th,
.product-import-preview-table td {
  max-width: 180px;
  padding: 5px 7px;
  overflow: hidden;
  border-bottom: 1px solid rgba(228, 231, 236, 0.9);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-review-workbench {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.image-review-card,
.image-review-empty {
  border: 1px solid rgba(203, 210, 224, 0.9);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.06);
}

.image-review-empty {
  display: grid;
  gap: 6px;
  padding: 28px;
  color: #667085;
}

.image-review-empty strong {
  color: #101828;
  font-size: 1.05rem;
}

.image-review-card {
  padding: 14px;
}

.image-review-card-head,
.image-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.image-review-card-head h3 {
  margin: 2px 0 0;
  color: #101828;
  font-size: 1.2rem;
  font-weight: 950;
}

.image-review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 850;
}

.image-review-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.image-review-column {
  display: grid;
  gap: 8px;
}

.image-review-column strong {
  color: #344054;
  font-size: 0.84rem;
}

.image-review-frame {
  display: grid;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(214, 219, 230, 0.95);
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(242, 244, 247, 0.72) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(242, 244, 247, 0.72) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(242, 244, 247, 0.72) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(242, 244, 247, 0.72) 75%);
  background-color: #fff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.image-review-frame img {
  width: 100%;
  height: 100%;
  max-height: 440px;
  object-fit: contain;
}

.image-review-frame span {
  color: #98a2b3;
  font-weight: 950;
}

.image-review-actions {
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid rgba(228, 231, 236, 0.9);
}

.image-review-actions form {
  margin: 0;
}

.image-review-mobile-note {
  display: none;
}

.select-col {
  width: 42px;
  text-align: center;
}

.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 12;
  justify-content: flex-end;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(214, 219, 230, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -10px 24px rgba(16, 24, 40, 0.05);
  backdrop-filter: blur(14px);
}

@media (max-width: 900px) {
  .database-workbench {
    width: min(100% - 18px, 100%);
  }

  .workbench-header,
  .database-search {
    grid-template-columns: 1fr;
  }

  .table-shell.excel-shell {
    max-height: 70vh;
  }

  .image-review-workbench {
    display: none;
  }

  .image-review-mobile-note {
    display: block;
    padding: 12px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 14px;
    color: #7c2d12;
    background: #fffbeb;
    font-weight: 800;
  }
}
