/* =====================================================
   Rental PS — Stylesheet (mobile-first)
   -----------------------------------------------------
   Semua warna diatur lewat variabel di :root — ubah di
   sini, seluruh halaman ikut berubah (Unit, F&B,
   Transaksi, Pengeluaran, Laporan, Master, Pengaturan,
   Login).
   Prinsip:
   - SATU warna aksen (--accent) untuk semua tombol aksi.
   - Semua permukaan & tombol memakai warna solid (tanpa efek dekoratif).
   - Target sentuh besar (--tap) untuk kasir di HP/tablet.
   - Angka total & status paling menonjol (hierarki jelas).
   ===================================================== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ---- TEMA TERANG (default) ----
     Palet "Biru kasir bersih": latar netral, kartu putih,
     satu aksen biru solid (tanpa gradien). */
  color-scheme: light;

  /* ---- permukaan & teks ---- */
  --bg: #F4F5F7;
  --bg-2: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #F1F3F7;
  --line: #E2E6EC;
  --line-soft: #EDF0F4;
  --text: #161A23;
  --muted: #5B6472;

  /* ---- permukaan tambahan ---- */
  --surface-2: rgba(22, 26, 35, .05);           /* tombol ghost / chip */
  --surface-3: rgba(22, 26, 35, .035);          /* baris item / ringkasan */
  --field-bg: #FFFFFF;
  --placeholder: rgba(22, 26, 35, .42);
  --scroll-thumb: rgba(22, 26, 35, .22);
  --overlay: rgba(15, 23, 42, .55);
  --danger-bg: #FDECEC;

  /* ---- SATU warna aksen untuk seluruh aplikasi ---- */
  --accent: #2563EB;                            /* biru solid (tanpa gradien) */
  --accent-2: #1D4ED8;                          /* shade aksen (hover/tekan) */
  --accent-ink: #FFFFFF;                        /* teks di atas aksen */
  --accent-soft: rgba(37, 99, 235, .12);
  --accent-line: rgba(37, 99, 235, .45);
  --accent-text: #1D4ED8;                       /* teks beraksen di latar terang */

  /* ---- warna status (bukan aksen, hanya makna) ---- */
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --green-text: #157a3d;
  --orange-text: #a05a08;
  --red-text: #c53030;
  --blue-text: #1d4ed8;
  --total-text: #131a2a;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 24px rgba(23, 32, 64, .10);
  --tap: 46px;                                  /* target sentuh minimum */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---- TEMA GELAP (pilihan, dipertahankan apa adanya) ---- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f1a;
  --bg-2: #101625;
  --card: #151c2d;
  --card-2: #1b2438;
  --line: #26314a;
  --line-soft: rgba(38, 49, 74, .55);
  --text: #e9eefb;
  --muted: #8b98b4;

  --surface-2: rgba(255, 255, 255, .05);
  --surface-3: rgba(255, 255, 255, .035);
  --field-bg: #0d1322;
  --placeholder: #5f6b86;
  --scroll-thumb: rgba(255, 255, 255, .14);
  --overlay: rgba(4, 7, 16, .74);
  --danger-bg: #2a1622;

  --accent-soft: rgba(37, 99, 235, .16);
  --accent-line: rgba(37, 99, 235, .5);
  --accent-text: #9ec1ff;

  --green-text: #7ce8a8;
  --orange-text: #ffcb82;
  --red-text: #ff9b9b;
  --blue-text: #9fc6ff;
  --total-text: #ffffff;

  --shadow: 0 10px 24px rgba(3, 7, 18, .45);
}

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  max-width: 100%;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; }

