/* ================================================================
   Besman Finance — identitas: merah #C62828, navy #2E3192
   ================================================================ */

:root {
  --red: #C62828;
  --red-2: #A51D1D;
  --red-lt: #FDECEC;
  --navy: #2E3192;
  --navy-2: #1E2168;
  --navy-lt: #EEEEF9;
  --ink: #15162E;
  --muted: #666B8A;
  --line: #E4E6F0;
  --bg: #F4F5FA;
  --white: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(21, 22, 46, .04), 0 10px 26px -16px rgba(21, 22, 46, .28);
  --sidebar: 252px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: none; }
small { font-size: 12.5px; }
strong { font-weight: 700; }

/* ------------------------------------------------------------ logo */

.logo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  user-select: none;
}
.logo__lock {
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: 100%;
}
.logo__word {
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -.045em;
}
.logo__bes { color: var(--red); }
.logo__man { color: var(--navy); }
.logo__swoosh {
  display: block;
  width: calc(100% + 5px);
  height: 8px;
  margin: 2px 0 0 -2px;
}
.logo__swoosh svg { display: block; width: 100%; height: 100%; }
.logo__swoosh path { fill: var(--red); }
.logo__tag {
  margin-top: 6px;
  font-family: 'Dancing Script', 'Segoe Script', cursive;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: .01em;
  white-space: nowrap;
}
.logo--dark .logo__man { color: #FFFFFF; }
.logo--dark .logo__tag { color: #F4A6A6; }
.logo--dark .logo__swoosh path { fill: #E24B4B; }
.logo--lg .logo__word { font-size: 44px; }
.logo--lg .logo__swoosh { height: 12px; }
.logo--lg .logo__tag { font-size: 17px; }

/* --------------------------------------------------------- sidebar */

.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(198, 40, 40, .30), transparent 60%),
    linear-gradient(170deg, #262A85 0%, #1B1E63 55%, #14163F 100%);
  color: #fff;
  z-index: 40;
}

.brand { display: block; padding: 0 8px 22px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 10px;
  color: rgba(255, 255, 255, .74);
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-link.is-active {
  background: #fff;
  color: var(--navy-2);
  font-weight: 700;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .8);
}
.nav-link.is-active .nav-ico { color: var(--red); }
.nav-ico { width: 19px; height: 19px; flex: none; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex: none;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-meta strong { font-size: 13.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: rgba(255, 255, 255, .6); font-size: 11.5px; }
.logout {
  display: block;
  text-align: center;
  padding: 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .86);
  font-size: 13px;
  font-weight: 600;
}
.logout:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.scrim { display: none; }

/* ------------------------------------------------------------ main */

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-titles h1 { font-size: 21px; }
.topbar-titles p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.date-chip {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  background: var(--navy-lt);
  border-radius: 999px;
  padding: 7px 13px;
  white-space: nowrap;
}

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  padding: 0 10px;
}
.menu-btn span { display: block; height: 2px; background: var(--navy); border-radius: 2px; }

.content { padding: 26px 32px 40px; flex: 1; }

.appfoot {
  padding: 16px 32px 28px;
  color: #9297B4;
  font-size: 12px;
}

/* ----------------------------------------------------------- blocks */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h2 { font-size: 17px; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 20px 22px; }

.grid { display: grid; gap: 20px; }
.grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.grid--2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.grid--half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mb-24 { margin-bottom: 24px; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }

/* ------------------------------------------------------------ stats */

.stat {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--navy);
}
.stat--out::after { background: var(--red); }
.stat--net::after { background: linear-gradient(180deg, var(--navy), var(--red)); }
.stat--muted::after { background: #C3C7DA; }
.stat-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.stat-value.is-negative { color: var(--red); }
.stat-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); }

