/* =============================================
   POS SYSTEM - style.css
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* -- Palette Hitam-Navy-Emas -- */
  --primary:       #d4af37;
  --primary-d:     #b8932a;
  --primary-l:     #fdf6dc;
  --green:         #2ecc71;
  --green-l:       #d5f5e3;
  --amber:         #f5d97a;
  --amber-l:       #fef9e7;
  --red:           #e74c3c;
  --red-l:         #fde8e6;
  --bg:            #111827;
  --white:         #1a2438;
  --white-true:    #ffffff;
  --text:          #f5d97a;
  --text-body:     #e8d5a3;
  --muted:         #8899aa;
  --border:        #2a3a52;
  --sidebar-bg:    #0a0e17;
  --sidebar-w:     240px;
  --nav-h:         64px;
}

* { margin:0; padding:0; box-sizing:border-box; font-family:'Plus Jakarta Sans',sans-serif; }

body { background: var(--bg); color: var(--text-body); }

/* -- LAYOUT -- */
.layout        { display:flex; min-height:100vh; }
.sidebar       { width:var(--sidebar-w); background:var(--sidebar-bg); color:var(--text); position:fixed; top:0; left:0; height:100vh; display:flex; flex-direction:column; z-index:200; transition:transform .3s; }
.main-content  { margin-left:var(--sidebar-w); flex:1; display:flex; flex-direction:column; min-height:100vh; }

/* -- SIDEBAR -- */
.sidebar-brand { padding:24px 20px 16px; border-bottom:1px solid var(--border); }
.sidebar-brand .brand-name { font-size:18px; font-weight:700; color:var(--primary); }
.sidebar-brand .brand-sub  { font-size:11px; color:var(--muted); }
.sidebar-nav   { flex:1; padding:12px 0; overflow-y:auto; }
.nav-section   { font-size:10px; font-weight:700; letter-spacing:.8px; color:var(--muted); padding:16px 20px 6px; text-transform:uppercase; }
.nav-link      { display:flex; align-items:center; gap:12px; padding:11px 20px; color:var(--muted); text-decoration:none; font-size:14px; font-weight:500; transition:background .15s, color .15s; border-radius:0; }
.nav-link:hover, .nav-link.active { background:rgba(212,175,55,.12); color:var(--primary); border-right:3px solid var(--primary); }
.nav-link .icon { font-size:18px; width:22px; text-align:center; }
.sidebar-user  { padding:16px 20px; border-top:1px solid var(--border); font-size:13px; }
.sidebar-user  .uname { font-weight:600; color:var(--primary); }
.sidebar-user  .urole { font-size:11px; color:var(--muted); }
.sidebar-user  a { color:var(--muted); text-decoration:none; font-size:12px; display:inline-block; margin-top:6px; }
.sidebar-user  a:hover { color:var(--primary); }