/* ================= BUTTONS ================= */
.btn {
  font: inherit; font-weight: 700; font-size: 14.5px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  min-height: var(--tap); padding: 12px 18px; cursor: pointer; color: var(--text);
  background: var(--card-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
}
.btn:active { background: var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: var(--accent-2); }
.btn.success { background: var(--green); color: #04210f; }
.btn.warn { background: var(--orange); color: #241300; }
.btn.danger { background: rgba(239, 68, 68, .16); color: var(--red-text); border-color: rgba(239, 68, 68, .42); }
.btn.ghost { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 9px 14px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--card-2); }

/* ================= FORMS ================= */
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  min-height: var(--tap); padding: 11px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input[type="date"] { min-width: 0; }
label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }

/* ================= LOGIN ================= */
.login-screen {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow-y: auto;
}
.login-card {
  position: relative; width: 100%; max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-logo {
  width: 48px; height: 48px; border-radius: 14px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; font-size: 24px;
  background: var(--accent);
}
.brand-logo.small { width: 38px; height: 38px; font-size: 18px; border-radius: 11px; }
.login-brand h1 { font-size: 20px; letter-spacing: -.02em; }
.login-brand p { font-size: 12px; color: var(--muted); }

.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form input { margin-bottom: 6px; }
.login-error { color: var(--red-text); font-size: 13px; background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .3); padding: 9px 11px; border-radius: 9px; }
.login-version { text-align: center; font-size: 11px; color: var(--muted); margin-top: 14px; letter-spacing: .04em; }

.server-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.server-box summary { cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 8px 0; }
.server-inner { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.server-row { display: flex; gap: 8px; }
.server-row .btn { flex: 1; }
.server-status { font-size: 12px; color: var(--muted); min-height: 16px; }
.server-status.ok { color: var(--green-text); }
.server-status.err { color: var(--red-text); }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.55; }


/* ================= SHEET ================= */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 80; background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-b));
  box-shadow: var(--shadow);
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h3 { font-size: 17.5px; letter-spacing: -.01em; }
.sheet-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sheet-close {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  width: 40px; height: 40px; border-radius: 11px; font-size: 16px; cursor: pointer; flex: 0 0 auto;
}
.sheet-close:active { background: var(--card-2); }
.sheet-body { display: flex; flex-direction: column; gap: 10px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }

/* ================= TOAST ================= */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(84px + var(--safe-b)); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 90vw; background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 15px; border-radius: 11px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
}
.toast.ok { border-color: rgba(34, 197, 94, .5); }
.toast.err { border-color: rgba(239, 68, 68, .55); background: var(--danger-bg); }
.toast.info { border-color: var(--accent-line); }

/* ================= APP LAYOUT (mobile) ================= */
.app { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--bg-2);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.net-badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted);
}
.net-badge.ok { color: var(--green-text); border-color: rgba(34, 197, 94, .45); background: rgba(34, 197, 94, .1); }
.net-badge.err { color: var(--red-text); border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .1); }
.user-chip {
  display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px; cursor: pointer;
  min-height: 44px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; color: var(--text);
}
.user-chip > span:first-child {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px;
}
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-chip-text strong { font-size: 12px; }
.user-chip-text small { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

main { flex: 1 1 auto; min-width: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(96px + var(--safe-b)); }
.page { display: none; }
.page.active { display: block; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-head h2 { font-size: 21px; letter-spacing: -.02em; }
.page-head p { margin-top: 2px; }

.nav {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 2px;
  background: var(--bg-2);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b));
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px;
  min-height: 56px;
  background: none; border: none; color: var(--muted); cursor: pointer; border-radius: 11px;
  font: inherit; transition: color .12s ease, background .12s ease;
}
.nav-btn span { font-size: 18px; line-height: 1; }
.nav-btn em { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: 0; line-height: 1.15; text-align: center; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-btn.active { color: var(--text); background: var(--accent-soft); }

/* ================= DRAWER (menu HP) =================
   Di HP bottom-nav disembunyikan total; menu dibuka lewat tombol hamburger
   di topbar. Drawer geser halus dari kiri. Di PC/tablet lebar hamburger &
   drawer disembunyikan (navigasi tetap sidebar/bar yang sudah ada). */
.hamburger {
  display: none;
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
  align-items: center; justify-content: center;
}
.hamburger:active { background: var(--card-2); }

.drawer-overlay {
  position: fixed; inset: 0; z-index: 60; background: var(--overlay);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 61;
  width: min(78vw, 300px); max-width: 86vw;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .28s cubic-bezier(.22, .61, .36, 1);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--line);
}
.drawer-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.drawer-close {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-size: 16px; cursor: pointer;
}
.drawer-close:active { background: var(--card-2); }

