/* ==================================================================
   android.css — layout khusus perangkat Android (HP / tablet)
   Aktif hanya bila <html> memiliki kelas .android-ui (lihat app.html).
   Desktop tidak terpengaruh karena semua aturan berscope di sini.
   ================================================================== */
html.android-ui { -webkit-text-size-adjust: 100%; }
html.android-ui body { overscroll-behavior-y: contain; overflow-x: hidden; }
html.android-ui .content,
html.android-ui .card { min-width: 0; }

/* ---------- Shell: sidebar jadi drawer, konten penuh lebar ---------- */
html.android-ui .sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: min(86vw, 320px); transform: translateX(-100%);
  transition: transform .22s ease; box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
html.android-ui .sidebar.open { transform: none; }
html.android-ui .sidebar-toggle { display: none; }
html.android-ui .sidebar-backdrop { z-index: 55; }
html.android-ui .main { margin-left: 0; width: 100%; min-width: 0; }

/* ---------- Topbar ringkas ---------- */
html.android-ui .topbar {
  position: sticky; top: 0; z-index: 30;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  min-height: 58px; gap: 8px;
  background: var(--paper, #fff);
  box-shadow: 0 1px 0 var(--line, #e6e2d8);
}
html.android-ui .menu-toggle { display: grid; width: 42px; height: 42px; border-radius: 12px; }
html.android-ui .topbar-title h1 { font-size: 17px; line-height: 1.2; }
html.android-ui .topbar-title p { display: none; }
html.android-ui .net-pill,
html.android-ui .server-chip,
html.android-ui #outboxBtn,
html.android-ui #helpBtn,
html.android-ui #logoutBtn,
html.android-ui #quickPosBtn { display: none !important; }
html.android-ui #notifBtn { width: 40px; height: 40px; border-radius: 12px; }
html.android-ui .topbar-tools { gap: 4px; }

/* ---------- Konten ---------- */
html.android-ui .content {
  padding: 12px 12px calc(96px + env(safe-area-inset-bottom));
  max-width: none;
}
html.android-ui .grid-2,
html.android-ui .grid-3,
html.android-ui .grid-4,
html.android-ui .form-grid,
html.android-ui .soap-grid { grid-template-columns: 1fr; }
html.android-ui .np-headrow { grid-template-columns: 1fr !important; }
html.android-ui .card { padding: 14px; border-radius: 14px; }
html.android-ui .card-head { margin-bottom: 10px; }
html.android-ui .status-ops { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
html.android-ui .status-chip { padding: 10px; border-radius: 12px; }
html.android-ui .kpi-value { font-size: 1.7rem; }
html.android-ui .hero-strip { padding: 16px; border-radius: 16px; }
html.android-ui .hero-strip h2 { font-size: 22px; }
html.android-ui .page-actions-row { flex-wrap: wrap; }
html.android-ui .btn { min-height: 42px; border-radius: 11px; }
html.android-ui .btn-sm { min-height: 38px; }
html.android-ui .btn-xs { min-height: 32px; }
html.android-ui .input,
html.android-ui .select,
html.android-ui textarea.input { min-height: 44px; font-size: 16px; border-radius: 11px; }
html.android-ui label { font-size: 13px; }
html.android-ui .help { font-size: 12px; line-height: 1.55; }

/* Tabel: bikin bisa di-scroll horizontal tanpa melebar halaman */
html.android-ui .table-card,
html.android-ui .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
html.android-ui .table { min-width: 560px; font-size: 12.5px; }
html.android-ui .table th,
html.android-ui .table td { padding: 9px 10px; white-space: nowrap; }
html.android-ui .table thead th { position: sticky; top: 0; z-index: 1; }

/* Tab filter: geser horizontal, jangan melebar halaman */
html.android-ui .tabs {
  max-width: 100%; overflow-x: auto; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
html.android-ui .tabs::-webkit-scrollbar { display: none; }
html.android-ui .tabs .tab { flex: 0 0 auto; }
html.android-ui .flex.wrap { max-width: 100%; }

/* ---------- Navigasi bawah ---------- */
.android-bottom { display: none; }
html.android-ui .android-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper, #fff);
  border-top: 1px solid var(--line, #e6e2d8);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 22px rgba(20,35,31,.08);
}
html.android-ui .android-bottom button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 54px; padding: 4px 2px; border: 0; background: transparent;
  color: var(--muted, #78827c); font-size: 10.5px; font-weight: 600;
  border-radius: 12px; cursor: pointer;
}
html.android-ui .android-bottom button .ico { width: 22px; height: 22px; display: grid; place-items: center; }
html.android-ui .android-bottom button .ico svg { width: 21px; height: 21px; }
html.android-ui .android-bottom button.active { color: var(--gold-2, #b9a02f); background: rgba(185,160,47,.10); }
html.android-ui .android-bottom button.pos .ico {
  width: 44px; height: 44px; margin-top: -18px; border-radius: 50%;
  background: var(--forest, #0d3b2e); color: #f7f1e3;
  box-shadow: 0 6px 16px rgba(13,59,46,.35);
}
html.android-ui .android-bottom button.pos .ico svg { width: 22px; height: 22px; }
html.android-ui .android-bottom button.pos span:last-child { margin-top: 2px; }
html.android-ui .android-bottom button:active { transform: scale(.96); }

/* ---------- Modal & drawer: full-screen bawah ---------- */
html.android-ui .modal-backdrop { padding: 0; align-items: flex-end; }
html.android-ui .modal {
  width: 100%; max-width: none; max-height: 92dvh;
  border-radius: 18px 18px 0 0; overflow: hidden;
  display: flex; flex-direction: column;
}
html.android-ui .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
html.android-ui .modal-head,
html.android-ui .modal-foot { padding-left: 16px; padding-right: 16px; }
html.android-ui .drawer { max-width: 92vw; width: 92vw; }
html.android-ui .toast-wrap {
  left: 50%; right: auto; top: 50%; bottom: auto;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 24px)); max-width: none;
}

/* ---------- POS: produk 2 kolom, keranjang menempel ---------- */
html.android-ui .pos-layout { grid-template-columns: 1fr; gap: 12px; }
html.android-ui .pos-product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
html.android-ui .pos-product-card { padding: 10px; border-radius: 12px; }
html.android-ui .pos-cart { position: static; }
html.android-ui .pos-cart-body { max-height: 42vh; }

/* ---------- HP kecil (≤ 380px) ---------- */
@media (max-width: 600px) {
  /* Grid dengan minmax() inline (kartu pie dll.) dipaksa 1 kolom agar
     tidak melebar di HP kecil. */
  html.android-ui .grid[style*="minmax("] { grid-template-columns: 1fr !important; }
}
@media (max-width: 380px) {
  html.android-ui .content { padding: 10px 9px calc(92px + env(safe-area-inset-bottom)); }
  html.android-ui .card { padding: 11px; }
  html.android-ui .topbar { padding-left: 8px; padding-right: 8px; }
  html.android-ui .topbar-title h1 { font-size: 16px; }
  html.android-ui .hero-strip { padding: 13px; }
  html.android-ui .hero-strip h2 { font-size: 20px; }
  html.android-ui .status-ops { gap: 6px; }
  html.android-ui .status-chip { padding: 8px; }
  html.android-ui .status-chip b { font-size: 15px; }
  html.android-ui .status-chip small { font-size: 9.5px; }
  html.android-ui .kpi-value { font-size: 1.5rem; }
  html.android-ui .android-bottom button { font-size: 9.5px; }
  html.android-ui .table { min-width: 520px; }
}

/* ---------- Tablet (≥ 600px) ---------- */
@media (min-width: 600px) {
  html.android-ui .content { padding: 16px 18px calc(96px + env(safe-area-inset-bottom)); }
  html.android-ui .grid-4,
  html.android-ui .form-grid,
  html.android-ui .soap-grid,
  html.android-ui .status-ops,
  html.android-ui .pos-product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  html.android-ui .pos-product-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  html.android-ui .status-ops { grid-template-columns: repeat(3, minmax(0,1fr)); }
  html.android-ui .np-headrow { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
  html.android-ui .android-bottom button { font-size: 11.5px; }
}

/* ---------- Tablet besar / landscape (≥ 900px) ---------- */
@media (min-width: 900px) {
  html.android-ui .android-bottom { display: none; }
  html.android-ui .content { padding-bottom: 60px; }
  html.android-ui .sidebar { position: relative; transform: none; box-shadow: none; }
  html.android-ui .menu-toggle { display: none; }
  html.android-ui .grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
