.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.admin-layout.sidebar-collapsed {
  grid-template-columns: 86px 1fr;
}

.sidebar {
  background: #0b1736;
  color: white;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  line-height: 1.2;
}

.sidebar .brand-text {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.2px;
  white-space: normal;
  word-break: keep-all;
}

.sidebar .brand small {
  display: block;
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
}

.sidebar .logo {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-collapse-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  flex: 0 0 auto;
}

.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,.18);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
}

.sidebar-user-name {
  font-weight: 900;
  color: #fff;
  font-size: 14px;
}

.sidebar-user-role {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-group-bottom {
  margin-top: auto;
}

.sidebar-group-title {
  padding: 6px 12px 2px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  transition: background .15s ease, transform .15s ease;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.08);
  transform: translateX(2px);
}

.sidebar-link.active {
  background: var(--pink);
  box-shadow: 0 12px 24px rgba(233, 30, 99, .22);
}

.sidebar-link-icon {
  width: 22px;
  text-align: center;
  font-size: 18px;
  flex: 0 0 22px;
}

.sidebar-link-label {
  white-space: nowrap;
}

.admin-main {
  padding: 24px;
  min-width: 0;
}

.admin-layout.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

.admin-layout.sidebar-collapsed .brand-text,
.admin-layout.sidebar-collapsed .sidebar-user-meta,
.admin-layout.sidebar-collapsed .sidebar-group-title,
.admin-layout.sidebar-collapsed .sidebar-link-label {
  display: none;
}

.admin-layout.sidebar-collapsed .sidebar .brand,
.admin-layout.sidebar-collapsed .sidebar-user-card,
.admin-layout.sidebar-collapsed .sidebar-link {
  justify-content: center;
}

.admin-layout.sidebar-collapsed .sidebar-top {
  flex-direction: column;
  align-items: center;
}

.admin-layout.sidebar-collapsed .sidebar-collapse-btn {
  width: 40px;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    min-height: auto;
  }

  .admin-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .admin-layout.sidebar-collapsed .brand-text,
  .admin-layout.sidebar-collapsed .sidebar-user-meta,
  .admin-layout.sidebar-collapsed .sidebar-group-title,
  .admin-layout.sidebar-collapsed .sidebar-link-label {
    display: block;
  }

  .admin-layout.sidebar-collapsed .sidebar .brand,
  .admin-layout.sidebar-collapsed .sidebar-user-card,
  .admin-layout.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;
  }

  .admin-layout.sidebar-collapsed .sidebar-top {
    flex-direction: row;
    align-items: flex-start;
  }
}

.admin-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-page-head h1 {
  margin: 0;
  font-size: 30px;
  color: #0f172a;
}

.admin-page-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-weight: 600;
}

