/* Token desain — nuansa kabut dingin, diambil dari tombol "Masuk dengan Google" (tombol pil abu, sorot putih, bayangan lembut). */
:root {
  --fog: #e3e6ed;
  --fog-deep: #d3d7e1;
  --surface-hi: #f5f6f9;
  --surface-lo: #d8dce5;
  --ink: #222735;
  --muted: #5f6678;
  --navy: #14207f;
  --danger: #a4262c;
  --ring: #3b5bdb;
  --radius-pill: 999px;
  --radius-panel: 22px;
  --shadow-raised: 0 10px 24px -12px rgba(46, 55, 84, .45), 0 2px 4px rgba(46, 55, 84, .08), inset 0 1px 0 rgba(255, 255, 255, .95);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; min-height: 100%; background: radial-gradient(120% 80% at 50% 0%, #eef0f5 0%, var(--fog) 55%, var(--fog-deep) 100%) var(--fog-deep); }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 1rem/1.55 var(--font);
  color: var(--ink);
}
h1, h2, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

.skip-link { position: absolute; left: 1rem; top: -3rem; padding: .5rem 1rem; background: var(--ink); color: #fff; border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 1rem; }

/* ——— Tombol ——— */
.btn-google, .btn-primary, .btn-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  font: 500 1rem/1 var(--font); cursor: pointer; text-decoration: none;
  border-radius: var(--radius-pill);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn-google {
  width: 100%; min-height: 58px; padding: 0 1.75rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--surface-hi) 0%, var(--surface-lo) 100%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-raised);
}
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(46, 55, 84, .5), 0 2px 4px rgba(46, 55, 84, .08), inset 0 1px 0 #fff; }
.btn-google:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(46, 55, 84, .18); }
.g-mark { flex: none; }

.btn-primary {
  width: 100%; min-height: 52px; padding: 0 1.5rem; margin-top: .5rem;
  color: #fff; background: var(--navy); border: 0;
  box-shadow: 0 10px 22px -12px rgba(20, 32, 127, .7);
}
.btn-primary:hover { background: #0f1968; }
.btn-primary:disabled { opacity: .6; cursor: progress; }

.btn-quiet {
  min-height: 40px; padding: 0 1.1rem; font-size: .9rem;
  color: var(--ink); background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 4px 10px -6px rgba(46, 55, 84, .45), inset 0 1px 0 #fff;
}

/* ——— Halaman masuk ——— */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-panel { width: min(100%, 26rem); display: grid; gap: 1rem; }
.login-brand { font-weight: 700; color: var(--navy); letter-spacing: .01em; }
.login-panel h1 { font-size: clamp(1.7rem, 5vw, 2.1rem); line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.login-lead { color: var(--muted); margin-bottom: .75rem; }
.login-note { font-size: .85rem; color: var(--muted); text-align: center; }

.alert { padding: .75rem 1rem; border-radius: 12px; background: #fbe9ea; color: var(--danger); font-size: .92rem; }

/* ——— Aplikasi ——— */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  max-width: 68rem; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 2.5rem);
}
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--navy); min-width: 0; }
.brand-logo { display: block; height: 44px; width: auto; }
.brand-app {
  font-weight: 500; font-size: .9rem; color: var(--muted);
  padding-left: .75rem; border-left: 1px solid rgba(34, 39, 53, .18); white-space: nowrap;
}
@media (max-width: 560px) { .brand-logo { height: 36px; } .brand-app { display: none; } }
.user { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.user-avatar { border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.user-id { min-width: 0; }
.user-name { font-weight: 500; line-height: 1.25; }
.user-email { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }

.app {
  display: grid; gap: 1.25rem; align-items: start;
  grid-template-columns: minmax(0, 1fr);
  max-width: 68rem; margin: 0 auto; padding: .5rem clamp(1rem, 4vw, 2.5rem) 3rem;
}
@media (min-width: 900px) { .app { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); } }

.panel { border-radius: var(--radius-panel); padding: clamp(1.25rem, 3vw, 2rem); }
.panel-form {
  background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .45));
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 18px 40px -28px rgba(46, 55, 84, .55);
}
.panel-form h1 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.25rem; }

