:root{
  --bg:#f6f8fc;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;
  --brand:#2563eb;
  --brand2:#22c55e;
  --soft:#f1f5ff;
  --shadow:0 16px 40px rgba(2, 6, 23, .10);
  --shadow2:0 10px 25px rgba(2, 6, 23, .08);
  --r:18px;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 10% 0%, rgba(37,99,235,.12), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(34,197,94,.12), transparent 50%),
    var(--bg);
  color:var(--text);
}

.container{max-width:1120px;margin:0 auto;padding:18px 14px 70px}

/* NAV */
.nav{
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:14px 16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.80);
  backdrop-filter: blur(10px);
  border-radius:22px;
  box-shadow:var(--shadow2);
}
.nav .brand{display:flex;align-items:center;gap:12px}
.nav .brand img{
  width:46px;height:46px;object-fit:contain;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  padding:8px;
}
.nav .brand .title{font-weight:900;letter-spacing:-.02em}
.nav .brand .sub{font-size:12px;color:var(--muted);margin-top:2px}

.pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;border-radius:999px;
  border:1px solid var(--line);
  background:var(--soft);
  color:#1e40af;
  font-size:13px;
  white-space:nowrap;
}

/* HERO gradient */
.hero{
  margin-top:14px;
  border:1px solid rgba(255,255,255,.45);
  border-radius:26px;
  box-shadow:var(--shadow);
  padding:20px;
  color:#0b1220;
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(900px 520px at 10% 0%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(900px 520px at 90% 10%, rgba(255,255,255,.35), transparent 60%),
    linear-gradient(135deg,
      rgba(37,99,235,.22) 0%,
      rgba(34,197,94,.18) 35%,
      rgba(168,85,247,.16) 70%,
      rgba(236,72,153,.14) 100%
    );
}
.hero::before{
  content:"";
  position:absolute;
  inset:-2px;
  background: linear-gradient(135deg,
    rgba(37,99,235,.35),
    rgba(34,197,94,.28),
    rgba(168,85,247,.22),
    rgba(236,72,153,.20)
  );
  filter: blur(26px);
  opacity:.55;
  z-index:0;
}
.hero > *{ position:relative; z-index:1; }
.hero h1{margin:0 0 8px;font-size:18px;letter-spacing:-.03em;color:#071126}
.hero p{margin:0;color:rgba(7,17,38,.70);line-height:1.6;font-size:15px}
.hero h4{margin:0 0 8px;font-size:12px;letter-spacing:-.03em;color:#071126}
.hero h5{display:flex;align-items:center;gap:10px}

/* CARD */
.card{
  margin-top:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.92);
  border-radius:26px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.cardbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:12px 16px;
  background:linear-gradient(90deg, rgba(37,99,235,.10), rgba(34,197,94,.08));
  border-bottom:1px solid var(--line);
}
.cardtitle{margin:0;font-size:16px;font-weight:900}
.cardbody{padding:16px}

.small{font-size:12px;color:var(--muted)}
.notice{
  margin-top:10px;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--muted);
  font-size:13px;
}

/* MODE TABS */
.modeTabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.tabBtn{
  border:1px solid var(--line);
  background:#fff;
  color:#0f172a;
  padding:10px 12px;
  border-radius:999px;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 10px 20px rgba(2,6,23,.06);
}
.tabBtn.active{
  border-color: rgba(37,99,235,.30);
  background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(34,197,94,.10));
}
.modePanel.hidden{display:none}

/* CONTROLS */
.controls{display:flex;gap:10px;flex-wrap:wrap;align-items:end}
label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
input[type="date"], select{
  padding:11px 12px;border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  font-size:14px;
  outline:none;
  min-width:200px;
}
input[type="date"]:focus, select:focus{
  border-color:rgba(37,99,235,.55);
  box-shadow:0 0 0 4px rgba(37,99,235,.14);
}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  padding:12px 14px;border-radius:16px;
  border:1px solid rgba(37,99,235,.25);
  background:linear-gradient(135deg, var(--brand) 0%, #111827 85%);
  color:#fff;font-weight:900;cursor:pointer;
  box-shadow:0 10px 20px rgba(37,99,235,.18);
}
.btn:disabled{opacity:.6;cursor:not-allowed}

/* Inline controls (desktop 1 baris) */
.controls-inline{
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap:10px;
  align-items:end;
}
.controls-inline > div{min-width:0}
.controls-inline .btn{min-width:160px}