.drawer-nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; overflow-y: auto; }
.drawer-nav .nav-btn {
  flex-direction: row; gap: 10px; padding: 12px 13px; border-radius: 12px;
  min-height: 48px; justify-content: flex-start; width: 100%;
}
.drawer-nav .nav-btn span { font-size: 17px; }
.drawer-nav .nav-btn em { font-size: 13.5px; }

/* ================= UNIT CARDS ================= */
.unit-stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stat-pill {
  font-size: 11px; font-weight: 800; padding: 6px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
}
.stat-pill.free { color: var(--green-text); border-color: rgba(34, 197, 94, .4); }
.stat-pill.run { color: var(--accent-text); border-color: var(--accent-line); }
.stat-pill.pause { color: var(--orange-text); border-color: rgba(245, 158, 11, .45); }

.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(158px, 100%), 1fr)); gap: 10px; }

/* Wadah halaman Unit menampung beberapa seksi kategori → susun vertikal,
   bukan grid (agar seksi tidak berbagi kolom). */
#unit-grid { display: flex; flex-direction: column; gap: 18px; }

/* Seksi per kategori: judul kategori + grid unit sendiri (kartu tetap kecil). */
.unit-section { margin-bottom: 0; }
.unit-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.unit-section-title { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.unit-section-count { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* Kartu unit dibungkus agar tombol TV (ikon monitor) bisa menempel di sudut kanan atas.
   Saat tombol TV tampil (.has-tv), baris atas kartu diberi ruang kanan sehingga
   tombol TIDAK PERNAH menumpuk badge TERSEDIA / nama unit, di lebar mana pun. */
.unit-wrap { position: relative; display: flex; min-width: 0; }
.unit-wrap > .unit-card { flex: 1 1 auto; width: 100%; min-width: 0; }
.unit-wrap.has-tv .unit-top { padding-right: 44px; }

.tv-btn {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; padding: 0;
  color: #fff; background: #d63b3b; border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 2px 8px rgba(214, 59, 59, .35);
}
/* Area sentuh diperluas ke >= 46px tanpa memperbesar tampilan tombol. */
.tv-btn::after { content: ''; position: absolute; inset: -6px; border-radius: 14px; }
.tv-btn:hover { background: #e04848; }
.tv-btn.mapped { background: #1f9d55; box-shadow: 0 2px 8px rgba(31, 157, 85, .35); }
.tv-btn.mapped:hover { background: #24b262; }

.unit-card {
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--green);
  border-radius: var(--radius); padding: 13px; display: flex; flex-direction: column; gap: 9px;
  min-height: 132px;
}
.unit-card:active { background: var(--card-2); }
.unit-card.run { border-left-color: var(--accent); }
.unit-card.pause { border-left-color: var(--orange); }
.unit-card.off { opacity: .55; border-left-color: var(--line); }

/* Baris atas: nama unit + badge. Bila tidak cukup lebar, badge turun ke baris
   berikutnya (rapi) — nama unit tidak dipotong dan tidak tertimpa tombol TV. */
.unit-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; row-gap: 5px; }
.unit-name { font-weight: 800; font-size: 15px; letter-spacing: -.01em; min-width: 0; flex: 0 1 auto; max-width: 100%; overflow-wrap: anywhere; }
.badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 5px 7px; border-radius: 99px; white-space: nowrap; flex: 0 0 auto;
}
.badge.free { background: rgba(34, 197, 94, .16); color: var(--green-text); }
.badge.run { background: var(--accent-soft); color: var(--accent-text); }
.badge.pause { background: rgba(245, 158, 11, .18); color: var(--orange-text); }
.badge.lewat { background: rgba(239, 68, 68, .18); color: var(--red-text); }
.badge.rental { background: var(--accent-soft); color: var(--accent-text); }
.badge.fnb { background: rgba(59, 130, 246, .18); color: var(--blue-text); }
.badge.off { background: var(--surface-2); color: var(--muted); }

.unit-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; overflow-wrap: anywhere; }
.unit-body { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.unit-body .row { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.unit-body .row span { color: var(--muted); }
.unit-body .row b { font-weight: 800; overflow-wrap: anywhere; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px; letter-spacing: .01em; }
.timer.warn { color: var(--orange); }
.timer.over { color: var(--red-text); }
.unit-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); }
.unit-total { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.unit-cta { font-size: 12px; font-weight: 800; color: var(--accent-text); }

/* ================= CHIPS / SEARCH ================= */
.chip-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  min-height: 42px; padding: 10px 15px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted);
}
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.search-row { margin-bottom: 10px; }
.date-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.date-row input { flex: 1 1 130px; width: auto; }