/* ----------------------------------------------------------- button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s, box-shadow .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #D53333, var(--red-2));
  color: #fff;
  box-shadow: 0 10px 22px -14px rgba(198, 40, 40, 1);
}
.btn-primary:hover { box-shadow: 0 12px 24px -12px rgba(198, 40, 40, .95); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #C9CDE0; }
.btn-danger { background: var(--red-lt); color: var(--red-2); border-color: #F6CFCF; }
.btn-danger:hover { background: #FADDDD; }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--navy); border-color: #C9CDE0; }
.icon-btn.danger:hover { color: var(--red); border-color: #F0C4C4; background: var(--red-lt); }

/* ------------------------------------------------------------ forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(46, 49, 146, .12);
}
.field .hint { font-size: 12px; color: var(--muted); }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filters .field { min-width: 140px; }

.amount-input { position: relative; }
.amount-input span {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.amount-input input { padding-left: 42px; font-weight: 700; letter-spacing: .01em; }

/* ------------------------------------------------------------- tabs */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.tab:hover { background: #F6F7FC; color: var(--navy); }
.tab.is-active { background: var(--navy); color: #fff; }

.period-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.period-nav { display: flex; align-items: center; gap: 8px; }
.period-label { display: flex; flex-direction: column; line-height: 1.25; }
.period-label strong { font-size: 15px; }
.period-label small { color: var(--muted); font-size: 12.5px; }
.period-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-left: auto; }
.period-form .field input, .period-form .field select { padding: 8px 11px; font-size: 13.5px; }

/* ----------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left;
  padding: 12px 20px;
  background: #F8F9FD;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #FBFBFE; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
table.data .num--in { color: var(--navy); }
table.data .num--out { color: var(--red); }
table.data tfoot td {
  padding: 14px 20px;
  background: #F8F9FD;
  font-weight: 700;
  border-top: 1px solid var(--line);
}
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge--in { background: var(--navy-lt); color: var(--navy); }
.badge--out { background: var(--red-lt); color: var(--red-2); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pagination .pages { display: flex; gap: 6px; }
.pagination .page {
  min-width: 32px;
  padding: 6px 8px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  background: #fff;
}
.pagination .page.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ------------------------------------------------------------ chart */

.chart { padding: 6px 2px 0; }
.chart-legend { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.swatch { width: 11px; height: 11px; border-radius: 3px; }
.swatch--in { background: var(--navy); }
.swatch--out { background: var(--red); }

.chart-plot {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 210px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(to top, transparent 0, transparent 51px, #F1F2F8 51px, #F1F2F8 52px);
}
.chart-plot--dense { gap: 3px; }
.bar-group {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  position: relative;
}
.bars { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.bar { flex: 1 1 0; min-height: 0; border-radius: 3px 3px 0 0; transition: filter .15s; }
.bar--in { background: linear-gradient(180deg, #4A4EC2, var(--navy)); }
.bar--out { background: linear-gradient(180deg, #DD4545, var(--red)); }
.bar-group:hover .bar { filter: brightness(1.12); }
.bar-labels { display: flex; justify-content: center; }
.bar-label {
  font-size: 10.5px;
  color: #9BA0BC;
  height: 18px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
}
.chart-plot--dense .bar-label { font-size: 9.5px; }
.chart-empty {
  height: 210px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
  background: #FCFCFE;
  border-radius: 10px;
}

/* -------------------------------------------------------- breakdown */

.bd-list { display: flex; flex-direction: column; gap: 16px; padding: 18px 22px 22px; }
.bd-row { display: flex; flex-direction: column; gap: 7px; }
.bd-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 13.5px; }
.bd-name { font-weight: 600; }
.bd-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-track { height: 7px; border-radius: 999px; background: #EFF0F7; overflow: hidden; }
.bd-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4A4EC2, var(--navy)); }
.bd-fill--out { background: linear-gradient(90deg, #DD4545, var(--red)); }
.bd-sub { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ alerts */

.alert {
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert--success { background: #EDF7F0; border-color: #C8E6D2; color: #1D6B3C; }
.alert--error { background: var(--red-lt); border-color: #F5CDCD; color: var(--red-2); }
.alert--info { background: var(--navy-lt); border-color: #D6D8F2; color: var(--navy-2); }
.alert--warning { background: #FFF7E6; border-color: #F6E3B4; color: #8A5B00; }

.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
}
.empty h4 { font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 380px; margin: 0 auto 16px; }

/* ----------------------------------------------------------- dialog */

dialog.modal {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: 0 30px 70px -30px rgba(10, 12, 40, .55);
  color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 17, 45, .45); }
.modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 24px; }
.modal-foot {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #FCFCFE;
  border-radius: 0 0 16px 16px;
}
.modal-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

/* ------------------------------------------------------------- auth */

body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(60% 60% at 15% 10%, rgba(198, 40, 40, .10), transparent 60%),
    radial-gradient(50% 50% at 85% 90%, rgba(46, 49, 146, .14), transparent 60%),
    var(--bg);
  padding: 28px 18px;
}
.auth-card {
  width: min(1000px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px -40px rgba(15, 17, 60, .45);
  border: 1px solid var(--line);
}
.auth-side {
  position: relative;
  padding: 44px 40px;
  color: #fff;
  background:
    radial-gradient(110% 70% at 0% 0%, rgba(198, 40, 40, .45), transparent 62%),
    linear-gradient(160deg, #2E3192 0%, #21246F 55%, #15173F 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  text-align: center;
}

/* papan putih berisi berkas logo (JPG berlatar putih) */
.auth-brand {
  width: 100%;
  max-width: 300px;
  background: #fff;
  border-radius: 16px;
  padding: 24px 26px;
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .55);
}
.auth-brand img { display: block; width: 100%; height: auto; }

.auth-side .auth-welcome {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  line-height: 1.4;
  max-width: 340px;
}

.auth-form { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { font-size: 22px; margin-bottom: 6px; }
.auth-form > p { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-form .form-stack { gap: 16px; }
.auth-hint {
  margin-top: 20px;
  padding: 13px 15px;
  border-radius: 11px;
  background: var(--navy-lt);
  border: 1px solid #DCDFF5;
  font-size: 12.5px;
  color: var(--navy-2);
  line-height: 1.55;
}
.auth-hint code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  background: #fff;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid #DDE0F3;
  font-size: 12px;
}

/* --------------------------------------------------------- print */

@media print {
  .sidebar, .topbar, .appfoot, .no-print, .page-head .actions, .period-form, .tabs { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; font-size: 12px; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .stat { box-shadow: none; border-color: #ccc; }
  table.data th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bd-fill, .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-only { display: none !important; }
.print-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.print-head .meta { text-align: right; font-size: 12px; color: var(--muted); }

/* ----------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, .35);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 45, .45);
    z-index: 35;
  }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px 18px 32px; }
  .appfoot { padding: 12px 18px 24px; }
  .auth-card { grid-template-columns: 1fr; }
  /* panel logo + sambutan tetap tampil di layar kecil (satu kolom di atas form) */
  .auth-side { padding: 30px 22px 26px; gap: 18px; }
  .auth-brand { max-width: 250px; padding: 18px 20px; }
  .auth-side .auth-welcome { font-size: 17px; }
}

@media (max-width: 640px) {
  .grid--stats, .grid--half, .form-row, .form-row--3 { grid-template-columns: minmax(0, 1fr); }
  .date-chip { display: none; }
  .topbar-titles h1 { font-size: 18px; }
  .stat-value { font-size: 22px; }
  .page-head { align-items: flex-start; }
  .filters .field { min-width: 100%; }
  .period-form { margin-left: 0; width: 100%; }
  .period-form .field { flex: 1 1 140px; }
  .table-wrap table.data th, .table-wrap table.data td { padding: 11px 14px; }
  .auth-form { padding: 32px 22px; }
  .logo__tag { white-space: normal; }
}

/* cetak: tampilkan blok khusus cetak (mengalahkan .print-only di atas) */
@media print {
  .print-head.print-only { display: flex !important; }
}

/* ------------------------------------------------- posisi kas (saldo) */

.cash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.cash-item {
  padding-left: 16px;
  border-left: 3px solid var(--line);
}
.cash-item--start { border-left-color: var(--navy); }
.cash-item--end { border-left-color: var(--red); }
.cash-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.cash-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}
.cash-value.is-negative { color: var(--red); }
.cash-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

@media (max-width: 860px) {
  .cash-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}

/* ------------------------------------------------------- buku besar */

table.data.ledger tbody tr.ledger-opening {
  background: #F8F9FD;
}
table.data.ledger tbody tr.ledger-opening td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  padding-top: 11px;
  padding-bottom: 11px;
}
table.data.ledger tbody tr.ledger-opening strong { color: var(--ink); }
table.data.ledger td.num { font-variant-numeric: tabular-nums; }

/* ================================================================
   Besman Sales — komponen tambahan
   ================================================================ */

.nav-group {
  margin: 16px 0 5px;
  padding: 0 13px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .38);
}
.nav-group:first-child { margin-top: 4px; }
.sidebar .nav-link { font-size: 13.8px; padding: 9px 13px; }
.sidebar-foot .nav-link { margin-bottom: 10px; }

.muted { color: var(--muted); }

.badge--ok { background: #E8F5EC; color: #1D6B3C; }
.badge--info { background: var(--navy-lt); color: var(--navy); }
.badge--bad { background: var(--red-lt); color: var(--red-2); }
.badge--muted { background: #F0F1F7; color: #6A6F8C; }

.mini-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini-filter input, .mini-filter select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.mini-filter input[type="search"] { min-width: 190px; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
}
.check input { width: 16px; height: 16px; accent-color: var(--navy); }

/* ------------------------------------------------------- formulir dokumen */

.doc-form { display: flex; flex-direction: column; gap: 20px; }

.items-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.items-table th {
  text-align: left;
  padding: 10px 12px;
  background: #F8F9FD;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.items-table th.num, .items-table td.num { text-align: right; }
.items-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.items-table tr:last-child td { border-bottom: 0; }
.items-table input, .items-table select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
}
.items-table input:focus, .items-table select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(46, 49, 146, .12);
}
.items-table .col-product { min-width: 190px; }
.items-table .col-desc { min-width: 240px; }
.items-table textarea {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  min-height: 58px;
}
.items-table textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(46, 49, 146, .12);
}
.spec-text { white-space: pre-line; }
.items-table .col-qty { width: 92px; }
.items-table .col-unit { width: 88px; }
.items-table .col-price { width: 140px; }
.items-table .js-line-total { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items-table .icon-btn { width: 28px; height: 28px; }

.order-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 24px;
  padding: 20px 22px;
  border-top: 1px solid var(--line);
  background: #FCFCFE;
  border-radius: 0 0 var(--radius) var(--radius);
}
.totals { display: flex; flex-direction: column; gap: 10px; }
.total-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.total-row span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-row--grand {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 17px;
  font-weight: 800;
}
.total-row--grand span:last-child { color: var(--red-2); }
.disc-row { display: flex; gap: 8px; align-items: center; }
.disc-row select {
  width: 84px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
}
.disc-row input {
  width: 120px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  text-align: right;
}
.tax-row { display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.tax-row input[type="number"] {
  width: 74px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
}

/* ------------------------------------------------------- detail dokumen */

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}
.meta-list { display: flex; flex-direction: column; gap: 12px; }
.meta-row { display: flex; justify-content: space-between; gap: 18px; font-size: 13.5px; }
.meta-row span:first-child { color: var(--muted); }
.meta-row span:last-child { font-weight: 600; text-align: right; }
.meta-row--block { flex-direction: column; gap: 3px; }
.meta-row--block span:last-child { font-weight: 500; text-align: left; line-height: 1.5; }

/* ------------------------------------------------------------ laporan */

.recap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.recap-list { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 22px; }
.recap-row { display: flex; flex-direction: column; gap: 6px; }
.recap-top { display: flex; justify-content: space-between; gap: 14px; font-size: 13.5px; align-items: baseline; }
.recap-name { font-weight: 600; }
.recap-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.recap-track { height: 6px; border-radius: 999px; background: #EFF0F7; overflow: hidden; }
.recap-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4A4EC2, var(--navy)); }
.recap-fill--red { background: linear-gradient(90deg, #DD4545, var(--red)); }
.recap-sub { font-size: 12px; color: var(--muted); }

@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .order-foot { grid-template-columns: minmax(0, 1fr); }
  .recap-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .items-table { font-size: 12.5px; }
  .items-table .col-desc { min-width: 150px; }
  .mini-filter input[type="search"] { min-width: 0; width: 100%; }
  .mini-filter { width: 100%; }
  .card-head { flex-wrap: wrap; }
}

/* sidebar dengan banyak menu harus bisa digulir di layar pendek */
.sidebar { overflow-y: auto; }
@media (max-width: 1080px) {
  .grid--half { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------- produk */

.field input.is-readonly,
.field input[readonly] {
  background: #F7F8FC;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: .04em;
  cursor: default;
}
.field textarea#pr-spec { min-height: 210px; line-height: 1.55; resize: vertical; }

.check--boxed {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FCFCFE;
  font-size: 13px;
  min-height: 41px;
}

.spec-preview {
  max-width: 320px;
  max-height: 4.6em;
  overflow: hidden;
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* ------------------------------------------------- pemilih produk (SO) */

.picker { position: relative; }

.picker-input {
  width: 100%;
  padding: 8px 30px 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
}
.picker-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(46, 49, 146, .12);
}
.picker-clear {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.picker-clear:hover { background: #F0F1F7; color: var(--red); }

.picker-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  min-width: 320px;
  max-width: min(520px, 78vw);
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 18px 40px -18px rgba(15, 17, 60, .45);
}
.picker-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}
.picker-item:hover, .picker-item:focus { background: var(--navy-lt); outline: none; }
.picker-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.picker-sub { font-size: 11.5px; color: var(--muted); }
.picker-spec {
  font-size: 11.5px;
  color: #4A4F6D;
  margin-top: 2px;
  padding-top: 3px;
  border-top: 1px dashed var(--line);
  white-space: normal;
  line-height: 1.4;
}
.picker-empty { padding: 12px 10px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 640px) {
  .picker-list { min-width: 0; width: min(320px, 78vw); }
}

.item-desc .spec, .spec { display: block; }
.item-desc strong { display: block; font-weight: 700; }
.item-desc .spec {
  white-space: pre-line;
  font-weight: 400;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
}
