/* =========================================================================
   PANEL POS — shell "rail ikon terang" + gaya konten.
   Dimuat PALING AKHIR di index.html sehingga menimpa style.css bawaan
   (yang masih dipakai bersama webpanel-ecommerce). Semua aturan konten
   di-scope ke body.pos-shell supaya halaman login tidak ikut berubah.
   ========================================================================= */

body.pos-shell {
  --pos-accent: #ea580c;
  --pos-accent-strong: #c2410c;
  --pos-accent-soft: #fff1e6;
  --pos-accent-ring: rgba(234, 88, 12, 0.18);
  --pos-bg: #f6f4f1;
  --pos-surface: #ffffff;
  --pos-line: #ebe6df;
  --pos-ink: #1c1917;
  --pos-ink-2: #57534e;
  --pos-ink-3: #a8a29e;
  --rail-w: 92px;

  /* Bootstrap: tombol/tautan/fokus "primary" ikut aksen POS */
  --bs-primary: var(--pos-accent);
  --bs-primary-rgb: 234, 88, 12;
  --bs-link-color: var(--pos-accent-strong);
  --bs-link-color-rgb: 194, 65, 12;
  --bs-link-hover-color: #9a3412;
  --bs-border-radius: 10px;

  background: var(--pos-bg) !important;
  color: var(--pos-ink);
}

/* ------------------------------------------------------------------ rail */
.pos-rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  background: var(--pos-surface);
  border-right: 1px solid var(--pos-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 6px;
  z-index: 1030;
}
.pos-rail__brand {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--pos-accent-soft);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}
.pos-rail__brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.pos-rail__nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  margin: 0 10px;
  border-radius: 14px;
  color: var(--pos-ink-2);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.rail-item i {
  font-size: 1.25rem;
  width: 44px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.rail-item:hover {
  color: var(--pos-ink);
}
.rail-item:hover i {
  background: #f3efea;
}
.rail-item.active {
  color: var(--pos-accent-strong);
  font-weight: 600;
}
.rail-item.active i {
  background: var(--pos-accent-soft);
  color: var(--pos-accent);
}
/* penanda aktif di tepi kiri rail */
.rail-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--pos-accent);
}
.pos-rail__foot {
  margin-top: auto;
}
.rail-user {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--pos-line);
  background: var(--pos-surface);
  color: var(--pos-ink-2);
  font-weight: 600;
  display: grid;
  place-items: center;
}
.rail-user:hover {
  border-color: var(--pos-accent);
  color: var(--pos-accent-strong);
}

/* ----------------------------------------------------------------- main */
.pos-main {
  margin-left: var(--rail-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pos-head {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 18px 28px 14px;
  background: rgba(246, 244, 241, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.pos-head__crumb {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pos-accent-strong);
}
.pos-head__title {
  margin: 2px 0 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.pos-head__desc {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--pos-ink-2);
}
.pos-head__side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pos-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--pos-surface);
  border: 1px solid var(--pos-line);
  font-size: 0.8rem;
  color: var(--pos-ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pos-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}
#content {
  padding: 8px 28px 32px;
  flex: 1;
}
/* judul h4 bawaan halaman dipindah ke header — lihat loadPage() */
.pos-moved-title {
  display: none !important;
}

/* ------------------------------------------------------ konten: kartu */
.pos-shell #content .card {
  border: 1px solid var(--pos-line) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  background: var(--pos-surface);
}

/* tab halaman (Gambar/Kategori/Produk/…) jadi segmented pill */
.pos-shell #content .nav-tabs {
  border-bottom: 0;
  gap: 4px;
  padding: 4px;
  background: #f3efea;
  border-radius: 12px;
  display: inline-flex;
  flex-wrap: wrap;
}
.pos-shell #content .nav-tabs .nav-link {
  border: 0 !important;
  border-radius: 9px;
  color: var(--pos-ink-2);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
}
.pos-shell #content .nav-tabs .nav-link:hover {
  color: var(--pos-ink);
}
.pos-shell #content .nav-tabs .nav-link.active {
  background: var(--pos-surface) !important;
  color: var(--pos-accent-strong) !important;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.08);
  font-weight: 600;
}

/* ----------------------------------------------------- konten: tabel */
.pos-shell #content .table {
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: var(--pos-accent-soft);
  font-size: 0.875rem;
  margin-bottom: 0;
}
.pos-shell #content .table > thead > tr > *,
.pos-shell #content .table-light > tr > * {
  background: #faf8f5 !important;
  color: var(--pos-ink-3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--pos-line);
}
.pos-shell #content .table > tbody > tr > * {
  border-color: #f1ece6;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.pos-shell #content .table > tbody > tr:hover > * {
  background: var(--pos-accent-soft);
}