.admin-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.admin-filter {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.admin-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
  color: #0f172a;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}

.admin-filter-actions {
  display: flex;
  gap: 8px;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.admin-btn-primary {
  background: var(--pink);
  color: #ffffff;
}

.admin-btn-light {
  background: #f1f5f9;
  color: #0f172a;
}

.admin-btn-warning {
  background: #f59e0b;
  color: #ffffff;
}

.admin-btn-success {
  background: #16a34a;
  color: #ffffff;
}

.admin-btn-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.admin-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-table-head h2 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
}

.admin-table-head span {
  color: #64748b;
  font-weight: 800;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

.admin-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-product-thumb {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  background: #fff1f2;
}

.admin-product-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #be185d;
  font-weight: 900;
}

.admin-product-name {
  font-weight: 900;
  color: #0f172a;
}

.admin-product-code {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.admin-product-meta {
  margin-top: 6px;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.admin-status-dang_ban {
  background: #dcfce7;
  color: #166534;
}

.admin-status-tam_an {
  background: #fef3c7;
  color: #92400e;
}

.admin-status-ngung_ban {
  background: #fee2e2;
  color: #991b1b;
}

.admin-profit-good {
  color: #15803d;
}

.admin-profit-bad {
  color: #b91c1c;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-inline-form {
  display: inline-flex;
  margin: 0;
}

.admin-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: #64748b;
  font-weight: 700;
  background: #f8fafc;
}

@media (max-width: 900px) {
  .admin-page-head {
    flex-direction: column;
  }

  .admin-filter {
    grid-template-columns: 1fr;
  }

  .admin-filter-actions {
    flex-wrap: wrap;
  }
}

.admin-product-form {
  width: 100%;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.admin-form-left,
.admin-form-right {
  min-width: 0;
}

.admin-form-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-form-row.two {
  grid-template-columns: 1fr 1fr;
}

.admin-form-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.admin-field {
  margin-bottom: 14px;
}

.admin-field label span {
  color: #e11d48;
}

.admin-field textarea {
  resize: vertical;
  line-height: 1.5;
}

.admin-check-field {
  display: flex;
  align-items: end;
}

.admin-checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin: 0 !important;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.admin-checkbox-label input {
  width: 18px;
  height: 18px;
}

.admin-image-box {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  background: #f8fafc;
}

.admin-image-box > label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 900;
  color: #334155;
}

.admin-image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #fff1f2;
  border: 1px dashed #f9a8d4;
  margin-bottom: 12px;
}

.admin-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-image-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #be185d;
  font-weight: 900;
}

.admin-file-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
}

.admin-image-note {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
  padding-top: 18px;
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-right {
    max-width: 360px;
  }
}

@media (max-width: 700px) {
  .admin-form-row.two,
  .admin-form-row.three {
    grid-template-columns: 1fr;
  }

  .admin-form-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.admin-current-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.admin-current-image-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #fff1f2;
}

.admin-current-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-current-image-item span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

.admin-alert {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 800;
}

.admin-alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.admin-alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ======================
   PHP 1.8.0.2.4
========================= */

html,
body {
  width: 100%;
  min-width: 320px;
  overflow: auto;
}

body {
  margin: 0;
}

/* Khung tổng admin */
.admin-layout {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: visible;
}

/* Sidebar trái */
.sidebar,
.admin-sidebar {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Vùng nội dung phải */
.admin-main {
  min-width: 0;
  width: auto;
  max-width: 100%;
  min-height: 100vh;
  height: auto;
  overflow: visible;
  padding: 24px;
}

/* Không cho các khối con ép vỡ layout */
.admin-main > *,
.admin-page-head,
.admin-card,
.admin-table-head {
  min-width: 0;
  max-width: 100%;
}

/* Header trang tự xuống dòng */
.admin-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* Card không cắt nội dung */
.admin-card {
  overflow: visible;
}

/* Bảng rộng thì cuộn ngang trong khung bảng */
.admin-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Giữ bảng không bị nát chữ, nhưng cuộn trong khung */
.admin-table {
  min-width: 980px;
}

/* Màn hình vừa */
@media (max-width: 1280px) {
  .admin-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .admin-main {
    padding: 18px;
  }

  .sidebar,
  .admin-sidebar {
    padding: 14px;
  }

  .sidebar a,
  .admin-sidebar a {
    font-size: 14px;
    padding: 12px 12px;
  }
}

/* Màn hình nhỏ: sidebar chuyển lên trên */
@media (max-width: 900px) {
  .admin-layout {
    display: block;
  }

  .sidebar,
  .admin-sidebar {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .admin-main {
    min-height: 100vh;
    padding: 14px;
  }
}


/* PHP 1.19.0 — Cố định thanh công cụ trái khi cuộn trang admin */
@media (min-width: 901px) {
  .admin-layout {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    height: 100vh;
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .admin-main {
    margin-left: 260px;
    min-height: 100vh;
  }

  .admin-layout.sidebar-collapsed .sidebar {
    width: 86px;
  }

  .admin-layout.sidebar-collapsed .admin-main {
    margin-left: 86px;
  }
}
