/* ==========================================================================
   Payment Tracker PT AMK — Design System
   Referensi visual: dashboard indigo-card (sidebar gelap, kartu putih lembut)
   ========================================================================== */

:root {
  --brand:        #4054E8;
  --brand-dark:   #3243C4;
  --brand-light:  #EEF1FE;
  --brand-soft:   #DDE3FD;

  --ink:          #1B2138;
  --ink-2:        #4A5470;
  --ink-3:        #8A93AD;
  --line:         #E6E9F2;
  --bg:           #F4F6FC;
  --card:         #FFFFFF;

  --ok:           #10A37F;
  --ok-bg:        #E4F7F1;
  --warn:         #E8A317;
  --warn-bg:      #FDF3DF;
  --bad:          #E5484D;
  --bad-bg:       #FDE9EA;
  --info:         #4054E8;
  --info-bg:      #EEF1FE;
  --muted-bg:     #F0F2F7;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(27, 33, 56, .06);
  --shadow:    0 4px 16px rgba(27, 33, 56, .07);
  --shadow-lg: 0 12px 32px rgba(27, 33, 56, .10);

  --sidebar-w: 248px;
  --topbar-h:  68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* ------------------------------------------------------------- Layout --- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--brand);
  color: #fff;
  padding: 22px 14px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 60;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 6px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 22px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: #fff; color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -.5px;
  flex: 0 0 38px;
}
.brand-text { line-height: 1.15; }
.brand-text strong { display: block; font-size: 14px; }
.brand-text span { font-size: 11px; opacity: .72; }

.nav-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
  opacity: .6; padding: 16px 12px 7px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: 11px;
  color: rgba(255,255,255,.86);
  font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.nav-item.is-active { background: #fff; color: var(--brand); font-weight: 650; box-shadow: var(--shadow-sm); }
.nav-item .ic { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item .count {
  margin-left: auto; background: rgba(255,255,255,.22);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700;
}
.nav-item.is-active .count { background: var(--brand-light); color: var(--brand); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 17px; }
.topbar .sub { font-size: 12px; color: var(--ink-3); }
.burger {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  align-items: center; justify-content: center;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
  flex: 0 0 36px;
}
.who { line-height: 1.2; text-align: right; }
.who strong { font-size: 13px; display: block; }
.who span { font-size: 11px; color: var(--ink-3); text-transform: capitalize; }

.content { padding: 22px; flex: 1; }

/* -------------------------------------------------------------- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { flex: 1; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 0; }

/* Default satu kolom dengan minmax(0,1fr) agar tabel lebar tidak
   memaksa kolom melar dan menabrak kolom sebelahnya. */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.card, .stat, .grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0,1fr) 340px; }

