/* =========================================================================
   Dasbor - lembar gaya tunggal.

   Ditulis tangan, bukan Tailwind CDN. CDN itu compiler JavaScript yang jalan
   di browser: gayanya baru muncul setelah JS selesai, jadi tiap halaman
   sempat tampil polos. Satu berkas CSS statis di-cache browser, tidak pernah
   berkedip, dan menghapus dependency eksternal terakhir dari produk ini.

   Palet sengaja NETRAL. Ini produk whitelabel - rangkanya harus bisa
   ditumpangi merek apa pun. Warna brand milik Whitelabel User cuma dipakai
   sebagai aksen: tombol utama, menu aktif, tautan. Kalau rangkanya sendiri
   punya kepribadian kuat, ia akan berkelahi dengan merek penggunanya.
   ========================================================================= */

:root {
    --brand: #2563eb;
    --brand-accent: #1e40af;

    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --text: #14161a;
    --muted: #6b7280;
    --line: #e4e7ec;
    --danger: #dc2626;
    --ok: #059669;

    --radius: 10px;
    --sidebar: 248px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

html.dark {
    --bg: #0d0f13;
    --surface: #16191f;
    --surface-2: #1d212a;
    --text: #eef0f3;
    --muted: #98a1af;
    --line: #262b35;
    --shadow: none;
}

@media (prefers-color-scheme: dark) {
    html:not(.light) {
        --bg: #0d0f13; --surface: #16191f; --surface-2: #1d212a;
        --text: #eef0f3; --muted: #98a1af; --line: #262b35; --shadow: none;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ------------------------------------------------------------- kerangka */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px 14px;
    font-weight: 650; letter-spacing: -.01em;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    min-height: 61px;
}
.sidebar__brand img { height: 26px; width: auto; border-radius: 5px; }
.sidebar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar__nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar__label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); padding: 12px 8px 6px; font-weight: 600;
}

.navitem {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--muted); text-decoration: none; font-weight: 500;
}
.navitem:hover { background: var(--surface-2); color: var(--text); }
.navitem[aria-current="page"] { background: var(--surface-2); color: var(--brand); font-weight: 600; }
.navitem svg { flex-shrink: 0; }

.sidebar__foot { border-top: 1px solid var(--line); padding: 12px 10px; }
.who {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; margin-bottom: 4px;
    border-radius: 8px;
    color: inherit; text-decoration: none;
}
.who:hover { background: var(--surface-2); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 650; font-size: 13px; text-transform: uppercase;
}
.who__meta { min-width: 0; }
.who__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__role { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------- konten */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: none;
    align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}

.content { padding: 28px 32px 64px; max-width: 940px; width: 100%; }

.page-head { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.015em; }
.page-head p { margin: 0; color: var(--muted); }

/* ---------------------------------------------------------------- kartu */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card__head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card__head h2 { margin: 0; font-size: 14px; font-weight: 650; }
.card__head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.card__body { padding: 18px; }

.empty { text-align: center; padding: 48px 24px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.empty__icon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.empty h3 { margin: 0 0 4px; font-size: 15px; }
.empty p { margin: 0 0 18px; color: var(--muted); }

/* -------------------------------------------------------------- kontrol */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-accent); border-color: var(--brand-accent); }
.btn--danger { color: var(--danger); border-color: var(--line); }
.btn--danger:hover { background: rgba(220, 38, 38, .08); }
.btn--sm { padding: 6px 11px; font-size: 13px; }
.btn--icon { padding: 7px; }
.btn[disabled] { opacity: .4; cursor: default; }
.btn--link { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; }
.btn--link:hover { background: none; text-decoration: underline; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 600; margin-bottom: 5px; }
.field .hint { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.field .err { margin: 5px 0 0; font-size: 12.5px; color: var(--danger); }

.input, select.input, textarea.input {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--text);
    font: inherit;
}
.input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.input--invalid { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 76px; }

.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
.prefixed { display: flex; align-items: center; }
.prefixed span { color: var(--muted); padding-right: 4px; white-space: nowrap; }

.switch { display: flex; align-items: flex-start; gap: 10px; }
.switch input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }

