:root {
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --shadow: 0 20px 45px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.login-card { width: min(420px, calc(100% - 32px)); margin: 10vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: 28px; }
.brand-login, .brand { display: flex; align-items: center; gap: 14px; }
.brand-login img, .brand img { width: 54px; height: 54px; object-fit: cover; border-radius: 18px; border: 1px solid var(--line); background: white; }
.brand-login p, .brand span { margin: 0; color: var(--muted); font-size: 13px; }
.brand-login h1, .brand strong { margin: 0; font-size: 22px; line-height: 1.1; }
.login-card input { width: 100%; margin: 18px 0 12px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #0f172a; color: white; padding: 22px; display: flex; flex-direction: column; gap: 28px; }
.sidebar .brand img { background: white; }
.sidebar .brand span { color: #94a3b8; display: block; margin-top: 4px; }
.sidebar nav { display: grid; gap: 8px; }
.nav { position: relative; border: 0; background: transparent; color: #cbd5e1; text-align: left; padding: 13px 14px; border-radius: 14px; cursor: pointer; }
.nav:hover, .nav.active { background: rgba(255, 255, 255, .10); color: white; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(220, 38, 38, .16); margin-left: 7px; vertical-align: middle; }
.content { padding: 24px; overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 28px; }
.topbar p { margin: 6px 0 0; }
.top-actions, .row-actions, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 13px; padding: 11px 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); background: #e2e8f0; font-weight: 700; }
.btn.primary { background: var(--primary); color: white; }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: white; border: 1px solid var(--line); }
.btn.success { background: var(--green-soft); color: var(--green); }
.btn.warning { background: var(--orange-soft); color: var(--orange); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.purple { background: var(--purple-soft); color: var(--purple); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.alert { margin: 0 0 16px; padding: 13px 15px; border-radius: 14px; background: var(--green-soft); color: var(--green); border: 1px solid rgba(22, 163, 74, .2); }
.alert.error { background: var(--red-soft); color: var(--red); border-color: rgba(220, 38, 38, .2); }
.page { display: none; }
.page.active { display: block; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.card, .panel, .detail-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.card { padding: 18px; }
.card small { color: var(--muted); }
.card strong { display: block; font-size: 26px; margin-top: 8px; }
.panel, .detail-card { padding: 20px; }
.panel h2, .detail-card h2 { margin: 0 0 8px; }
.panel-head { margin-bottom: 14px; }
.order-list { display: grid; gap: 10px; }
.order-item { position: relative; width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 18px; padding: 14px; cursor: pointer; transition: .18s ease; }
.order-item:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(15, 23, 42, .06); }
.order-item.unread { border-color: rgba(220, 38, 38, .35); }
.order-item .redmark { position: absolute; top: 14px; right: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.order-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-right: 18px; }
.order-top strong { font-size: 15px; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.unpaid { background: var(--orange-soft); color: var(--orange); }
.badge.paid { background: var(--green-soft); color: var(--green); }
.badge.sent { background: var(--primary-soft); color: var(--primary); }
.badge.completed { background: var(--purple-soft); color: var(--purple); }
.badge.expired, .badge.closed { background: #f1f5f9; color: #475569; }
.order-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 8px; }
.tab { white-space: nowrap; border: 1px solid var(--line); background: white; border-radius: 999px; padding: 10px 14px; cursor: pointer; font-weight: 800; }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.orders-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.detail-card { position: sticky; top: 18px; }
.detail-line { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.detail-line span:first-child { color: var(--muted); }
.action-grid { display: grid; gap: 10px; margin-top: 14px; }
.action-grid input, .action-grid textarea { width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.form-panel label { display: grid; gap: 7px; margin: 12px 0; font-weight: 800; }
.form-panel small { color: var(--muted); font-weight: 500; }
input, textarea { border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: white; color: var(--text); outline: none; }
textarea { min-height: 96px; resize: vertical; }
.codebox { width: 100%; min-height: 560px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.switches { display: grid; gap: 8px; margin: 12px 0; }
.switches label { display: flex; align-items: center; gap: 8px; margin: 0; }
.logo-preview { width: 140px; height: 140px; border-radius: 32px; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; background: white; margin: 12px 0; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.notice-box, .steps { background: #f8fafc; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 14px 0; }
.steps h3 { margin-bottom: 6px; }
.steps p { margin-top: 0; color: var(--muted); }
.empty { padding: 22px; text-align: center; color: var(--muted); background: white; border: 1px dashed var(--line); border-radius: 18px; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-radius: 0 0 26px 26px; }
  .sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav { text-align: center; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orders-layout, .grid2 { grid-template-columns: 1fr; }
  .detail-card { position: static; }
}
@media (max-width: 640px) {
  .content { padding: 14px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
  .sidebar { padding: 16px; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-meta { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .btn { width: 100%; }
}
.small-text { font-size: 12px; line-height: 1.45; }
.user-badge { display: inline-flex; align-items: center; max-width: 360px; padding: 10px 13px; border-radius: 999px; background: white; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
select { border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: white; color: var(--text); outline: none; }
.admin-list-panel { margin-top: 16px; }
.admin-users { display: grid; gap: 12px; }
.admin-user-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: white; }
.admin-user-card p { margin: 4px 0; color: var(--muted); }
.admin-user-card small { color: var(--muted); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) {
  .admin-user-card { grid-template-columns: 1fr; }
  .admin-actions { justify-content: stretch; }
  .user-badge { max-width: 100%; }
}
@media (max-width: 640px) {
  .user-badge { width: 100%; justify-content: center; }
}

/* V5 product manager refinements */
input, textarea, select { font-weight: 400; }
textarea, .codebox, .normalbox { font-weight: 400; }
b, strong { font-weight: 600; }
.btn { font-weight: 600; }
.form-panel label { font-weight: 600; }
.form-panel small { font-weight: 400; }

.product-manager { overflow: hidden; }
.product-tools { display: flex; gap: 10px; margin: 14px 0 18px; }
.product-tools input { flex: 1; }
.product-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.product-list-wrap { border: 1px solid var(--line); border-radius: 20px; background: #f8fafc; padding: 12px; }
.product-list-title { font-size: 13px; color: var(--muted); margin: 2px 4px 10px; }
.product-list { display: grid; gap: 8px; max-height: 760px; overflow: auto; padding-right: 2px; }
.product-card { width: 100%; text-align: left; border: 1px solid var(--line); background: white; border-radius: 16px; padding: 12px; cursor: pointer; display: grid; gap: 5px; }
.product-card:hover { border-color: rgba(37, 99, 235, .35); }
.product-card.active { border-color: var(--primary); box-shadow: 0 10px 24px rgba(15, 23, 42, .06); }
.product-name { font-weight: 600; color: var(--text); line-height: 1.35; }
.product-info { color: var(--muted); font-size: 12px; }
.product-editor { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: white; }
.editor-head, .variants-head, .variant-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-head h3, .variants-head h3 { margin: 0 0 4px; }
.editor-head p, .variants-head p { margin: 0; }
.clean-form { margin-top: 14px; box-shadow: none; border-radius: 18px; padding: 0; border: 0; }
.normalbox { min-height: 130px; line-height: 1.45; font-family: inherit; }
.inline-check { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 9px !important; font-weight: 500 !important; }
.inline-check input { width: auto; }
.variants-head { margin: 20px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.variant-list { display: grid; gap: 12px; }
.variant-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #fbfdff; }
.variant-card label { display: grid; gap: 7px; margin: 10px 0; font-weight: 600; }
.variant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.small-actions .btn { padding: 8px 10px; border-radius: 11px; width: auto; }
.advanced-json { margin-top: 16px; border: 1px dashed var(--line); border-radius: 18px; padding: 14px; background: #f8fafc; }
.advanced-json summary { cursor: pointer; font-weight: 600; }
.codebox.compact { min-height: 280px; margin-top: 12px; font-size: 12px; background: white; }
@media (max-width: 980px) {
  .product-layout { grid-template-columns: 1fr; }
  .product-list { max-height: 360px; }
}
@media (max-width: 640px) {
  .product-tools { flex-direction: column; }
  .variant-grid { grid-template-columns: 1fr; }
  .editor-head, .variants-head, .variant-top { display: grid; }
}


.proof-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #f8fafc; }
.proof-panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.proof-panel-head span { color: var(--muted); font-size: 12px; font-weight: 800; }
.proof-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.proof-card { margin: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
.proof-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #f1f5f9; }
.proof-card figcaption { padding: 10px; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.proof-card figcaption b { color: var(--text); }
.proof-card figcaption small { display: block; color: var(--muted); line-height: 1.35; word-break: break-word; }
.muted-proof { color: var(--muted); }

/* V6 mobile header and drawer menu */
.mobile-header,
.drawer-backdrop { display: none; }

@media (max-width: 1100px) {
  body.drawer-lock { overflow: hidden; }
  .shell { display: block; min-height: 100vh; }

  .mobile-header {
    display: block;
    position: sticky;
    top: 0;
    z-index: 60;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 12px;
    background: rgba(15, 23, 42, .98);
    color: white;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .22);
    backdrop-filter: blur(14px);
  }

  .mobile-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    max-height: 76px;
    margin-bottom: 12px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    transition: max-height .28s ease, opacity .24s ease, transform .28s ease, margin-bottom .28s ease;
  }

  .mobile-header.compact .mobile-brand-row {
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
    transform: translateY(-18px);
    pointer-events: none;
  }

  .hamburger {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 15px;
    background: rgba(255, 255, 255, .08);
    display: grid;
    place-items: center;
    gap: 0;
    padding: 10px;
    flex: 0 0 auto;
    cursor: pointer;
  }

  .hamburger span {
    display: block;
    width: 21px;
    height: 2px;
    border-radius: 99px;
    background: white;
    margin: 3px 0;
  }

  .mobile-brand {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    min-width: 0;
  }

  .mobile-brand img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 17px;
    background: white;
    border: 1px solid rgba(255, 255, 255, .24);
  }

  .mobile-brand strong,
  .mobile-brand span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-brand strong { font-size: 18px; line-height: 1.15; }
  .mobile-brand span { color: #cbd5e1; font-size: 13px; margin-top: 3px; }

  .mobile-quicknav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-nav {
    min-height: 43px;
    border: 1px solid rgba(255, 255, 255, .13);
    background: rgba(255, 255, 255, .08);
    color: #e2e8f0;
    border-radius: 15px;
    padding: 8px 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
  }

  .quick-nav.active {
    background: white;
    color: var(--primary);
    border-color: white;
  }

  .quick-nav .dot { width: 8px; height: 8px; margin-left: 3px; box-shadow: 0 0 0 3px rgba(220, 38, 38, .20); }

  .sidebar {
    position: fixed;
    z-index: 80;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    height: 100dvh;
    padding: calc(env(safe-area-inset-top, 0px) + 22px) 20px 24px;
    border-radius: 0 26px 26px 0;
    transform: translateX(-104%);
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: 20px 0 46px rgba(15, 23, 42, .28);
  }

  .shell.drawer-open .sidebar { transform: translateX(0); }

  .drawer-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
  }

  .shell.drawer-open .drawer-backdrop { display: block; }
  .sidebar nav { grid-template-columns: 1fr !important; }
  .nav { text-align: left; width: 100%; }

  .content { padding: 18px 12px 72px; overflow: visible; }
  .topbar { margin-top: 4px; }
  .topbar h1 { font-size: 26px; }
}

@media (max-width: 640px) {
  .mobile-header { padding-left: 10px; padding-right: 10px; }
  .mobile-brand strong { font-size: 16px; }
  .mobile-brand span { font-size: 12px; }
  .quick-nav { font-size: 12px; padding: 8px 6px; border-radius: 13px; }
  .top-actions { grid-template-columns: 1fr 1fr; }
  .top-actions .user-badge { grid-column: 1 / -1; }
  .top-actions #refreshBtn,
  .top-actions #installTopBtn,
  .top-actions #logoutBtn { min-height: 44px; }
}

/* V7 professional mobile/header/product cleanup */
.hidden-json,
.advanced-json.hidden-json {
  display: none !important;
}

.sidebar {
  display: flex;
  flex-direction: column;
}
.sidebar nav {
  flex: 1 1 auto;
}
.drawer-bottom-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(226, 232, 240, .18);
  display: grid;
  gap: 10px;
}
.drawer-bottom-actions .btn {
  width: 100%;
  justify-content: center;
}

.mobile-brand span,
#mobileServerStatus {
  display: none !important;
}

.product-manager .panel-head {
  align-items: center;
}
.product-manager .panel-head h2 {
  margin-bottom: 4px;
}
.product-manager .row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.product-editor {
  box-shadow: 0 12px 30px rgba(15, 23, 42, .04);
}
.product-card {
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.product-card:hover,
.product-card.active {
  transform: translateY(-1px);
}
.variant-card {
  box-shadow: 0 8px 18px rgba(15, 23, 42, .03);
}
.variant-top strong {
  font-weight: 600;
}

@media (max-width: 1100px) {
  .mobile-header {
    padding-bottom: 10px;
  }
  .mobile-brand-row {
    align-items: center;
  }
  .mobile-brand {
    grid-template-columns: 46px minmax(0, 1fr);
  }
  .mobile-brand img {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }
  .mobile-brand strong {
    font-size: 17px;
    letter-spacing: -.2px;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
  }
  .sidebar nav {
    flex: 1 1 auto;
  }
  .drawer-bottom-actions {
    margin-top: auto;
    padding-top: 18px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }
  .drawer-bottom-actions .btn {
    min-height: 46px;
    border-radius: 15px;
  }
  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .top-actions .user-badge {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .top-actions {
    grid-template-columns: 1fr;
  }
  .top-actions #refreshBtn {
    width: 100%;
    min-height: 44px;
  }
  .product-manager .panel-head {
    display: grid;
    gap: 12px;
  }
  .product-manager .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .product-manager .row-actions .btn {
    width: 100%;
  }
  .product-list-wrap,
  .product-editor,
  .variant-card {
    border-radius: 18px;
  }
  .variant-top .row-actions {
    grid-template-columns: 1fr 1fr;
  }
}


/* V8 scroll stabil: header HP tidak berubah tinggi saat halaman discroll */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 1100px) {
  body {
    overscroll-behavior-y: contain;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .mobile-brand-row,
  .mobile-header.compact .mobile-brand-row {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin-bottom: 10px !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }

  .mobile-brand,
  .mobile-brand img,
  .mobile-quicknav,
  .quick-nav,
  .content {
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .quick-nav,
  .nav,
  .btn,
  .order-item,
  .product-card {
    -webkit-tap-highlight-color: transparent;
  }

  .order-item:hover,
  .product-card:hover,
  .product-card.active {
    transform: none;
  }
}

/* V10 scroll profesional: HP bisa scroll, desktop sidebar tetap diam */
@media (min-width: 1101px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .shell {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .content {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .content::-webkit-scrollbar,
  .sidebar::-webkit-scrollbar {
    width: 8px;
  }

  .content::-webkit-scrollbar-thumb,
  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .35);
    border-radius: 999px;
  }
}

@media (max-width: 1100px) {
  html,
  body {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  body.drawer-lock {
    overflow: hidden !important;
    touch-action: none;
  }

  .shell {
    display: block;
    height: auto !important;
    min-height: 100dvh;
    max-height: none !important;
    overflow: visible !important;
  }

  .content {
    height: auto !important;
    min-height: calc(100dvh - 150px);
    max-height: none !important;
    overflow: visible !important;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    flex: 0 0 auto;
    contain: layout paint;
  }

  .page.active {
    min-height: 60vh;
  }

  .orders-layout,
  .product-layout,
  .grid2,
  .cards,
  .panel,
  .detail-card,
  .order-list,
  .product-list,
  .admin-users {
    min-height: 0;
  }

  .product-list {
    max-height: none;
    overflow: visible;
  }

  .tabs,
  .mobile-quicknav {
    -webkit-overflow-scrolling: touch;
  }
}

/* V11 fix scroll HP: body tidak jadi area scroll, hanya konten utama yang scroll */
@media (max-width: 1100px) {
  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: manipulation;
  }

  body.drawer-lock {
    overflow: hidden !important;
    touch-action: none;
  }

  .shell {
    display: flex !important;
    flex-direction: column;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    position: relative;
  }

  .mobile-header {
    position: relative !important;
    top: auto !important;
    flex: 0 0 auto;
    width: 100%;
    z-index: 60;
  }

  .content {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 18px 12px max(72px, calc(72px + env(safe-area-inset-bottom, 0px))) !important;
  }

  .content > .topbar,
  .content > .alert,
  .content > .page {
    min-width: 0;
  }

  .shell.drawer-open .content {
    pointer-events: none;
  }

  .drawer-backdrop {
    touch-action: none;
  }

  .sidebar {
    max-height: 100dvh;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .tabs,
  .product-list,
  .order-list,
  textarea {
    -webkit-overflow-scrolling: touch;
  }
}

@supports not (height: 100dvh) {
  @media (max-width: 1100px) {
    .shell {
      height: 100vh !important;
      min-height: 100vh !important;
      max-height: 100vh !important;
    }
  }
}

/* V12: daftar produk HP punya scroll sendiri dan hanya menampilkan sekitar 5 produk */
@media (max-width: 1100px) {
  .product-layout {
    min-height: 0 !important;
  }

  .product-list-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .product-list {
    max-height: 392px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-right: 5px;
  }

  .product-card {
    min-height: 72px;
  }

  .product-list::-webkit-scrollbar {
    width: 6px;
  }

  .product-list::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .35);
    border-radius: 999px;
  }
}

@media (max-width: 430px) {
  .product-list {
    max-height: 384px !important;
  }
}


/* V13 dashboard mobile ringkas dan profesional */
.dashboard-sticky-summary {
  display: none;
}

@media (max-width: 1100px) {
  body.page-dashboard .topbar {
    display: none;
  }

  .dashboard-sticky-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 12;
    margin: -6px 0 14px;
    padding: 10px 0 10px;
    background: linear-gradient(180deg, rgba(248,250,252,.98) 0%, rgba(248,250,252,.96) 82%, rgba(248,250,252,0) 100%);
    backdrop-filter: blur(6px);
  }

  .dashboard-title-block {
    min-width: 0;
  }

  .dashboard-title-block h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -.4px;
  }

  .dashboard-title-block p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
  }

  .dashboard-revenue-chip {
    min-width: 132px;
    border-radius: 20px;
    background: white;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
    padding: 12px 14px;
    text-align: right;
  }

  .dashboard-revenue-chip small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 4px;
  }

  .dashboard-revenue-chip strong {
    display: block;
    font-size: 20px;
    line-height: 1.1;
    color: var(--text);
  }

  .dashboard-cards {
    display: grid !important;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, minmax(106px, auto));
    grid-auto-columns: minmax(160px, 1fr);
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    margin-bottom: 16px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-cards .card {
    min-height: 106px;
    scroll-snap-align: start;
    margin: 0;
  }

  .dashboard-cards .stat-revenue {
    display: none;
  }

  .dashboard-cards::-webkit-scrollbar {
    height: 6px;
  }

  .dashboard-cards::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .28);
    border-radius: 999px;
  }

  .dashboard-cards .card small {
    font-size: 13px;
  }

  .dashboard-cards .card strong {
    font-size: 26px;
  }
}

@media (max-width: 640px) {
  .dashboard-sticky-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: -4px;
    padding-top: 6px;
  }

  .dashboard-title-block h2 {
    font-size: 24px;
  }

  .dashboard-title-block p {
    font-size: 13px;
  }

  .dashboard-revenue-chip {
    min-width: 126px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .dashboard-revenue-chip strong {
    font-size: 17px;
  }

  .dashboard-cards {
    grid-auto-columns: minmax(150px, 1fr);
    grid-template-rows: repeat(2, minmax(96px, auto));
  }

  .dashboard-cards .card {
    min-height: 96px;
    padding: 16px;
  }

  .dashboard-cards .card strong {
    font-size: 24px;
  }
}


/* V14 perbaikan dashboard HP: hilangkan duplikat, top area sticky, statistik tanpa geser */
.dashboard-sticky-summary {
  display: none !important;
}

.topbar-title-group {
  display: block;
}

.topbar-revenue-chip {
  display: none;
}

@media (max-width: 1100px) {
  body.page-dashboard .topbar {
    position: sticky;
    top: 0;
    z-index: 18;
    margin: -6px 0 14px;
    padding: 10px 0 12px;
    background: linear-gradient(180deg, rgba(248,250,252,.99) 0%, rgba(248,250,252,.97) 86%, rgba(248,250,252,0) 100%);
    backdrop-filter: blur(6px);
  }

  body.page-dashboard .topbar-title-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    margin-bottom: 10px;
  }

  body.page-dashboard .topbar-title-copy {
    min-width: 0;
  }

  body.page-dashboard .topbar h1 {
    font-size: 24px;
    line-height: 1.05;
    letter-spacing: -.3px;
    margin-bottom: 6px;
  }

  body.page-dashboard .topbar p {
    font-size: 13px;
    line-height: 1.35;
    margin: 0;
  }

  body.page-dashboard .topbar-revenue-chip {
    display: block;
    min-width: 122px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: white;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    text-align: right;
  }

  body.page-dashboard .topbar-revenue-chip small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 3px;
    line-height: 1.15;
  }

  body.page-dashboard .topbar-revenue-chip strong {
    display: block;
    font-size: 16px;
    line-height: 1.1;
    white-space: nowrap;
  }

  body.page-dashboard .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 10px;
    align-items: center;
  }

  body.page-dashboard .top-actions .user-badge {
    width: 100%;
    max-width: none;
    min-width: 0;
    justify-content: flex-start;
    font-size: 12px;
    padding: 11px 12px;
  }

  body.page-dashboard .top-actions #refreshBtn {
    width: 100%;
    min-height: 44px;
  }

  body.page-dashboard .dashboard-cards {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    padding: 0;
    margin-bottom: 16px;
    scroll-snap-type: none;
  }

  body.page-dashboard .dashboard-cards .card {
    min-height: 88px;
    padding: 14px 12px;
    margin: 0;
  }

  body.page-dashboard .dashboard-cards .stat-revenue {
    display: none;
  }

  body.page-dashboard .dashboard-cards .card small {
    font-size: 11px;
    line-height: 1.25;
  }

  body.page-dashboard .dashboard-cards .card strong {
    font-size: 18px;
    line-height: 1.1;
  }

  body.page-dashboard .dashboard-cards::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 640px) {
  body.page-dashboard .topbar {
    padding-top: 6px;
  }

  body.page-dashboard .topbar-title-group {
    gap: 10px;
  }

  body.page-dashboard .topbar-revenue-chip {
    min-width: 116px;
    padding: 9px 10px;
  }

  body.page-dashboard .topbar-revenue-chip strong {
    font-size: 15px;
  }

  body.page-dashboard .top-actions {
    grid-template-columns: minmax(0, 1fr) 104px;
  }
}

@media (max-width: 420px) {
  body.page-dashboard .dashboard-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* V16 dashboard HP stabil: tidak berubah saat pindah menu, omzet tampil, statistik satu baris */
@media (max-width: 1100px) {
  body.page-dashboard .topbar {
    display: grid !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 22 !important;
    gap: 10px !important;
    margin: -6px 0 12px !important;
    padding: 8px 0 12px !important;
    background: linear-gradient(180deg, rgba(248,250,252,.99) 0%, rgba(248,250,252,.98) 86%, rgba(248,250,252,0) 100%) !important;
    backdrop-filter: blur(6px);
  }

  body.page-dashboard .topbar-title-group {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 !important;
  }

  body.page-dashboard .topbar-title-copy {
    min-width: 0 !important;
  }

  body.page-dashboard .topbar h1 {
    display: block !important;
    margin: 0 0 4px !important;
    font-size: 23px !important;
    line-height: 1.05 !important;
    letter-spacing: -.25px !important;
  }

  body.page-dashboard .topbar p {
    display: block !important;
    margin: 0 !important;
    font-size: 12.5px !important;
    line-height: 1.25 !important;
    color: var(--muted) !important;
  }

  body.page-dashboard .topbar-revenue-chip {
    display: block !important;
    width: auto !important;
    min-width: 114px !important;
    max-width: 126px !important;
    padding: 8px 10px !important;
    border-radius: 15px !important;
    border: 1px solid var(--line) !important;
    background: white !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .05) !important;
    text-align: right !important;
  }

  body.page-dashboard .topbar-revenue-chip small {
    display: block !important;
    margin: 0 0 3px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    color: var(--muted) !important;
    white-space: nowrap !important;
  }

  body.page-dashboard .topbar-revenue-chip strong {
    display: block !important;
    font-size: 14px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    color: var(--text) !important;
  }

  body.page-dashboard .top-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 96px !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
  }

  body.page-dashboard .top-actions .user-badge {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 40px !important;
    justify-content: flex-start !important;
    padding: 9px 11px !important;
    font-size: 11.5px !important;
    border-radius: 15px !important;
  }

  body.page-dashboard .top-actions #refreshBtn {
    width: 100% !important;
    min-height: 40px !important;
    height: 40px !important;
    padding: 8px 10px !important;
    border-radius: 15px !important;
    font-size: 12px !important;
  }

  body.page-dashboard .dashboard-cards {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    grid-auto-flow: row !important;
    grid-auto-columns: initial !important;
    gap: 6px !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 0 12px !important;
    scroll-snap-type: none !important;
  }

  body.page-dashboard .dashboard-cards .stat-revenue {
    display: none !important;
  }

  body.page-dashboard .dashboard-cards .card {
    min-width: 0 !important;
    min-height: 68px !important;
    padding: 8px 5px !important;
    border-radius: 14px !important;
    margin: 0 !important;
    scroll-snap-align: unset !important;
    overflow: hidden !important;
  }

  body.page-dashboard .dashboard-cards .card small {
    display: block !important;
    font-size: 8.5px !important;
    line-height: 1.15 !important;
    color: var(--muted) !important;
    overflow-wrap: anywhere !important;
  }

  body.page-dashboard .dashboard-cards .card strong {
    display: block !important;
    margin-top: 6px !important;
    font-size: 15.5px !important;
    line-height: 1.05 !important;
    letter-spacing: -.2px !important;
    white-space: nowrap !important;
  }

  body.page-dashboard .dashboard-cards::-webkit-scrollbar {
    display: none !important;
  }
}

@media (max-width: 390px) {
  body.page-dashboard .topbar h1 {
    font-size: 21px !important;
  }

  body.page-dashboard .topbar p {
    font-size: 11.5px !important;
  }

  body.page-dashboard .topbar-revenue-chip {
    min-width: 108px !important;
    max-width: 112px !important;
    padding: 8px 8px !important;
  }

  body.page-dashboard .topbar-revenue-chip strong {
    font-size: 13px !important;
  }

  body.page-dashboard .top-actions {
    grid-template-columns: minmax(0, 1fr) 86px !important;
  }

  body.page-dashboard .dashboard-cards {
    gap: 5px !important;
  }

  body.page-dashboard .dashboard-cards .card {
    min-height: 64px !important;
    padding: 7px 4px !important;
    border-radius: 13px !important;
  }

  body.page-dashboard .dashboard-cards .card small {
    font-size: 7.8px !important;
  }

  body.page-dashboard .dashboard-cards .card strong {
    font-size: 14px !important;
  }
}
.sidebar nav a.nav { text-decoration: none; display: block; }