form { display: grid; gap: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 340px) { .row { grid-template-columns: 1fr; } }
.field { display: grid; gap: .3rem; align-content: start; }
label { font-size: .9rem; font-weight: 500; }
input {
  width: 100%; min-height: 46px; padding: 0 .9rem;
  font: 400 1rem var(--font); color: var(--ink);
  background: #fff; border: 1px solid #c4c9d6; border-radius: 12px;
}
input:focus-visible { outline-offset: 0; border-color: var(--ring); }
input[aria-invalid="true"] { border-color: var(--danger); }
input.auto { background: #f1f3f8; }
.hint, .hint-block { font-size: .8rem; color: var(--muted); }
.error { font-size: .82rem; color: var(--danger); }
.error:empty { display: none; }

/* ——— Hasil ——— */
.panel-result { display: grid; }
@media (min-width: 900px) { .panel-result { min-height: 18rem; } }
.empty { align-self: center; color: var(--muted); max-width: 22rem; }
.result { display: grid; gap: .5rem; align-content: start; }
.result-for { font-weight: 500; }
.result-label { color: var(--muted); }
.result-value {
  font-size: clamp(2.4rem, 7vw, 3.9rem); font-weight: 700; line-height: 1.05;
  letter-spacing: -.03em; color: var(--navy); font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.formula {
  margin-top: .25rem; padding: .7rem 1rem; border-radius: 12px; width: fit-content; max-width: 100%;
  background: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere;
}
.formula sup { font-size: .72em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.stats dt { font-size: .82rem; color: var(--muted); }
.stats dd { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.table-wrap { margin-top: 1.25rem; }
.table-wrap summary { cursor: pointer; font-weight: 500; padding: .4rem 0; }
.scroll { overflow-x: auto; max-height: 22rem; overflow-y: auto; margin-top: .5rem; border-radius: 12px; background: rgba(255, 255, 255, .55); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .5rem .9rem; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: #eceef4; font-size: .82rem; font-weight: 500; color: var(--muted); }
tbody tr + tr td { border-top: 1px solid rgba(34, 39, 53, .07); }
tbody tr:last-child td { font-weight: 700; color: var(--navy); }

/* Satu momen gerak: angka hasil muncul saat perhitungan selesai */
.result.is-new .result-value { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

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

/* ——— Navigasi ——— */
.app-nav { display: flex; gap: .25rem; margin-right: auto; margin-left: 1.5rem; }
.app-nav a {
  padding: .45rem .9rem; border-radius: var(--radius-pill);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.app-nav a:hover { color: var(--ink); }
.app-nav a[aria-current="page"] {
  color: var(--ink);
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: 0 4px 10px -6px rgba(46, 55, 84, .45), inset 0 1px 0 #fff;
}
@media (max-width: 640px) { .app-nav { order: 3; width: 100%; margin: 0; } }

/* ——— Verifikasi 2FA ——— */
.steps { margin: 0; padding-left: 1.25rem; display: grid; gap: .35rem; color: var(--ink); }
.setup { display: grid; gap: 1rem; }
.qr {
  width: 220px; max-width: 100%; aspect-ratio: 1; justify-self: center;
  padding: 10px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-raised);
}
.qr svg { display: block; width: 100%; height: 100%; }
.manual summary { cursor: pointer; font-weight: 500; }
.manual p { margin-top: .5rem; font-size: .9rem; color: var(--muted); }
.secret {
  font-size: 1.05rem !important; color: var(--ink) !important; letter-spacing: .08em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; user-select: all;
}
.otp { margin-top: .5rem; }
.otp-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.login-note a { color: var(--muted); }

/* ——— Kelola admin ——— */
.app-single { grid-template-columns: minmax(0, 1fr) !important; }
.panel-form .hint-block { margin: -.5rem 0 1rem; max-width: 60ch; }
.inline-form { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.inline-form .btn-primary { width: auto; margin-top: 1.55rem; }
@media (max-width: 560px) { .inline-form { grid-template-columns: 1fr; } .inline-form .btn-primary { width: 100%; margin-top: 0; } }
.notice { margin-top: 1rem; padding: .75rem 1rem; border-radius: 12px; background: #e6f4ea; color: #1e6b34; font-size: .92rem; }
.alert { margin-top: .5rem; }
.panel-list { background: rgba(255, 255, 255, .45); border: 1px solid rgba(255, 255, 255, .9); }
.panel-list h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }
.panel-list .scroll { max-height: none; }
.admin-table th, .admin-table td { text-align: left; }
.admin-table td:first-child { font-weight: 500; }
.admin-table tbody tr:last-child td { font-weight: inherit; color: inherit; }
.admin-table tbody td:first-child { font-weight: 500; color: var(--ink); }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: var(--radius-pill); font-size: .8rem; background: #e3e6ee; color: var(--muted); }
.badge-super { background: var(--navy); color: #fff; }
.btn-link-danger {
  font: 500 .9rem var(--font); color: var(--danger); background: none; border: 0; padding: .35rem .5rem;
  border-radius: 8px; cursor: pointer;
}
.btn-link-danger:hover { background: #fbe9ea; }
.btn-link-danger[data-action="confirm"] { background: var(--danger); color: #fff; }
.admin-table th, .admin-table td { padding: .55rem .7rem; }
.admin-table td:nth-child(2) { white-space: normal; min-width: 8rem; }
.admin-table td:last-child { text-align: right; }

/* ——— Alamat & telepon ——— */
textarea {
  width: 100%; min-height: 5.5rem; padding: .7rem .9rem; resize: vertical;
  font: 400 1rem/1.5 var(--font); color: var(--ink);
  background: #fff; border: 1px solid #c4c9d6; border-radius: 12px;
}
textarea:focus-visible { outline-offset: 0; border-color: var(--ring); }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.alert-info { background: #e8ecf8; color: var(--navy); margin: -.5rem 0 1rem; }
.result-contact { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.saved { margin-top: 1rem; font-size: .9rem; color: #1e6b34; }
.saved a { color: inherit; font-weight: 500; }

/* ——— Riwayat ——— */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.list-head h1 { font-size: 1.15rem; font-weight: 700; }
.search { display: flex; gap: .5rem; flex: 1 1 18rem; max-width: 26rem; }
.search input { min-height: 40px; }
.draft-table th, .draft-table td { text-align: left; padding: .6rem .7rem; vertical-align: top; white-space: normal; }
.draft-table th.num, .draft-table td.num { text-align: right; white-space: nowrap; }
.draft-table td.nowrap { white-space: nowrap; }
.draft-table td.strong { font-weight: 700; color: var(--navy); }
.draft-table td.who { min-width: 14rem; max-width: 22rem; }
.draft-table .clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.draft-table td.num strong { color: var(--navy); }
.draft-table td.admin { max-width: 12rem; overflow-wrap: break-word; font-size: .92rem; }
.draft-table td.who { min-width: 12rem; }
.draft-table .sub { display: block; font-size: .85rem; color: var(--muted); }
.draft-table tbody tr:last-child td { font-weight: inherit; color: inherit; }
.draft-table tbody tr:last-child td.strong { font-weight: 700; color: var(--navy); }
.btn-small { min-height: 34px; padding: 0 .9rem; font-size: .85rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.pager p { font-size: .9rem; color: var(--muted); }
.pager button:disabled { opacity: .45; cursor: default; }

/* ——— Masa aktif admin ——— */
select {
  width: 100%; min-height: 46px; padding: 0 .9rem;
  font: 400 1rem var(--font); color: var(--ink);
  background: #fff; border: 1px solid #c4c9d6; border-radius: 12px;
}
select:focus-visible { outline-offset: 0; border-color: var(--ring); }
select[aria-invalid="true"] { border-color: var(--danger); }
.admin-table td { vertical-align: top; }
.admin-table .sub { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; }
.admin-table td.expiry div { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; }
.admin-table .expired { color: var(--danger); font-weight: 500; }
.admin-table tr.is-expired td:first-child strong { color: var(--muted); }
.btn-link {
  font: 500 .88rem var(--font); color: var(--navy); background: none; border: 0; padding: .2rem .35rem;
  border-radius: 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover { background: #e8ecf8; }
.expiry-edit { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.expiry-edit select { width: auto; min-height: 34px; font-size: .88rem; padding: 0 .5rem; }

/* ——— Identitas JF DIGEX ——— */
.site-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
}
.login { position: relative; z-index: 1; padding-top: 6rem; }

/* Logo bundar besar di tengah sebagai latar, opacity 30%. Hanya dekorasi: tidak bisa diklik atau dipilih. */
.page-login::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("/assets/img/jfdigex-bundar.webp") center / min(88vmin, 760px) no-repeat;
  opacity: .3;
}
/* Panel masuk diberi kaca buram agar teks tetap terbaca di atas logo */
.login-panel {
  padding: clamp(1.5rem, 4vw, 2.25rem); border-radius: var(--radius-panel);
  background: rgba(245, 246, 249, .6); border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 24px 48px -28px rgba(20, 32, 127, .45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
/* Layar sempit: logo latar dibuat lebih besar dari lebar layar agar tetap terlihat di sekitar panel */
@media (max-width: 640px) { .page-login::before { background-size: 118vw; } }
.login-panel .login-brand { display: none; }

/* ——— Masa aktif di bawah email ——— */
.user-expiry { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.user-expiry.is-soon { color: var(--danger); font-weight: 500; }

.proses { display: grid; gap: .5rem; }

/* ——— Peran dewa ——— */
.badge-dewa { background: linear-gradient(135deg, #8a6a12, #c9a227); color: #fff; }
.badge-me { background: #e8ecf8; color: var(--navy); font-size: .72rem; vertical-align: middle; }
#form-admin.inline-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
#form-admin .field { flex: 0 1 13rem; min-width: 10rem; }
#form-admin .field:first-child { flex: 1 1 16rem; }
#form-admin .btn-primary { flex: 0 0 auto; width: auto; margin-top: 1.55rem; }
@media (max-width: 560px) { #form-admin .field, #form-admin .btn-primary { flex: 1 1 100%; width: 100%; margin-top: 0; } }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem .5rem; }
.row-actions .is-confirm { background: var(--navy); color: #fff; text-decoration: none; }
.row-actions .btn-link-danger.is-confirm { background: var(--danger); }
.admin-table td.expiry .sub { display: block; }
.admin-table .expired .sub { color: inherit; }
.extend-preview { flex-basis: 100%; font-size: .82rem; color: var(--navy); font-weight: 500; }

/* ——— Admin formula (sakelar) ——— */
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 38px; height: 22px; margin: 0; cursor: pointer; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px; background: #c9ceda; position: relative; flex: none;
  transition: background-color .15s ease; box-shadow: inset 0 1px 2px rgba(34, 39, 53, .2);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(34, 39, 53, .3); transition: transform .15s ease;
}
.switch input:checked + .switch-track { background: var(--navy); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--ring); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-text { font-size: .88rem; }
.sub-strong { font-weight: 500; color: var(--muted); }

/* ——— Riwayat per nama & hapus ——— */
.list-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; flex: 1 1 22rem; justify-content: flex-end; }
.btn-danger-quiet { color: var(--danger); }
.btn-danger-quiet.is-active { background: var(--danger); color: #fff; box-shadow: none; }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 1.1rem;
  font: 500 .9rem var(--font); color: #fff; background: var(--danger); border: 0; border-radius: var(--radius-pill); cursor: pointer;
}
.btn-danger:disabled { opacity: .45; cursor: default; }
.group-table .col-pilih { width: 2.5rem; text-align: center; }
.group-table input.pilih { width: 18px; height: 18px; accent-color: var(--danger); cursor: pointer; }
.group-row { cursor: pointer; }
.group-row:hover td { background: rgba(255, 255, 255, .5); }
.group-row.is-open td { background: rgba(232, 236, 248, .8); }
.group-row td.actions { text-align: right; white-space: nowrap; }
.group-detail > td { padding: 0 0 .5rem 1.5rem !important; background: rgba(232, 236, 248, .45); }
.sub-table { width: 100%; border-collapse: collapse; }
.sub-table td { padding: .5rem .7rem; vertical-align: top; border-top: 1px dashed rgba(34, 39, 53, .12); font-size: .94rem; }
.sub-table td.num { text-align: right; }
.sub-table td.actions { text-align: right; }
.sub-table .sub { display: block; font-size: .82rem; color: var(--muted); }
.bulk-bar {
  position: sticky; bottom: 1rem; z-index: 3; margin-top: 1rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 1rem; border-radius: 16px; background: #fff; box-shadow: 0 12px 30px -12px rgba(34, 39, 53, .35);
}
.bulk-bar p { font-size: .9rem; }
.bulk-actions { display: flex; gap: .5rem; }
.admin-table td.actions { width: 1%; }
.admin-table .row-actions { flex-direction: column; align-items: flex-end; }
.admin-table .row-actions button { white-space: normal; text-align: right; max-width: 8.5rem; line-height: 1.3; }
.admin-table td.col-formula { white-space: nowrap; }
.sub-table thead th { background: transparent; font-size: .78rem; font-weight: 500; color: var(--muted); text-align: left; padding: .35rem .7rem; position: static; }
.sub-table thead th.num { text-align: right; }
.sub-table tbody tr { cursor: pointer; }
.sub-table tbody tr:hover td { background: rgba(255, 255, 255, .6); }
.group-table td.who .sub { display: block; }
.group-table td.who { min-width: 14rem; }
.group-table td.admin { min-width: 14rem; }
.sub-table td.num .sub { font-weight: 400; }