/* ================= PRODUCT GRID ================= */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 9px; }
.prod-card {
  font: inherit; color: var(--text); cursor: pointer; text-align: left;
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px;
  display: flex; flex-direction: column; gap: 4px; min-height: 112px;
}
.prod-card:active { background: var(--card-2); }
.prod-card.habis { opacity: .5; }
.prod-emoji { font-size: 21px; line-height: 1; }
.prod-name { font-size: 13px; font-weight: 700; line-height: 1.25; }
.prod-price { font-size: 13px; font-weight: 800; color: var(--accent-text); margin-top: auto; font-variant-numeric: tabular-nums; }
.prod-stock { font-size: 10.5px; color: var(--muted); }


/* ================= LISTS / TRANSAKSI ================= */
.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-item {
  width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px;
  display: flex; flex-direction: column; gap: 5px;
}
.tx-item:active { background: var(--card-2); }
.tx-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tx-code { font-size: 12.5px; font-weight: 800; letter-spacing: .02em; color: var(--accent-text); }
.tx-sub { font-size: 12px; color: var(--muted); }
.tx-amounts { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tx-amounts b { color: var(--text); font-weight: 700; }
.tx-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 7px; flex-wrap: wrap; }
.tx-total { font-weight: 800; font-size: 16.5px; font-variant-numeric: tabular-nums; }
.pay-tag { font-size: 10.5px; font-weight: 800; padding: 4px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }

