:root {
  --navy: #111C2D;
  --navy-2: #1E2E45;
  --navy-soft: #EDF1F6;
  --gold: #92400E;
  --gold-bg: #FFFBEB;
  --gold-bd: #E5C98B;
  --emerald: #166534;
  --emerald-bg: #F0FDF4;
  --emerald-bd: #B6DEC4;
  --sky: #1E3A5F;
  --sky-bg: #EFF5FB;
  --sky-bd: #BCD0E5;
  --red: #991B1B;
  --red-bg: #FEF2F2;
  --red-bd: #EABABA;
  --bg: #EAEEF2;
  --card: #FFFFFF;
  --border: #C4CDD8;
  --border-soft: #DCE2E9;
  --text: #0F172A;
  --muted: #526071;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: none;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.48;
  letter-spacing: -0.004em;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }
.mono, .num { font-variant-numeric: tabular-nums lining-nums; }

h1, h2, h3, .tb-title, .fs-title, .hero-amount, .buku-saldo-amt {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.hero-amount, .buku-saldo-amt, .sup-saldo, .tx-amt, .bar-num, .jt-val, .mini-card .v, .multi-bar .tot {
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 700;
  letter-spacing: -0.01em;
}

input, select, textarea, button {
  font-family: inherit;
  touch-action: manipulation;
}

input, select, textarea {
  font-size: 16px !important; /* Cegah auto-zoom iOS Safari */
  color: var(--text);
}

/* ---------- LOGIN ---------- */
.layar-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 16px calc(24px + var(--safe-bot));
  background: var(--bg);
}

.login-wrap {
  width: 100%;
  max-width: 420px;
}

.login-brand {
  text-align: center;
  color: var(--navy);
  margin-bottom: 16px;
}

.login-logo {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.login-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.login-brand p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.login-card {
  padding: 20px !important;
  border-top: 3px solid var(--navy) !important;
}

.coba-cepat {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.coba-judul {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  text-align: center;
}

.coba-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ---------- SHELL & TOPBAR ---------- */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(70px + var(--safe-bot));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--navy);
  color: #fff;
  padding-top: var(--safe-top);
  border-bottom: 2px solid #09111C;
}

.topbar-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tb-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tb-logo {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  flex-shrink: 0;
}

