/* =====================================================================
   FAHOVE PAY - Admin UI
   Putih / abu muda / hitam, aksen merah Fahove secukupnya.
   Desktop first, tetap nyaman di mobile.
   ===================================================================== */

:root {
    --red:        #d92828;
    --red-dark:   #b21f1f;
    --red-soft:   #fdecec;

    --ink:        #14171c;
    --ink-2:      #3b424c;
    --ink-3:      #6b7482;
    --line:       #e4e7ec;
    --line-2:     #eff1f4;
    --bg:         #f6f7f9;
    --surface:    #ffffff;

    --ok:         #16794a;
    --ok-soft:    #e7f6ee;
    --warn:       #9a6207;
    --warn-soft:  #fdf3e2;
    --bad:        #b3261e;
    --bad-soft:   #fdeceb;
    --info:       #1e5fbf;
    --info-soft:  #e9f0fd;

    --radius:     10px;
    --radius-sm:  7px;
    --shadow:     0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
    --sidebar-w:  248px;
    --font:       "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
    --mono:       ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 12.5px; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- layout */
.app { display: block; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--surface); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; z-index: 40;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px 16px; border-bottom: 1px solid var(--line-2);
}
.brand-mark {
    width: 34px; height: 34px; flex: none; border-radius: 9px;
    background: var(--red); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .3px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 14px; letter-spacing: -.1px; }
.brand-text small { color: var(--ink-3); font-size: 11px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; margin-bottom: 1px; border-radius: var(--radius-sm);
    color: var(--ink-2); font-weight: 500; font-size: 13.5px; text-decoration: none;
}
.nav-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.nav-item.is-active { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }

.sidebar-foot { border-top: 1px solid var(--line-2); padding: 14px; display: grid; gap: 10px; }
.who { display: flex; flex-direction: column; line-height: 1.3; }
.who strong { font-size: 13px; }
.who small { color: var(--ink-3); font-size: 11px; letter-spacing: .4px; }