/* ----------------------------------------------------------- Hero card -- */
.hero {
  background: linear-gradient(115deg, var(--brand) 0%, #5C6EF0 55%, #7B89F5 100%);
  border-radius: var(--r-lg);
  color: #fff; padding: 26px 28px;
  position: relative; overflow: hidden;
}
.hero h2 { font-size: 23px; margin-bottom: 4px; }
.hero p  { margin: 0; opacity: .85; font-size: 13px; }
.hero .stamp {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.18); border-radius: 9px;
  padding: 6px 12px; font-size: 12px; margin-bottom: 16px;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -70px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.09);
}
.hero::before {
  content: ''; position: absolute; right: 70px; bottom: -110px;
  width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.hero-stats { display: flex; gap: 28px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stats div span { display: block; font-size: 11px; opacity: .8; }
.hero-stats div strong { font-size: 18px; }

/* --------------------------------------------------------- Stat tiles --- */
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.stat .value { font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.stat .cap { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat .trend {
  display: inline-block; margin-top: 9px; font-size: 11px; font-weight: 650;
  padding: 3px 9px; border-radius: 999px;
}
.stat .spark { height: 38px; margin: 2px 0 6px; }

/* ------------------------------------------------------------ Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.badge.ok    { background: var(--ok-bg);   color: #0B7A5F; }
.badge.warn  { background: var(--warn-bg); color: #9A6B06; }
.badge.bad   { background: var(--bad-bg);  color: #C02A2F; }
.badge.info  { background: var(--info-bg); color: var(--brand); }
.badge.muted { background: var(--muted-bg); color: var(--ink-2); }
.badge.dark  { background: #1B2138; color: #fff; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------ Tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); font-weight: 700;
  padding: 11px 14px; background: #FAFBFE;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr:hover { background: #FBFCFF; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl .tt { font-weight: 600; color: var(--ink); }
table.tbl .sub { font-size: 11.5px; color: var(--ink-3); }
table.tbl tfoot td {
  background: #FAFBFE; font-weight: 700; border-top: 2px solid var(--line);
}

/* ----------------------------------------------------------- Progress --- */
.bar { height: 7px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.bar.ok  > i { background: var(--ok); }
.bar.warn> i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

.plan-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.plan-row .nm { flex: 1; font-size: 13px; }
.plan-row .pc { font-weight: 700; font-size: 13px; }

/* -------------------------------------------------------------- Forms --- */
label.f { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.inp, select.inp, textarea.inp {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--ink); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus, select.inp:focus, textarea.inp:focus {
  outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.inp[readonly] { background: #F8F9FC; color: var(--ink-2); }
textarea.inp { min-height: 76px; resize: vertical; }
.field { margin-bottom: 14px; }
.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.row { display: grid; gap: 14px; }
.row.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.row.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.row.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ------------------------------------------------------------ Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 650; font-size: 13px; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .05s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #F7F8FC; color: var(--ink); }
.btn-ok   { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #0B8A6C; color: #fff; }
.btn-bad  { background: var(--bad); color: #fff; }
.btn-bad:hover { background: #CF3237; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ Filters --- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px;
}
.filters .f-item { min-width: 150px; flex: 1 1 150px; }
.filters .f-item.grow { flex: 2 1 240px; }

/* ------------------------------------------------------------- Modals --- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(27,33,56,.45);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 32px 16px; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 620px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { max-width: 860px; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.x {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--muted-bg);
  cursor: pointer; color: var(--ink-2); font-size: 16px; line-height: 1;
}

/* -------------------------------------------------------------- Flash --- */
.flash-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: grid; gap: 8px; max-width: 380px; }
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 13px; background: #fff; border-left: 4px solid var(--brand);
  animation: slide .2s ease;
}
@keyframes slide { from { transform: translateX(16px); opacity: 0 } to { transform: none; opacity: 1 } }
.flash.success { border-left-color: var(--ok); }
.flash.error   { border-left-color: var(--bad); }
.flash.warning { border-left-color: var(--warn); }

/* --------------------------------------------------------- Empty state -- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty svg { opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; font-size: 13px; }

/* ----------------------------------------------------------- Donut ------ */
.donut { position: relative; width: 148px; height: 148px; flex: 0 0 148px; }
.donut .lbl {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.donut .lbl b { font-size: 22px; display: block; letter-spacing: -.02em; }
.donut .lbl span { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }

.legend { display: grid; gap: 9px; font-size: 12.5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 8px; }

/* ------------------------------------------------------------ Tabs ------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* --------------------------------------------------------- Timeline ----- */
.tl { position: relative; padding-left: 22px; }
.tl::before { content:''; position: absolute; left: 6px; top: 5px; bottom: 5px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content:''; position: absolute; left: -20px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.tl-item.ok::before  { background: var(--ok);   box-shadow: 0 0 0 3px var(--ok-bg); }
.tl-item.warn::before{ background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.tl-item.bad::before { background: var(--bad);  box-shadow: 0 0 0 3px var(--bad-bg); }

/* ------------------------------------------------------- Login screen --- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #EEF1FE 0%, #F4F6FC 50%, #E7EBFD 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 940px; background: #fff; border-radius: 24px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: grid; grid-template-columns: 1.05fr 1fr;
}
.login-aside {
  background: linear-gradient(150deg, var(--brand) 0%, #5C6EF0 60%, #8390F7 100%);
  color: #fff; padding: 44px 40px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.login-aside::after {
  content:''; position: absolute; right: -80px; bottom: -80px;
  width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.1);
}
.login-aside h2 { font-size: 26px; line-height: 1.25; margin-bottom: 12px; }
.login-aside p { opacity: .85; font-size: 13.5px; }
.login-aside ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; position: relative; z-index: 1; }
.login-aside li { display: flex; gap: 10px; font-size: 13px; align-items: flex-start; }
.login-form { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }

/* --------------------------------------------------------- Utilities ---- */
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.xs    { font-size: 11px; }
.strong{ font-weight: 700; }
.nowrap{ white-space: nowrap; }
.right { text-align: right; }
.center{ text-align: center; }
.mt-0 { margin-top: 0 }   .mt-1 { margin-top: 8px }  .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; display: block; }

.pagination { display: flex; gap: 5px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--ink-2); padding: 0 9px;
}
.pagination a:hover { background: #F7F8FC; text-decoration: none; }
.pagination .cur { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.pagination .gap { border: 0; background: transparent; }

.scrim { display: none; position: fixed; inset: 0; background: rgba(27,33,56,.4); z-index: 55; }
.scrim.open { display: block; }

/* ------------------------------------------------------------ Print ----- */
@media print {
  .sidebar, .topbar, .filters, .btn, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .card { border: 0; box-shadow: none; }
}

/* ------------------------------------------------------- Responsive ----- */
@media (max-width: 1200px) {
  .g-main { grid-template-columns: minmax(0,1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .row.c3, .row.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .burger { display: flex; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .who { display: none; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0,1fr); }
  .row.c2, .row.c3, .row.c4 { grid-template-columns: minmax(0,1fr); }
  .hero { padding: 20px; }
  .hero h2 { font-size: 19px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  table.tbl th, table.tbl td { padding: 10px; }
  .filters { padding: 12px; }
  .filters .f-item { flex: 1 1 100%; }
  .modal-body { padding: 16px; }
  h1 { font-size: 18px; }
  /* Notifikasi jangan menutupi judul halaman di layar kecil */
  .flash-wrap { top: auto; bottom: 14px; left: 12px; right: 12px; max-width: none; }
  .stat .spark { height: 30px; }
  .stat .value { font-size: 19px; }
}