/* -- TOPBAR -- */
.topbar        { height:var(--nav-h); background:var(--sidebar-bg); border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 24px; gap:16px; position:sticky; top:0; z-index:100; }
.topbar-title  { font-size:18px; font-weight:700; flex:1; color:var(--primary); }
.topbar-btn    { background:var(--primary); color:#0a0e17; font-weight:700; border:none; border-radius:10px; padding:9px 18px; font-size:13px; font-weight:600; cursor:pointer; font-family:inherit; text-decoration:none; display:inline-flex; align-items:center; gap:6px; transition:opacity .2s; }
.topbar-btn:hover { opacity:.85; }
.topbar-btn.secondary { background:var(--white); color:var(--text-body); border:1px solid var(--border); }

/* -- PAGE BODY -- */
.page-body     { padding:24px; flex:1; }

/* -- CARDS -- */
.card          { background:var(--white); border-radius:16px; border:1px solid var(--border); color:var(--text-body); }
.card-header   { padding:18px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.card-header h3 { font-size:15px; font-weight:700; }
.card-body     { padding:20px; }

/* -- STAT CARDS -- */
.stat-grid     { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card     { background:var(--white); border-radius:16px; padding:20px; border:1px solid var(--border); color:var(--text-body); }
.stat-card .sc-label { font-size:12px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.4px; }
.stat-card .sc-val   { font-size:28px; font-weight:700; margin:6px 0 2px; }
.stat-card .sc-sub   { font-size:12px; color:var(--muted); }
.sc-green { border-left:4px solid var(--green); }
.sc-blue  { border-left:4px solid var(--primary); }
.sc-amber { border-left:4px solid var(--amber); }
.sc-red   { border-left:4px solid var(--red); }

/* -- TABLE -- */
.table-wrap    { overflow-x:auto; }
table          { width:100%; border-collapse:collapse; font-size:14px; }
thead          { background:var(--sidebar-bg); }
th             { padding:12px 16px; text-align:left; font-size:11px; font-weight:700; color:var(--primary); text-transform:uppercase; letter-spacing:.5px; white-space:nowrap; }
td             { padding:13px 16px; border-bottom:1px solid var(--border); vertical-align:middle; color:var(--text-body); }
tr:last-child td { border-bottom:none; }
tr:hover td    { background:rgba(212,175,55,.06); }

/* -- BADGE -- */
.badge         { display:inline-block; padding:4px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.badge-green   { background:rgba(46,204,113,.2); color:#2ecc71; }
.badge-amber   { background:rgba(245,217,122,.2); color:var(--primary); }
.badge-red     { background:rgba(231,76,60,.2); color:#e74c3c; }
.badge-blue    { background:rgba(212,175,55,.15); color:var(--primary); }

/* -- BUTTONS -- */
.btn           { display:inline-flex; align-items:center; gap:6px; border:none; border-radius:8px; padding:8px 14px; font-size:13px; font-weight:600; cursor:pointer; font-family:inherit; text-decoration:none; transition:opacity .2s; }
.btn:hover     { opacity:.85; }
.btn-primary   { background:var(--primary); color:#0a0e17; font-weight:700; }
.btn-green     { background:var(--green);   color:#0a0e17; font-weight:700; }
.btn-red       { background:var(--red);     color:#fff; }
.btn-amber     { background:var(--amber);   color:#fff; }
.btn-ghost     { background:var(--bg); color:var(--text); }
.btn-sm        { padding:6px 11px; font-size:12px; }

/* -- FORMS -- */
.form-group    { margin-bottom:16px; }
.form-group label { display:block; font-size:12px; font-weight:700; color:var(--muted); margin-bottom:6px; letter-spacing:.3px; text-transform:uppercase; }
.form-control  { width:100%; background:var(--sidebar-bg); border:1px solid var(--border); border-radius:10px; padding:12px 14px; font-size:14px; outline:none; font-family:inherit; transition:border-color .2s; color:var(--text-body); }
.form-control:focus { border-color:var(--primary); background:var(--sidebar-bg); box-shadow:0 0 0 2px rgba(212,175,55,.2); }
.form-row      { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media(max-width:600px){ .form-row { grid-template-columns:1fr; } }

/* -- MODAL -- */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:1000; align-items:center; justify-content:center; padding:20px; }
.modal-overlay.open { display:flex; }
.modal         { background:var(--white); border-radius:20px; width:100%; max-width:520px; max-height:90vh; overflow-y:auto; animation:fadeUp .25s ease; border:1px solid var(--border); }
.modal-header  { padding:20px 24px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; background:var(--sidebar-bg); border-radius:20px 20px 0 0; }
.modal-header h4 { font-size:16px; font-weight:700; color:var(--primary); }
.modal-close   { background:none; border:none; font-size:22px; cursor:pointer; color:var(--muted); line-height:1; transition:color .2s; }
.modal-body    { padding:24px; }
.modal-footer  { padding:16px 24px; border-top:1px solid var(--border); display:flex; gap:12px; justify-content:flex-end; background:var(--sidebar-bg); border-radius:0 0 20px 20px; }
@keyframes fadeUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

/* -- ALERT -- */
.alert         { padding:12px 16px; border-radius:10px; font-size:14px; margin-bottom:16px; }
.alert-success { background:rgba(46,204,113,.15); color:#2ecc71; border:1px solid rgba(46,204,113,.3); }
.alert-error   { background:rgba(231,76,60,.15); color:#e74c3c; border:1px solid rgba(231,76,60,.3); }

/* -- MOBILE RESPONSIVE -- */


/* -- LOGIN -- */
.login-page    { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(160deg,#0a0e17 0%,#111827 50%,#1a2438 100%); padding:20px; }
.login-card    { background:var(--white); border-radius:24px; padding:40px 36px; width:100%; max-width:400px; box-shadow:0 20px 60px rgba(0,0,0,.6); border:1px solid var(--border); }
.login-card h1 { font-size:24px; font-weight:700; margin-bottom:4px; color:var(--primary); }
.login-card p  { color:var(--muted); font-size:14px; margin-bottom:28px; }
.login-logo    { font-size:40px; margin-bottom:16px; }

/* -- KASIR POS -- */
.pos-layout    { display:grid; grid-template-columns:1fr 360px; gap:0; height:calc(100vh - var(--nav-h)); }
.pos-products  { padding:20px; overflow-y:auto; background:var(--bg); }
.pos-cart      { background:var(--white); border-left:1px solid var(--border); display:flex; flex-direction:column; }
.product-grid  { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; }
.product-card  { background:var(--white); border-radius:14px; padding:16px 12px; text-align:center; cursor:pointer; border:2px solid transparent; transition:all .2s; }
.product-card:hover  { border-color:var(--primary); transform:translateY(-2px); box-shadow:0 4px 16px rgba(212,175,55,.2); }
.product-card:active { transform:scale(.97); }
.product-card .p-icon  { font-size:32px; margin-bottom:8px; }
.product-card .p-name  { font-size:13px; font-weight:600; margin-bottom:4px; line-height:1.3; }
.product-card .p-price { font-size:13px; color:var(--primary); font-weight:700; }
.product-card .p-stok  { font-size:11px; color:var(--muted); margin-top:2px; }
.pos-cart-header { padding:16px 20px; border-bottom:1px solid var(--border); font-size:15px; font-weight:700; color:var(--primary); }
.cart-items    { flex:1; overflow-y:auto; padding:12px 16px; }
.cart-empty    { text-align:center; color:var(--muted); padding:40px 0; font-size:14px; }
.cart-item     { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.cart-item .ci-name   { flex:1; font-size:13px; font-weight:600; }
.cart-item .ci-price  { font-size:12px; color:var(--muted); }
.cart-item .ci-qty    { display:flex; align-items:center; gap:6px; }
.qty-btn       { width:26px; height:26px; border-radius:6px; border:1px solid var(--border); background:var(--bg); cursor:pointer; font-size:14px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.qty-btn:hover { background:var(--primary-l); border-color:var(--primary); }
.ci-qty span   { font-size:14px; font-weight:700; min-width:22px; text-align:center; }
.ci-del        { background:none; border:none; color:var(--red); cursor:pointer; font-size:16px; }
.cart-total    { padding:16px 20px; border-top:1px solid var(--border); }
.total-row     { display:flex; justify-content:space-between; font-size:14px; margin-bottom:6px; }
.total-row.grand { font-size:18px; font-weight:700; margin-top:8px; color:var(--primary); }
.cart-actions  { padding:0 20px 20px; display:flex; flex-direction:column; gap:10px; }
.btn-bayar     { width:100%; padding:16px; font-size:16px; font-weight:700; border:none; border-radius:14px; background:var(--primary); color:#0a0e17; cursor:pointer; font-family:inherit; transition:opacity .2s; }
.btn-bayar:hover { opacity:.9; }
.btn-clear     { width:100%; padding:12px; font-size:14px; font-weight:600; border:none; border-radius:12px; background:var(--red-l); color:var(--red); cursor:pointer; font-family:inherit; }

/* -- STRUK -- */
.struk         { font-size:13px; font-family:monospace; max-width:300px; margin:0 auto; padding:20px; }
.struk hr      { border:none; border-top:1px dashed #999; margin:10px 0; }
.struk .s-center { text-align:center; }
.struk .s-bold   { font-weight:bold; }
.struk table   { width:100%; font-size:12px; }
.struk td      { padding:3px 0; border:none; }

@media print {
  body * { visibility:hidden; }
  .struk, .struk * { visibility:visible; }
  .struk { position:absolute; left:0; top:0; }
}

/* =============================================
   MOBILE RESPONSIVE - Breakpoint 768px
   ============================================= */

/* -- Bottom Navigation Bar (mobile only) -- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 68px;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  z-index: 300;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 8px 8px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.5);
}

/* Tombol biasa */
.mobile-nav-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px 8px; border: none; background: none;
  cursor: pointer; font-family: inherit; color: var(--muted);
  font-size: 10px; font-weight: 600; border-radius: 12px;
  transition: color .15s; flex: 1; text-decoration: none;
  white-space: nowrap;
}
.mobile-nav-btn .mni { font-size: 22px; display: block; line-height: 1; }
.mobile-nav-btn.active { color: var(--primary); }
.mobile-nav-btn.active .mni-wrap {
  background: rgba(212,175,55,.15); border-radius: 10px; padding: 4px 10px;
}

/* Tombol PENJUALAN - bulat besar di tengah */
.mobile-nav-btn.center-fab {
  flex: 0 0 64px;
  position: relative;
  top: -16px;
  background: none;
  padding: 0;
  gap: 0;
  color: var(--white);
}
.mobile-nav-btn.center-fab .fab-circle {
  width: 60px; height: 60px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 20px rgba(212,175,55,.5);
  border: 3px solid var(--white);
  margin-bottom: 4px;
}
.mobile-nav-btn.center-fab .fab-label {
  font-size: 10px; font-weight: 700;
  color: var(--primary); display: block; text-align: center;
}
.mobile-nav-btn.center-fab.active .fab-circle {
  background: var(--primary-d);
}

/* -- Sidebar overlay (mobile) -- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 190;
}
.sidebar-overlay.open { display: block; }

/* -- Hamburger button (mobile) -- */
.hamburger {
  display: none; background: none; border: none;
  font-size: 22px; cursor: pointer; padding: 6px;
  color: var(--text); line-height: 1;
}

@media (max-width: 768px) {

  /* Sembunyikan sidebar, tampilkan hamburger */
  .sidebar          { transform: translateX(-100%); z-index: 200; box-shadow: 4px 0 20px rgba(0,0,0,.2); }
  .sidebar.open     { transform: translateX(0); }
  .main-content     { margin-left: 0; }
  .hamburger        { display: block; }

  /* Topbar mobile */
  .topbar           { padding: 0 14px; gap: 10px; }
  .topbar-title     { font-size: 15px; }
  .topbar-btn       { padding: 7px 12px; font-size: 12px; }
  .topbar-btn span  { display: none; }

  /* Page body */
  .page-body        { padding: 12px; padding-bottom: 72px; }

  /* Stat grid - 2 kolom di mobile */
  .stat-grid        { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card .sc-val { font-size: 22px; }

  /* Tabel - scroll horizontal */
  .table-wrap       { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td            { padding: 10px 12px; font-size: 13px; }

  /* Card */
  .card-header      { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
  .card-body        { padding: 14px 16px; }

  /* Form */
  .form-row         { grid-template-columns: 1fr; }
  .modal            { border-radius: 20px 20px 0 0; padding: 20px 16px; }
  .modal-overlay    { align-items: flex-end; padding: 0; }

  /* Bottom nav tampil */
  .mobile-nav       { display: flex; }

  /* -- POS Layout mobile: FULL VIEWPORT, tidak scroll -- */
  .pos-layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    height: calc(100vh - var(--nav-h) - 68px);
    overflow: hidden;
  }

  /* Tab switcher */
  .pos-tab-bar {
    display: flex !important;
    background: var(--white);
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
  }
  .pos-tab {
    flex: 1; padding: 10px; text-align: center; font-size: 13px;
    font-weight: 700; color: var(--muted); cursor: pointer;
    border: none; background: none; font-family: inherit;
    border-bottom: 3px solid transparent; transition: all .2s;
  }
  .pos-tab.active { color: var(--primary); border-bottom-color: var(--primary); background:rgba(212,175,55,.05); }

  /* Panel produk & keranjang masing-masing isi penuh */
  .pos-products {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
  }
  .pos-products.tab-active { display: block; }

  .pos-cart {
    border-left: none;
    border-top: none;
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
  }
  .pos-cart.tab-active { display: flex; }

  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .product-card { padding: 10px 6px; }
  .product-card .p-icon { font-size: 24px; margin-bottom: 4px; }
  .product-card .p-name { font-size: 11px; }
  .product-card .p-price { font-size: 11px; }
  .product-card .p-stok { font-size: 10px; }

  /* Cart bagian dalam */
  .pos-cart-header { padding: 10px 14px; font-size: 13px; flex-shrink: 0; }
  .cart-items      { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 14px; }
  .cart-total      { flex-shrink: 0; padding: 10px 14px; }
  .cart-actions    { flex-shrink: 0; padding: 0 14px 76px; }

  /* Tombol scan */
  .scan-btn         { padding: 8px 12px; font-size: 12px; }

  /* Filter form laporan */
  .filter-form      { flex-direction: column; align-items: stretch !important; }
  .filter-form .form-group { width: 100%; }
  .filter-form input,
  .filter-form select { width: 100% !important; }

  /* Topbar action buttons - stack */
  .topbar-actions   { display: flex; gap: 6px; }

  /* Sticky bar stok */
  .sticky-bar       { padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .sticky-bar .btn  { padding: 10px 14px; font-size: 13px; }

  /* Sembunyikan kolom tidak penting di tabel kecil */
  .hide-mobile      { display: none !important; }

  /* Login */
  .login-card       { padding: 28px 20px; border-radius: 20px; }
}

@media (max-width: 480px) {
  .stat-grid        { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card        { padding: 14px 12px; }
  .stat-card .sc-val { font-size: 20px; }
  .product-grid     { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .product-card     { padding: 10px 6px; }
  .product-card .p-icon { font-size: 22px; }
  .product-card .p-name { font-size: 11px; }
  .product-card .p-price { font-size: 11px; }
}

/* -- POS page khusus: tidak ada padding page-body -- */
@media (max-width: 768px) {
  .pos-page .page-body {
    padding: 0 !important;
    padding-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--nav-h));
    overflow: hidden;
  }
  .pos-page .main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
}

/* =============================================
   FIX TAMBAHAN - POS & HALAMAN LAIN
   ============================================= */

/* Tombol bayar cepat di panel produk (mobile) */
.mobile-quick-bayar {
  margin-bottom: 10px;
  display: none;
}

/* -- POS: pastikan layout tidak overflow -- */
@media (max-width: 768px) {
  /* Halaman penjualan: seluruh konten pas di viewport */
  .pos-page body,
  body.pos-page { overflow: hidden; }

  .pos-page .main-content {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .pos-page .topbar { flex-shrink: 0; }

  .pos-page .page-body {
    flex: 1;
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .pos-tab-bar { flex-shrink: 0; }

  .pos-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Panel produk */
  .pos-products {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 10px 68px 10px;
    display: none;
  }
  .pos-products.tab-active { display: block; }

  /* Panel keranjang */
  .pos-cart {
    height: 100%;
    overflow: hidden;
    display: none;
    flex-direction: column;
  }
  .pos-cart.tab-active { display: flex; }

  .cart-items {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  .cart-total   { flex-shrink: 0; padding: 10px 14px; }
  .cart-actions { flex-shrink: 0; padding: 0 14px 76px; }

  /* -- LAPORAN mobile -- */
  .laporan-grid-2 { grid-template-columns: 1fr !important; }

  .filter-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  .filter-form input[type="date"],
  .filter-form select,
  .filter-form button { width: 100% !important; }

  /* Stat grid laporan */
  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* -- BARANG mobile -- */
  .barang-search-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .barang-search-row input { max-width: 100% !important; }

  /* -- AKUN mobile -- */
  .akun-table th:nth-child(3),
  .akun-table td:nth-child(3) { display: none; }

  /* Card header wrap di mobile */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-header h3 { font-size: 14px; }

  /* Topbar title lebih kecil */
  .topbar-title { font-size: 14px !important; }

  /* Sembunyikan teks panjang di topbar button, tampilkan hanya ikon */
  .topbar .topbar-btn .btn-text { display: none; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .product-card { padding: 8px 4px; border-radius: 10px; }
  .product-card .p-icon  { font-size: 22px; margin-bottom: 3px; }
  .product-card .p-name  { font-size: 10px; }
  .product-card .p-price { font-size: 10px; font-weight: 700; }
  .product-card .p-stok  { display: none; }
}

/* =============================================
   MASTER MOBILE FIX - override semua konflik
   ============================================= */

/* Global: pastikan tidak ada elemen yang melebarkan halaman */
html, body { max-width: 100%; overflow-x: hidden; }

/* Tabel: jangan paksa lebar, biarkan wrapper yang scroll */
table { min-width: unset; width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

@media (max-width: 768px) {

  /* -- Reset dasar -- */
  html, body { overflow-x: hidden; width: 100%; }

  /* -- Sidebar -- */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }

  /* -- Page body default -- */
  .page-body { padding: 12px; padding-bottom: 76px; }

  /* -- Topbar -- */
  .topbar { padding: 0 12px; gap: 8px; min-height: var(--nav-h); }
  .topbar-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-btn { padding: 7px 10px; font-size: 12px; white-space: nowrap; }

  /* -- Bottom nav -- */
  .mobile-nav { display: flex; }

  /* -- Stat grid 2 kolom -- */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 14px 12px; }
  .stat-card .sc-val { font-size: 20px; }
  .stat-card .sc-label { font-size: 11px; }
  .stat-card .sc-sub { font-size: 11px; }

  /* -- Tabel: tidak paksa lebar -- */
  table { font-size: 12px; width: 100%; }
  th, td { padding: 8px 10px; }
  /* Kolom aksi tetap terlihat */
  td:last-child, th:last-child { white-space: nowrap; }

  /* -- Card -- */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-header h3 { font-size: 13px; }
  .card-body { padding: 12px 14px; }

  /* -- Form & modal -- */
  .form-row { grid-template-columns: 1fr; }
  .modal { border-radius: 20px 20px 0 0; padding: 18px 16px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .form-control { font-size: 16px; }

  /* -- Filter laporan -- */
  .filter-form { flex-direction: column !important; gap: 8px !important; }
  .filter-form > div, .filter-form input, .filter-form select, .filter-form button {
    width: 100% !important;
  }
  .filter-form input[type="date"] { width: 100% !important; }

  /* -- Grid 2 kolom laporan jadi 1 -- */
  .laporan-grid-2 { grid-template-columns: 1fr !important; }

  /* -- Search barang -- */
  .barang-search-row { flex-direction: column !important; }
  .barang-search-row input { max-width: 100% !important; }

  /* -- HIDE kolom tidak penting di mobile -- */
  .hide-mobile { display: none !important; }

  /* -- Login -- */
  .login-card { padding: 24px 18px; }
}

/* -------------------------------------
   POS PENJUALAN - full viewport mobile
   ------------------------------------- */
@media (max-width: 768px) {
  body.pos-page { overflow: hidden; height: 100vh; }

  body.pos-page .main-content {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.pos-page .topbar { flex-shrink: 0; }

  body.pos-page .page-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
  }

  .pos-tab-bar { flex-shrink: 0; display: none; }

  .pos-layout {
    flex: 1;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    grid-template-columns: unset !important;
    height: auto !important;
    overflow: hidden;
  }

  /* Panel produk */
  .pos-products {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    padding-bottom: 76px;
    display: none;
    background: var(--bg);
  }
  .pos-products.tab-active { display: block; }

  /* Panel keranjang */
  .pos-cart {
    flex: 1;
    min-height: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-left: none !important;
    border-top: 1px solid var(--border);
  }
  .pos-cart.tab-active { display: flex; }

  .pos-cart-header { flex-shrink: 0; padding: 10px 14px; font-size: 13px; }
  .cart-items { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px; }
  .cart-total { flex-shrink: 0; padding: 10px 14px; border-top: 1px solid var(--border); }
  .cart-actions { flex-shrink: 0; padding: 0 14px 76px; gap: 8px; }
  .btn-bayar { padding: 13px; font-size: 15px; }
  .btn-clear { padding: 10px; font-size: 13px; }

  /* Product grid mobile */
  .product-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 7px; }
  .product-card { padding: 10px 6px; border-radius: 12px; }
  .product-card .p-icon  { font-size: 24px; margin-bottom: 4px; }
  .product-card .p-name  { font-size: 11px; line-height: 1.2; }
  .product-card .p-price { font-size: 11px; }
  .product-card .p-stok  { font-size: 10px; }

  /* Quick bayar bar */
  .mobile-quick-bayar { display: block; margin-bottom: 8px; }
}

@media (max-width: 400px) {
  .product-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 5px; }
  .product-card { padding: 8px 4px; }
  .product-card .p-icon { font-size: 20px; }
  .product-card .p-name { font-size: 10px; }
  .product-card .p-price { font-size: 10px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* =============================================
   DARK GOLD THEME - Override & Polish
   ============================================= */

/* Scrollbar gelap */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Pastikan semua teks terbaca */
strong, h1, h2, h3, h4, h5, h6 { color: var(--text); }
p, span, div { color: inherit; }
label { color: var(--muted) !important; }
code  { color: var(--primary); background: rgba(212,175,55,.1); padding: 2px 6px; border-radius: 4px; }

/* Link tabel agar terbaca */
a { color: var(--primary); }
a:hover { color: var(--amber); }

/* Card header teks */
.card-header h3 { color: var(--text); }
.card-body { color: var(--text-body); }

/* Stat card nilai */
.stat-card .sc-val { color: var(--primary); }
.stat-card .sc-label { color: var(--muted); }
.stat-card .sc-sub { color: var(--muted); }

/* Search input placeholder */
::placeholder { color: var(--muted); opacity: .7; }
input, select, textarea {
  background: var(--sidebar-bg) !important;
  color: var(--text-body) !important;
  border-color: var(--border) !important;
}
select option { background: var(--sidebar-bg); color: var(--text-body); }

/* Chip filter stok */
.chip-all    { background: var(--white); color: var(--muted); border: 1px solid var(--border); }
.chip-habis  { background: rgba(231,76,60,.12); color: #e87070; border: 1px solid rgba(231,76,60,.25); }
.chip-rendah { background: rgba(212,175,55,.12); color: #c9a227; border: 1px solid rgba(212,175,55,.25); }
.chip-aman   { background: rgba(46,204,113,.12); color: #4bcf80; border: 1px solid rgba(46,204,113,.25); }
.chip.active { box-shadow: 0 0 0 2px currentColor; filter: brightness(1.15); }

/* Stok input & tipe select */
.stok-input {
  background: var(--sidebar-bg) !important;
  border-color: var(--border) !important;
  color: var(--text-body) !important;
}
.stok-input.changed { border-color: var(--primary) !important; background: rgba(212,175,55,.08) !important; }
.tipe-select { background: var(--sidebar-bg) !important; color: var(--text-body) !important; border-color: var(--border) !important; }

/* Bottom nav text */
.mobile-nav-btn { color: var(--muted); }
.mobile-nav-btn.active { color: var(--primary); }
.fab-label { color: var(--primary) !important; }

/* Pagination */
.btn-ghost { background: var(--white); color: var(--text-body); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(212,175,55,.1); color: var(--primary); }

/* POS tab bar */
.pos-tab-bar { background: var(--sidebar-bg); border-bottom: 1px solid var(--border); }
.pos-tab { background: none; color: var(--muted); border-bottom: 3px solid transparent; }
.pos-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Product card di POS */
.product-card { background: var(--white); }
.product-card .p-name { color: var(--text-body); }
.product-card .p-stok { color: var(--muted); }

/* Cart items */
.cart-item .ci-name { color: var(--text); }
.cart-item .ci-price { color: var(--muted); }
.cart-total { border-top: 1px solid var(--border); }
.total-row { color: var(--text-body); }
.total-row.grand { color: var(--primary); }
.cart-empty { color: var(--muted); }

/* Qty buttons */
.qty-btn { background: var(--bg); border-color: var(--border); color: var(--text-body); }
.qty-btn:hover { background: rgba(212,175,55,.15); border-color: var(--primary); color: var(--primary); }

/* Btn clear */
.btn-clear { background: rgba(231,76,60,.15); color: #e74c3c; }

/* Recent list & activity */
.recent-info .rname { color: var(--text); }
.recent-info .rsub  { color: var(--muted); }
.recent-time        { color: var(--muted); }
.act-info           { color: var(--text-body); }
.act-info .act-sub  { color: var(--muted); }

/* Profil page */
.profil-hero { background: linear-gradient(135deg, #0a0e17 0%, #111827 100%); border-bottom: 2px solid var(--primary); }
.profil-avatar { background: rgba(212,175,55,.2); border-color: var(--primary); }
.profil-role { background: rgba(212,175,55,.2); color: var(--primary); }
.info-card { background: var(--white); border-color: var(--border); }
.info-label { color: var(--muted) !important; }
.info-value { color: var(--text); }
.action-btn { background: var(--white); border-color: var(--border); color: var(--text-body); }
.action-btn:hover { background: rgba(212,175,55,.08); }
.action-btn.danger .ab-text { color: #e74c3c !important; }

/* Login card */
.login-card { color: var(--text-body); }
.login-card label { color: var(--muted) !important; }

/* Scrollbar pada mobile */
@media (max-width: 768px) {
  .mobile-nav { background: var(--sidebar-bg) !important; border-top: 1px solid var(--border); }
  .pos-products { background: var(--bg) !important; }
  .pos-cart { background: var(--white) !important; }
}

/* Date input — pastikan teks dan icon kalender terlihat */
input[type="date"] {
  color: var(--text-body) !important;
  background: var(--white) !important;
  border: 1px solid var(--border) !important;
  color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(2) hue-rotate(5deg);
  cursor: pointer;
  opacity: 0.8;
}
input[type="date"]::-webkit-datetime-edit { color: var(--text-body); }
input[type="date"]::-webkit-datetime-edit-fields-wrapper { color: var(--text-body); }
