/* ====== Sumber Data Table (Zebra + Hover) ====== */
.sd-wrap {
  --bg:#ffffff;
  --fg:#111111;
  --muted:#666666;
  --line:#e5e7eb;
  --head:#f1f3f5;
  --shadow:0 2px 8px rgba(0,0,0,.08);
  --accent:#2643e9;
  --hover:#eef4ff;
  --zebra:#fafafa; /* warna baris selang */
}

body{
  background:#f5f6fa;
  color:var(--fg);
  margin:0;
  font-family:system-ui,Segoe UI,Arial,sans-serif;
}

/* Lebarkan kanvas di desktop, masih responsif */
.container{
  max-width:min(1280px, 92vw); /* dulu 960px */
  margin:10px auto;
  padding:0 12px;
}

.sd-title{
  font:700 28px/1.2 system-ui,Segoe UI,Arial;
  color:var(--fg);
  text-align:center;
  margin:10px 0 5px;
}
.sd-sub{
  font:400 14px/1.6 system-ui,Segoe UI,Arial;
  color:var(--muted);
  text-align:center;
  margin:0 0 18px;
}

.sd-card{
  background:var(--bg);
  border-radius:10px;
  box-shadow:var(--shadow);
  overflow:hidden;
}

.sd-table{
  width:100%;
  border-collapse:collapse;
  font:500 15px/1.45 system-ui,Segoe UI,Arial;
  background:var(--bg);
  color:#222;

  /* default (desktop/tablet): jangan paksa scroll */
  min-width:0;
}
.sd-table thead{ background:var(--head); }
.sd-table th{
  padding:12px 16px;
  text-align:left;
  font-weight:700;
  border-bottom:2px solid #dfe3e8;
  color:#111;
  white-space:nowrap;
}
.sd-table td{
  padding:10px 16px;
  border-bottom:1px solid var(--line);
  color:#222;
}

/* zebra + hover */
.sd-table tbody tr:nth-child(even){ background-color:var(--zebra); }
.sd-table tr:hover{ background:var(--hover); transition:background-color .15s ease-in-out; }

/* penjajaran kolum */
.sd-table td:nth-child(1){ text-align:center; font-weight:700; color:#444; }
.sd-table td:nth-child(2){ text-align:left; text-transform:uppercase; }
.sd-table th:nth-child(3), .sd-table td:nth-child(3){ text-align:right; }
.sd-table td:nth-child(4), .sd-table td:nth-child(5){ font-weight:600; }

/* header sortable + ikon arah */
.sd-sortable{ cursor:pointer; user-select:none; position:relative; }
.sd-sortable::after{
  content:""; margin-left:8px; border:5px solid transparent;
  border-top-color:#b8bfd3; display:inline-block; transform:translateY(2px);
}
.sd-sortable.sd-asc::after{ border-top-color:transparent; border-bottom-color:var(--accent); transform:translateY(-2px); }
.sd-sortable.sd-desc::after{ border-top-color:var(--accent); }

/* Sticky header bila skrol menegak */
.sd-table thead th{ position:sticky; top:0; z-index:2; background:var(--head); }

/* ===== Scroll mendatar wrapper ===== */
.sd-scroll{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  position:relative;
  padding-bottom:6px; /* ruang untuk scrollbar */
}
/* hint swipe tidak perlu di desktop */
.sd-scroll::after{ display:none; }

/* ===== Lebar kolum stabil (desktop) ===== */
.sd-table th:nth-child(3), .sd-table td:nth-child(3){
  width:160px; white-space:nowrap; padding-right:20px; text-align:right;
}
.sd-table th:nth-child(4), .sd-table td:nth-child(4){ width:180px; white-space:nowrap; }
.sd-table th:nth-child(5), .sd-table td:nth-child(5){ width:180px; white-space:nowrap; }

/* ===== Kolum NEGERI: satu baris bila luas; auto-wrap bila sempit ===== */
.sd-table th:nth-child(2){
  white-space: nowrap;
  text-align: left;
  text-transform: capitalize; /* Tajuk “Negeri” dalam Title Case */
}

.sd-table td:nth-child(2){
  white-space: nowrap;
  text-align: left;
  text-transform: uppercase;  /* Isi negeri kekal huruf besar */
}

@media (max-width:1280px){
  .sd-table th:nth-child(2), .sd-table td:nth-child(2){
    white-space:normal; word-break:break-word; max-width:400px;
  }
}
@media (max-width:992px){
  .sd-table th:nth-child(2), .sd-table td:nth-child(2){ max-width:280px; }
}
@media (max-width:640px){
  .sd-table th:nth-child(2), .sd-table td:nth-child(2){ max-width:200px; }
}

/* ===== Mobile tweaks ===== */
@media (max-width:768px){
  /* aktifkan scroll mendatar di phone */
  .sd-table{ min-width:760px; }
  .sd-scroll::after{
    display:block; content:"";
    position:absolute; right:0; top:0; bottom:0; width:14px; pointer-events:none;
    background:linear-gradient(to left, rgba(245,246,250,1), rgba(245,246,250,0));
  }
}

@media (max-width:640px){
  .sd-title{ font-size:22px; }
  .sd-table th, .sd-table td{ padding:10px 12px; font-size:14px; }
}

/* ===== Sembunyi lajur kurang penting di skrin kecil ===== */
/* ≤420px: sorok kolum ke-5 (Tarikh Terakhir) */
@media (max-width:420px){
  .sd-table th:nth-child(5), .sd-table td:nth-child(5){ display:none; }
  .sd-table{ min-width:620px; }
}
/* ≤360px: sorok “Jumlah Transaksi” juga */
@media (max-width:360px){
  .sd-table th:nth-child(3), .sd-table td:nth-child(3){ display:none; }
  .sd-table{ min-width:520px; }
}

/*Hide Tarikh Terakhir Kemaskini*/
/* Hide kolum Tarikh Terakhir Kemaskini (kolum ke-5) */
#sumberTable th:nth-child(5),
#sumberTable td:nth-child(5) {
    display: none;
}
