:root{
  --bg1:#0b0620; --bg2:#180e40;
  --panel:#130a2f; --border:#2a184d;
  --brand1:#9b5cff; --brand2:#4c1d95; --accent:#facc15;
  --text:#ececf1; --muted:#a8acb3;
  --red:#dc2626; --red-dark:#b91c1c;
  --green:#25D366; --green-dark:#1ebe5d;
  --blue:#0088cc; --blue-dark:#0070aa;
  --yellow:#facc15; --yellow-dark:#eab308;

  --panel-gray:#1f2937;
  --panel-gray-border:#374151;
  --panel-gray-soft:#111827;
}
*{box-sizing:border-box}
body{margin:0;color:var(--text);font-family:'Segoe UI',Roboto,Arial,sans-serif;background:linear-gradient(180deg,var(--bg1),var(--bg2))}
.container{max-width:1200px;margin:20px auto 64px;padding:0 12px}

.header{display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px;margin-bottom:10px}
.logo img{display:block;width:clamp(96px,50vw,220px);height:auto;max-height:20vh;object-fit:contain}
.title{font-size:clamp(22px,4vw,32px);font-weight:900;letter-spacing:.3px;cursor:pointer;color:var(--accent)}
.login-badge{font-size:12px;color:#fff;background:#0f0a24;border:1px solid var(--border);padding:4px 8px;border-radius:999px}
.desc{color:var(--muted);font-size:14px}

/* Menu tombol atas (WA/Tele/Login) – responsif */
.menu{
  display: grid;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px){
  .menu{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px){
  .menu{ grid-template-columns: 1fr; }
}
.btn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 14px;
  min-height:52px;
  border-radius:14px;
  border:1px solid var(--border);
  color:#fff;
  text-decoration:none;
  font-size:14px;
  font-weight:800;
  box-shadow:0 3px 10px rgba(0,0,0,.25);
}
.btn img{ width:20px; height:20px; flex:0 0 20px; }
@media (max-width: 480px){
  .btn{ min-height:48px; font-size:13px; padding:10px 12px; }
}
@media (max-width:560px){
  .btn{min-height:44px;padding:10px 12px;font-size:13px}
}
.btn:hover{transform:translateY(-2px)}
.wa{background:var(--green)} .wa:hover{background:var(--green-dark)}
.tele{background:var(--blue)} .tele:hover{background:var(--blue-dark)}
.login{background:var(--red)} .login:hover{background:var(--red-dark)}

/* Toolbar pencarian + pager – responsif */
.toolbar{
  display:flex;gap:10px;align-items:center;justify-content:space-between;
  margin-top:12px;flex-wrap:wrap
}
.search{
  display:flex;gap:8px;align-items:center;
  flex: 1 1 380px;
}
.search .input{width:100%;max-width:520px}
@media (max-width:700px){
  .toolbar{gap:10px}
  .search{flex:1 1 100%}
  .search .input{max-width:none}
  .toolbar > div:last-child{display:flex;gap:8px;width:100%}
  .toolbar .page-btn{flex:1}
}

.page-btn:hover{background:#231050}
.page-btn[disabled]{opacity:.5;cursor:not-allowed}

.table-wrapper{background:var(--panel);border:1px solid var(--border);border-radius:16px;box-shadow:0 8px 25px rgba(0,0,0,.35);margin-top:12px}
.table-scroll{width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
table{width:100%;min-width:980px;border-collapse:collapse;font-size:14px}
thead{background:linear-gradient(90deg,var(--brand1),var(--brand2));color:#fff;position:sticky;top:0;z-index:5}
th,td{padding:12px 10px;text-align:center;border-bottom:1px solid var(--border);white-space:nowrap}
td:not(:last-child), th:not(:last-child){border-right:1px solid var(--border)}
tbody tr:nth-child(even){background:rgba(255,255,255,.03)}
tr:hover td{background:rgba(155,92,255,.06)}

.pill{background:rgba(155,92,255,.18);border:1px solid var(--border);padding:5px 10px;border-radius:999px;font-size:13px;white-space:nowrap}
.badge{border:1px solid var(--border);background:#140c2d;border-radius:999px;padding:3px 8px;font-size:11px}
.rank{font-weight:800;display:flex;justify-content:center;align-items:center;gap:6px;color:var(--accent)}
.bar{position:relative;height:10px;border-radius:999px;background:#170e36;border:1px solid var(--border);overflow:hidden;min-width:90px}
.bar span{position:absolute;left:0;top:0;height:100%;background:linear-gradient(90deg,var(--brand1),var(--brand2))}
.pos{color:var(--accent);font-weight:800}
.neg{color:#f87171;font-weight:800}

tr.dq td{background:rgba(220,38,38,.18)!important;color:#fecaca}
tr.dq:hover td{background:rgba(220,38,38,.25)!important}
.dq-pill{background:rgba(220,38,38,.25);border-color:#b91c1c;color:#fecaca}

.mini-btn{background:transparent;border:1px dashed var(--border);color:#fff;font-size:11px;padding:2px 8px;border-radius:999px;cursor:pointer;margin-left:6px;}
.mini-btn.alasan{background: var(--yellow);color:#000;border:1px solid var(--yellow-dark);}
.mini-btn.alasan:hover{ background: var(--yellow-dark); }

.page-btn.warn{background: var(--yellow);color:#000;border:1px solid var(--yellow-dark);}
.page-btn.warn:hover{ background: var(--yellow-dark); }

.pager{display:flex;justify-content:space-between;align-items:center;margin:12px 0}
#pageInfo{color:#a8acb3;font-size:13px}

.banner-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  margin-top: 12px;
}
.banner-img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

#admin,#master{
  display:none;margin-top:12px;
  background:var(--panel-gray);
  border:1px solid var(--panel-gray-border);
  border-radius:12px;padding:12px;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
}
#admin .grid,#master .grid{
  display:grid;
  gap:12px;
  grid-template-columns:repeat(auto-fit,minmax(160px,220px));
  justify-content:flex-start;
}
#admin .section-title,#master .section-title{
  font-weight:900;letter-spacing:.3px;margin:6px 0 8px;
  color:#f3f4f6;
  background:linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,0));
  border:1px dashed var(--panel-gray-border);
  padding:8px 10px;border-radius:10px;
}
#admin .input,#master .input{background:#fff;border:1px solid var(--panel-gray-border)}
#admin .page-btn,#master .page-btn{background:#fff900;border-color:#3b4452}
#admin .page-btn:hover,#master .page-btn:hover{background:#333e4f}
#admin .desc,#master .desc{color:#c7c9ce}

.event{margin-top:24px;background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:18px}
.event-header{display:flex;gap:12px;align-items:center;margin-bottom:8px}
.event-logo{width:42px;height:42px;border-radius:10px;background:linear-gradient(135deg,var(--brand1),var(--brand2));display:flex;align-items:center;justify-content:center;font-size:22px}
.event-title{font-size:clamp(18px,3.5vw,22px);font-weight:900;letter-spacing:.2px}
.event-sub{color:#a8acb3;font-size:13px}
.event-badges{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 14px}
.event-grid{display:grid;grid-template-columns:1.3fr 1fr;gap:14px}
.card{background:#110a29;border:1px solid var(--border);border-radius:12px;padding:12px}
.card h4{margin:0 0 8px 0;font-size:14px;letter-spacing:.2px}
.rule-list{margin:0;padding-left:18px;line-height:1.7}
.rule-list li{margin:4px 0}

.prize-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
@media(max-width:720px){.prize-grid{grid-template-columns:1fr}}
.prize{border:1px dashed var(--border);border-radius:12px;padding:10px 12px;display:grid;grid-template-columns:44px 1fr auto;gap:10px;align-items:center;background:#10092a}
.prize .icon{font-size:22px;display:flex;align-items:center;justify-content:center;width:32px;height:32px}
.prize .label{font-size:14px;font-weight:700}
.prize .amount{font-weight:800;color:var(--accent);text-align:right;white-space:nowrap}

.total-prize{margin-top:10px;padding:10px;border-radius:10px;background:linear-gradient(90deg,rgba(155,92,255,.18),rgba(76,29,149,.18));border:1px solid var(--border);text-align:center;font-weight:800}

@media(max-width:600px){
  th,td{font-size:12px;padding:10px 6px}
  .pill{font-size:11px;padding:3px 8px}
  .bar{height:6px}
  .event-grid{grid-template-columns:1fr}
  #admin .grid,#master .grid{grid-template-columns:1fr;}
}

/* Modal Login */
.modal-backdrop{position:fixed; inset:0; background:rgba(0,0,0,.6); display:none; align-items:center; justify-content:center; z-index:1000;}
.modal{width:min(92vw,560px); background:#0f0a24; border:1px solid var(--border); border-radius:14px; padding:14px; box-shadow:0 20px 60px rgba(0,0,0,.5);}
.modal h3{margin:0 0 10px 0; font-size:16px; letter-spacing:.2px; color:#fff}
.modal .grid{display:grid; gap:8px; grid-template-columns:1fr 1fr;}
.modal .row{display:flex; gap:8px; justify-content:flex-end; margin-top:10px}
.modal .input{width:100%}
@media(max-width:560px){ .modal .grid{grid-template-columns:1fr;} }
/* ===== [Event Editor – nicer form] ===== */
.form-grid{display:grid;gap:12px}
.two-col{grid-template-columns:1fr 1fr}
@media(max-width:880px){ .two-col{grid-template-columns:1fr} }

.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:12px;color:#c7c9ce}
.field .hint{font-size:11px;color:#9ca3af}
.input--big{min-height:42px;font-size:14px}

.ta{min-height:120px;resize:vertical;line-height:1.5}
.ta--mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}

.card-light{background:#0f0a24;border:1px solid var(--panel-gray-border);border-radius:12px;padding:12px}
.sticky-actions{display:flex;gap:8px;flex-wrap:wrap;position:sticky;bottom:0;background:linear-gradient(180deg, rgba(17,10,41,.4), rgba(17,10,41,.9));padding:10px;border:1px dashed var(--panel-gray-border);border-radius:10px}
.divider{height:1px;background:rgba(255,255,255,.08);margin:6px 0 10px 0;border:0}
.badge-soft{display:inline-block;padding:2px 8px;border:1px dashed var(--panel-gray-border);border-radius:999px;font-size:11px;color:#c7c9ce}

.modal-wide{width:min(96vw,900px)}
.table-like{width:100%;border-collapse:collapse}
.table-like th,.table-like td{border:1px solid var(--panel-gray-border);padding:6px 8px;background:#0f0a24}
.table-like th{background:#121233}
.input-cell{width:100%;box-sizing:border-box;padding:6px}
.row-actions{display:flex;gap:6px;justify-content:flex-end}

/* Banner 3 kolom – responsif */
.banner-row{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
  margin:12px 0;
}
.banner-item{background:var(--panel);border:1px solid var(--border);border-radius:12px;overflow:hidden;position:relative;}
.banner-item img{
  display:block;width:100%;height:auto;
  aspect-ratio: 30/10; object-fit: cover;
}
/* Tombol lineup (Nambah doang, gak ganggu banner) */
.lineup-btn {
  display:block;
  width:100%;
  background: linear-gradient(90deg, #FFF, #FFF);
  border: none;
  color: #000;
  font-weight: 800;
  font-size: 10px;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: 0 0 12px 12px;
  transition: .2s;
}
.lineup-btn:hover { background: linear-gradient(90deg, #7c3aed, #5b21b6); }

@media (max-width:900px){ .banner-row{grid-template-columns: repeat(2,1fr);} }
@media (max-width:560px){ .banner-row{grid-template-columns: 1fr;} }
@media (max-width:640px){
  #admin .grid,#master .grid{grid-template-columns: 1fr}
  #admin .page-btn,#master .page-btn{width:100%}
}
@media(max-width:600px){
  .table-scroll{overflow-x:auto}
  table{min-width: 760px}
  th,td{font-size:12px;padding:9px 6px}
}
@media (max-width:560px){
  .container{padding:0 10px}
  .title{font-size: clamp(20px, 5.5vw, 28px)}
}
.banner-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.banner-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: var(--panel-gray-soft);
  border: 1px dashed var(--panel-gray-border);
  border-radius: 10px;
  padding: 10px;
}
.banner-field {
  flex: 1 1 200px;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}
.banner-line input[type=file] {
  display: block;
  margin-top: 6px;
  width: 100%;
  font-size: 12px;
}
.banner-line .page-btn {
  background: linear-gradient(180deg, #22c55e, #15803d);
  border: none;
  font-weight: 700;
  color: #000;
  padding: 10px 16px;
  border-radius: 8px;
  transition: .2s;
}
.banner-line .page-btn:hover {
  background: linear-gradient(180deg, #16a34a, #166534);
}
@media (max-width:600px){
  .banner-line{
    flex-direction: column;
    align-items: stretch;
  }
  .banner-line .page-btn{
    width: 100%;
  }
}

/* Panel Admin - Grid Layout untuk input form (USERID, WIN, WH, dll) */
#admin .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);  /* 7 kolom untuk input */
  gap: 16px;  /* Jarak antar input */
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
}

/* Menata label dan input */
#admin .grid label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-bottom: 6px;
}

/* Input fields */
#admin .grid input {
  padding: 10px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-gray-border);
  background-color: #fff;
  color: #111827;
  text-align: center;
  min-height: 42px;
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Tombol 'ENTRY BARU' dan 'SIMPAN / TAMBAH' */
#admin .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

/* Menata tombol */
#admin .page-btn {
  height: 42px;
  padding: 0 20px;
  font-weight: 800;
  font-size: 14px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f9ff00;
  color: #000;
  cursor: pointer;
  flex: 1 1 10%;
}

#admin .page-btn:hover {
  background-color: var(--brand2);
}

#admin .page-btn.warn {
  background-color: var(--red);
}

#admin .page-btn.warn:hover {
  background-color: var(--red-dark);
}

/* Responsif */
@media (max-width: 1024px) {
  #admin .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #admin .row {
    flex-direction: column;
  }

  #admin .page-btn {
    width: 100%;
    margin-bottom: 12px;
  }
}

@media (max-width: 768px) {
  #admin .grid {
    grid-template-columns: 1fr;
  }
}

.reset-btn {
  background-color: #dc2626;
  color: #fff;
}

.reset-btn:hover {
  background-color: #b91c1c;
}

#reset_all_points {
  width: 100%;
  max-width: 400px;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  text-align: center;
  display: block;
  margin: 0 auto;
  box-sizing: border-box;
  transition: background-color 0.3s ease;
}

#reset_all_points:hover {
  background-color: #b91c1c;
}

@media (max-width: 768px) {
  #reset_all_points {
    padding: 12px 20px;
    font-size: 14px;
    max-width: 100%;
  }
}

.lihat-btn {
  background: linear-gradient(90deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s;
}
.lihat-btn:hover {
  background: linear-gradient(90deg, #16a34a, #15803d);
  transform: scale(1.03);
}

/* === History Viewer (rapih) === */
.his-wrap{display:flex;flex-direction:column;gap:12px}
.his-section{background:#0f0a24;border:1px solid var(--panel-gray-border);border-radius:12px;overflow:hidden;box-shadow:0 6px 18px rgba(0,0,0,.28)}
.his-head{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;background:linear-gradient(90deg,var(--brand1),var(--brand2));border-bottom:1px solid var(--panel-gray-border);position:sticky;top:0;z-index:2}
.his-title{font-weight:900;letter-spacing:.2px}
.his-stats{display:flex;gap:8px;align-items:center}
.his-chip{background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.25);padding:3px 8px;border-radius:999px;font-size:12px;white-space:nowrap}
.his-table{width:100%;border-collapse:collapse}
.his-table th,.his-table td{padding:10px 8px;border-bottom:1px solid var(--panel-gray-border);background:#0f0a24;white-space:nowrap}
.his-table thead th{background:#121233;position:sticky;top:46px;z-index:1}
.his-table tbody tr:nth-child(even) td{background:rgba(255,255,255,.03)}
.his-amount{text-align:right;font-weight:800}
.his-empty{padding:10px;color:#c7c9ce}
.his-col-team{max-width:380px;white-space:normal}
@media(max-width:720px){
  .his-table th,.his-table td{font-size:12px;padding:8px 6px}
  .his-col-team{max-width:260px}
}

.his-toggle{cursor:pointer; user-select:none; display:flex; align-items:center; gap:8px}
.his-arrow{font-weight:900}

/* ==== Bulk History - Responsive & Rapi ==== */
#bulk_history_area {
  max-height: 60vh;
  overflow: auto;
  padding-right: 2px;
}

#bulk_history_area .table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--panel-gray-border);
  border-radius: 8px;
}

#bulk_history_area .table-like {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

#bulk_history_area .table-like th,
#bulk_history_area .table-like td {
  border: 1px solid var(--panel-gray-border);
  padding: 8px 10px;
  background: #0f0a24;
  white-space: nowrap;
  text-align: left;
}

#bulk_history_area .table-like thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #121233;
}

#bulk_history_area .input-cell {
  width: 100%;
  min-width: 120px;
  box-sizing: border-box;
}

#bulk_history_area select.input-cell {
  min-width: 100px;
}

#bulk_history_area td:nth-child(5) input[type="number"] {
  text-align: right;
}

#bulk_history_area .card {
  background: var(--panel-gray-soft);
  border: 1px solid var(--panel-gray-border);
  border-radius: 10px;
  padding: 10px;
}

#bulk_history_area .page-btn {
  height: 40px;
  font-size: 13px;
}

.modal.modal-wide {
  width: min(96vw, 1100px);
}

@media (max-width: 900px) {
  #bulk_history_area .table-like { min-width: 760px; }
  #bulk_history_area .table-like th,
  #bulk_history_area .table-like td { font-size: 13px; padding: 7px 8px; }
}

@media (max-width: 600px) {
  #bulk_history_area .table-like { min-width: 680px; }
  #bulk_history_area .table-like th,
  #bulk_history_area .table-like td { font-size: 12px; padding: 6px 6px; }
  #bulk_history_area .input-cell { min-width: 110px; }
  #bulk_history_area select.input-cell { min-width: 90px; }
}

/* === Keterangan 'P' (ikon & popover) === */
.note-cell{ position:relative; display:inline-block }
.note-icon{
  display:inline-flex; align-items:center; justify-content:center;
  margin-left:6px; padding:2px 6px; border-radius:6px;
  border:1px solid var(--panel-gray-border);
  background:#1f2937; font-size:12px; cursor:pointer; user-select:none;
}
.note-icon:hover{ background:#374151 }
.note-pop{
  position:absolute; left:0; top:120%;
  background:#0f0a24; border:1px solid var(--panel-gray-border);
  border-radius:8px; padding:8px 10px; min-width:220px; max-width:320px;
  box-shadow:0 8px 20px rgba(0,0,0,.35); color:#e5e7eb; z-index:30; display:none;
  white-space:normal; line-height:1.4;
}

/* === Pop-up Overlay untuk Keterangan P === */
.note-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.25s ease-out;
}

.note-popup-content {
  background: linear-gradient(145deg, #1b1d2a, #23253a);
  border: 1px solid #3b3e5a;
  border-radius: 14px;
  padding: 20px 24px;
  color: #f3f4f6;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.45);
  font-family: "Inter", sans-serif;
  animation: slideUp 0.3s ease-out;
}

.note-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 8px;
  border-bottom: 1px solid #3b3e5a;
  padding-bottom: 6px;
}
.note-popup-header .icon {
  font-size: 18px;
}

.note-popup-body {
  font-size: 14px;
  line-height: 1.6;
  margin-top: 6px;
  color: #e5e7eb;
  white-space: pre-wrap;
  text-align: justify;
}

.note-popup-close {
  margin-top: 16px;
  text-align: center;
  background: #374151;
  border-radius: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}
.note-popup-close:hover {
  background: #4b5563;
}

/* Animasi */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==== Warna hasil taruhan ==== */
.hasil-win   { color: #00ff80 !important; }
.hasil-wh    { color: #4ABA7B !important; }
.hasil-lose  { color: #ff4d4d !important; }
.hasil-lh    { color: #ff8080 !important; }
.hasil-run   { color: #ffffff !important; }
.hasil-draw  { color: #F5EB27 !important; }
.hasil-p     { color: #ff0000 !important; }
