:root {
  --bg: #0b1f17;
  --bg-2: #0f2a1f;
  --card: #14352783;
  --card-solid: #14352a;
  --line: #21503d;
  --accent: #16c47f;
  --accent-2: #0fa968;
  --text: #eaf5ef;
  --muted: #8fb3a3;
  --danger: #ff6b6b;
  --warn: #ffb020;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-2), var(--bg));
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--accent); }
button { font-family: inherit; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-2), var(--bg));
  transition: opacity .5s ease;
}
.splash.fade { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; animation: pop .6s ease; }
.brand { font-size: 34px; font-weight: 800; margin: 14px 0 4px; letter-spacing: -.5px; }
.brand span { color: var(--accent); }
.tagline { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.spinner {
  width: 28px; height: 28px; margin: 0 auto;
  border: 3px solid #ffffff22; border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Layout ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 0 0 88px; min-height: 100vh; }
.screen { padding: 16px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: #0b1f17e6; backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo svg { display: block; }
.topbar h2 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar .spacer { flex: 1; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 22px; padding: 26px 22px; box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-card h1 { text-align: center; font-size: 24px; margin: 6px 0 2px; }
.auth-card h1 span { color: var(--accent); }
.auth-tag { text-align: center; color: var(--accent); margin: 4px 0 2px; font-size: 14px; font-weight: 700; letter-spacing: .3px; }
.auth-sub { text-align: center; color: var(--muted); margin: 26px 0 20px; font-size: 13px; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; font-size: 15px;
  background: #1b4332; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; outline: none;
}
input::placeholder, textarea::placeholder { color: #7ea895; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238fb3a3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.cc-field { max-width: 92px; flex: 0 0 92px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 16px; font-size: 15px; font-weight: 700;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #04130c; border: none; border-radius: 12px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: #173d2e; color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: #3a1414; color: var(--danger); border: 1px solid #5a1f1f; }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }

.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; padding: 4px; }
.muted { color: var(--muted); }
.error-msg { color: var(--danger); font-size: 13px; margin: 4px 0 10px; min-height: 16px; }
.hint { display: block; margin-top: 5px; font-size: 11px; line-height: 1.45; color: var(--muted); }
.hint b { color: var(--accent); font-weight: 600; }

/* Tombol pilih file yang rapi (ganti tampilan "Choose Files" bawaan) */
.file-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #1b4332; border: 1px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--text); transition: border-color .15s ease, background .15s ease; }
.file-btn:hover { border-color: var(--accent); background: #1f4d39; }
.file-btn:active { transform: scale(.99); }
.file-btn .file-ic { font-size: 18px; }
.file-btn .file-txt { font-size: 14px; color: var(--muted); }

/* Field password + tombol lihat */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 17px; padding: 6px; line-height: 1; }

/* Checkbox kapabilitas (role editor) */
.chk { display: flex; align-items: center; gap: 10px; padding: 10px 4px; cursor: pointer; font-size: 15px; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 10px; font-size: 16px; }

/* ---------- Player / badges ---------- */
.avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: #0c241a; border: 1px solid var(--line); flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; color: var(--accent);
}
.avatar.lg { width: 84px; height: 84px; font-size: 28px; }
.player-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-solid); margin-bottom: 10px; cursor: pointer; }
.player-row:active { background: #173d2e; }
.player-row .meta { flex: 1; min-width: 0; }
.player-row .name { font-weight: 700; }
.player-row .sub { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #0c241a; border: 1px solid var(--line); color: var(--accent); white-space: nowrap; }
.badge.role { color: var(--warn); border-color: #4a3a16; }
.pts { font-weight: 800; color: var(--accent); font-size: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; background: #0c241a; border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.chip.active { background: var(--accent); color: #04130c; border-color: var(--accent); font-weight: 700; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }

/* ---------- Portfolio ---------- */
.pf-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-type {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card-solid); color: var(--text); cursor: pointer; text-align: left;
}
.pf-type:active { background: #173d2e; }
.pf-type .ic { font-size: 22px; }
.pf-type .t { font-weight: 700; font-size: 14px; }
.pf-type .d { font-size: 11px; color: var(--muted); }

.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.media-grid img, .media-grid video { width: 100%; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #000; }
/* Video sebagai thumbnail kecil dengan ikon play; klik buka tab baru */
.video-thumb { position: relative; display: block; }
.video-thumb .play-ic {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 26px; text-shadow: 0 1px 6px rgba(0,0,0,.8); pointer-events: none;
}
.media-thumb { position: relative; }
.media-thumb .rm { position: absolute; top: 4px; right: 4px; background: #000a; color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }

.set-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.set-row input { text-align: center; }
.set-row .vs { color: var(--muted); font-weight: 700; }

/* ---------- Tabs / bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; max-width: 560px; margin: 0 auto;
  background: #0b1f17f2; backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.bottomnav button {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 10px 4px 14px; font-size: 11px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.bottomnav button.active { color: var(--accent); }
.bottomnav .ic { font-size: 20px; }

/* ---------- Modal / sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: #000a; z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--card-solid); border-radius: 20px 20px 0 0; border: 1px solid var(--line); padding: 18px 16px 28px; animation: slideup .25s ease; }
@keyframes slideup { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 16px; }
.sheet-handle { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: -6px auto 14px; }

/* ---------- Misc ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.list-head h2 { margin: 0; font-size: 20px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .ic { font-size: 40px; margin-bottom: 10px; }
.rank-num { font-weight: 800; width: 28px; text-align: center; color: var(--muted); }
.rank-num.top { color: var(--accent); }
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #04130c; color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 80; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: #5a1f1f; color: #ffd5d5; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Palet placeholder template WA ---------- */
.ph-head { display: flex; align-items: baseline; justify-content: space-between; margin: 2px 0 8px; font-size: 13px; font-weight: 700; color: var(--text); }
.ph-head span { font-size: 11px; font-weight: 400; color: var(--muted); }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 16px; }
.ph-btn { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 9px 11px; background: #0c241a; border: 1px solid var(--line); border-radius: 11px; color: var(--text); cursor: pointer; text-align: left; transition: transform .1s ease, border-color .15s ease, background .15s ease; }
.ph-btn:hover { border-color: var(--accent); }
.ph-btn:active { transform: scale(.96); background: #173d2e; }
.ph-btn .ph-tok { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 700; color: var(--accent); font-size: 13px; }
.ph-btn .ph-lbl { font-size: 11px; color: var(--muted); }

/* ---------- Daftar template WA ---------- */
.tmpl-item { background: #0c241a; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.tmpl-head { display: flex; align-items: center; gap: 6px; }
.tmpl-name { flex: 1; font-weight: 700; font-size: 15px; }
.tmpl-body { color: var(--muted); font-size: 13px; white-space: pre-wrap; margin-top: 6px; line-height: 1.5; }
.icon-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 8px; }
.icon-btn:active { background: #173d2e; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #ffffff10; font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Mode pemantauan ---------- */
.mon-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.mon-label { flex: 0 0 38%; font-size: 13px; }
.mon-bar { flex: 1; height: 9px; background: #0c241a; border-radius: 99px; overflow: hidden; }
.mon-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; }
.mon-n { flex: 0 0 auto; font-weight: 700; color: var(--accent); min-width: 28px; text-align: right; font-size: 13px; }
.day-head { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: none; color: var(--text); padding: 13px 16px; cursor: pointer; font-size: 14px; font-weight: 700; }
.day-head:active { background: #173d2e; }
.day-head .caret { color: var(--accent); font-size: 12px; }
.day-body { padding: 0 16px 10px; }
.day-body .kv:first-child { border-top: 1px solid var(--line); padding-top: 10px; }
