.stock-content {
  padding-top: 26px;
}

.stock-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 30px;
}

.stock-top h1,
.stock-top p,
.stock-top small {
  margin: 0;
}

.stock-top h1 {
  font-size: 30px;
}

.stock-top p {
  margin-top: 8px;
  font-weight: 800;
}

.stock-top span,
.stock-top small {
  color: var(--muted);
}

.stock-top small {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.stock-actions {
  display: flex;
  gap: 14px;
}

.stock-actions button,
.stock-filter button,
.stock-table td button,
.stock-footer button,
.stock-footer select,
.stock-detail button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stock-actions button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  height: 42px;
  padding: 0 18px;
}

.stock-actions .primary {
  background: linear-gradient(135deg, var(--green-bright), var(--green));
  color: #fff;
  border: none;
}

.stock-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stock-stats article {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 128px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(23, 44, 39, 0.05);
}

.stock-stats article > span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 12px;
}

.stock-stats p,
.stock-stats small {
  margin: 0;
}

.stock-stats p {
  color: #4f5e59;
  font-weight: 800;
}

.stock-stats strong {
  display: block;
  margin: 10px 0 12px;
  font-size: 22px;
  word-break: break-word;
}

.stock-stats small {
  font-weight: 800;
}

.stock-stats .up {
  color: var(--green);
}

.stock-stats .down {
  color: #e34b5b;
}

/* Filter Bar - single clean row */
.stock-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.stock-filter label {
  flex: 1;
  min-width: 170px;
}

.stock-filter label:first-child {
  flex: 2;
  min-width: 240px;
}

.stock-filter label > span {
  position: relative;
  display: block;
}

.stock-filter input,
.stock-filter select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  outline: 0;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13.5px;
}

.stock-filter input {
  padding: 0 42px 0 14px;
}

.stock-filter label > span i {
  position: absolute;
  right: 12px;
  top: 11px;
  color: var(--muted);
}

.stock-filter button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stock-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.stock-table {
  padding: 0;
  overflow: hidden;
}

.stock-tabs {
  display: flex;
  gap: 24px;
  align-items: center;
  height: 62px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.stock-tabs button {
  position: relative;
  height: 100%;
  border: 0;
  color: #4f5e59;
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.stock-tabs button.active {
  color: var(--green);
}

.stock-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--green);
}

.tab-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: #fef3c7;
  color: #b45309;
}

.tab-badge.empty {
  background: #fee2e2;
  color: #b91c1c;
}

.table-scroll {
  overflow-x: auto;
}

.stock-table table {
  width: 100%;
  min-width: 950px;
  border-collapse: collapse;
}

.stock-table th {
  background: #fbfcfc;
  text-align: left;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 800;
}

.stock-table td,
.stock-table th {
  padding: 14px 18px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.stock-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.stock-table tbody tr:hover {
  background: #f8fafc;
}

.stock-table tbody tr.selected-row {
  background: #ecfdf5 !important;
  border-left: 3px solid var(--green);
}

.stock-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.stock-product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  white-space: nowrap;
}

.stock-product .prod-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.stock-product .prod-thumb img,
.detail-visual-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stock-product .prod-thumb i.sprite,
.detail-visual-box i.sprite {
  display: block;
  width: 34px;
  height: 42px;
  background-image: url("assets/grocery-sprite.png");
  background-repeat: no-repeat;
  background-size: 800% 200%;
  background-position-y: 100%;
  flex-shrink: 0;
}

.safe-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  font-style: normal;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}

.low-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  font-style: normal;
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
  white-space: nowrap;
}

.empty-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  font-style: normal;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  white-space: nowrap;
}

.stock-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
  white-space: nowrap;
}

.stock-footer p {
  margin: 0;
  font-size: 13.5px;
  color: #64748b;
  font-weight: 700;
}

.stock-footer div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

.pagination-buttons button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 6px;
}

.pagination-buttons button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* Detail Side Panel */
.stock-detail {
  padding: 22px;
}

.stock-detail header {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-visual-box {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}

.stock-detail h2 {
  margin: 0 0 4px;
  font-size: 16.5px;
  color: #0f172a;
}

.stock-detail p {
  margin: 2px 0;
  font-size: 12px;
  color: #64748b;
}

.stock-amount {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.stock-amount small {
  display: block;
  font-size: 11.5px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 2px;
}

.stock-amount strong {
  font-size: 20px;
  color: var(--green);
}

.stock-amount b {
  font-size: 15px;
  color: #334155;
}

.stock-info {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.stock-info h3,
.warehouse-info h3,
.mutation-info h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #0f172a;
  font-weight: 800;
}

.stock-info dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  margin: 0;
  font-size: 13px;
}

.stock-info dt {
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

.stock-info dd {
  margin: 0;
  font-weight: 800;
  color: #1e293b;
  white-space: nowrap;
}

.warehouse-info,
.mutation-info {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.warehouse-info p,
.mutation-info p {
  display: flex;
  justify-content: space-between;
  margin: 6px 0;
  font-size: 12.5px;
  color: #334155;
  white-space: nowrap;
}

.mutation-info p span {
  color: #94a3b8;
  font-size: 11px;
}

.mutation-info b {
  color: #059669;
}

.mutation-info em {
  color: #dc2626;
  font-style: normal;
  font-weight: 800;
}

.stock-detail footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.stock-detail footer button {
  display: inline-flex;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stock-detail footer .primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--green-bright), var(--green));
}

/* ============================================================
   MODAL DIALOG
============================================================ */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(4, 15, 12, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.admin-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.admin-modal-card {
  width: 100%;
  max-width: 580px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.admin-modal-backdrop.is-open .admin-modal-card {
  transform: translateY(0);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.admin-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.admin-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
}

.admin-modal-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.admin-modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-modal-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-modal-form label span {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
}

.admin-modal-form input,
.admin-modal-form select,
.admin-modal-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13.5px;
  color: #0f172a;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.admin-modal-form input:focus,
.admin-modal-form select:focus,
.admin-modal-form textarea:focus {
  border-color: #008a4b;
}

.admin-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
}

.admin-modal-actions .btn-cancel {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-weight: 700;
  cursor: pointer;
}

.admin-modal-actions .btn-save {
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #00b368, #008a4b);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 138, 75, 0.3);
}

@media (max-width: 1500px) {
  .stock-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1400px) {
  .stock-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .stock-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .stock-actions {
    width: 100%;
    flex-direction: column;
  }

  .stock-actions button {
    justify-content: center;
  }

  .stock-stats,
  .stock-filter label,
  .stock-filter label:first-child,
  .stock-amount,
  .stock-detail footer,
  .form-grid-2 {
    grid-template-columns: 1fr;
    min-width: 100%;
  }

  .stock-tabs {
    overflow-x: auto;
  }

  .stock-footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}
