*{
  box-sizing:border-box;
}

:root{
  --blue1:#1689e8;
  --blue2:#0874d9;
  --bg:#f5f7fa;
  --border:#e1e5ea;
  --text:#111827;
  --muted:#64748b;
  --green:#22c55e;
  --red:#ef4444;
}

html{
  width:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  width:100%;
  min-width:0;
  background:var(--bg);
  font-family:Arial,Helvetica,sans-serif;
  color:var(--text);
}

/* =========================================================
   DESKTOP
========================================================= */

.dashboard{
  width:min(1420px,calc(100% - 44px));
  margin:34px auto 60px;
}

.hero{
  min-height:116px;
  border-radius:15px 15px 0 0;
  background:linear-gradient(105deg,var(--blue1),var(--blue2));
  display:flex;
  align-items:center;
  padding:0 34px;
  box-shadow:0 3px 10px rgba(8,116,217,.12);
}

.hero h1{
  margin:0;
  color:#fff;
  font-size:39px;
  line-height:1;
  font-weight:700;
  letter-spacing:-.5px;
}

.table-card{
  background:#fff;
  padding:54px 32px 0;
  border-radius:0 0 15px 15px;
  box-shadow:0 4px 15px rgba(15,23,42,.06);
  overflow:hidden;
}

.table-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  margin:0 0 18px;
}

.toolbar-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.toolbar-left strong{
  font-size:17px;
}

.toolbar-left span{
  font-size:12px;
  color:var(--muted);
  background:#f1f5f9;
  padding:5px 9px;
  border-radius:999px;
}

.search-wrap input{
  height:38px;
  width:250px;
  border:1px solid var(--border);
  border-radius:8px;
  padding:0 12px;
  outline:none;
  font-size:14px;
}

.search-wrap input:focus{
  border-color:var(--blue1);
  box-shadow:0 0 0 3px rgba(22,137,232,.1);
}

/* =========================================================
   TABLE
========================================================= */

.table-scroll{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}

table{
  width:100%;
  min-width:1040px;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}

th,
td{
  text-align:center;
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  vertical-align:middle;
}

th:first-child,
td:first-child{
  border-left:1px solid var(--border);
}

/* HEADER */

th{
  height:100px;
  padding:12px 10px;
  background:linear-gradient(135deg,#39a7ef,#168fe2);
  color:#fff;
  font-size:23px;
  font-weight:700;
  line-height:1.2;
  word-break:normal;
  overflow-wrap:break-word;
}

th:first-child{
  border-radius:7px 0 0 0;
}

th:last-child{
  border-radius:0 7px 0 0;
}

/* COLUMN WIDTH */

th:nth-child(1){width:15.5%}
th:nth-child(2){width:13%}
th:nth-child(3){width:10.5%}
th:nth-child(4){width:12%}
th:nth-child(5){width:11%}
th:nth-child(6){width:13.5%}
th:nth-child(7){width:12.5%}
th:nth-child(8){width:12%}

/* BODY */

td{
  height:118px;
  background:#fff;
  padding:10px 9px;
  font-size:21px;
  line-height:1.2;
}

tbody tr:nth-child(even) td{
  background:#fbfcfe;
}

tbody tr:hover td{
  background:#f8fbff;
}

/* =========================================================
   CONTENT
========================================================= */

.username{
  font-weight:700;
  color:#0b0f14;
  white-space:nowrap;
}

.trx{
  color:#30363d;
  white-space:nowrap;
}

.dark{
  color:#20262e;
}

.money{
  white-space:nowrap;
  line-height:1.05;
}

.money .currency{
  display:block;
  line-height:1;
  margin-bottom:3px;
}

.money > span:last-child{
  display:block;
  line-height:1.05;
}

.ppn{
  color:#31b83f;
  font-weight:700;
  white-space:nowrap;
}

.sisa{
  color:#ef4650;
  font-weight:700;
  white-space:nowrap;
}

.progress-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:101px;
  height:40px;
  padding:0 15px;
  border-radius:9px;
  background:#29c33f;
  color:#fff;
  font-size:17px;
  font-weight:700;
  white-space:nowrap;
  box-shadow:inset 0 -1px 0 rgba(0,0,0,.08);
}