.env-chip {
    display: inline-flex; align-items: center; gap: 6px; align-self: start;
    padding: 4px 9px; border-radius: 100px; font-size: 11px; font-weight: 700; letter-spacing: .5px;
    background: var(--info-soft); color: var(--info);
}
.env-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.env-live { background: var(--ok-soft); color: var(--ok); }
.env-inline { margin: 0 auto 4px; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    padding: 16px 26px; background: rgba(246,247,249,.88); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.topbar-title p { margin: 2px 0 0; color: var(--ink-3); font-size: 12.5px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-actions form { margin: 0; }

.main { flex: 1; padding: 22px 26px 40px; display: grid; gap: 18px; align-content: start; }

.foot {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 26px; border-top: 1px solid var(--line);
    color: var(--ink-3); font-size: 12px;
}

.hamburger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }
.scrim { position: fixed; inset: 0; background: rgba(20,23,28,.4); z-index: 35; border: 0; }

/* ---------------------------------------------------------------- cards */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-flush .pad { padding: 16px 20px 4px; }
.card-narrow { max-width: 720px; }
.card-highlight { border-color: var(--red); background: linear-gradient(180deg, var(--red-soft), var(--surface) 60%); }
.card-title { margin: 0 0 12px; font-size: 14px; font-weight: 650; letter-spacing: -.1px; }
.card-flush .card-title { margin-bottom: 6px; }

.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* ---------------------------------------------------------------- stats */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 3px;
}
.stat-label { color: var(--ink-3); font-size: 11.5px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.stat-value { font-size: 23px; font-weight: 680; letter-spacing: -.6px; line-height: 1.25; }
.stat-value.stat-sm { font-size: 15px; letter-spacing: -.2px; }
.stat-foot { color: var(--ink-3); font-size: 12px; }
.stat-ok   { border-left-color: var(--ok); }
.stat-warn { border-left-color: var(--warn); }
.stat-bad  { border-left-color: var(--bad); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table thead th {
    background: #fafbfc; color: var(--ink-3); font-size: 11px; font-weight: 650;
    text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
    border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
.table tbody tr:hover { background: #fbfcfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .act { text-align: right; white-space: nowrap; }
.table .truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .empty { text-align: center; color: var(--ink-3); padding: 34px 14px; }
.table .subrow td { background: #fffdf7; border-bottom: 1px solid var(--line-2); color: var(--warn); }
.row-flag { background: #fffaf3 !important; }
.amount { font-weight: 650; font-variant-numeric: tabular-nums; }
.link-strong { color: var(--ink); font-weight: 600; }
.link-strong:hover { color: var(--red-dark); }
.muted { color: var(--ink-3); }

/* ---------------------------------------------------------------- badges */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 100px;
    font-size: 11px; font-weight: 650; letter-spacing: .3px; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-ok    { background: var(--ok-soft);   color: var(--ok);   border-color: #cceada; }
.badge-warn  { background: var(--warn-soft); color: var(--warn); border-color: #f6e4c2; }
.badge-bad   { background: var(--bad-soft);  color: var(--bad);  border-color: #f5cfcd; }
.badge-info  { background: var(--info-soft); color: var(--info); border-color: #cfdefa; }
.badge-live  { background: var(--red-soft);  color: var(--red-dark); border-color: #f5c9c9; }
.badge-muted { background: var(--line-2);    color: var(--ink-3); border-color: var(--line); }

.count-chip {
    display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 100px;
    background: var(--red-soft); color: var(--red-dark); font-size: 11px; font-weight: 700;
}

b.ok { color: var(--ok); } b.bad { color: var(--bad); } b.muted { color: var(--ink-3); font-weight: 500; }

/* ---------------------------------------------------------------- kv list */
.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13.5px; }
.kv dd.break { word-break: break-all; }
.kv code { background: var(--line-2); padding: 1px 6px; border-radius: 5px; }

.copyable { cursor: pointer; border: 1px dashed var(--line); }
.copyable:hover { background: var(--red-soft); border-color: var(--red); }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 11.5px; }
.field .err { color: var(--bad); font-size: 11.5px; font-style: normal; }

input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="search"], input[type="date"], select, textarea {
    width: 100%; padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.form-row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.settings-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.check { display: flex; align-items: start; gap: 9px; margin-bottom: 14px; font-size: 13px; }
.check input { margin-top: 3px; accent-color: var(--red); }
.check-inline { margin: 0; align-items: center; white-space: nowrap; }

.filters {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
}
.filters input[type="search"] { flex: 1 1 240px; min-width: 180px; }
.filters select, .filters input[type="date"] { width: auto; min-width: 140px; }
.inline-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.inline-form { display: inline; }

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; font-weight: 600; }
.btn-block { width: 100%; }

.btn-primary   { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--line-2); }
.btn-ghost     { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-ghost.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-danger    { background: var(--surface); color: var(--bad); border-color: #f0c9c7; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-row form { margin: 0; }

/* ---------------------------------------------------------------- alerts */
.alert {
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px;
    border: 1px solid transparent; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.alert-success { background: var(--ok-soft);   color: var(--ok);   border-color: #cceada; }
.alert-warning { background: var(--warn-soft); color: var(--warn); border-color: #f6e4c2; }
.alert-error   { background: var(--bad-soft);  color: var(--bad);  border-color: #f5cfcd; }
.alert-info    { background: var(--info-soft); color: var(--info); border-color: #cfdefa; }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

.hint { color: var(--ink-3); font-size: 12px; margin: 10px 0 0; }
.hint-bad { color: var(--bad); }
.empty { color: var(--ink-3); text-align: center; padding: 20px; }
.empty-inline { color: var(--ink-3); font-size: 12.5px; }

.code-block {
    background: #0f1319; color: #dbe3ec; padding: 14px 16px; border-radius: var(--radius-sm);
    overflow-x: auto; margin: 0; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}

/* ---------------------------------------------------------------- charts */
.chart { margin: 0; }
.chart figcaption { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.chart svg { width: 100%; height: 148px; display: block; }
.chart .bar rect { fill: var(--red); opacity: .82; }
.chart .bar:hover rect { opacity: 1; }
.chart .grid { stroke: var(--line); stroke-width: .5; vector-effect: non-scaling-stroke; }
.chart .axis { font-size: 4px; fill: var(--ink-3); }
.chart-max { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); }

.hbar { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbar li { display: grid; grid-template-columns: 96px 1fr 62px; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--line-2); border-radius: 100px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--red); border-radius: 100px; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3); }

.syscheck { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.syscheck li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 8px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px;
}
.syscheck li:last-child { border-bottom: 0; }
.syscheck span { color: var(--ink-3); }

/* ---------------------------------------------------------------- pager */
.pager { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.pager-item {
    padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-2); font-size: 12.5px; text-decoration: none;
}
.pager-item:hover { background: var(--line-2); text-decoration: none; }
.pager-item.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager-item.is-disabled { opacity: .45; pointer-events: none; }
.pager-gap { color: var(--ink-3); padding: 0 2px; }
.pager-info { margin-left: auto; color: var(--ink-3); font-size: 12px; }

/* ---------------------------------------------------------------- auth */
.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--bg); }

.login-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 14px; padding: 28px 26px 24px;
    box-shadow: 0 8px 28px rgba(16,24,40,.08);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.login-brand strong { display: block; font-size: 15px; }
.login-brand small { color: var(--ink-3); font-size: 11.5px; }
.login-card .field { margin-top: 14px; }
.login-card .btn { margin-top: 18px; }
.login-note { margin: 14px 0 0; text-align: center; color: var(--ink-3); font-size: 11.5px; }

.error-card { text-align: center; max-width: 420px; }
.error-code { font-size: 56px; font-weight: 700; color: var(--red); line-height: 1; letter-spacing: -2px; }
.error-card h1 { font-size: 19px; margin: 10px 0 6px; }
.error-card p { color: var(--ink-3); margin: 0 0 20px; }

/* ---------------------------------------------------------------- toast */
.toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 100px;
    font-size: 12.5px; z-index: 90; box-shadow: 0 6px 20px rgba(16,24,40,.2);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
    .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(16,24,40,.18); }
    .shell { margin-left: 0; }
    .hamburger { display: block; }
    .topbar { padding: 12px 16px; }
    .main { padding: 16px 16px 32px; }
    .foot { padding: 14px 16px; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dt { margin-top: 8px; }
}

@media (min-width: 981px) { .scrim { display: none !important; } }

@media print {
    .sidebar, .topbar-actions, .filters, .pager, .hamburger { display: none !important; }
    .shell { margin-left: 0; }
    body { background: #fff; }
}

/* =====================================================================
   Buat Invoice — pemilihan metode pembayaran
   ===================================================================== */
.mode-switch { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin-bottom: 16px; }

.radio-card {
    display: flex; align-items: start; gap: 10px;
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; cursor: pointer; background: var(--surface);
}
.radio-card:hover { border-color: var(--ink-3); background: #fbfcfd; }
.radio-card input { margin-top: 3px; accent-color: var(--red); }
.radio-card strong { display: block; font-size: 13.5px; }
.radio-card small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.radio-card:has(input:checked) { border-color: var(--red); background: var(--red-soft); }

.channels { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.channels[hidden] { display: none; }

.channel-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; }
.channel-group legend {
    display: flex; align-items: baseline; gap: 8px;
    padding: 0 6px; font-size: 11.5px; font-weight: 650;
    text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3);
}

.channel { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.channel input { accent-color: var(--red); }

.link-btn {
    background: none; border: 0; padding: 0; cursor: pointer;
    font: inherit; font-size: 10.5px; font-weight: 500;
    color: var(--info); text-transform: none; letter-spacing: 0;
}
.link-btn:hover { text-decoration: underline; }

.amount-preview { color: var(--red-dark); font-weight: 600; min-height: 16px; }

.paylink { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.paylink code { flex: 1 1 320px; word-break: break-all; padding: 8px 10px; background: var(--surface); border-radius: var(--radius-sm); }

.chip-row { display: inline-flex; flex-wrap: wrap; gap: 4px; }

.alert ul.tight { margin: 6px 0 0; padding-left: 18px; }
.alert ul.tight li { margin-bottom: 3px; }
.alert > div { flex: 1; }

/* ---------------------------------------------------------------- captcha */
.field-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}

.captcha-ganti {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 0; background: none; border: 0; cursor: pointer;
    font: inherit; font-size: 12px; font-weight: 600; color: var(--info);
}
.captcha-ganti:hover { color: var(--ink); text-decoration: underline; }
.captcha-ganti:disabled { opacity: .45; cursor: default; text-decoration: none; }
.captcha-ganti svg { width: 13px; height: 13px; }

.captcha-img {
    display: block; width: 100%; height: auto;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface);
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