/* ------------------------------------------------ konten: form & tombol */
.pos-shell .form-control,
.pos-shell .form-select {
  border-radius: 10px;
  border-color: #e2dcd4;
}
.pos-shell .form-control:focus,
.pos-shell .form-select:focus {
  border-color: var(--pos-accent);
  box-shadow: 0 0 0 3px var(--pos-accent-ring);
}
.pos-shell .btn {
  border-radius: 10px;
  font-weight: 500;
}
.pos-shell .btn-primary {
  --bs-btn-bg: var(--pos-accent);
  --bs-btn-border-color: var(--pos-accent);
  --bs-btn-hover-bg: var(--pos-accent-strong);
  --bs-btn-hover-border-color: var(--pos-accent-strong);
  --bs-btn-active-bg: #9a3412;
  --bs-btn-active-border-color: #9a3412;
  --bs-btn-disabled-bg: var(--pos-accent);
  --bs-btn-disabled-border-color: var(--pos-accent);
  --bs-btn-focus-shadow-rgb: 234, 88, 12;
}
.pos-shell .btn-outline-primary {
  --bs-btn-color: var(--pos-accent-strong);
  --bs-btn-border-color: var(--pos-accent);
  --bs-btn-hover-bg: var(--pos-accent);
  --bs-btn-hover-border-color: var(--pos-accent);
  --bs-btn-active-bg: var(--pos-accent-strong);
  --bs-btn-active-border-color: var(--pos-accent-strong);
}
.pos-shell .dropdown-menu {
  border: 1px solid var(--pos-line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 28px rgba(28, 25, 23, 0.12) !important;
}
.pos-shell .dropdown-item {
  border-radius: 8px;
  font-size: 0.875rem;
  padding: 0.45rem 0.7rem;
}
.pos-shell .dropdown-item:active {
  background: var(--pos-accent);
}
.pos-shell .pagination {
  --bs-pagination-active-bg: var(--pos-accent);
  --bs-pagination-active-border-color: var(--pos-accent);
  --bs-pagination-color: var(--pos-ink-2);
  --bs-pagination-hover-color: var(--pos-accent-strong);
  --bs-pagination-focus-box-shadow: 0 0 0 3px var(--pos-accent-ring);
  --bs-pagination-border-radius: 8px;
}
.pos-shell .text-primary {
  color: var(--pos-accent-strong) !important;
}
.pos-shell .spinner-border.text-primary {
  color: var(--pos-accent) !important;
}

/* ------------------------------------- layar sempit: rail jadi tab bawah */
@media (max-width: 767.98px) {
  .pos-rail {
    inset: auto 0 0 0;
    width: auto;
    height: auto;
    flex-direction: row;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-top: 1px solid var(--pos-line);
    box-shadow: 0 -6px 18px rgba(28, 25, 23, 0.06);
  }
  .pos-rail__brand,
  .pos-rail__foot {
    display: none;
  }
  .pos-rail__nav {
    flex-direction: row;
    justify-content: space-around;
  }
  .pos-rail__nav li {
    flex: 1;
  }
  .rail-item {
    margin: 0 2px;
  }
  .rail-item.active::before {
    left: 30%;
    right: 30%;
    top: -7px;
    bottom: auto;
    width: auto;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }
  .pos-main {
    margin-left: 0;
    padding-bottom: 84px;
  }
  .pos-head {
    padding: 14px 16px 10px;
  }
  .pos-head__title {
    font-size: 1.3rem;
  }
  .pos-head__desc,
  #posClock {
    display: none;
  }
  #content {
    padding: 4px 16px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail-item,
  .rail-item i {
    transition: none;
  }
}

/* style.css memberi overflow-x:hidden pada html & body; pada body itu membuat
   body jadi scroll container sehingga header sticky tidak menempel. `clip`
   tetap mencegah scroll horizontal tanpa membuat scroll container. */
body.pos-shell {
  overflow-x: clip;
}

/* Tombol "Aksi" per baris (.btn-aksi) memakai --mj-action (ungu) dari
   style.css; di Panel POS disamakan dengan aksen oranye. */
body.pos-shell {
  --mj-action: var(--pos-accent);
  --mj-action-dark: var(--pos-accent-strong);
}
.pos-shell .btn-aksi {
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.2) !important;
}

/* ------------------------------------------------ submenu (baris pill) */
.pos-subnav {
  display: flex;
  gap: 6px;
  padding: 0 28px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pos-subnav::-webkit-scrollbar {
  display: none;
}
.pos-subnav__item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--pos-line);
  background: var(--pos-surface);
  color: var(--pos-ink-2);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pos-subnav__item:hover {
  border-color: #d6cec4;
  color: var(--pos-ink);
}
.pos-subnav__item.active {
  background: var(--pos-accent);
  border-color: var(--pos-accent);
  color: #fff;
}
@media (max-width: 767.98px) {
  .pos-subnav {
    padding: 0 16px 10px;
  }
  .rail-item {
    font-size: 0.64rem;
  }
  .rail-item i {
    width: 36px;
  }
}