/* =========================================================
   EMPTY
========================================================= */

.empty-state{
  text-align:center;
  padding:34px;
  color:var(--muted);
}

/* =========================================================
   CONTROLS
========================================================= */

.controls-card{
  margin-top:22px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:15px;
  padding:22px;
  box-shadow:0 4px 15px rgba(15,23,42,.05);
}

.controls-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  margin-bottom:18px;
}

.controls-head h2{
  margin:0 0 5px;
  font-size:20px;
}

.controls-head p{
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.storage-status{
  font-size:12px;
  color:#16a34a;
  background:#f0fdf4;
  padding:7px 10px;
  border-radius:999px;
}

.controls-grid{
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:10px;
}

.btn{
  min-height:42px;
  border:1px solid #d8dee7;
  background:#fff;
  color:#1f2937;
  border-radius:8px;
  padding:0 14px;
  font-weight:700;
  cursor:pointer;
  font-size:13px;
}

.btn:hover{
  background:#f8fafc;
}

.btn.primary{
  border-color:var(--blue2);
  background:linear-gradient(135deg,var(--blue1),var(--blue2));
  color:#fff;
}

.btn.danger{
  color:#dc2626;
  border-color:#fecaca;
}

.btn.danger:hover{
  background:#fff5f5;
}

.file-btn{
  display:flex;
  align-items:center;
  justify-content:center;
}

.file-btn input{
  display:none;
}

.select-row{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:15px;
}

.select-row label{
  font-size:13px;
  font-weight:700;
}

.select-row select{
  height:39px;
  min-width:260px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  padding:0 10px;
  color:#1f2937;
}

/* =========================================================
   MODAL
========================================================= */

dialog{
  border:0;
  border-radius:15px;
  padding:0;
  width:min(680px,calc(100% - 28px));
  box-shadow:0 25px 70px rgba(15,23,42,.25);
}

dialog::backdrop{
  background:rgba(15,23,42,.48);
}

dialog form{
  padding:24px;
}

.modal-head{
  display:flex;
  justify-content:space-between;
  gap:15px;
  margin-bottom:20px;
}

.modal-head h2{
  margin:0 0 5px;
  font-size:22px;
}

.modal-head p{
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.close-btn{
  border:0;
  background:#f1f5f9;
  width:34px;
  height:34px;
  border-radius:50%;
  font-size:23px;
  cursor:pointer;
  color:#475569;
}

.form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.form-grid label{
  font-size:12px;
  font-weight:700;
  color:#374151;
}

.form-grid input{
  display:block;
  width:100%;
  height:42px;
  margin-top:6px;
  border:1px solid #d7dde5;
  border-radius:8px;
  padding:0 11px;
  font-size:14px;
  outline:none;
}

.form-grid input:focus{
  border-color:var(--blue1);
  box-shadow:0 0 0 3px rgba(22,137,232,.1);
}

.auto-calc{
  display:flex;
  gap:9px;
  align-items:flex-start;
  margin-top:16px;
  font-size:12px;
  color:#475569;
  line-height:1.4;
}

.auto-calc input{
  margin-top:2px;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:22px;
}

.toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translate(-50%,20px);
  background:#111827;
  color:#fff;
  padding:11px 16px;
  border-radius:9px;
  font-size:13px;
  opacity:0;
  pointer-events:none;
  transition:.2s;
  z-index:20;
}

.toast.show{
  opacity:1;
  transform:translate(-50%,0);
}


/* =========================================================
   TABLET / HP
   901px → 601px
========================================================= */

@media (max-width:900px){

  .dashboard{
    width:calc(100% - 20px);
    margin:16px auto 28px;
  }

  .hero{
    min-height:82px;
    padding:0 22px;
  }

  .hero h1{
    font-size:30px;
  }

  .table-card{
    padding:24px 12px 0;
  }

  .table-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    margin:0 3px 16px;
  }

  .toolbar-left{
    gap:8px;
    min-width:0;
  }

  .toolbar-left strong{
    font-size:15px;
    white-space:nowrap;
  }

  .toolbar-left span{
    font-size:10px;
    padding:5px 8px;
    white-space:nowrap;
  }

  .search-wrap{
    flex:0 0 220px;
  }

  .search-wrap input{
    width:100%;
  }

  .table-scroll{
    overflow:hidden;
  }

  table{
    width:100%;
    min-width:0;
  }

  /* Tetap gunakan proporsi yang sama */
  th:nth-child(1){width:15.5%}
  th:nth-child(2){width:13%}
  th:nth-child(3){width:10.5%}
  th:nth-child(4){width:12%}
  th:nth-child(5){width:11%}
  th:nth-child(6){width:13.5%}
  th:nth-child(7){width:12.5%}
  th:nth-child(8){width:12%}

  th{
    height:72px;
    padding:7px 5px;
    font-size:14px;
    line-height:1.18;
  }

  td{
    height:92px;
    padding:8px 6px;
    font-size:13px;
    line-height:1.18;
  }

  .username{
    font-size:13px;
  }

  .trx{
    font-size:12px;
  }

  .money{
    font-size:11.5px;
    letter-spacing:-.1px;
  }

  .ppn,
  .sisa,
  .dark{
    font-size:12px;
  }

  .progress-badge{
    min-width:72px;
    height:30px;
    padding:0 7px;
    font-size:11px;
    border-radius:7px;
  }

  .controls-card{
    padding:17px;
    margin-top:14px;
  }

  .controls-head{
    align-items:flex-start;
    flex-direction:column;
  }

  .controls-grid{
    grid-template-columns:1fr 1fr;
    gap:9px;
  }

  .btn{
    min-height:40px;
    padding:0 8px;
    font-size:12px;
  }

  .select-row{
    align-items:flex-start;
    flex-direction:column;
  }

  .select-row select{
    width:100%;
    min-width:0;
  }
}