/* --------------------------------------------------------------- lain-lain */

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.alert--ok { background: rgba(5, 150, 105, .1); color: var(--ok); }
.alert--err { background: rgba(220, 38, 38, .1); color: var(--danger); }
.alert--info { background: var(--surface-2); color: var(--text); }
.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }
/* Balasan mentah dari server (mis. SMTP). Sengaja monospace: yang penting
   di sini bukan keindahannya, tapi bisa disalin persis apa adanya. */
.alert__detail { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; opacity: .85; }

/* --- daftar panjang: kotak cari + tautan halaman --- */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; }
.toolbar .input { flex: 1; min-width: 0; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pager__info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager__nav { display: flex; align-items: center; gap: 8px; }
.pager__page { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager [aria-disabled="true"] { opacity: .4; }

/* --- kartu dasbor: deretan angka --- */
.metrics { display: flex; flex-wrap: wrap; gap: 22px; }
.metric__n { font-size: 24px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric__l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.tag--ok { background: rgba(5, 150, 105, .12); color: var(--ok); }
.tag--muted { background: var(--surface-2); color: var(--muted); }
.tag--err { background: rgba(220, 38, 38, .12); color: var(--danger); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list__main { min-width: 0; flex: 1; }
.list__title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.list__meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__actions { display: flex; gap: 6px; flex-shrink: 0; }

.stat { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------------- responsif */

.sidebar__close { display: none; }

@media (max-width: 860px) {
    .topbar { display: flex; }
    .content { padding: 20px 16px 56px; }
    .page-head { flex-direction: column; }

    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 40;
        transform: translateX(-100%); transition: transform .18s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .18);
    }
    html.nav-open .sidebar { transform: none; }
    html.nav-open .scrim { display: block; }
    .sidebar__close { display: inline-flex; }

    .scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
    .row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------------- halaman masuk */

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth__box { width: 100%; max-width: 384px; }
.auth__brand { text-align: center; margin-bottom: 22px; }
.auth__brand img { height: 34px; width: auto; margin-bottom: 10px; }
.auth__brand h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.auth__title { margin: 0 0 3px; font-size: 16px; }
.auth__sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.auth__alt { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.auth__foot { text-align: center; margin-top: 18px; display: flex; gap: 14px;
              justify-content: center; align-items: center; flex-wrap: wrap; }
.auth__foot .btn--link { font-size: 12.5px; color: var(--muted); }
.auth__foot button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.auth__foot button:hover { color: var(--brand); }

/* --------------------------------------------------------- wizard instalasi */

.wizard { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.wizard__box { width: 100%; max-width: 560px; }

.steps { display: flex; gap: 6px; margin-bottom: 26px; }
.steps__item { flex: 1; text-align: center; }
.steps__dot {
    width: 30px; height: 30px; margin: 0 auto 6px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 650;
    background: var(--surface-2); color: var(--muted);
}
.steps__item--on .steps__dot { background: var(--brand); color: #fff; }
.steps__item--done .steps__dot { background: rgba(5, 150, 105, .15); color: var(--ok); }
.steps__label { font-size: 11.5px; color: var(--muted); }
.steps__item--on .steps__label { color: var(--text); font-weight: 600; }

.check { list-style: none; margin: 0 0 20px; padding: 0; }
.check li {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 13px; border-radius: 8px; margin-bottom: 6px;
    background: var(--surface-2);
}
.check li[data-ok="1"] { background: rgba(5, 150, 105, .09); }
.check li[data-ok="0"] { background: rgba(220, 38, 38, .09); }
.check__state { font-weight: 650; font-size: 13px; white-space: nowrap; }
.check li[data-ok="1"] .check__state { color: var(--ok); }
.check li[data-ok="0"] .check__state { color: var(--danger); }

details.adv { border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; }
details.adv > summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.adv[open] > summary { margin-bottom: 12px; }

.done-mark {
    width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
    background: rgba(5, 150, 105, .14); color: var(--ok);
    display: flex; align-items: center; justify-content: center;
}

/* ============================================================ pusat bantuan */

/* Isi tutorial: teks biasa yang sudah diubah jadi paragraf oleh Core\Guide. */
.prose { margin-top: 10px; }
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--brand); overflow-wrap: anywhere; }

/* Video tersemat, rasio 16:9 tanpa bergantung pada aspect-ratio. */
.embed { position: relative; padding-top: 56.25%; margin: 12px 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Baris admin WhatsApp di layar pengaturan. */
.agent { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; background: var(--surface-2); }

/* Daftar penanda dinamis di layar isi email. */
.chips { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; white-space: nowrap; }
.chip__desc { font-size: 12.5px; color: var(--muted); }

/* Pratinjau email. Latar putih tetap, karena begitulah klien email menggambarnya. */
.mailpreview { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* --- tombol obrolan mengambang --- */
.chatw { position: fixed; right: 18px; bottom: 18px; z-index: 40; }
.chatw__btn {
    list-style: none; cursor: pointer; width: 52px; height: 52px; border-radius: 50%;
    background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}
.chatw__btn::-webkit-details-marker { display: none; }
.chatw__btn:hover { background: var(--brand-accent); }
.chatw__btn svg { width: 24px; height: 24px; }
.chatw[open] .chatw__btn { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

.chatw__panel {
    position: absolute; right: 0; bottom: 62px; width: 290px; max-width: calc(100vw - 36px);
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .18); overflow: hidden;
}
.chatw__head { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chatw__head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.chatw__list { max-height: 320px; overflow-y: auto; }
.chatw__agent { display: flex; align-items: center; gap: 11px; padding: 11px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.chatw__agent:last-child { border-bottom: 0; }
.chatw__agent:hover { background: var(--surface-2); }
.chatw__meta { min-width: 0; }
.chatw__name { display: block; font-weight: 600; font-size: 13.5px; }
.chatw__role { display: block; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
    .chatw { right: 14px; bottom: 14px; }
}

/* ============================================================= pembayaran */

/* Kotak pilihan paket di halaman Tagihan. */
.planbox {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 10px;
}
.planbox:last-child { margin-bottom: 0; }
.planbox--current { border-color: var(--brand); background: var(--surface-2); }
.planbox__main { min-width: 0; }
.planbox__name { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.planbox__price { font-size: 20px; font-weight: 680; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.planbox__price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.planbox__limits { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.planbox__buy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 560px) {
    .planbox__buy { width: 100%; }
    .planbox__buy .btn { flex: 1; justify-content: center; }
}

/* ============================================================ foto profil */

/*
 * Lingkaran inisial di atas sudah ada sejak awal dan TIDAK diubah - tampilan
 * sekarang ikut dipakai tiga halaman. Yang ditambahkan cuma dua hal: dukungan
 * gambar di dalamnya, dan ukuran besar untuk halaman akun.
 *
 * Inisial tetap jadi cadangan, bukan gambar "orang abu-abu" bawaan: gambar
 * bawaan membuat semua baris terlihat sama, inisial masih membedakan satu
 * pengguna dari yang lain.
 */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--lg { width: 84px; height: 84px; font-size: 28px; }

.avatarpick { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatarpick__opts { min-width: 240px; flex: 1; }
.radioline {
    display: flex; align-items: center; gap: 8px;
    font-size: 13.5px; font-weight: 550; margin: 12px 0 6px;
    cursor: pointer;
}
.radioline:first-child { margin-top: 0; }
.radioline input { margin: 0; }

/* ================================================== verifikasi dua langkah */

/*
 * Rahasia TOTP ditampilkan sebagai teks untuk diketik manual - kode QR
 * sengaja tidak dibuat, karena satu-satunya jalan pintasnya adalah mengirim
 * rahasia itu ke layanan pembuat QR milik orang lain.
 */
.secretbox {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 17px; letter-spacing: .12em; font-weight: 600;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 14px; margin: 8px 0 4px; word-break: break-all;
    user-select: all;   /* satu klik memilih seluruhnya */
}

.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.codes code {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
    padding: 8px 10px; text-align: center; font-size: 14px; letter-spacing: .06em;
    user-select: all;
}

.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 14px; line-height: 1.6; }
.steps li:last-child { margin-bottom: 0; }

/* =============================================== melihat sebagai pelanggan */

/*
 * Sengaja mencolok dan tidak bisa ditutup. Bahaya terbesar dari fitur ini
 * bukan penyalahgunaan yang disengaja - melainkan lupa bahwa ia sedang
 * menyala, lalu mengira layar pelanggan adalah layar sendiri.
 */
.asbanner {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    flex-wrap: wrap; margin-bottom: 18px; padding: 12px 16px; border-radius: 10px;
    background: #b45309; color: #fff; font-size: 13.5px; font-weight: 600;
}
.asbanner .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; }
.asbanner .btn:hover { background: rgba(255,255,255,.28); }
