/* ============================================================
   Attago Finance — sistem distribusi & keuangan multi-depo
   Identitas: hitam tinta + merah sinyal (chevron ganda logo perusahaan) di atas putih.
   Merah merek hanya untuk tanda merek, menu aktif, dan tombol aksi uang (Bayar, Setor, Tinjau);
   merah tua --red-* tetap berarti telat / minus / galat.
   Tipografi: Plus Jakarta Sans (variable) + IBM Plex Mono
   ============================================================ */

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/static/fonts/plus-jakarta-sans-wght.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/static/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/static/fonts/ibm-plex-mono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #F3F3F4;
  --surface: #FFFFFF;
  --surface2: #F8F8F9;
  --line: #E4E4E7;
  --line2: #D4D4D8;
  --ink: #111113;
  --ink2: #4A4A51;
  --ink3: #74747C;

  /* warna utama: hitam tinta & abu arang (nama "teal" dipertahankan agar semua halaman ikut) */
  --teal-950: #070708;
  --teal-900: #111113;
  --teal-800: #1B1B1E;
  --teal-700: #2A2A2E;
  --teal-600: #111113;
  --teal-500: #3F3F46;
  --teal-100: #E4E4E7;
  --teal-50: #F4F4F5;

  /* merah merek (chevron logo) */
  --brand: #E5322B;
  --brand-600: #C92A22;
  --brand-700: #A8231C;
  --brand-50: #FDEEEC;

  --amber-700: #8F5715;
  --amber-600: #B26E1E;
  --amber-500: #D98A2B;
  --amber-100: #F7E7CC;
  --amber-50: #FBF4E6;

  --green-700: #17663A;
  --green-600: #1E7B47;
  --green-50: #E6F4EC;
  --red-700: #912018;
  --red-600: #B42318;
  --red-50: #FDECEA;
  --blue-600: #2A78D6;
  --blue-50: #E8F0FB;

  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 17, 19, .05), 0 10px 28px -14px rgba(17, 17, 19, .16);
  --shadow-sm: 0 1px 2px rgba(17, 17, 19, .06);
  --sidebar-w: 248px;
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; text-underline-offset: 3px; }
/* tautan di dalam kalimat & nomor dokumen: bergaris tipis agar terlihat bisa diklik */
p a, .hint a, a.mono { text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
p a:hover, .hint a:hover, a.mono:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--ink3); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 22px 26px 48px; max-width: 1460px; width: 100%; margin: 0 auto; }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #151517 0%, #0C0C0D 100%);
  color: #B9B9C0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.side-logo {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); margin-bottom: 4px;
}
.side-logo img { width: 38px; height: 38px; }
/* merek bertumpuk seperti logo perusahaan: ATTAGO tebal, FINANCE berjarak */
.merek .nm { font-size: 19px; font-weight: 800; color: inherit; letter-spacing: .01em; line-height: 1; text-transform: uppercase; }
.merek .tg { font-size: 9.5px; color: inherit; opacity: .62; letter-spacing: .42em; text-transform: uppercase; font-weight: 700; margin-top: 4px; }
.side-logo, .side-logo:hover, .login-left .brand { color: #fff; text-decoration: none; }
.side-nav { padding: 6px 12px 12px; flex: 1; }
.nav-sec {
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #7E7E87; padding: 16px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8.5px 10px; margin: 1px 0;
  border-radius: 9px; color: #CFCFD5; font-weight: 550; font-size: 13.5px;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 700; }
/* menu aktif ditandai chevron merah kecil — tanda yang sama dengan logo */
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; width: 7px; height: 12px; margin-top: -6px;
  background: var(--brand); clip-path: polygon(0 0, 48% 0, 100% 50%, 48% 100%, 0 100%, 52% 50%);
}
.nav-item .ic { width: 17px; height: 17px; opacity: .85; }
.side-user {
  margin: 10px 12px 14px; padding: 11px 12px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px; display: flex; align-items: center; gap: 10px;
}
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { color: #fff; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 11.5px; color: #9D9DA5; }
.side-user form { margin: 0; }
.side-user button {
  background: none; border: 0; color: #A5A5AD; cursor: pointer; padding: 6px; border-radius: 8px; display: flex;
}
.side-user button:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 26px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.tb-title h1 { font-size: 19px; font-weight: 800; }
.tb-title .tb-sub { font-size: 12.5px; color: var(--ink3); margin-top: 1px; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.tb-date { font-size: 12.5px; color: var(--ink3); padding-right: 6px; }
.burger { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px; cursor: pointer; color: var(--ink2); }

/* ---------- kartu & grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px 0;
}
.card-head.bordered { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.card-title .muted { font-weight: 550; }

/* KPI */
.kpi { padding: 16px 18px 15px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; color: var(--ink2); font-weight: 650; letter-spacing: .02em; }
.kpi .val { font-size: 24px; font-weight: 800; letter-spacing: -.03em; margin-top: 3px; }
.kpi .foot { margin-top: 7px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.kpi .ic-wrap {
  position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.kpi.k-teal .ic-wrap { background: var(--teal-50); color: var(--teal-600); }
.kpi.k-amber .ic-wrap { background: var(--amber-50); color: var(--amber-600); }
.kpi.k-green .ic-wrap { background: var(--green-50); color: var(--green-600); }
.kpi.k-red .ic-wrap { background: var(--red-50); color: var(--red-600); }
.delta { font-size: 11.5px; font-weight: 750; padding: 2px 7px; border-radius: 99px; }
.delta.up { background: var(--green-50); color: var(--green-700); }
.delta.down { background: var(--red-50); color: var(--red-700); }

/* ---------- tombol ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  padding: 8.5px 14px; font: 650 13.5px var(--font); letter-spacing: .005em;
  transition: background .12s, border-color .12s, color .12s;
  text-decoration: none !important;
}
.btn .ic { width: 15.5px; height: 15.5px; }
.btn-primary { background: var(--teal-600); color: #fff; }
.btn-primary:hover { background: var(--teal-700); }
/* tombol aksi uang (Bayar, Setor, Tinjau, Terima …) memakai merah merek */
.btn-amber { background: var(--brand); color: #fff; }
.btn-amber:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--ink2); border-color: var(--line2); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--teal-50); }
.btn-danger { background: var(--surface); color: var(--red-600); border-color: var(--red-50); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { padding: 5.5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn { white-space: nowrap; }
/* input di dalam tabel: padding lebih rapat agar angka tidak terpotong */
.tbl td .input { padding: 7px 8px; }
/* angka di tabel form tanpa tombol panah: qty/harga 3–5 digit tetap terbaca utuh */
.tbl td input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.tbl td input[type=number]::-webkit-inner-spin-button,
.tbl td input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* tabel ringkas untuk kartu sempit (pratinjau jurnal) */
.tbl.tbl-rapat th, .tbl.tbl-rapat td { padding: 8px 10px; }
.tbl-rapat td:first-child { overflow-wrap: anywhere; }
/* tabel umur utang: judul kolom angka boleh dua baris agar nama pemasok tidak terjepit */
.tbl-umur th.num { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.tbl-umur .nama { min-width: 160px; }
/* matriks stok per depo (laporan stok): 12 kolom harus muat di layar 1280px */
.tbl-matriks { font-size: 12.5px; }
.tbl.tbl-matriks th, .tbl.tbl-matriks td { padding: 9px 7px; }
.tbl.tbl-matriks .sticky-col { min-width: 160px; }
.tbl-matriks th.num { white-space: normal; vertical-align: bottom; line-height: 1.3; }

/* ---------- badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 750; letter-spacing: .03em;
  padding: 2.5px 9px; border-radius: 99px; white-space: nowrap;
}
.b-teal { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }
.b-amber { background: var(--amber-50); color: var(--amber-700); }
.b-green { background: var(--green-50); color: var(--green-700); }
.b-red { background: var(--red-50); color: var(--red-700); }
.b-blue { background: var(--blue-50); color: #1C5CA8; }
.b-gray { background: #EEEEF0; color: var(--ink2); }
.b-solid-red { background: var(--red-600); color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- tabel ---------- */
.tbl-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink3); font-weight: 750; padding: 11px 14px;
  border-bottom: 1px solid var(--line); background: var(--surface2);
  white-space: nowrap;
}
.tbl td { padding: 10.5px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #F7F7F8; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tfoot td { background: var(--surface2); font-weight: 750; }

/* matriks stok */
.tbl .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 210px; box-shadow: 2px 0 0 var(--line); }
.tbl tbody tr:hover .sticky-col { background: #F7F7F8; }
.cell-low { background: var(--red-50) !important; color: var(--red-700); font-weight: 750; }
.cell-warn { background: var(--amber-50) !important; color: var(--amber-700); font-weight: 700; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink2); }
.field .req { color: var(--red-600); }
.field input, .field select, .field textarea, .input {
  font: 500 13.5px var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line2); border-radius: 9px;
  padding: 9px 12px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(17, 17, 19, .1);
}
.field .hint { font-size: 11.5px; color: var(--ink3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.radio-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-cards label {
  flex: 1; min-width: 120px; cursor: pointer;
  border: 1.5px solid var(--line2); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; font-size: 13px;
}
.radio-cards input { display: none; }
.radio-cards label:has(input:checked) { border-color: var(--teal-600); background: var(--teal-50); }
.radio-cards b { font-size: 13.5px; }

/* filter bar */
.filterbar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.filterbar .field { margin: 0; min-width: 130px; }
.filterbar .field.grow { flex: 1; min-width: 190px; }
.filterbar input, .filterbar select { padding: 7.5px 11px; font-size: 13px; }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; padding: 13px 20px; }
.pager .pg-info { margin-right: auto; font-size: 12.5px; color: var(--ink3); }
.pager a, .pager span.cur {
  min-width: 30px; height: 30px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line2); font-size: 13px; font-weight: 600; color: var(--ink2);
}
.pager a:hover { border-color: var(--teal-500); color: var(--teal-600); text-decoration: none; }
.pager span.cur { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }

/* ---------- flash ---------- */
.flash {
  position: fixed; top: 18px; right: 18px; z-index: 100;
  display: flex; gap: 10px; align-items: flex-start;
  max-width: 380px; padding: 13px 16px; border-radius: 12px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 13.5px;
  animation: flashin .25s ease;
}
.flash.sukses { background: #0E5133; color: #E7F8EE; }
.flash.gagal { background: #7C271F; color: #FDECEA; }
@keyframes flashin { from { transform: translateY(-8px); opacity: 0; } }

/* ---------- meter row (bar chart HTML) ---------- */
.meter { display: flex; flex-direction: column; gap: 11px; }
.meter-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.meter-row .m-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--ink2); }
.meter-row .m-bar { height: 14px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.meter-row .m-bar > i { display: block; height: 100%; border-radius: 4px; background: var(--teal-500); min-width: 2px; }
.meter-row.alt .m-bar > i { background: var(--brand); }
.meter-row .m-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; white-space: nowrap; }

/* daftar ringkas (list rows) */
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .s { font-size: 12px; color: var(--ink3); }

/* ---------- produk card ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.prod-card { display: flex; flex-direction: column; }
.prod-img {
  height: 150px; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(90px 90px at 50% 46%, rgba(17,17,19,.06), transparent 70%),
    linear-gradient(180deg, var(--surface2), #EEEEF0);
  border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 1px solid var(--line);
}
.prod-img img { height: 116px; }
.prod-body { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.prod-body .p-name { font-weight: 800; font-size: 14.5px; letter-spacing: -.01em; }
.prod-body .p-pack { font-size: 12px; color: var(--ink3); margin-top: 1px; }
.tier { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.tier b { font-variant-numeric: tabular-nums; }
.tiers { border-top: 1px dashed var(--line2); padding-top: 8px; }
.prod-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 9px; border-top: 1px dashed var(--line2); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-left {
  position: relative; overflow: hidden; isolation: isolate;
  background: #111113; color: #C9C9CF; padding: 46px 54px; display: flex; flex-direction: column;
}
/* chevron ganda raksasa — tanda merek. Ikut alur flex di antara merek dan judul (tak pernah menimpa teks),
   mengecil di layar pendek, dan terpotong di tepi kanan panel. */
.login-left::after {
  content: ''; order: 1; flex: 1 1 auto; min-height: 150px; max-height: 470px; margin: 30px -190px 8px 0;
  background: url('/static/img/hero-chevron.svg') no-repeat right center / contain;
}
.login-left .brand { display: flex; align-items: center; gap: 13px; }
.login-left .brand img { width: 46px; height: 46px; }
.login-left .brand .nm { font-size: 24px; }
.login-left .brand .tg { font-size: 10.5px; }
.login-hero { order: 2; margin: auto 0 0; padding: 22px 0 6px; max-width: 440px; }
.login-hero h2 { color: #fff; font-size: 30px; font-weight: 800; letter-spacing: -.025em; line-height: 1.2; }
.login-hero h2 em { font-style: normal; color: var(--brand); }
.login-hero p { color: #A9A9B1; font-size: 14px; margin: 14px 0 0; }
.login-chips { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 20px; }
.login-chips span {
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 99px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #E4E4E7;
}
.login-right { display: flex; align-items: center; justify-content: center; padding: 36px 26px; background: var(--bg); }
.login-card { width: 100%; max-width: 392px; }
.login-merek-hp { display: none; align-items: center; justify-content: center; gap: 11px; margin-bottom: 20px; color: var(--ink); }
.login-merek-hp img { width: 40px; height: 40px; }
.login-card .card { padding: 30px 30px 26px; }
.login-card h1 { font-size: 21px; margin-bottom: 2px; }
.login-card .sub { color: var(--ink3); font-size: 13px; margin-bottom: 20px; }
.login-demo {
  margin-top: 16px; font-size: 12.5px; color: var(--ink2);
  background: var(--surface2); border: 1px dashed var(--line2);
  border-radius: 10px; padding: 10px 13px;
}
.login-err {
  background: var(--red-50); color: var(--red-700); font-weight: 650; font-size: 13px;
  padding: 9px 13px; border-radius: 9px; margin-bottom: 14px;
}

/* ---------- halaman faktur / cetak ---------- */
.inv-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.inv-no { font-family: var(--mono); font-weight: 600; font-size: 17px; }
.totals { margin-left: auto; max-width: 330px; width: 100%; }
.totals .trow { display: flex; justify-content: space-between; padding: 5.5px 0; font-size: 13.5px; }
.totals .trow.grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-size: 16.5px; font-weight: 800; }

/* ---------- dialog ---------- */
dialog.dlg {
  border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 0; width: 400px; max-width: calc(100vw - 40px);
}
dialog.dlg::backdrop { background: rgba(10, 10, 12, .5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px 0; }
.dlg-body { padding: 12px 18px 18px; }

/* ---------- lain-lain ---------- */
.empty { padding: 34px 20px; text-align: center; color: var(--ink3); }
.empty .ic { width: 34px; height: 34px; opacity: .4; margin-bottom: 8px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chart-box { padding: 6px 18px 16px; height: 300px; position: relative; }
.chart-box canvas { max-width: 100%; }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--ink2); align-items: center; }
.legend-inline .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.stat-inline { display: flex; gap: 26px; flex-wrap: wrap; }
.stat-inline .si b { display: block; font-size: 17px; letter-spacing: -.02em; }
.stat-inline .si span { font-size: 12px; color: var(--ink3); }

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .sidebar, .no-print, .flash, .tb-right, .burger, .seg { display: none !important; }
  .topbar { position: static; padding: 0 0 12px; border: 0; }
  .cetak-merek { font-size: 10.5px; color: var(--ink3); margin-bottom: 4px; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block; }
  @page { margin: 14mm; }
}

/* ---------- responsif ---------- */
@media (max-width: 1180px) {
  .col-3 { grid-column: span 6; }
  .col-4 { grid-column: span 6; }
  .col-5, .col-7, .col-8, .col-9, .col-6 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
    transform: translateX(-100%); transition: transform .2s ease; height: 100dvh;
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(10,10,12,.45); }
  .burger { display: inline-flex; }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 12px 14px; }
  .tb-date { display: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-merek-hp { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .col-3, .col-4 { grid-column: span 12; }
  .meter-row { grid-template-columns: 96px 1fr auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   NAVIGASI BERKELOMPOK (bisa dilipat)
   ============================================================ */
.nav-grp > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; border-radius: 6px; }
.nav-grp > summary::-webkit-details-marker { display: none; }
.nav-grp > summary::after {
  content: ''; width: 6px; height: 6px; margin-right: 8px; opacity: .7;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s ease;
}
.nav-grp[open] > summary::after { transform: rotate(45deg); }
.nav-grp > summary:hover { color: #E4E4E7; }
.nav-grp > summary:focus-visible { outline-offset: -2px; }
.nav-grp:not([open]) + .nav-grp > summary { padding-top: 10px; }
.nav-bawah { margin-top: 14px; }

/* ============================================================
   KAS & BANK
   ============================================================ */
.rek-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.rek-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.rek-card .rk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rek-card .rk-nama { font-weight: 800; font-size: 14.5px; letter-spacing: -.01em; }
.rek-card .rk-no { font-family: var(--mono); font-size: 12px; color: var(--ink3); }
.rek-card .rk-saldo { font-size: 23px; font-weight: 800; letter-spacing: -.03em; }
.rek-card .rk-meta { display: flex; gap: 14px; font-size: 12px; color: var(--ink2); flex-wrap: wrap; }
.rek-card .rk-aksi { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px dashed var(--line2); padding-top: 10px; }
.ikon-bulat { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ikon-bulat.bank { background: var(--teal-50); color: var(--teal-600); }
.ikon-bulat.kas { background: var(--amber-50); color: var(--amber-600); }
.masuk { color: var(--green-600); }
.keluar { color: var(--red-600); }
tr.batal td { color: var(--ink3); }
tr.batal td .coret { text-decoration: line-through; }
.tbl tr.hari td { background: var(--surface2); font-weight: 750; font-size: 12.5px; color: var(--ink2); border-top: 1px solid var(--line2); }
.tbl tr.subtotal td { background: #FAFAFA; font-weight: 700; font-size: 12.5px; }
.lawan { font-size: 12px; color: var(--ink3); }

/* form bukti kas/bank */
.baris-akun td { vertical-align: top; }
.baris-akun .input { padding: 7px 8px; }
.saldo-info { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--line); font-size: 12.5px; }
.saldo-info b { font-size: 15px; }
.saldo-info.kurang { background: var(--red-50); border-color: #F0D4D1; color: var(--red-700); }

/* rekonsiliasi */
.rekon-sum { position: sticky; top: 76px; }
.rekon-sum .baris { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; }
.rekon-sum .baris b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rekon-sum .baris span { min-width: 0; }
.rekon-sum .selisih { margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-weight: 800; text-align: center; font-size: 14px; }
.rekon-sum .selisih.nol { background: var(--green-50); color: var(--green-700); }
.rekon-sum .selisih.ada { background: var(--red-50); color: var(--red-700); }
.tbl tr.dicentang td { background: var(--teal-50); }
.cek { width: 17px; height: 17px; accent-color: var(--teal-600); cursor: pointer; }

/* jurnal harian */
.jh .tbl td { padding-top: 6px; padding-bottom: 6px; }
.jh tr.jh-kepala td { border-top: 1px solid var(--line2); padding-top: 10px; background: var(--surface); }
.jh tr.jh-baris td.akun-k { padding-left: 38px; }
.jh tr.jh-baris td { border-bottom: 0; }
.jh .nav-hari { display: flex; align-items: center; gap: 6px; }

@media print {
  .nav-grp, .filterbar, .page-actions { display: none !important; }
  .jh .tbl { font-size: 11px; }
  .tbl tr.hari td, .tbl tr.subtotal td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 900px) {
  .rekon-sum { position: static; }
}

/* ============================================================
   LAPORAN KEUANGAN
   ============================================================ */
.lap-kepala { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.kpi .kpi-link { display: inline-block; margin-top: 9px; font-size: 12px; font-weight: 700; color: var(--teal-600); }
.kpi .kpi-link:hover { color: var(--brand-600); }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; max-width: 100%; overflow-x: auto; }
.seg a { padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 650; color: var(--ink2); text-decoration: none; white-space: nowrap; }
.seg a:hover { color: var(--teal-700); background: var(--teal-50); }
.seg a.on { background: var(--teal-600); color: #fff; }
.seg.seg-sm a { padding: 4px 10px; font-size: 12px; }

/* matriks laba rugi (kolom depo / bulan) */
.tbl-lr { font-size: 12.5px; }
.tbl-lr th, .tbl-lr td { padding: 7px 10px; }
.tbl-lr th.num { white-space: normal; vertical-align: bottom; min-width: 78px; line-height: 1.3; }
.tbl-lr th a { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.tbl-lr th a:hover { color: var(--brand-600); }
.tbl-lr .kol-sub { display: block; font-size: 10.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink3); }
.tbl-lr .sticky-col { min-width: 240px; }
.tbl-lr th.sticky-col { background: var(--surface2); z-index: 3; }
.tbl-lr .kol-total { border-left: 1px solid var(--line2); font-weight: 750; }
.tbl-lr td.neg { color: var(--red-600); }
.tbl-lr tr.tfoot td.sticky-col, .tbl-lr tr.pct td.sticky-col { background: var(--surface2); }
.tbl-lr tr.pct td { font-size: 11.5px; color: var(--ink3); background: var(--surface2); padding-top: 3px; padding-bottom: 6px; }
.tbl-lr tr.tfoot td { border-bottom: 0; }
.tbl-lr tr.laba-bersih td { font-size: 13.5px; }
.tbl-ak tr.rincian td { border-bottom: 0; padding-top: 3px; padding-bottom: 3px; }
@media (max-width: 900px) {
  .tbl-lr .sticky-col { min-width: 150px; max-width: 170px; white-space: normal; }
  .lap-kepala .seg { width: 100%; }
}

@media print {
  .tbl-lr { font-size: 9.5px; }
  .tbl-lr th, .tbl-lr td { padding: 4px 5px; }
  .tbl-lr .sticky-col { position: static; min-width: 0; box-shadow: none; }
  .tbl-wrap { overflow: visible; }
  .chart-box { break-inside: avoid; }
}

/* ---------- stock opname ---------- */
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.kotak-info { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; }
.kotak-info .ic { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.kotak-info.gagal { background: var(--red-50); color: var(--red-700); }
.kotak-info.awas { background: var(--amber-50); color: var(--amber-700); }
.so-meta { display: grid; grid-template-columns: repeat(2, minmax(160px, auto)); gap: 8px 28px; font-size: 13px; }
.so-meta span.muted { display: block; font-size: 11.5px; }
.so-baris { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.so-baris b { text-align: right; }
.so-inline { display: flex; gap: 10px; align-items: flex-end; }
.so-link { display: flex; gap: 8px; }
.so-link input { font-family: var(--mono); font-size: 12.5px; }
.so-cepat { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.putusan { display: flex; flex-direction: column; gap: 10px; }
.putusan .opsi {
  display: grid; grid-template-columns: 18px 1fr; gap: 2px 10px; padding: 11px 13px;
  border: 1.5px solid var(--line2); border-radius: 11px; cursor: pointer;
}
.putusan .opsi input { grid-row: span 2; margin-top: 3px; accent-color: var(--teal-600); width: auto; }
.putusan .opsi b { font-size: 13.5px; }
.putusan .opsi span { font-size: 12px; color: var(--ink2); line-height: 1.45; }
.putusan .opsi:has(input:checked) { border-color: var(--teal-600); background: var(--teal-50); }
.putusan .opsi:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.opsi-isi { padding: 2px 2px 0 30px; }
.opsi-isi.tanpa-indent { padding-left: 0; }
.cek-baris { display: flex; gap: 9px; align-items: flex-start; font-weight: 500 !important; color: var(--ink) !important; cursor: pointer; }
.cek-baris input { width: auto !important; margin-top: 3px; accent-color: var(--teal-600); }
.alur-langkah { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; color: var(--ink2); display: flex; flex-direction: column; gap: 7px; }
.sel-kurang { color: var(--red-600); font-weight: 750; }
.sel-lebih { color: var(--green-600); font-weight: 750; }
.tbl tr.sama td { color: var(--ink3); }
.tbl tr.sama td b { font-weight: 600; }
.row-item.batal .t a, .row-item.batal b { text-decoration: line-through; }

/* lembar hitung untuk petugas (dibuka lewat link, tanpa login) — ponsel dulu */
.hitung-body { background: var(--bg); }
.hitung-top { background: #111113; color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 11px; }
.hitung-top .nm { font-size: 17px; }
.hitung-top .tg { font-size: 9px; }
.hitung-top .ket { margin-left: auto; font-size: 11px; font-weight: 700; color: #A5A5AD; letter-spacing: .08em; text-transform: uppercase; }
.hitung-wrap { max-width: 680px; margin: 0 auto; padding: 16px 12px 48px; }
.hitung-judul { font-size: 21px; margin: 2px 0 1px; }
.hitung-info { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.hitung-info span { display: block; font-size: 11.5px; }
.hitung-petunjuk { background: var(--teal-50); border-color: var(--teal-100); font-size: 13px; }
.hitung-petunjuk ol { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--ink2); }
.hitung-instruksi { margin-top: 10px; padding: 9px 12px; background: #fff; border-radius: 9px; border: 1px solid var(--teal-100); }
.hitung-item { display: grid; grid-template-columns: 38px 1fr 124px; gap: 6px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.hitung-item:last-child { border-bottom: 0; }
.hitung-item img { width: 34px; height: 44px; object-fit: contain; }
.hitung-item .nama { min-width: 0; font-size: 14px; }
.hitung-item .jml { position: relative; }
.hitung-item .jml input { font-size: 20px; font-weight: 750; text-align: right; height: 50px; padding: 8px 46px 8px 10px; }
.hitung-item .jml .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink3); pointer-events: none; }
.hitung-item .cat { grid-column: 2 / -1; font-size: 13px; padding: 7px 10px; }
.hitung-item.terisi .jml input { border-color: var(--ink); background: #FAFAFA; }
.hitung-item.salah { background: var(--red-50); }
.hitung-item.salah .jml input { border-color: var(--red-600); }
#progres.lengkap { color: var(--green-700); font-weight: 750; }
.hitung-kirim { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 14px; }
.hitung-pesan { text-align: center; padding: 30px 22px; }
.hitung-pesan h1 { font-size: 20px; margin: 10px 0 6px; }
.hitung-pesan p { color: var(--ink2); margin: 0 0 8px; }
.hitung-ikon { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--ink2); }
.hitung-ikon .ic { width: 26px; height: 26px; }
.hitung-ikon.sukses { background: var(--green-50); color: var(--green-600); }
.hitung-ikon.gagal { background: var(--red-50); color: var(--red-600); }
@media (max-width: 420px) {
  .hitung-item { grid-template-columns: 30px 1fr 108px; padding: 11px 12px; gap: 6px 10px; }
  .hitung-item img { width: 28px; height: 38px; }
  .so-meta { grid-template-columns: 1fr; }
}

/* ---------- umur piutang ---------- */
.umur-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.umur-strip.tiga { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.umur-strip.polos { border: 0; box-shadow: none; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.umur-total {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface2); font-size: 12.5px;
}
.umur-total .lbl { font-weight: 700; color: var(--ink2); }
.umur-total .val { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.umur-total .badge { align-self: center; }
.umur-sel { padding: 13px 15px 12px; border-left: 1px solid var(--line); border-top: 4px solid var(--umur, var(--line)); min-width: 0; }
.umur-sel.lancar, .umur-strip.tiga .umur-sel.t21 { border-left: 0; }
.umur-sel .lbl { font-size: 11.5px; font-weight: 700; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.umur-sel .val { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.umur-sel .foot { font-size: 11.5px; color: var(--ink3); margin-top: 2px; white-space: nowrap; }
.umur-sel.lancar { --umur: var(--green-600); }
.umur-sel.t7 { --umur: #E3B341; }
.umur-sel.t14 { --umur: var(--amber-500); }
.umur-sel.t21 { --umur: #D9674E; }
.umur-sel.t30 { --umur: var(--red-600); }
.umur-sel.t30p { --umur: var(--red-700); }
.tbl-aging { font-size: 12.5px; }
.tbl-aging th, .tbl-aging td { padding: 9px 7px; }
.tbl-aging th.num { white-space: normal; vertical-align: bottom; line-height: 1.25; }
.tbl-aging th.th-grup { text-align: center; border-bottom: 1px solid var(--line2); padding-bottom: 6px; }
.tbl-aging thead tr:nth-child(2) th { padding-top: 6px; }
.tbl-aging .nama { min-width: 180px; }
.tbl-aging td.nol { color: var(--ink3); }
.tbl-aging td.u-t7, .tbl-aging td.u-t14 { color: var(--amber-700); font-weight: 650; }
.tbl-aging td.u-t21, .tbl-aging td.u-t30 { color: var(--red-600); font-weight: 700; }
.tbl-aging td.u-t30p { color: var(--red-700); font-weight: 800; }
@media (max-width: 900px) {
  .umur-strip, .umur-strip.tiga { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .umur-sel { border-left: 0 !important; border-bottom: 1px solid var(--line); }
}
@media print {
  .umur-strip, .umur-sel { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl-aging { font-size: 10px; }
  .tbl-aging th, .tbl-aging td { padding: 4px 5px; }
}