/* =========================================================
   HP PORTRAIT
   600px ke bawah
========================================================= */

@media (max-width:600px){

  .dashboard{
    width:calc(100% - 12px);
    margin:8px auto 22px;
  }

  .hero{
    min-height:68px;
    padding:0 15px;
    border-radius:9px 9px 0 0;
  }

  .hero h1{
    font-size:24px;
    letter-spacing:-.3px;
  }

  .table-card{
    padding:16px 6px 0;
    border-radius:0 0 9px 9px;
  }

  /* =====================================================
     TOOLBAR
  ===================================================== */

  .table-toolbar{
    display:block;
    margin:0 3px 13px;
  }

  .toolbar-left{
    width:100%;
    margin-bottom:9px;
  }

  .toolbar-left strong{
    font-size:14px;
  }

  .toolbar-left span{
    font-size:9px;
    padding:4px 7px;
  }

  .search-wrap{
    width:100%;
  }

  .search-wrap input{
    width:100%;
    height:37px;
    font-size:13px;
  }

  /* =====================================================
     TABLE MOBILE
     
     JANGAN gunakan clamp ekstrem.
     Ukuran dibuat tetap agar tidak berubah-ubah
     dan jarak antarkolom tetap profesional.
  ===================================================== */

  .table-scroll{
    width:100%;
    overflow:hidden;
  }

  table{
    width:100%;
    min-width:0;
    table-layout:fixed;
  }

  /* PROPOSI KOLOM */

  th:nth-child(1){width:15.5%}
  th:nth-child(2){width:13%}
  th:nth-child(3){width:10.5%}
  th:nth-child(4){width:12%}
  th:nth-child(5){width:11%}
  th:nth-child(6){width:13.5%}
  th:nth-child(7){width:12.5%}
  th:nth-child(8){width:12%}

  /* HEADER */

  th{
    height:62px;
    padding:6px 4px;
    font-size:10px;
    line-height:1.18;
    vertical-align:middle;
    overflow:hidden;
    word-break:normal;
  }

  /* BODY */

  td{
    height:80px;
    padding:7px 4px;
    font-size:10px;
    line-height:1.15;
    vertical-align:middle;
    overflow:hidden;
  }

  /* USERNAME */

  .username{
    font-size:10px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  /* TRANSACTION */

  .trx{
    font-size:9px;
    white-space:nowrap;
    letter-spacing:-.1px;
  }

  /* TEXT */

  .dark{
    font-size:9px;
    white-space:nowrap;
  }

  .ppn,
  .sisa{
    font-size:9px;
    white-space:nowrap;
  }

  /* =====================================================
     NOMINAL
     
     Rp1.200.000 tetap satu baris.
     Tidak lagi dibuat terlalu kecil.
  ===================================================== */

  .money{
    font-size:8.5px;
    line-height:1;
    white-space:nowrap;
    letter-spacing:-.15px;
  }

  .money .currency{
    display:inline;
    margin:0;
    line-height:1;
  }

  .money > span:last-child{
    display:inline;
    line-height:1;
  }

  /* =====================================================
     PROGRESS
  ===================================================== */

  .progress-badge{
    min-width:0;
    width:calc(100% - 6px);
    max-width:70px;
    height:25px;
    padding:0 4px;
    border-radius:6px;
    font-size:8.5px;
    line-height:1;
    white-space:nowrap;
  }

  /* =====================================================
     CONTROL PANEL
  ===================================================== */

  .controls-card{
    padding:13px;
    margin-top:10px;
    border-radius:10px;
  }

  .controls-head h2{
    font-size:17px;
  }

  .controls-head p{
    font-size:12px;
  }

  .controls-grid{
    grid-template-columns:1fr 1fr;
    gap:7px;
  }

  .btn{
    min-height:38px;
    padding:0 6px;
    font-size:10.5px;
  }

  .select-row{
    gap:8px;
  }

  .select-row label{
    font-size:12px;
  }

  .select-row select{
    height:38px;
    font-size:12px;
  }
}


/* =========================================================
   HP SANGAT KECIL
   380px ke bawah
========================================================= */

@media (max-width:380px){

  .dashboard{
    width:calc(100% - 8px);
    margin-top:5px;
  }

  .hero{
    min-height:62px;
    padding:0 12px;
  }

  .hero h1{
    font-size:21px;
  }

  .table-card{
    padding-left:4px;
    padding-right:4px;
  }

  th{
    height:58px;
    padding:5px 2px;
    font-size:8.5px;
  }

  td{
    height:75px;
    padding:6px 2px;
    font-size:9px;
  }

  .username{
    font-size:9px;
  }

  .trx{
    font-size:8px;
  }

  .dark,
  .ppn,
  .sisa{
    font-size:8px;
  }

  .money{
    font-size:7.5px;
  }

  .progress-badge{
    height:23px;
    font-size:7.5px;
    width:calc(100% - 4px);
  }
}


/* =========================================================
   LANDSCAPE HP
========================================================= */

@media (min-width:561px)
and (max-width:900px)
and (orientation:landscape){

  .dashboard{
    width:calc(100% - 20px);
    margin:12px auto 24px;
  }

  .hero{
    min-height:72px;
    padding:0 20px;
  }

  .hero h1{
    font-size:27px;
  }

  .table-card{
    padding:20px 9px 0;
  }

  .table-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:15px;
    margin-bottom:14px;
  }

  .toolbar-left{
    margin:0;
  }

  .toolbar-left strong{
    font-size:14px;
  }

  .search-wrap{
    flex:0 0 240px;
  }

  th{
    height:62px;
    padding:6px 5px;
    font-size:12px;
    line-height:1.18;
  }

  td{
    height:78px;
    padding:7px 5px;
    font-size:12px;
  }

  .username{
    font-size:12px;
  }

  .trx{
    font-size:11px;
  }

  .dark,
  .ppn,
  .sisa{
    font-size:11px;
  }

  .money{
    font-size:10.5px;
  }

  .progress-badge{
    min-width:68px;
    height:27px;
    font-size:10px;
    padding:0 6px;
  }
}