/* ================= ITEM ROWS (keranjang / sesi) ================= */
.items-list { display: flex; flex-direction: column; gap: 7px; }
.item-row {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 10px;
}
.item-emoji { font-size: 18px; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-name { font-size: 13.5px; font-weight: 700; }
.item-note { font-size: 11.5px; color: var(--muted); }
.qty-box { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 17px; cursor: pointer; line-height: 1;
}
.qty-btn:active { background: var(--accent-soft); }
.qty-val { min-width: 24px; text-align: center; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.item-total { font-size: 13px; font-weight: 800; min-width: 68px; text-align: right; font-variant-numeric: tabular-nums; }

/* Invoice / ringkasan: rincian & total selalu terbaca penuh di semua lebar,
   tanpa tumpang tindih antara label dan nominal. */
.summary { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px; display: flex; flex-direction: column; gap: 7px; }
.summary-row { display: flex; align-items: baseline; justify-content: space-between; font-size: 13.5px; gap: 10px; flex-wrap: wrap; }
.summary-row span { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.summary-row b { font-weight: 700; text-align: right; margin-left: auto; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.summary-row.total { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 3px; font-size: 14px; }
.summary-row.total b { font-size: clamp(17px, 5.5vw, 22px); font-weight: 800; color: var(--total-text); }

.pay-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-toggle button {
  font: inherit; font-weight: 700; font-size: 14px; padding: 13px; cursor: pointer;
  min-height: 48px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted);
}
.pay-toggle button.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.cash-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.cash-quick button {
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 10px 13px;
  min-height: 42px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.change-box { font-size: 13px; display: flex; justify-content: space-between; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(34, 197, 94, .1); border: 1px solid rgba(34, 197, 94, .3); }
.change-box.minus { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); color: var(--red-text); }

.form-grid { display: flex; flex-direction: column; gap: 10px; }
.form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.switch-row { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); min-height: 44px; }
.switch-row input { width: auto; min-height: 0; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 26px; display: block; margin-bottom: 8px; }


/* ================= LAPORAN ================= */
.report-body { display: flex; flex-direction: column; gap: 14px; }
/* Ringkasan: 2 kolom bila layar cukup lebar, turun ke 1 kolom di HP sempit
   supaya nominal rupiah tidak terpotong. */
.sum-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.sum-card {
  background: var(--card); border: 1px solid var(--line); min-width: 0;
  border-radius: var(--radius); padding: 13px; display: flex; flex-direction: column; gap: 4px;
}
.sum-card span { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.sum-card b { font-size: clamp(16px, 5.6vw, 20px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sum-card small { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 379px) {
  .sum-cards { grid-template-columns: 1fr; }
}
.sum-card.rental { border-color: var(--accent-line); }
.sum-card.rental b { color: var(--accent-text); }
.sum-card.fnb { border-color: rgba(59, 130, 246, .38); }
.sum-card.fnb b { color: var(--blue-text); }
.sum-card.total b { color: var(--total-text); }
.sum-card.trx b { color: var(--green-text); }
.sum-card.expense { border-color: rgba(239, 68, 68, .4); }
.sum-card.expense b { color: var(--red-text); }
.sum-card.profit { border-color: rgba(34, 197, 94, .42); }
.sum-card.profit b { color: var(--green-text); }
.sum-card.profit.neg { border-color: rgba(239, 68, 68, .45); }
.sum-card.profit.neg b { color: var(--red-text); }

.section-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; }

.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 8px; font-size: 12px; }
.bar-track { height: 9px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar-fill.rental { background: var(--accent); height: 100%; }
.bar-fill.fnb { background: var(--blue); height: 100%; }
.bar-val { font-weight: 700; font-variant-numeric: tabular-nums; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 4px; border-bottom: 1px solid var(--line); }
table.data-table td { padding: 8px 4px; border-bottom: 1px solid var(--line-soft); }
table.data-table td.num, table.data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table tr:last-child td { border-bottom: none; }

.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; }
.legend .r { background: var(--accent); }
.legend .f { background: var(--blue); }

/* ================= PENGELUARAN ================= */
.head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#page-pengeluaran .sum-cards { margin-bottom: 12px; }
.exp-list { display: flex; flex-direction: column; gap: 8px; }
.exp-item {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid rgba(239, 68, 68, .5);
  border-radius: var(--radius-sm); padding: 12px 13px;
  display: flex; flex-direction: column; gap: 6px;
}
.exp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.exp-cat { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.exp-amount { font-size: 16px; font-weight: 800; color: var(--red-text); font-variant-numeric: tabular-nums; }
.exp-meta { font-size: 11.5px; color: var(--muted); }
.exp-note { font-size: 12.5px; color: var(--text); line-height: 1.45; }
.exp-item .row-actions { margin-top: 2px; justify-content: flex-end; }

/* ================= MASTER ================= */
.master-body { display: flex; flex-direction: column; gap: 10px; }
.master-list { display: flex; flex-direction: column; gap: 7px; }
.master-item {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px;
}
.master-main { flex: 1 1 auto; min-width: 0; }
.master-title { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.master-sub { font-size: 11.5px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; }
.row-actions button {
  font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; padding: 9px 11px;
  min-height: 40px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.row-actions button.del { color: var(--red-text); border-color: rgba(239, 68, 68, .35); }


/* ================= PENGATURAN ================= */
.settings-body { display: flex; flex-direction: column; gap: 12px; }
.settings-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 11px;
}
.settings-head { display: flex; flex-direction: column; gap: 3px; }
.settings-head h3 { font-size: 15.5px; letter-spacing: -.01em; }
.settings-head p { font-size: 12px; color: var(--muted); line-height: 1.5; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-actions .btn { flex: 1 1 140px; }
.settings-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.settings-note.ok { color: #6ee7a8; }
.settings-note.err { color: #ff9b9b; }
.settings-readonly { opacity: .75; }

/* ---- Toggle tema (Setelan) — preferensi perangkat, kasir & owner ---- */
.theme-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 11px;
}
.theme-toggle {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.theme-toggle:active { background: var(--card-2); }
.theme-toggle-track { width: 52px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: 0 0 auto; transition: background .15s ease; }
.theme-toggle[aria-pressed="true"] .theme-toggle-track { background: var(--accent); }
.theme-toggle-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; transition: left .15s ease; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.theme-toggle[aria-pressed="true"] .theme-toggle-thumb { left: 25px; }
.theme-toggle-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.theme-toggle-text b { font-size: 14px; }
.theme-toggle-text small { font-size: 11.5px; color: var(--muted); }

/* ================= DESKTOP (>= 900px) ================= */
@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: 232px 1fr;
    grid-template-rows: auto 1fr;
    height: 100dvh;
  }
  .topbar { grid-column: 1 / -1; grid-row: 1; padding: 12px 20px; }
  .nav {
    grid-column: 1; grid-row: 2; position: static; display: flex; flex-direction: column;
    border-top: none; border-right: 1px solid var(--line); padding: 14px 10px; gap: 4px;
    background: var(--bg-2); align-items: stretch; overflow-y: auto;
  }
  .nav-btn { flex-direction: row; gap: 10px; padding: 12px 13px; border-radius: 12px; min-height: 48px; justify-content: flex-start; }
  .nav-btn span { font-size: 17px; }
  .nav-btn em { font-size: 13.5px; }
  main { grid-column: 2; grid-row: 2; padding: 20px 24px 40px; }
  .nav { position: static; }
  .toast-host { bottom: 22px; }
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: 18px; border-bottom: 1px solid var(--line); max-height: 86dvh; max-width: 620px; }
  .unit-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .sum-cards { grid-template-columns: repeat(4, 1fr); }
  .page-head h2 { font-size: 24px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .settings-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
}

/* Layar cukup lebar: kunci maksimal 4 kartu per baris (kartu tetap kecil). */
@media (min-width: 1120px) {
  .unit-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  .unit-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .unit-name { font-size: 13.5px; }
  .badge { font-size: 9px; padding: 4px 6px; letter-spacing: .02em; }
  .unit-wrap.has-tv .unit-top { padding-right: 40px; }
  .brand-text span { display: none; }
  .net-badge { display: none; }
  .nav-btn em { font-size: 8.5px; }
  .nav-btn { padding: 7px 0; min-height: 52px; }
}

.nav-btn.active em { color: var(--accent-text); }

/* ================= HP (menu hamburger) =================
   Lebar kecil: bottom-nav 7 tombol disembunyikan TOTAL, hamburger tampil. */
@media (max-width: 767px) {
  .hamburger { display: inline-flex; }
  .nav { display: none; }
  /* Ruang bawah tidak perlu lagi melebar untuk bar nav, cukup aman sentuh. */
  main { padding-bottom: calc(24px + var(--safe-b)); }
  .toast-host { bottom: calc(20px + var(--safe-b)); }
}