/* TABLE */
.tablewrap{overflow:auto;-webkit-overflow-scrolling:touch;margin-top:10px}
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
  background:#fff;
}
thead th{
  background:#f8fafc;
  border-bottom:1px solid var(--line);
  color:#0f172a;
  font-weight:900;
  padding:10px 12px;
  text-align:left;
  white-space:nowrap;
  font-size:13px;
}
tbody td{
  border-bottom:1px solid var(--line);
  padding:10px 12px;
  font-size:13px;
}
.num{font-variant-numeric:tabular-nums}
.right{text-align:right}
.center{text-align:center}
.badge{
  display:inline-block;margin-left:8px;
  padding:2px 10px;border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  font-size:11px;color:#334155;
}

/* Pastel row colors */
tbody tr:nth-child(6n+1) td { background: rgba(59,130,246,.06); }
tbody tr:nth-child(6n+2) td { background: rgba(34,197,94,.06); }
tbody tr:nth-child(6n+3) td { background: rgba(234,179,8,.08); }
tbody tr:nth-child(6n+4) td { background: rgba(168,85,247,.06); }
tbody tr:nth-child(6n+5) td { background: rgba(236,72,153,.06); }
tbody tr:nth-child(6n)   td { background: rgba(20,184,166,.06); }
tbody tr:hover td { background: rgba(15, 23, 42, .04); }

/* Chart block */
.chartWrap{
  margin-top:12px;
  border:1px solid var(--line);
  border-radius:22px;
  background:#fff;
  padding:14px;
}
.chartHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  margin-bottom:10px;
}
.sectionTitle{font-size:16px;font-weight:900;margin:0}

/* Mapel blocks */
.dayBlock{
  margin-top:12px;
  border:1px solid var(--line);
  border-radius:22px;
  background:#fff;
  box-shadow:0 10px 20px rgba(2,6,23,.06);
  overflow:hidden;
}
.dayBlock .dayHead{
  padding:12px 14px;
  background:linear-gradient(90deg, rgba(37,99,235,.08), rgba(34,197,94,.06));
  border-bottom:1px solid var(--line);
  font-weight:900;
}

/* ===== Sort header: tampil seperti <th> biasa, tapi bisa ditap ===== */
.thbtn{
  appearance:none;
  -webkit-appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  width:100%;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;

  font:inherit;
  color:inherit;
  text-align:inherit;

  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color:transparent;

  /* ikon jangan turun baris */
  white-space:nowrap;
}
.thbtn-right{justify-content:flex-end}
.thbtn > span:first-child{
  overflow:hidden;
  text-overflow:ellipsis;
}
.thicon{
  flex:0 0 auto;
  opacity:.8;
  font-weight:900;
}
@media (hover:hover){
  .thbtn:hover .thicon{opacity:1;}
}

/* MOBILE */
@media (max-width: 900px){
  .controls-inline{grid-template-columns:1fr}
  .controls-inline .btn{min-width:0;width:100%}
}

@media (max-width: 560px){
  .container{padding:14px 12px 56px}
  .nav{padding:12px 12px;border-radius:20px}
  .hero{padding:14px;border-radius:22px}
  .hero h1{font-size:22px}
  .card{border-radius:22px}
  .cardbar{padding:10px 12px}
  .cardbody{padding:12px}

  /* form/tombol full width */
  input[type="date"], select{min-width:0;width:100%}
  .btn{width:100%;justify-content:center}

  /* tabel lebih rapat */
  thead th, tbody td{padding:8px 8px;font-size:12px;line-height:1.2}

  /* nav jangan turun baris */
  .nav{flex-wrap:nowrap;align-items:center}
  .nav .brand{min-width:0;flex:1 1 auto}
  .nav .pill{margin-left:auto;flex:0 0 auto}

  /* bikin tap lebih enak */
  #modeSelect,
  input[type="date"], select,
  .btn{
    padding-top:14px;
    padding-bottom:14px;
    border-radius:18px;
  }

  #modeSelect{width:100%;min-width:0}
  .controls > div,
  .controls-inline > div{width:100%}

  /* badge turun bawah */
  .badge{
    display:block;
    margin:6px 0 0 0;
    width:fit-content;
    font-size:11px;
    padding:3px 8px
  }

  /* Kolom rekap all: atur lebar */
  #tableAll th:nth-child(1), #tableAll td:nth-child(1){width:26%;}
  #tableAll th:nth-child(2), #tableAll td:nth-child(2){width:18%;}
  #tableAll th:nth-child(3), #tableAll td:nth-child(3){width:18%;}
  #tableAll th:nth-child(4), #tableAll td:nth-child(4){width:19%;}
  #tableAll th:nth-child(5), #tableAll td:nth-child(5){width:19%;}
}

  .tablewrap-cabdin {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tablewrap-cabdin table.table-cabdin {
    min-width: 780px;
  }

  .tablewrap-cabdin table.table-cabdin th,
  .tablewrap-cabdin table.table-cabdin td {
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
  }