/* =========================================================
   LANDSCAPE HP KECIL
========================================================= */

@media (max-width:560px)
and (orientation:landscape){

  .dashboard{
    width:calc(100% - 14px);
    margin:7px auto 18px;
  }

  .hero{
    min-height:60px;
    padding:0 15px;
  }

  .hero h1{
    font-size:23px;
  }

  .table-card{
    padding:15px 6px 0;
  }

  .table-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:11px;
  }

  .toolbar-left{
    margin:0;
  }

  .toolbar-left strong{
    font-size:12px;
  }

  .toolbar-left span{
    font-size:8px;
  }

  .search-wrap{
    flex:0 0 180px;
  }

  .search-wrap input{
    height:34px;
    font-size:11px;
  }

  th{
    height:54px;
    padding:5px 3px;
    font-size:9px;
  }

  td{
    height:68px;
    padding:5px 3px;
    font-size:9px;
  }

  .username{
    font-size:9px;
  }

  .trx{
    font-size:8px;
  }

  .dark,
  .ppn,
  .sisa{
    font-size:8px;
  }

  .money{
    font-size:8px;
  }

  .progress-badge{
    height:23px;
    font-size:8px;
    max-width:65px;
  }

  .controls-card{
    margin-top:9px;
  }
}

/* =========================================================
   COMPACT TABLE
   Tinggi kolom dibuat sedikit lebih pendek
========================================================= */