.tb-title {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-sub {
  font-size: 11.5px;
  color: #B6C2D1;
}

.badge-role {
  background: #1E2E45;
  border: 1px solid #384D6B;
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 4px;
  white-space: nowrap;
}

.cabang-bar {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 14px 9px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cabang-bar::-webkit-scrollbar { display: none; }

.cab-pill {
  border: 1px solid #354A66;
  background: #18273D;
  color: #CBD5E1;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
}

.cab-pill.active {
  background: #FFFFFF;
  color: var(--navy);
  border-color: #FFFFFF;
  font-weight: 700;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 12px 20px;
  flex: 1;
}

.kartu {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

/* ---------- HERO CARD BERANDA (FLAT FORMAL) ---------- */
.hero-card {
  background: var(--navy);
  color: #fff;
  border: 1px solid #09111C;
  border-top: 3px solid #B45309;
  padding: 16px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #B6C2D1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-badge-ok {
  background: #1B2B42;
  color: #E2E8F0;
  border: 1px solid #384E6D;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.hero-amount {
  font-size: 27px;
  font-weight: 700;
  margin: 5px 0 12px;
  color: #FFFFFF;
}

.hero-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #2A3D58;
}

.hero-stat {
  background: #18273D;
  border: 1px solid #2F4360;
  border-radius: 4px;
  padding: 9px 10px;
}

.hero-stat .lbl {
  font-size: 11px;
  color: #B6C2D1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hero-stat .val {
  font-size: 14.5px;
  font-weight: 700;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.hero-stat .val.sky { color: #93C5FD; }
.hero-stat .val.gold { color: #FCD34D; }

/* ---------- QUICK ACTIONS ---------- */
.aksi-utama {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.1s ease;
}

.btn:active { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { min-height: 35px; padding: 6px 11px; font-size: 13px; border-radius: 4px; }

.btn-primary { background: var(--navy); color: #fff; border-color: #09111C; }
.btn-emerald { background: var(--emerald); color: #fff; border-color: #0F4725; }
.btn-gold { background: var(--gold); color: #fff; border-color: #78350F; }
.btn-danger { background: var(--red); color: #fff; border-color: #7F1D1D; }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid #94A3B8; }
.btn-soft { background: #EDF1F6; color: var(--navy); border: 1px solid var(--border); }
.btn-wa { background: #166534; color: #fff; border-color: #14532D; }

.btn-chip {
  background: #F8FAFC;
  border: 1px solid var(--border);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 36px;
}
.btn-chip:active { background: var(--navy-soft); }

/* ---------- SECTION HEADERS ---------- */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 2px 6px;
}

.sec-head h2 {
  margin: 0;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.055em;
  font-weight: 700;
  color: var(--muted);
}

.sec-link {
  background: none;
  border: none;
  color: var(--sky);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px;
}

/* ---------- URGENT / JATUH TEMPO LIST ---------- */
.jt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.jt-item:last-child { border-bottom: none; padding-bottom: 0; }
.jt-item:first-child { padding-top: 0; }

.jt-info { min-width: 0; flex: 1; cursor: pointer; }
.jt-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jt-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.jt-val {
  font-size: 13.5px;
  color: var(--red);
}

/* ---------- TOP HUTANG BARS ---------- */
.bar-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.bar-row:last-child { border-bottom: none; padding-bottom: 0; }
.bar-row:first-child { padding-top: 0; }

.bar-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}
.bar-name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-num {
  font-size: 13.5px;
  color: var(--navy);
  white-space: nowrap;
}
.bar-track {
  height: 6px;
  background: #E2E8F0;
  border: 1px solid #CBD5E1;
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--navy-2);
}

/* ---------- BULAN INI MINI CARDS ---------- */
.dua-kolom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.mini-card .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.mini-card .v { font-size: 16px; margin-top: 3px; }
.mini-card .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- BADGES / TAGS (FORMAL RECTANGULAR) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-red { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.pill-gold { background: var(--gold-bg); color: var(--gold); border-color: var(--gold-bd); }
.pill-green { background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald-bd); }
.pill-sky { background: var(--sky-bg); color: var(--sky); border-color: var(--sky-bd); }
.pill-gray { background: #F1F5F9; color: #334155; border-color: #CBD5E1; }

/* ---------- SEARCH & FILTER ---------- */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.search-input {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  padding: 9px 12px;
  outline: none;
}
.search-input:focus { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }

.filter-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.filter-strip::-webkit-scrollbar { display: none; }

.f-pill {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
}
.f-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.sort-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.sort-select {
  background: #fff;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 13px !important;
  font-weight: 600;
  color: var(--navy);
}

/* ---------- SUPPLIER CARDS ---------- */
.sup-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 13px;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.sup-card:active { background: #F1F5F9; }

.sup-left { min-width: 0; flex: 1; }
.sup-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
}
.sup-no {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sup-name-txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sup-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.sup-right { text-align: right; flex-shrink: 0; }
.sup-saldo { font-size: 15px; }
.sup-saldo.hutang { color: var(--red); }
.sup-saldo.deposit { color: var(--sky); }
.sup-saldo.lunas { color: var(--emerald); }
.sup-sub-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 5px 8px calc(6px + var(--safe-bot));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-btn {
  border: none;
  background: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-top: 2px solid transparent;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn.active {
  color: var(--navy);
  font-weight: 700;
  border-top-color: var(--navy);
}

/* ---------- FULL SCREEN OVERLAYS ---------- */
.full-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(96px + var(--safe-bot));
}

.fs-head {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--navy);
  color: #fff;
  border-bottom: 2px solid #09111C;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #354A66;
  background: #18273D;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.fs-title-box { min-width: 0; flex: 1; }
.fs-title {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-sub {
  font-size: 11.5px;
  color: #B6C2D1;
}

.fs-body {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 12px 20px;
}

/* ---------- BUKU PEMASOK SUMMARY & SUBTABS ---------- */
.buku-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.buku-saldo-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.buku-saldo-amt {
  font-size: 24px;
  margin-top: 2px;
}
.buku-saldo-amt.hutang { color: var(--red); }
.buku-saldo-amt.deposit { color: var(--sky); }
.buku-saldo-amt.lunas { color: var(--emerald); }

.buku-mini-stats {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.buku-mini-stats b { color: var(--text); font-variant-numeric: tabular-nums; }

.buku-actions {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr 0.8fr;
  gap: 6px;
  margin-top: 12px;
}

.subtab-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #DCE2E9;
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 5px;
  margin-bottom: 10px;
  gap: 3px;
}

.subtab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 6px;
  border-radius: 3px;
  cursor: pointer;
}
.subtab-btn.active {
  background: #fff;
  color: var(--navy);
  border-color: var(--border);
  font-weight: 700;
}

/* ---------- TRANSACTION / UNPAID CARDS ---------- */
.tx-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  margin-bottom: 7px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.tx-card.selected {
  border-color: var(--emerald);
  background: #F0FDF4;
}

.tx-check {
  width: 20px;
  height: 20px;
  accent-color: var(--emerald);
  margin-top: 2px;
  flex-shrink: 0;
}

.tx-icon {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  flex-shrink: 0;
}
.tx-icon.nota { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.tx-icon.bayar { background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald-bd); }
.tx-icon.saldo { background: #F1F5F9; color: var(--navy); border-color: var(--border); }

.tx-mid { min-width: 0; flex: 1; }
.tx-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.tx-title {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-amt { font-size: 14px; white-space: nowrap; }
.tx-amt.masuk { color: var(--red); }
.tx-amt.keluar { color: var(--emerald); }

.tx-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.tx-run {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- MULTI-NOTA STICKY PAY BAR ---------- */
.multi-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bot));
  max-width: 756px;
  margin: 0 auto;
  z-index: 55;
  background: var(--navy);
  color: #fff;
  border: 1px solid #09111C;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.multi-bar .info { font-size: 12px; color: #CBD5E1; }
.multi-bar .tot { font-size: 16px; }

/* ---------- TABEL EXCEL MODE ---------- */
.table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.xl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 560px;
}
.xl-table th {
  background: #EEF2F6;
  color: var(--navy);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1.5px solid var(--border);
  border-right: 1px solid var(--border-soft);
  white-space: nowrap;
}
.xl-table th:last-child, .xl-table td:last-child { border-right: none; }
.xl-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-soft);
  border-right: 1px solid #EDF1F6;
  vertical-align: top;
}
.xl-table tr:nth-child(even) td { background: #FAFBFD; }
.xl-table tr:active td { background: #EDF2F7; }
.xl-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- MODAL SHEET (TIRAI & LEMBAR) ---------- */
.tirai {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.lembar {
  width: 100%;
  max-width: 580px;
  max-height: 92dvh;
  background: #fff;
  border-top: 3px solid var(--navy);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(24px + var(--safe-bot));
}

@media (min-width: 640px) {
  .tirai { align-items: center; padding: 16px; }
  .lembar { border-radius: 6px; border: 1px solid var(--border); border-top: 3px solid var(--navy); max-height: 88dvh; }
}

.lembar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 11px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.lembar-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}
.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #F1F5F9;
  color: var(--navy);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- FORM ELEMENTS ---------- */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--navy);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  background: #fff;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy);
  box-shadow: inset 0 0 0 1px var(--navy);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.err-msg {
  background: var(--red-bg);
  border: 1px solid var(--red-bd);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 11px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.info-banner {
  background: var(--sky-bg);
  border: 1px solid var(--sky-bd);
  color: var(--sky);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 11px;
  border-radius: 4px;
  margin-bottom: 12px;
}

/* ---------- ITEM ROWS IN NOTA FORM ---------- */
.item-box {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 8px;
}
.item-box-top {
  display: flex;
  gap: 6px;
  margin-bottom: 7px;
}
.item-box-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 0.8fr;
  gap: 6px;
}
.item-box input {
  padding: 8px 9px !important;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  background: #fff;
  width: 100%;
}
.item-sub-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.item-sub-line b { color: var(--navy); font-variant-numeric: tabular-nums; }

.chip-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.metode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.metode-btn {
  border: 1px solid #94A3B8;
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 4px;
  border-radius: 4px;
  cursor: pointer;
}
.metode-btn.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

/* ---------- MENU LAINNYA ---------- */
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.menu-item:last-child { border-bottom: none; padding-bottom: 2px; }
.menu-item:first-child { padding-top: 2px; }
.menu-title { font-weight: 600; font-size: 14px; color: var(--text); }
.menu-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- FOTO PREVIEW ---------- */
.foto-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0F172A;
  margin-top: 8px;
}

/* ---------- EMPTY / FOOTER / TOAST ---------- */
.empty-box {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.powered-by {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 16px 8px 6px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-bot));
  transform: translateX(-50%);
  z-index: 90;
  background: var(--navy);
  border: 1px solid #384D6B;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 5px;
  max-width: 90vw;
  text-align: center;
}

/* ---------- SIDEBAR DEFAULT (SEMBUNYI DI HP) ---------- */
.pc-sidebar { display: none; }
.app-stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- HOVER RESPONSIF UNTUK MOUSE PC ---------- */
@media (hover: hover) {
  .sup-card:hover, .tx-card:hover {
    border-color: #8A99AD;
    background: #FAFBFD;
  }
  .jt-item:hover, .bar-row:hover, .menu-item:hover {
    background: #F6F8FA;
  }
  .xl-table tbody tr:hover td {
    background: #EDF2F7;
  }
  .btn-primary:hover { background: var(--navy-2); }
  .btn-emerald:hover { background: #14532D; }
  .btn-outline:hover { background: #F1F5F9; border-color: var(--navy); }
  .btn-soft:hover { background: #E2E8F0; }
  .btn-chip:hover { background: #E2E8F0; border-color: #94A3B8; }
  .f-pill:hover:not(.active) { border-color: var(--navy); color: var(--navy); }
  .sb-nav-btn:hover:not(.active) { background: #1A2B42; color: #FFFFFF; }
}

/* ---------- MODE PC / LAYAR LEBAR (>= 960px) ---------- */
@media (min-width: 960px) {
  .app-shell {
    flex-direction: row;
    padding-left: 244px;
    padding-bottom: 24px;
  }

  .bottom-nav { display: none !important; }

  .pc-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 244px;
    z-index: 60;
    background: var(--navy);
    color: #fff;
    border-right: 1px solid #09111C;
    padding: 16px 14px;
  }

  .sb-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid #24364E;
  }
  .sb-logo {
    width: 34px;
    height: 34px;
    border-radius: 5px;
    flex-shrink: 0;
  }
  .sb-title {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.25;
  }
  .sb-sub {
    font-size: 11px;
    color: #9FB0C4;
    margin-top: 2px;
  }

  .sb-quick {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 14px 0;
    border-bottom: 1px solid #24364E;
  }
  .sb-btn-bayar {
    background: #1B2C44 !important;
    color: #FFFFFF !important;
    border-color: #364C6B !important;
  }
  .sb-btn-bayar:hover { background: #253A57 !important; }

  .sb-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
    flex: 1;
  }
  .sb-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    color: #CBD5E1;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 10px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
  }
  .sb-nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
  .sb-nav-btn.active {
    background: #1D314B;
    color: #FFFFFF;
    border-left-color: #D97706;
    font-weight: 700;
  }

  .sb-foot {
    padding-top: 12px;
    border-top: 1px solid #24364E;
    font-size: 11.5px;
    color: #9FB0C4;
  }
  .sb-user {
    color: #FFFFFF;
    font-weight: 600;
    margin-bottom: 4px;
  }
  .sb-hint {
    font-size: 11px;
    color: #8296AE;
    margin-bottom: 8px;
  }
  .sb-powered {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7D91A8;
  }

  /* Topbar PC: bersih terang menyatu dengan area kerja */
  .topbar {
    background: #FFFFFF;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
  }
  .topbar-inner {
    max-width: 1180px;
    padding: 10px 24px;
  }
  .tb-logo { display: none; }
  .tb-title { font-size: 16px; color: var(--navy); }
  .tb-sub { color: var(--muted); }
  .badge-role {
    background: #EDF1F6;
    border-color: var(--border);
    color: var(--navy);
  }
  .cabang-bar {
    max-width: 1180px;
    padding: 0 24px 10px;
  }
  .cab-pill {
    border-color: var(--border);
    background: #F8FAFC;
    color: var(--muted);
  }
  .cab-pill.active {
    background: var(--navy);
    color: #FFFFFF;
    border-color: var(--navy);
  }

  /* Area kerja lebar PC */
  .main-content {
    max-width: 1180px;
    padding: 18px 24px 32px;
  }

  .pc-beranda-top {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 14px;
    align-items: stretch;
    margin-bottom: 10px;
  }
  .pc-beranda-top .hero-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .pc-beranda-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .pc-beranda-mid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }

  .pc-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .pc-grid-2 .sup-card { margin-bottom: 0; }
  .pc-grid-2 .empty-box { grid-column: 1 / -1; }

  /* Layar penuh di PC tetap sisakan sidebar kiri */
  .full-screen {
    left: 244px;
    padding-bottom: 64px;
  }
  .fs-head {
    padding: 12px 24px;
  }
  .fs-body {
    max-width: 1180px;
    padding: 18px 24px 32px;
  }
  .multi-bar {
    left: 268px;
    right: 24px;
    max-width: 1132px;
  }

  /* Form modal & input baris barang lebih lapang seperti spreadsheet di PC */
  .lembar {
    max-width: 720px;
    padding: 20px 22px 24px;
  }
  .buku-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
    align-items: center;
  }
  .buku-actions {
    margin-top: 0;
    grid-template-columns: repeat(2, 1fr);
  }
  .toast { bottom: 24px; }
}
