/* BTI Dashboard — gaya dasar, ramah ponsel. Modul berikutnya menambah komponen di sini. */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #1d4ed8;
    --primary-text: #ffffff;
    --ok-bg: #ecfdf5; --ok-line: #a7f3d0;
    --bad-bg: #fef2f2; --bad-line: #fecaca;
    --wait-bg: #fffbeb; --wait-line: #fde68a;
    --radius: 10px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1115; --surface: #171a21; --text: #e5e7eb; --muted: #9ca3af; --line: #2a2f3a;
        --primary: #3b82f6;
        --ok-bg: #052e1f; --ok-line: #065f46; --bad-bg: #3a0d0d; --bad-line: #7f1d1d; --wait-bg: #3a2a05; --wait-line: #78350f;
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--primary); }
code, .secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.topbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
    padding: .75rem 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin: 0; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.nav a { color: var(--muted); text-decoration: none; padding: .25rem 0; }
.nav a.active { color: var(--text); font-weight: 600; }
.main { max-width: 960px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

.auth { min-height: 100vh; display: grid; place-items: start center; padding: 2rem 16px; }
.auth__card {
    width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.5rem;
}
.auth__card .brand { margin-bottom: 1rem; color: var(--muted); font-size: .875rem; }

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; margin: 1rem 0;
}
.form { display: grid; gap: .875rem; margin: 1rem 0; }
.field { display: grid; gap: .25rem; }
.field > span { font-weight: 600; font-size: .9rem; }
.input {
    width: 100%; padding: .6rem .75rem; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--line); border-radius: 8px;
}
.input--code { letter-spacing: .2em; font-family: ui-monospace, Menlo, monospace; }
.validation-message { color: #dc2626; font-size: .85rem; }

.btn {
    display: inline-block; text-align: center; padding: .6rem 1rem; font: inherit; font-weight: 600;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
    text-decoration: none; cursor: pointer;
}
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn--small { padding: .3rem .6rem; font-size: .85rem; }

.alert { padding: .75rem 1rem; border-radius: 8px; border: 1px solid; margin: .75rem 0; }
.alert p { margin: .25rem 0; }
.alert--ok { background: var(--ok-bg); border-color: var(--ok-line); }
.alert--bad { background: var(--bad-bg); border-color: var(--bad-line); }
.alert--wait { background: var(--wait-bg); border-color: var(--wait-line); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .6rem 0; border-top: 1px solid var(--line);
}
.list li:first-child { border-top: 0; }
.badge { font-size: .8rem; color: var(--muted); }
.steps { padding-left: 1.25rem; }
.qr { max-width: 220px; margin: 1rem 0; background: #fff; padding: 8px; border-radius: 8px; }
.qr svg { width: 100%; height: auto; display: block; }
.codes {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: .25rem 1rem; padding: 0; list-style: none;
    font-family: ui-monospace, Menlo, monospace;
}

/* Kelola pelanggan, layanan, langganan. Satu kolom di layar sempit; dua kolom mulai 640px. */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.page-head h1 { margin: 0; }
.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }
.grid-2 { display: grid; gap: .875rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: 1.1rem; height: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn--danger { color: #dc2626; border-color: var(--bad-line); }
.btn:disabled { opacity: .6; cursor: default; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.list a { text-decoration: none; }
.list .title { font-weight: 600; }
.list .meta { display: block; color: var(--muted); font-size: .85rem; }
.badge--on { color: #059669; }
.badge--off { color: #dc2626; }
.line-row { display: grid; gap: .5rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.line-row:first-child { border-top: 0; }
@media (min-width: 640px) { .line-row { grid-template-columns: 2fr 1fr auto; align-items: end; } }
.total { display: flex; justify-content: space-between; font-weight: 700; padding-top: .5rem; border-top: 1px solid var(--line); }
.version { margin: .75rem 0; }
.version h3 { font-size: 1rem; margin: 0 0 .25rem; }
.trail { list-style: none; margin: 0; padding: 0; font-size: .875rem; }
.trail li { padding: .4rem 0; border-top: 1px solid var(--line); }
.trail li:first-child { border-top: 0; }

/* Beranda, tagihan, WA, laporan, pengaturan (Tugas 10). Ponsel dulu: satu kolom, tombol besar. */
.badge--warn { color: #b45309; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin: 1rem 0; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; }
.stat .label { display: block; color: var(--muted); font-size: .85rem; }
.stat .value { display: block; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .sub { display: block; color: var(--muted); font-size: .8rem; }
.filters { display: grid; gap: .75rem; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(4, 1fr) auto; } }
.filters .actions { align-self: end; }
.list .end { display: flex; align-items: center; gap: .75rem; }
.list li > a { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.wa-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: .75rem 0; }
.wa-item h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.wa-item .meta { color: var(--muted); font-size: .875rem; }
.wa-item pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: .9rem; background: var(--bg); padding: .5rem .75rem; border-radius: 8px; margin: .5rem 0; }
.wa-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.wa-actions .btn { flex: 1 1 9rem; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; }
.btn--wa { background: #16a34a; border-color: #16a34a; color: #fff; }
.kv { display: grid; gap: .25rem .75rem; grid-template-columns: max-content 1fr; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tpl { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.tpl:first-of-type { border-top: 0; padding-top: 0; }
textarea.input { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.nowrap { white-space: nowrap; }

/* Impor riwayat Xendit (Tugas 11): kelompok bertingkat di dalam kartu pelanggan; baris invoice bertumpuk di ponsel. */
.import-customer h2 { margin: 0; overflow-wrap: anywhere; }
.import-group { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .75rem; }
.import-group h3 { margin: 0 0 .25rem; font-size: 1rem; overflow-wrap: anywhere; }
.import-flags { margin: .25rem 0 .75rem; padding-left: 1.1rem; font-size: .85rem; color: #b45309; }
.import-bills { margin-top: .5rem; }
.import-links { list-style: none; margin: .25rem 0 0; padding: 0; width: 100%; font-size: .875rem; }
.import-links li { display: grid; gap: .25rem .5rem; padding: .4rem 0; border-top: 1px dashed var(--line); }
.import-links code { overflow-wrap: anywhere; }
@media (min-width: 900px) {
    .import-links li { grid-template-columns: 9rem minmax(0, 1fr) 7rem 7rem 10rem 12rem; align-items: center; }
}

/* Tabel data (Transaksi Xendit): digulir di dalam kartu pada layar sempit, halaman tidak ikut melebar. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .45rem .5rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
table.data thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .8rem; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.dim td { color: var(--muted); }
