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

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

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

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

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

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

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

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

.category-actions button,
.category-filter button,
.category-tree button,
.category-table td button,
.category-footer button,
.category-footer select {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 800;
}

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

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

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

.category-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);
}

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

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

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

.category-stats strong {
  display: block;
  margin: 10px 0 12px;
  font-size: 26px;
}

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

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

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

.category-filter {
  display: grid;
  grid-template-columns: 1fr 0.7fr auto;
  gap: 28px;
  align-items: center;
  margin-bottom: 18px;
}

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

.category-filter input,
.category-filter select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  outline: 0;
}

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

.category-filter select {
  padding: 0 14px;
}

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

.category-filter button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 22px;
  color: var(--green);
  border-color: rgba(15, 159, 99, 0.42);
}

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

.category-tree,
.category-table {
  padding: 0;
  overflow: hidden;
}

.category-tree header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  height: 62px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.category-tree h2,
.category-table h2 {
  margin: 0;
  font-size: 17px;
}

.category-tree button {
  height: 38px;
  padding: 0 14px;
}

.category-tree ul {
  list-style: none;
  margin: 0;
  padding: 14px 18px 22px;
}

.category-tree li {
  display: grid;
  grid-template-columns: 18px 22px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  color: #263530;
}

.category-tree li.child {
  padding-left: 28px;
}

.category-tree li.child::before {
  content: "";
  position: absolute;
}

.category-tree li span,
.category-tree li i {
  color: var(--green);
}

.category-tree li b {
  font-size: 14px;
}

.category-tree li em {
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #606d68;
  background: #f0f3f2;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.category-table h2 {
  height: 62px;
  padding: 20px 22px 0;
}

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

.category-table table {
  min-width: 980px;
}

.category-table th {
  background: #fbfcfc;
}

.category-table td,
.category-table th {
  padding: 18px 20px;
  vertical-align: middle;
}

.category-name {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
  min-width: 210px;
}

.category-name small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.cat-thumb {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: #f1f4f3;
}

.cat-thumb::before {
  content: "";
  display: block;
}

.phone::before {
  width: 18px;
  height: 34px;
  border: 3px solid #27323a;
  border-radius: 5px;
  background: linear-gradient(160deg, #141a1f, #b7c4c7);
}

.shirt::before {
  width: 30px;
  height: 31px;
  background: linear-gradient(135deg, #cfd4d5, #88939a);
  clip-path: polygon(18% 0, 38% 0, 44% 10%, 56% 10%, 62% 0, 82% 0, 100% 22%, 82% 36%, 82% 100%, 18% 100%, 18% 36%, 0 22%);
}

.beauty::before {
  width: 28px;
  height: 34px;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(90deg, #e4b5ae 0 45%, #8a5a50 45% 55%, #f3d0ca 55%);
}

.sofa::before {
  width: 36px;
  height: 22px;
  border-radius: 5px 5px 8px 8px;
  background: linear-gradient(#7b8186 0 58%, #565d62 58%);
  box-shadow: -4px 8px 0 -2px #3f474c, 4px 8px 0 -2px #3f474c;
}

.food::before {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 28% 30%, #f0443e 0 5px, transparent 6px),
    radial-gradient(circle at 55% 28%, #f7ad27 0 6px, transparent 7px),
    radial-gradient(circle at 70% 58%, #22a35f 0 6px, transparent 7px),
    linear-gradient(135deg, #f3f7f4, #dceee5);
}

.sport::before {
  width: 38px;
  height: 18px;
  border-radius: 999px;
  background: #303940;
  box-shadow: -16px 0 0 -4px #303940, 16px 0 0 -4px #303940;
}

.car::before {
  width: 38px;
  height: 22px;
  border-radius: 10px 10px 5px 5px;
  background: linear-gradient(#e34b5b 0 55%, #821a24 55%);
  box-shadow: -10px 12px 0 -7px #1f2930, 10px 12px 0 -7px #1f2930;
}

.toy::before {
  width: 30px;
  height: 32px;
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 34% 40%, #4a2a16 0 3px, transparent 4px),
    radial-gradient(circle at 66% 40%, #4a2a16 0 3px, transparent 4px),
    linear-gradient(#d58831, #f0a64a);
}

.category-table td em {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 7px;
  font-style: normal;
  font-weight: 900;
}

.active-status {
  color: var(--green);
  background: #eaf9f2;
}

.inactive-status {
  color: #e34b5b;
  background: #ffe9ee;
}

.category-table td:last-child {
  display: flex;
  gap: 10px;
  align-items: center;
}

.category-table td button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.category-table td button.danger {
  color: #e34b5b;
}

.category-table td:last-child > span {
  color: #4e5c57;
}

.category-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

.category-footer p {
  margin: 0;
  color: #4f5e59;
  font-weight: 700;
  font-size: 13.5px;
}

/* ============================================================
   REAL-TIME DYNAMIC CATEGORY CELLS & TREE STYLES
============================================================ */
.category-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cat-emoji-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.cat-name-info strong {
  display: block;
  font-size: 14px;
  color: #0f172a;
}

.cat-name-info small {
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.badge-pill {
  padding: 2px 6px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #059669;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
}

.cat-desc-cell {
  max-width: 280px;
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

.cat-count-cell strong {
  color: #0f172a;
  font-size: 13.5px;
}

.cat-order-cell {
  text-align: center;
  font-family: monospace;
  font-size: 14px;
}

/* Status Toggle Button */
.btn-status-toggle {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-status-toggle.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.btn-status-toggle.inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.btn-status-toggle:hover {
  transform: scale(1.05);
}

/* Table Actions Cell */
.table-actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action-edit {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-edit:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-action-delete {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-delete:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Tree Styling */
.category-tree ul {
  list-style: none;
  padding: 10px 0;
  margin: 0;
}

.category-tree li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid #f8fafc;
  font-size: 13.5px;
  transition: background 0.15s ease;
}

.category-tree li:hover {
  background: #f8fafc;
}

.category-tree li.tree-root {
  background: #f0fdf4;
  font-weight: 800;
  color: #008a4b;
}

.category-tree li.child {
  padding-left: 44px;
  font-size: 12.5px;
  color: #64748b;
}

.category-tree li em {
  margin-left: auto;
  font-style: normal;
  font-weight: 800;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
}

/* ============================================================
   MODAL TAMBAH / EDIT KATEGORI
============================================================ */
.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;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 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, #008a4b, #006838);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 138, 75, 0.25);
}

.admin-modal-actions .btn-save:hover {
  transform: translateY(-1px);
}

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

  .category-main {
    grid-template-columns: 1fr;
  }
}

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

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

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

  .category-stats,
  .category-filter {
    grid-template-columns: 1fr;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  /* Rows per page footer — scroll horizontal */
  .category-footer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    white-space: nowrap;
  }
  .category-footer::-webkit-scrollbar { display: none; }
  .category-footer p { flex-shrink: 0; }
  .category-footer div {
    flex-shrink: 0;
    flex-wrap: nowrap;
    align-items: center;
  }
}

