:root {
  --blue-900: #081020;
  --blue-800: #0c1a30;
  --blue-700: #12263f;
  --green-900: #07241a;
  --green-800: #0b3a28;
  --green-600: #12805a;
  --green-500: #16a16f;
  --green-400: #2dd4a0;
  --accent: #2dd4a0;
  --accent2: #4f8cff;
  --text: #eef4fb;
  --text-dim: #9fb0c3;
  --card: rgba(255,255,255,0.045);
  --card-border: rgba(255,255,255,0.10);
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 8% -10%, rgba(79,140,255,0.22), transparent 60%),
    radial-gradient(1000px 700px at 105% 110%, rgba(22,161,111,0.24), transparent 55%),
    linear-gradient(135deg, var(--blue-900) 0%, var(--blue-800) 38%, var(--green-900) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- Layout ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 20px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border: 1px solid var(--card-border);
  background: var(--card); border-radius: var(--radius);
  backdrop-filter: blur(8px); margin-bottom: 20px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.15rem; letter-spacing: .5px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-700), var(--green-600));
  font-weight: 900; font-size: 1.1rem; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.logo-img { height: 42px; width: auto; display: block; filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); }
.logo-login { max-width: 200px; width: auto; height: auto; margin: 0 auto 12px; display: block; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
.brand small { display: block; font-weight: 400; font-size: .72rem; color: var(--text-dim); letter-spacing: .3px; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.userchip { font-size: .85rem; color: var(--text-dim); }
.userchip b { color: var(--text); }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px; backdrop-filter: blur(8px);
}
.card h3 { font-size: 1rem; margin-bottom: 14px; letter-spacing: .3px; color: var(--text); }

.stat { padding: 18px 20px; }
.stat .label { font-size: .78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 1.9rem; font-weight: 800; margin-top: 6px; }
.stat .sub { font-size: .8rem; color: var(--text-dim); margin-top: 4px; }
.stat.green .value { color: var(--accent); }
.stat.blue .value { color: var(--accent2); }

/* ---------- Buttons & inputs ---------- */
button, .btn {
  font-family: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  border: none; border-radius: 10px; padding: 11px 18px; color: #04231a;
  background: linear-gradient(135deg, var(--green-400), var(--green-500));
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { transform: scale(.98); }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.btn-blue { background: linear-gradient(135deg, #5b9bff, var(--accent2)); color: #04122a; }
.btn-danger { background: rgba(248,113,113,.14); border: 1px solid rgba(248,113,113,.4); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 8px; }

input, select, textarea {
  font-family: inherit; font-size: 1rem; color: var(--text);
  background: rgba(0,0,0,.28); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 12px 14px; width: 100%; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(22,161,111,.18); }
textarea { resize: vertical; min-height: 80px; }
input::placeholder, textarea::placeholder { color: #6b7f95; }
label { display: block; font-size: .8rem; color: var(--text-dim); margin: 12px 0 6px; }

.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--card-border); white-space: nowrap; }
th { color: var(--text-dim); font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
tr:hover td { background: rgba(255,255,255,.03); }
td.num, th.num { text-align: right; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-green { background: rgba(22,161,111,.18); color: var(--green-400); border: 1px solid rgba(22,161,111,.35); }
.badge-red { background: rgba(248,113,113,.15); color: var(--danger); border: 1px solid rgba(248,113,113,.35); }
.badge-yellow { background: rgba(251,191,36,.15); color: var(--warning); border: 1px solid rgba(251,191,36,.35); }
.badge-blue { background: rgba(79,140,255,.15); color: var(--accent2); border: 1px solid rgba(79,140,255,.35); }

/* ---------- Login (index) ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 420px; padding: 36px 32px; text-align: center;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 20px; backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-card .logo-big {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-700), var(--green-600));
  font-size: 2rem; font-weight: 900; box-shadow: 0 8px 26px rgba(0,0,0,.4);
}
.login-card h1 { font-size: 1.4rem; letter-spacing: .5px; }
.login-card .tagline { color: var(--text-dim); font-size: .9rem; margin: 6px 0 24px; }
.login-card .hint { font-size: .8rem; color: var(--text-dim); margin-top: 16px; }
.step { display: none; }
.step.active { display: block; }

/* OTP boxes */
.otp-row { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.otp-row input {
  width: 48px; height: 56px; text-align: center; font-size: 1.5rem; font-weight: 700;
  padding: 0; background: rgba(0,0,0,.3);
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 12px; font-size: .9rem; font-weight: 600;
  background: #0e1a24; border: 1px solid var(--card-border); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  z-index: 999; display: none; max-width: 90vw;
}
#toast.ok { background: rgba(10,60,42,.95); border-color: rgba(22,161,111,.5); }
#toast.err { background: rgba(60,20,25,.95); border-color: rgba(248,113,113,.5); }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 500; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 480px; background: #0c1826; border: 1px solid var(--card-border);
  border-radius: 18px; padding: 24px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 6px; }
.modal .close-x { float: right; cursor: pointer; color: var(--text-dim); font-size: 1.3rem; line-height: 1; }

/* ---------- QR ---------- */
.qr-box { text-align: center; }
.qr-box img { width: 230px; height: 230px; border-radius: 12px; background: #fff; padding: 8px; }
.qr-amount { font-size: 1.8rem; font-weight: 800; color: var(--accent); margin: 10px 0 2px; }
.qr-note { font-size: .85rem; color: var(--text-dim); }
.countdown { font-size: .9rem; color: var(--warning); font-weight: 700; margin-top: 8px; }

/* ---------- Tabs (admin) ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.tab {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--card-border);
  background: transparent; color: var(--text-dim); cursor: pointer; font-size: .88rem; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.tab.active { background: linear-gradient(135deg, var(--blue-700), var(--green-600)); color: #fff; border-color: transparent; }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

.muted { color: var(--text-dim); font-size: .85rem; }
.row-actions { display: flex; gap: 6px; }
.pill { display:inline-block; padding:2px 8px; border-radius:6px; font-size:.7rem; font-weight:700; background:rgba(255,255,255,.06); }
.spacer { flex: 1; }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-700), var(--green-600));
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg {
  width: 86px; height: 86px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-700), var(--green-600));
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.initial { font-weight: 800; color: #fff; font-size: 1.15rem; }
.avatar-lg .initial { font-size: 2.1rem; }

/* ---------- Landing page builder ---------- */
.chip { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:999px; background:rgba(255,255,255,.06); border:1px solid var(--card-border); font-size:.82rem; }
.chip button { background:none; border:none; color:var(--danger); cursor:pointer; font-size:.9rem; padding:0 2px; }
.media-item { display:flex; gap:8px; align-items:center; background:rgba(0,0,0,.18); border:1px solid var(--card-border); border-radius:10px; padding:8px; margin-bottom:8px; }
.media-item img { width:56px; height:56px; object-fit:cover; border-radius:6px; flex-shrink:0; }
.media-item input { margin:0; padding:9px 10px; font-size:.88rem; min-width:0; }
.media-item .rm { flex-shrink:0; }

/* ---------- Broadcast WA: Quill editor (dark) & progress ---------- */
#bcEditor { margin-bottom:4px; }
.ql-toolbar.ql-snow { background:var(--card); border:1px solid var(--card-border) !important; border-radius:12px 12px 0 0; border-bottom:none !important; }
.ql-container.ql-snow { background:rgba(0,0,0,.28); border:1px solid var(--card-border) !important; border-radius:0 0 12px 12px; border-top:none !important; color:var(--text); font-family:inherit; height:auto !important; }
.ql-editor { min-height:140px; max-height:280px; height:auto !important; overflow-y:auto; color:var(--text); font-size:.95rem; line-height:1.55; }
.ql-editor.ql-blank::before { color:var(--text-dim); font-style:normal; left:15px; }
.ql-snow .ql-stroke { stroke:var(--text-dim); }
.ql-snow .ql-fill { fill:var(--text-dim); }
.ql-snow .ql-picker { color:var(--text-dim); }
.ql-snow .ql-picker-label:hover, .ql-snow .ql-picker-label.ql-active { color:var(--text); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke:var(--accent); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill:var(--accent); }
.ql-snow .ql-picker-options { background:#182336; border:1px solid var(--card-border); border-radius:8px; }
.ql-snow .ql-tooltip { background:#182336; border:1px solid var(--card-border); color:var(--text); border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.4); }
.ql-snow .ql-tooltip input[type=text] { background:rgba(0,0,0,.3); color:var(--text); border:1px solid var(--card-border); }
.ql-snow .ql-tooltip a.ql-action, .ql-snow .ql-tooltip a.ql-remove { color:var(--accent); }
.progress { width:100%; height:10px; background:rgba(255,255,255,.08); border-radius:999px; overflow:hidden; }
.progress-bar { height:100%; width:0%; background:linear-gradient(90deg,#2dd4a0,#16a16f); border-radius:999px; transition:width .4s ease; }

/* ---------- Navigasi dropdown + kartu data ---------- */
.nav-wrap { margin-bottom:18px; }
.nav-select { width:100%; max-width:340px; background:var(--card); border:1px solid var(--card-border); color:var(--text); border-radius:12px; padding:12px 14px; font-size:1rem; font-weight:600; cursor:pointer; outline:none; }
.nav-select:focus { border-color:var(--accent); }
.search-box { width:100%; max-width:360px; }
.data-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.data-card { background:var(--card); border:1px solid var(--card-border); border-radius:14px; padding:16px; display:flex; flex-direction:column; gap:12px; }
.data-card-top { display:flex; align-items:center; gap:12px; }
.data-avatar { width:56px; height:56px; border-radius:14px; object-fit:cover; flex-shrink:0; cursor:pointer; border:1px solid var(--card-border); background:rgba(255,255,255,.06); }
.data-avatar-initial { width:56px; height:56px; border-radius:14px; flex-shrink:0; cursor:pointer; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.4rem; color:#fff; background:linear-gradient(135deg,#16a16f,#0e8f5c); }
.data-card-name { font-weight:700; color:var(--text); }
.data-card-meta { color:var(--text-dim); font-size:.85rem; margin-top:2px; line-height:1.45; }
.data-card-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.wa-btn { display:inline-flex; align-items:center; gap:6px; background:linear-gradient(135deg,#25d366,#128c7e); color:#fff; text-decoration:none; font-weight:700; font-size:.85rem; padding:8px 14px; border-radius:10px; }
.wa-btn:hover { filter:brightness(1.08); }
.detail-avatar { width:80px; height:80px; border-radius:16px; object-fit:cover; border:1px solid var(--card-border); background:rgba(255,255,255,.06); }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px 16px; }
.detail-grid .k { color:var(--text-dim); font-size:.78rem; }
.detail-grid .v { color:var(--text); font-size:.92rem; word-break:break-word; }
.detail-grid .full { grid-column:1 / -1; }

@media (max-width: 640px) {
  .shell { padding: 12px; }
  .login-card { padding: 28px 20px; }
  .otp-row input { width: 42px; height: 50px; font-size: 1.25rem; }
  .stat .value { font-size: 1.5rem; }
}