@media (max-width:900px){

  th{
    height:62px;
    padding:5px 5px;
  }

  td{
    height:76px;
    padding:6px 5px;
  }

  .progress-badge{
    height:28px;
  }
}


/* =========================================================
   HP PORTRAIT
========================================================= */

@media (max-width:600px){

  th{
    height:56px;
    padding:5px 3px;
  }

  td{
    height:70px;
    padding:5px 3px;
  }

  .progress-badge{
    height:24px;
    border-radius:6px;
    padding:0 5px;
  }
}


/* =========================================================
   HP SANGAT KECIL
========================================================= */

@media (max-width:380px){

  th{
    height:52px;
  }

  td{
    height:65px;
  }

  .progress-badge{
    height:22px;
  }
}


/* =========================================================
   LANDSCAPE HP
========================================================= */

@media (min-width:561px)
and (max-width:900px)
and (orientation:landscape){

  th{
    height:54px;
    padding:5px 4px;
  }

  td{
    height:68px;
    padding:5px 4px;
  }

  .progress-badge{
    height:25px;
  }
}



/* =========================================================
   FIX PROGRESS COLOR
   Letakkan PALING BAWAH CSS
========================================================= */

/* 0% - 49.9% = MERAH */
.progress-badge.progress-low{
  background:#ef4444 !important;
  color:#fff !important;
}

/* 50% - 99.9% = KUNING */
.progress-badge.progress-medium{
  background:#f59e0b !important;
  color:#fff !important;
}

/* 100% = HIJAU */
.progress-badge.progress-high{
  background:#22c55e !important;
  color:#fff !important;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width:600px){

  .progress-badge.progress-low{
    background:#ef4444 !important;
  }

  .progress-badge.progress-medium{
    background:#f59e0b !important;
  }

  .progress-badge.progress-high{
    background:#22c55e !important;
  }

}


/* =========================================================
   LANDSCAPE
========================================================= */

@media (
  min-width:561px
) and (
  max-width:900px
) and (
  orientation:landscape
){

  .progress-badge.progress-low{
    background:#ef4444 !important;
  }

  .progress-badge.progress-medium{
    background:#f59e0b !important;
  }

  .progress-badge.progress-high{
    background:#22c55e !important;
  }

}