/* =====================================================
   NOTA - Design System (compact, mobile-first)
   ===================================================== */
:root {
  --navy: #0a2a5e;
  --navy-2: #123a7d;
  --navy-3: #e8eef8;
  --gold: #d4af37;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #15803d;
  --green-bg: #e7f6ec;
  --red: #b91c1c;
  --red-bg: #fdeaea;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --radius: 10px;
  --topbar-h: 52px;
  --sidebar-w: 224px;
  --sidebar-mini: 60px;
  --bottomnav-h: 58px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { margin: 0 0 .5rem; font-weight: 700; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-navy { color: var(--navy) !important; }
.text-amber { color: var(--amber) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .35rem !important; }
.mb-2 { margin-bottom: .75rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-1 { margin-top: .35rem !important; }
.mt-2 { margin-top: .75rem !important; }
.w-100 { width: 100% !important; }
.min-w-0 { min-width: 0 !important; }

/* ============ Layout ============ */
.app-body { display: flex; min-height: 100vh; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--navy); color: #fff; z-index: 1030; box-shadow: var(--shadow);
}
.topbar .brand {
  display: flex; align-items: center; gap: 7px; color: #fff; font-weight: 700;
  font-size: 15px; text-decoration: none; letter-spacing: .3px;
}
.topbar .brand:hover { text-decoration: none; color: #fff; }
.topbar .brand i { color: var(--gold); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.btn-icon {
  background: rgba(255,255,255,.12); border: 0; color: #fff; width: 34px; height: 34px;
  border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
.btn-icon:hover { background: rgba(255,255,255,.22); }

.btn-usaha, .btn-user {
  display: inline-flex; align-items: center; gap: 6px; max-width: 42vw;
  background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px;
}
.btn-usaha:hover, .btn-user:hover { background: rgba(255,255,255,.22); }
.btn-usaha .usaha-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-user .avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.btn-user .user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-usaha {
  background: rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12.5px;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--border); z-index: 1040;
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  transition: transform .22s ease, width .22s ease, box-shadow .22s ease;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-weight: 700; color: var(--navy);
}
.sidebar-head .btn-icon { background: var(--navy-3); color: var(--navy); }
.sidebar-nav { padding: 8px 8px 20px; }
.nav-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  padding: 12px 10px 4px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: #334155; font-size: 13px; font-weight: 500; margin-bottom: 1px;
}
.nav-item:hover { background: var(--navy-3); text-decoration: none; color: var(--navy); }
.nav-item.active { background: var(--navy); color: #fff; }
.nav-item.active i { color: var(--gold); }
.nav-item i { font-size: 15px; width: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 10px 14px; border-top: 1px solid var(--border); }

.sidebar-backdrop {
  position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(15,23,42,.4);
  z-index: 1035; display: none;
}
.sidebar-backdrop.show { display: block; }

.app-main {
  flex: 1; min-width: 0; padding: calc(var(--topbar-h) + 12px) 16px 24px;
  margin-left: var(--sidebar-w);
  transition: margin-left .22s ease;
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: 260px; box-shadow: var(--shadow); }
  .sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; padding: calc(var(--topbar-h) + 10px) 10px calc(var(--bottomnav-h) + 16px); }
}
/* Desktop: sidebar dapat dilipat menjadi rail ikon (preferensi disimpan).
   Saat dilipat hanya ikon tampil; menampilkan label penuh ketika di-hover. */
@media (min-width: 992px) {
  html.sidebar-collapsed .sidebar {
    width: var(--sidebar-mini);
    box-shadow: var(--shadow);
  }
  html.sidebar-collapsed .app-main { margin-left: var(--sidebar-mini); }
  html.sidebar-collapsed .sidebar .nav-item span { display: none; }
  html.sidebar-collapsed .sidebar .sidebar-foot { display: none !important; }
  html.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 9px 0; }
  /* judul grup jadi garis pemisah; tinggi tetap agar tak meloncat saat hover */
  html.sidebar-collapsed .sidebar .nav-group-title { color: transparent; position: relative; }
  html.sidebar-collapsed .sidebar .nav-group-title::after {
    content: ""; position: absolute; left: 16px; right: 16px; top: 50%;
    height: 1px; background: var(--border);
  }
  /* hover: kembali ke lebar penuh, menumpuk di atas konten */
  html.sidebar-collapsed .sidebar:hover {
    width: var(--sidebar-w);
    z-index: 1055;
    box-shadow: 0 8px 28px rgba(16,24,40,.16);
  }
  html.sidebar-collapsed .sidebar:hover .nav-item span { display: block; }
  html.sidebar-collapsed .sidebar:hover .sidebar-foot { display: block !important; }
  html.sidebar-collapsed .sidebar:hover .nav-group-title { color: var(--muted); }
  html.sidebar-collapsed .sidebar:hover .nav-group-title::after { display: none; }
  html.sidebar-collapsed .sidebar:hover .nav-item { justify-content: flex-start; padding: 8px 10px; }
}

/* ============ Bottom nav (mobile) ============ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottomnav-h);
  background: #fff; border-top: 1px solid var(--border); z-index: 1030;
  display: flex; align-items: stretch; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: 10px; border: 0; background: none; text-decoration: none;
}
.bn-item i { font-size: 19px; }
.bn-item.active { color: var(--navy); font-weight: 700; }
.bn-item.active i { color: var(--navy); }
.bn-add {
  width: 52px; height: 52px; margin-top: -18px; border-radius: 50%; background: var(--gold);
  color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 24px;
  box-shadow: 0 6px 14px rgba(212,175,55,.5); text-decoration: none; flex: 0 0 auto;
  border: 0; padding: 0; cursor: pointer;
}
.bn-add:hover { color: var(--navy); text-decoration: none; }

/* ============ Cards & content ============ */
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.page-header h2 { margin: 0; font-size: 1.1rem; color: var(--navy); }
.page-subtitle { color: var(--muted); font-size: 11.5px; margin: 1px 0 0; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden;
}
.card-dashboard { transition: border-color .2s ease; }
.card-dashboard:hover { border-color: var(--gold); }
.card-header {
  padding: 9px 12px; border-bottom: 1px solid var(--border); font-weight: 700;
  display: flex; align-items: center; gap: 8px; background: #fbfcfe; color: var(--navy); font-size: 13px;
}
.card-body { padding: 12px; }
.card-body.p-0 { padding: 0; }
.card-actions { margin-left: auto; display: flex; gap: 6px; }

.stat-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 600px) { .stat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.stat {
  border-radius: var(--radius); padding: 13px 14px; color: #fff; box-shadow: var(--shadow);
  border: 1px solid transparent;
  display: flex; flex-direction: column; gap: 7px;
  transition: border-color .2s ease;
}
.stat-dashboard:hover { border-color: var(--gold); }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; opacity: .92; }
.stat .value { font-size: 1.2rem; font-weight: 700; line-height: 1.25; word-break: break-word; }
.stat .value.big { font-size: 1.55rem; margin-top: 4px; }
.stat .sub { font-size: 11.5px; opacity: .88; }
.stat.navy { background: linear-gradient(135deg, #0a2a5e, #1d4ed8); }
.stat.green { background: linear-gradient(135deg, #065f46, #0d9488); }
.stat.red { background: linear-gradient(135deg, #991b1b, #dc2626); }
.stat.amber { background: linear-gradient(135deg, #92400e, #d97706); }
.stat.slate { background: linear-gradient(135deg, #334155, #475569); }
.stat .cmp-rows { display: flex; flex-direction: column; gap: 5px; }
.stat .cmp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.stat .cmp-row span { opacity: .92; }
.stat .cmp-row span small { opacity: .7; font-size: 11px; }
.stat .cmp-row b { font-size: 14px; font-weight: 700; white-space: nowrap; }
.stat .cmp-bar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; margin: 2px 0; }
.stat .cmp-bar span { display: block; height: 100%; border-radius: 99px; background: rgba(255, 255, 255, .95); box-shadow: 0 0 8px rgba(255, 255, 255, .5); transition: width .4s ease; }
.stat .cmp-diff { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid rgba(255, 255, 255, .25); padding-top: 7px; margin-top: auto; }
.stat .cmp-diff em { font-style: normal; font-size: 11.5px; opacity: .8; }

/* ============ Buttons ============ */
.btn { font-size: 12.5px; border-radius: 8px; padding: 6px 12px; font-weight: 600; }
.btn-sm { font-size: 11.5px; padding: 4px 9px; }
.btn-xs { font-size: 11px; padding: 2px 7px; }
.btn {
  box-shadow: 0 3px 0 rgba(15, 23, 42, .25);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(15, 23, 42, .28), 0 8px 14px rgba(15, 23, 42, .18);
}
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .25), 0 2px 4px rgba(15, 23, 42, .15);
}
.btn:disabled, .btn.disabled, .btn.disabled:hover, .btn:disabled:hover {
  transform: none;
  box-shadow: 0 3px 0 rgba(15, 23, 42, .12);
}
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-outline-navy { border: 1.5px solid #1e40af; color: var(--navy); background: #fff; }
.btn-outline-navy:hover { background: var(--navy); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #c9a52f; color: var(--navy); }

/* ============ Forms ============ */
.form-label { font-size: 11.5px; font-weight: 600; color: #334155; margin-bottom: 3px; }
.form-control, .form-select { font-size: 13px; border-radius: 8px; border-color: #cbd5e1; padding: 6px 10px; }
.form-control:focus, .form-select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 .15rem rgba(18,58,125,.15); }
.form-control-sm, .form-select-sm { font-size: 12px; padding: 4px 8px; }
.form-text { font-size: 10.5px; }
.select2-container--bootstrap-5 .select2-selection--single,
.select2-container--bootstrap-5 .select2-selection--multiple {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.select2-container--bootstrap-5 .select2-selection--single { min-height: 34px; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection--single,
.select2-container--bootstrap-5.select2-container--focus .select2-selection--multiple,
.select2-container--bootstrap-5.select2-container--open .select2-selection--single,
.select2-container--bootstrap-5.select2-container--open .select2-selection--multiple {
  border-color: var(--navy-2);
  box-shadow: 0 0 0 .15rem rgba(18,58,125,.15);
}
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filter-bar .fb-item { display: flex; flex-direction: column; min-width: 0; }
.btn-toggle { flex-wrap: wrap; }
.btn-toggle .btn-check:checked + .btn-outline-navy,
.btn-toggle .btn-check:active + .btn-outline-navy {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
@media (max-width: 575.98px) {
  .filter-bar { gap: 6px; }
  .filter-bar .fb-item { flex: 1 1 46%; }
  .filter-bar .fb-item.wide { flex: 1 1 100%; }
}

/* ============ Tables ============ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; margin: 0; font-size: 12.5px; }
.table > :not(caption) > * > * { padding: 6px 8px; }
.table thead th {
  background: #f7f9fc; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
  font-weight: 700; white-space: nowrap; border: 1px solid var(--border);
}
.table tbody tr { transition: background-color .15s ease, outline-color .15s ease; }
.table tbody tr:hover {
  background-color: #eef4ff;
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.table tbody tr:hover > th,
.table tbody tr:hover > td { background-color: #eef4ff; }
.table-hover tbody tr:hover,
.table-hover tbody tr:hover > th,
.table-hover tbody tr:hover > td { background-color: #eef4ff; }
.table tbody tr:hover .cell-strong { color: var(--navy); }
.table td, .table th { vertical-align: middle; border: 1px solid var(--border); }
.table .cell-strong { font-weight: 700; color: var(--navy); }
.table td.wrap, .table th.wrap { white-space: normal; word-break: break-word; }

/* ============ Tabel jadi kartu di layar kecil & tablet (tanpa scroll horizontal) ============ */
@media (max-width: 991.98px) {
  .table-wrap.wrap-card { overflow-x: visible; }
  table.table-card { border-collapse: separate; border-spacing: 0; }
  table.table-card thead { display: none; }
  table.table-card tbody tr {
    display: block; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 6px 10px; margin: 0 0 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    position: static; transform: none !important; z-index: auto; will-change: auto;
  }
  table.table-card tbody tr:hover {
    background: #fff; transform: none; position: static;
    box-shadow: inset 0 0 0 2px var(--gold), 0 2px 8px rgba(10, 42, 94, .10);
  }
  table.table-card tbody td {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    border: 0; border: 1px dashed #e8edf5; padding: 6px 0 !important;
    text-align: right !important; white-space: normal; font-size: 12.5px;
  }
  table.table-card tbody td:nth-last-child(1) { border-bottom: 0; }
  table.table-card tbody td::before {
    content: attr(data-label); flex: 0 0 42%; text-align: left; font-weight: 700;
    color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
  }
  table.table-card tbody td:not([data-label])::before { content: none; }
  table.table-card tfoot { display: block; margin-top: 4px; }
  table.table-card tfoot tr {
    display: block; background: #f7f9fc; border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px;
  }
  table.table-card tfoot td, table.table-card tfoot th {
    display: flex; justify-content: space-between; border: 0; padding: 4px 0 !important; text-align: right;
  }
  table.table-card tbody td .btn + .btn, table.table-card tbody td .btn + a.btn { margin-left: 4px; }
}
.nowrap-num { white-space: nowrap; }

/* ============ Media / galeri barang ============ */
.barang-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.barang-thumb {
  width: 54px; height: 54px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
  background: #f8fafc; display: block; position: relative;
}
.barang-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.barang-thumb .del {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; line-height: 1;
  border-radius: 50%; background: rgba(220,38,38,.92); color: #fff; border: 0; font-size: 11px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.drop-zone {
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 14px; text-align: center;
  background: #fbfdff; color: #64748b; font-size: 12px; cursor: pointer;
}
.drop-zone.dragover { border-color: var(--gold); background: #fffdf4; color: var(--navy); }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Foto barang - tampilan besar (detail stok) */
.barang-foto { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #f8fafc; }
.barang-foto img { width: 100%; max-height: 380px; object-fit: contain; display: block; margin: 0 auto; cursor: zoom-in; }
/* Slider foto barang */
.barang-carousel { border-radius: 10px; overflow: hidden; background: #0b1220; }
.barang-carousel .carousel-item img {
  width: 100%; max-height: 380px; object-fit: contain; display: block; margin: 0 auto; cursor: zoom-in;
}
.barang-carousel .carousel-indicators { margin-bottom: 6px; }
.barang-carousel .carousel-indicators [data-bs-target] {
  width: 8px; height: 8px; border-radius: 50%; border: 0; background-color: rgba(255,255,255,.55);
}
.barang-carousel .carousel-indicators .active { background-color: var(--gold); }
.barang-carousel .carousel-control-prev-icon,
.barang-carousel .carousel-control-next-icon { filter: drop-shadow(0 1px 3px rgba(0,0,0,.8)); }

/* Lightbox gambar */
.nota-lightbox {
  position: fixed; inset: 0; z-index: 1090; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(6, 16, 33, .88); opacity: 0; transition: opacity .2s ease; cursor: zoom-out;
  touch-action: none; overscroll-behavior: contain;
}
.nota-lightbox.show { opacity: 1; }
.nota-lightbox img {
  max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain;
  box-shadow: 0 12px 44px rgba(0,0,0,.55); cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  touch-action: none; will-change: transform;
}
.nota-lightbox .lb-close {
  position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.16); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.nota-lightbox .lb-close:hover { background: rgba(255,255,255,.3); }
.nota-lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff; font-size: 24px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.nota-lightbox .lb-nav:hover { background: rgba(255,255,255,.3); }
.nota-lightbox .lb-prev { left: 16px; }
.nota-lightbox .lb-next { right: 16px; }
.nota-lightbox .lb-count {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 12px;
  background: rgba(255,255,255,.16); padding: 3px 12px; border-radius: 999px; letter-spacing: .5px;
}
/* Badge jumlah foto pada thumbnail */
.barang-thumb .thumb-count {
  position: absolute; right: 2px; bottom: 2px; background: rgba(10,42,94,.85); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 14px; padding: 0 5px; border-radius: 6px;
}

/* ============ Badges ============ */
.badge-status { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.bs-belum { background: var(--red-bg); color: var(--red); }
.bs-sebagian { background: var(--amber-bg); color: var(--amber); }
.bs-lunas { background: var(--green-bg); color: var(--green); }
.bs-draft { background: #eef2f7; color: #475569; }
.bs-final { background: var(--navy-3); color: var(--navy); }
.bs-batal { background: var(--red-bg); color: var(--red); text-decoration: line-through; }
.bs-pemasok { background: #2563eb; color: #fff; box-shadow: inset 0 0 0 1px #1e40af; }
.bs-pelanggan { background: #16a34a; color: #fff; box-shadow: inset 0 0 0 1px #15803d; }
.bs-keduanya { background: #7c3aed; color: #fff; box-shadow: inset 0 0 0 1px #6d28d9; }
.bs-pemasok i, .bs-pelanggan i, .bs-keduanya i { margin-right: 3px; font-size: 11px; }
tr.row-batal > td { opacity: .68; }
tr.row-batal td:nth-child(1) a { text-decoration: line-through; color: var(--red); }
.table tbody tr.row-batal:hover { background-color: #fef2f2; outline-color: var(--red); }
.table tbody tr.row-batal:hover > th,
.table tbody tr.row-batal:hover > td { background-color: #fef2f2; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--navy-3); color: var(--navy); }

/* ============ Alerts ============ */
.alert { border-radius: var(--radius); font-size: 12.5px; padding: 9px 12px; border: 1px solid transparent; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #b7e2c6; }
.alert-danger { background: var(--red-bg); color: var(--red); border-color: #f3c2c2; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #f7dfa0; }
.alert-info { background: #e7f0fb; color: #1e40af; border-color: #c7dcf7; }
.alert-autohide { transition: opacity .5s; }

/* ============ DataTables compact ============ */
.dataTables_wrapper { font-size: 12.5px; }
.dataTables_wrapper .row { --bs-gutter-x: 0; }
div.dataTables_wrapper div.dataTables_filter input { font-size: 12px; }
div.dataTables_wrapper div.dataTables_length select { font-size: 12px; }
table.dataTable { border-collapse: collapse !important; }
table.dataTable thead th { border-bottom: 1px solid var(--border) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 3px 8px !important; margin: 0 1px !important; border-radius: 6px !important; font-size: 12px;
}
.dataTables_wrapper div.dataTables_info, .dataTables_wrapper div.dataTables_filter { font-size: 11.5px; }
@media (max-width: 575.98px) {
  div.dataTables_wrapper div.dataTables_filter { text-align: left; margin-top: 6px; }
  div.dataTables_wrapper div.dataTables_filter input { width: 100%; }
}

/* ============ Modal / toast ============ */
.modal-content { border-radius: var(--radius); font-size: 13px; }
.modal-header, .modal-footer { padding: 10px 14px; }
.modal-body { padding: 14px; }
#nota-toasts {
  position: fixed; right: 12px; bottom: calc(var(--bottomnav-h) + 12px); z-index: 1090;
  display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: calc(100vw - 24px);
  pointer-events: none;
}
@media (min-width: 992px) { #nota-toasts { bottom: 16px; } }
.nota-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 9px;
  background: rgba(10,42,94,.97); color: #f8fafc; border-radius: 10px; padding: 10px 12px; font-size: 12.5px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35); border-left: 4px solid var(--gold);
  opacity: 0; transform: translateY(10px);
  animation: notaToastIn .28s cubic-bezier(.21,1.02,.73,1) forwards;
}
.nota-toast.hide { animation: notaToastOut .3s ease forwards; }
.nota-toast .ic { font-size: 14px; line-height: 1.35; margin-top: 1px; flex: 0 0 auto; }
.nota-toast .tx { flex: 1 1 auto; }
.nota-toast .x {
  flex: 0 0 auto; background: transparent; border: 0; color: inherit; opacity: .6;
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 4px;
}
.nota-toast .x:hover { opacity: 1; }
.nota-toast.ok { border-left-color: #34d399; }
.nota-toast.ok .ic { color: #34d399; }
.nota-toast.err { border-left-color: #fb7185; }
.nota-toast.err .ic { color: #fb7185; }
.nota-toast.warn, .nota-toast.info { border-left-color: #f7bd40; }
.nota-toast.warn .ic, .nota-toast.info .ic { color: #f7bd40; }
@keyframes notaToastIn { to { opacity: 1; transform: translateY(0); } }
@keyframes notaToastOut { to { opacity: 0; transform: translateY(10px); } }

/* ============ Login ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at top, #16345f, var(--navy) 60%);
}
.login-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: 14px; padding: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.login-title { text-align: center; font-weight: 800; color: var(--navy); font-size: 20px; margin-bottom: 4px; }
.login-title i { color: var(--gold); font-size: 30px; }
.login-sub { text-align: center; color: var(--muted); font-size: 11.5px; margin-bottom: 18px; }

/* ============ Utility: no horizontal scroll ============ */
img, svg, canvas, table, iframe { max-width: 100%; }
.wrap-break { overflow-wrap: anywhere; word-break: break-word; }
.row-tight { --bs-gutter-x: .6rem; --bs-gutter-y: .6rem; }

/* toggle button group untuk laporan */
.btn-group.flex-wrap .btn { flex: 1 1 auto; min-width: 110px; }

/* ============ Form transaksi: pembeda jenis ============ */
.trx-form[data-jenis="jual"] { --trx: #15803d; --trx-2: #166534; --trx-bg: #e7f6ec; --trx-border: #b7e2c6; }
.trx-form[data-jenis="beli"] { --trx: #b91c1c; --trx-2: #991b1b; --trx-bg: #fdeaea; --trx-border: #f3c2c2; }
.trx-form .trx-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--trx-bg); color: var(--trx);
  border: 1px solid var(--trx-border); border-left: 5px solid var(--trx);
  border-radius: var(--radius, 10px); padding: 10px 14px; margin-bottom: 12px;
  font-weight: 700; letter-spacing: .3px;
}
.trx-form .trx-banner i { font-size: 22px; }
.trx-form #j_jual:checked + label,
.trx-form #j_jual:active + label { background: #15803d !important; border-color: #15803d !important; color: #fff !important; }
.trx-form #j_beli:checked + label,
.trx-form #j_beli:active + label { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
.trx-form .trx-detail .card-header { background: var(--trx-bg); color: var(--trx); }
.trx-form .trx-total-val { color: var(--trx); font-size: 1.15rem; }
.trx-form .form-control:focus, .trx-form .form-select:focus {
  border-color: var(--trx); box-shadow: 0 0 0 .15rem rgba(0,0,0,.06);
}
.trx-form .btn-final { background: var(--trx); border: 1.5px solid var(--trx); color: #fff; }
.trx-form .btn-final:hover { background: var(--trx-2); border-color: var(--trx-2); color: #fff; }

/* Surat jalan blocks di form transaksi */
.sj-block { border: 1px solid var(--trx-border, var(--border)); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; background: #fff; }
.sj-block-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--trx-bg); border-bottom: 1px solid var(--trx-border, var(--border)); flex-wrap: wrap; }
.sj-block-head .sj-no { flex: 0 0 auto; }
.sj-block-head .sj-armada { flex: 1 1 170px; min-width: 130px; }
.sj-block-head .sj-pengemudi { flex: 1 1 150px; min-width: 120px; }
.sj-block-head .btn-sj-del { flex: 0 0 auto; }
.sj-block .table { margin-bottom: 0; }

@media print {
  .sidebar, .topbar, .bottomnav, .sidebar-backdrop, .d-print-none { display: none !important; }
  .app-main { padding: 0 !important; margin: 0 !important; }
  .app-body { display: block !important; }
  .card { border: 0 !important; box-shadow: none !important; break-inside: avoid; }
  body { background: #fff !important; }
  .d-print-block { display: block !important; }
}

