:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Login ---------- */

body.login-page { background: #eef2f9; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 44%) 1fr;
}

/* Panel merek: gradien biru + pola titik halus + ilustrasi baris data. */
.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 44px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(96, 165, 250, 0.55), transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(30, 64, 175, 0.9), transparent 55%),
    linear-gradient(150deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
}
.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
}
.login-hero > * { position: relative; }

.hero-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.hero-logo {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fde68a;
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0.95;
}

/* Ilustrasi abstrak: baris data, yang duplikat dicoret & memudar. */
.hero-art {
  width: min(100%, 340px);
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(6px);
  transform: rotate(-3deg);
}
.art-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  animation: art-in 0.6s ease both;
}
.art-row + .art-row { margin-top: 8px; }
.art-row i { width: 70px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.85); }
.art-row b { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.4); }
.art-row b.short { flex: 0 0 38%; margin-right: auto; }
.art-row em { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; }
.art-row em.ok { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25); }
.art-row em.x { background: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25); }
.art-row.dup { opacity: 0.45; }
.art-row.dup i, .art-row.dup b { background: rgba(255, 255, 255, 0.35); }
.art-row:nth-child(2) { animation-delay: 0.08s; }
.art-row:nth-child(3) { animation-delay: 0.16s; }
.art-row:nth-child(4) { animation-delay: 0.24s; }
.art-row:nth-child(5) { animation-delay: 0.32s; }
.art-row:nth-child(6) { animation-delay: 0.4s; }
@keyframes art-in {
  from { opacity: 0; transform: translateX(-12px); }
}
.art-row.dup { animation-name: art-in-dup; }
@keyframes art-in-dup {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 0.45; }
}

/* Sisi form */
/* main.login-main: menimpa aturan umum `main` milik halaman aplikasi (max-width & margin). */
main.login-main {
  max-width: none;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 32px 24px;
}
.login-form {
  width: 100%;
  max-width: 380px;
  animation: form-in 0.5s ease both;
}
@keyframes form-in {
  from { opacity: 0; transform: translateY(8px); }
}
.login-form h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.login-sub { margin: 4px 0 28px; color: var(--muted); font-size: 14px; }

.mobile-brand { display: none; }

.lf { display: block; margin-bottom: 16px; }
.lf-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #334155; }
.lf-box { position: relative; display: block; }
.lf-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.15s;
}
/* Diawali .lf supaya menang atas aturan umum input[type="text"] di bawah file ini,
   yang kalau tidak akan menimpa padding kiri sehingga teks bertumpuk dengan ikon. */
.lf .lf-box input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d5dce7;
  border-radius: 11px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lf .lf-box input:hover { border-color: #b8c3d4; }
.lf .lf-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}
.lf-box:focus-within .lf-icon { color: var(--accent); }
.lf .lf-box input#password { padding-right: 104px; }
.lf-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lf-toggle:hover { background: #eff6ff; }

.login-btn {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: none;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.login-btn:hover { filter: brightness(1.06); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.38); }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }
.login-btn:disabled { opacity: 0.7; cursor: wait; box-shadow: none; }

.login-form .alert { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  .art-row, .login-form { animation: none; }
}

/* Layar sempit: panel merek disembunyikan, logo pindah ke atas form. */
@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  body.login-page {
    background:
      radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.18), transparent 50%),
      radial-gradient(circle at 0% 100%, rgba(37, 99, 235, 0.12), transparent 55%),
      #eef2f9;
  }
  main.login-main { padding: 12vh 16px 24px; align-items: start; }
  .login-form {
    max-width: 420px;
    padding: 28px 22px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    font-size: 16px;
    font-weight: 700;
  }
  .mobile-brand .accent { color: var(--accent); }
  .mobile-brand .hero-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    border: none;
    color: #fde68a;
  }
  .login-form h1 { font-size: 24px; }
}

/* ---------- Layout ---------- */

header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 650; font-size: 15px; white-space: nowrap; }
.brand span { color: var(--accent); }

/* Bisa digeser mendatar kalau tab tidak muat (layar sempit). Dropdown-nya
   dipasang position:fixed supaya tidak ikut terpotong oleh overflow ini. */
nav.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }

nav.tabs button {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
}

nav.tabs button:hover { background: var(--surface-2); color: var(--text); }
nav.tabs button.active { background: #eff6ff; color: var(--accent); }

/* ---------- Menu Riwayat (dropdown) ---------- */

.tab-dropdown { position: relative; }
.tab-dropdown > .dropdown-toggle { display: flex; align-items: center; gap: 6px; }
/* inline-block wajib: transform diabaikan pada elemen inline biasa. */
.tab-dropdown .caret {
  display: inline-block;
  font-size: 11px;
  transition: transform 0.15s ease;
}

/* Terbuka saat pointer diarahkan ke menu, atau saat diklik (untuk layar sentuh).
   Kelas .no-hover dipasang sesaat setelah memilih item supaya menu tidak
   tetap menempel di bawah pointer. */
.tab-dropdown:hover:not(.no-hover) .caret,
.tab-dropdown.open .caret { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  /* fixed, bukan absolute: nav bisa digeser mendatar dan akan memotong
     apa pun yang absolut di dalamnya. Posisinya dihitung di app.js. */
  position: fixed;
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.tab-dropdown:hover:not(.no-hover) .dropdown-menu,
.tab-dropdown.open .dropdown-menu { display: block; }

.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 6px;
}

.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.clock {
  text-align: right;
  line-height: 1.3;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding-right: 12px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.clock > div:first-child { color: var(--text); font-weight: 600; }
.clock .alt { color: var(--muted); }

main { max-width: 1080px; margin: 0 auto; padding: 24px; }

section.page { display: none; }
section.page.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 4px; font-size: 15px; }
.card p.hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
/* Judul yang langsung diikuti isi (tanpa paragraf penjelas) butuh jarak sendiri. */
.card h2 + form, .card h2 + .table-wrap, .card h2 + .stats { margin-top: 16px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 200px; }
.row > .shrink { flex: 0 0 auto; }

/* ---------- Form ---------- */

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; }

input[type="text"], input[type="password"], input[type="search"], input[type="file"],
input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 13px;
}
label.check input { width: auto; margin: 0; }

/* Berlaku untuk <button> maupun <a class="btn"> — beberapa tombol unduh
   memang berupa tautan agar browser menanganinya sebagai unduhan biasa. */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* Tombol berisi ikon saja (mis. Unduh), berbentuk kotak kecil. */
.btn.btn-ikon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  text-decoration: none;
  color: var(--accent);
}
.btn.btn-ikon svg { display: block; }

/* ---------- Alerts ---------- */

.alert {
  padding: 10px 13px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  display: none;
}
.alert.show { display: block; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

/* ---------- Stats ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.stat .val { font-size: 22px; font-weight: 650; line-height: 1.2; }
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.good .val { color: var(--ok); }
.stat.warn .val { color: var(--warn); }

/* ---------- Kotak upload (seret & lepas) ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 34px 20px;
  margin-top: 16px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
/* display:flex di atas mengalahkan atribut [hidden] bawaan browser. */
.dropzone[hidden] { display: none; }

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: #eff6ff;
  outline: none;
}
/* Saat file ditarik melintas di atas kotak. */
.dropzone.seret {
  border-color: var(--accent);
  border-style: solid;
  background: #dbeafe;
}

.dropzone-ikon { width: 34px; height: 34px; color: var(--accent); }
.dropzone-judul { font-size: 14px; font-weight: 500; }
.dropzone-judul span { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dropzone-syarat { font-size: 12px; color: var(--muted); }

/* Kartu file yang sudah dipilih. */
.file-terpilih {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.file-terpilih[hidden] { display: none; }

.file-ikon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.file-info { flex: 1; min-width: 0; }
.file-info b {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info span { font-size: 12px; color: var(--muted); }

#compareBtn { margin-top: 16px; }

/* ---------- Hasil: angka yang bisa diklik ---------- */

.result-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.count-link {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.count-link:hover { color: var(--accent-hover); }
.count-link.zero { color: var(--muted); text-decoration: none; cursor: default; }

.result-text { font-size: 13px; color: var(--muted); }
.result-text b { display: block; color: var(--text); font-size: 14px; }

/* Angka data baru di tabel riwayat */
a.count-cell {
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}
a.count-cell:hover { color: var(--accent-hover); }

/* ---------- Kolom password + tombol lihat ---------- */

.pw-field { position: relative; }
.pw-field input { padding-right: 96px; }

.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.pw-toggle:hover { background: var(--surface); color: var(--text); }

/* ---------- Tabel statistik ---------- */

td.nol { color: #cbd5e1; }

tfoot td {
  background: var(--surface-2);
  border-top: 2px solid var(--border);
  border-bottom: none;
}

/* ---------- Filter tanggal ---------- */

.filter-row { margin-bottom: 14px; align-items: flex-end; }
.filter-row .field > span { font-size: 12px; color: var(--muted); }
.filter-row input[type="date"] { min-width: 150px; }

.filter-count {
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 9px;
  white-space: nowrap;
}

/* Versi ringkas (tab Assign): Dari & Sampai kecil bersebelahan. */
.filter-ringkas {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.filter-ringkas label > span {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.fr-tanggal { display: flex; gap: 8px; }
.fr-tanggal label { flex: 1 1 0; min-width: 0; }
.filter-ringkas input[type="date"],
.filter-ringkas select {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
}
.filter-ringkas input[type="date"] { width: 140px; }
.fr-akun select { width: auto; min-width: 130px; }
.fr-aksi { display: flex; align-items: center; gap: 6px; }
.fr-aksi .filter-count { padding: 0 0 0 4px; font-size: 12px; }

/* Kartu total list bersih yang sudah di-assign (tab Assign). */
.total-kartu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
}
.tk-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tk-angka {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.tk-item + .tk-item .tk-angka { color: var(--text); }
button.tk-klik {
  display: block;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
button.tk-klik:hover { color: var(--accent-hover); }
button.tk-klik:disabled { cursor: default; text-decoration: none; color: #94a3b8; }

/* Kotak pencarian di jendela pratinjau gabungan. */
.modal-cari { margin-bottom: 10px; }
.modal-cari[hidden], .modal-aksi .btn[hidden] { display: none; }
.modal td.sel-file { color: var(--muted); font-size: 12px; word-break: break-word; }
.tk-sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.tk-sub b { color: var(--text); }

/* ---------- Sel waktu (WIB + California) ---------- */

.time-cell { white-space: nowrap; line-height: 1.4; font-variant-numeric: tabular-nums; }
.time-cell .alt { color: var(--muted); font-size: 12px; }
.time-cell .tz, .clock .tz {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Jendela pratinjau ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.modal-head h2 { margin: 0 0 2px; font-size: 15px; }
.modal-head p.hint { margin: 0; }
.modal-aksi { display: flex; gap: 8px; flex-shrink: 0; }
.modal-aksi .btn { text-decoration: none; }

.modal .table-wrap { overflow-y: auto; flex: 1; }
.modal .pager { margin-top: 12px; }

/* Sel bisa diklik untuk disalin. */
.modal table tbody td {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.modal table tbody td:hover { background: #eff6ff; }

.modal table tbody td.tersalin { background: #ecfdf5; }
.modal table tbody td.gagal-salin { background: #fef2f2; }

.modal table tbody td.tersalin::after,
.modal table tbody td.gagal-salin::after {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}
.modal table tbody td.tersalin::after { content: 'TERSALIN'; background: var(--ok); }
.modal table tbody td.gagal-salin::after { content: 'GAGAL'; background: var(--danger); }

@media (max-width: 640px) {
  .modal-overlay { padding: 12px; }
  .modal { max-height: 92vh; padding: 14px; }
  .modal-head { flex-direction: column; gap: 10px; }

  /* Tabel pratinjau tetap berbentuk tabel — dirapatkan agar dua kolomnya muat. */
  .modal .table-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: visible;
  }
  .modal table th,
  .modal table td { padding: 8px 10px; font-size: 13px; }
  .modal table th { font-size: 11px; }
  .modal table td:first-child {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  /* Keterangan kendaraan bisa panjang: biarkan membungkus, bukan melebar. */
  .modal table td:last-child { word-break: break-word; }
}

/* ---------- Sel Assign ---------- */

.assign-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.assign-cell select {
  width: auto;
  min-width: 130px;
  padding: 5px 9px;
  font-size: 13px;
}

.btn.assign-btn { background: var(--ok); color: #fff; }
.btn.assign-btn:hover { background: #047857; color: #fff; }

.assign-info {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
}
.assign-info b { color: var(--text); }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Garis pemisah antar kolom (tabel riwayat upload). */
table.gridlines th:not(:last-child),
table.gridlines td:not(:last-child) { border-right: 1px solid var(--border); }

.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

.pager { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 14px; color: var(--muted); font-size: 13px; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.tag.ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.tag.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }

@media (max-width: 640px) {
  header.topbar { padding: 0 12px; gap: 12px; }
  .brand, .clock, #whoami { display: none; }
  nav.tabs button { padding: 8px 10px; }
  main { padding: 14px; }

  /* ---------- Tabel jadi kartu ----------
     Di layar sempit tabel lebar memaksa geser mendatar terus-menerus.
     Tiap baris diubah jadi kartu, dengan judul kolom diambil dari data-label. */
  .table-wrap { border: none; border-radius: 0; overflow-x: visible; }

  table.responsif thead { display: none; }
  table.responsif,
  table.responsif tbody,
  table.responsif tfoot,
  table.responsif tr,
  table.responsif td { display: block; width: 100%; }

  table.responsif tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 12px;
    margin-bottom: 10px;
  }
  table.responsif tr:last-child { margin-bottom: 0; }
  table.responsif tbody tr:hover { background: var(--surface); }

  table.responsif td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    text-align: right;
    border: none;
    border-bottom: 1px solid var(--bg);
  }
  table.responsif tr td:last-child { border-bottom: none; }

  table.responsif td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
  /* Sel tanpa judul (tombol aksi) tampil rata kanan tanpa label. */
  table.responsif td[data-label=""]::before { display: none; }
  table.responsif td[data-label=""] { justify-content: flex-end; }

  table.responsif td.empty { justify-content: center; text-align: center; }
  table.responsif td.empty::before { display: none; }

  /* Baris TOTAL di tabel statistik. */
  table.responsif tfoot tr { background: var(--surface-2); }
  table.responsif tfoot td { border-top: none; background: none; }

  /* Filter ringkas: tanggal mengisi lebar penuh, tetap bersebelahan. */
  .filter-ringkas { flex-direction: column; align-items: stretch; }
  .filter-ringkas input[type="date"] { width: 100%; }
  .fr-akun select { width: 100%; }

  /* ---------- Kartu ringkas (tab Assign) ----------
     Nama file + waktu di kiri, angka List Bersih + Unduh di kanan. */
  table.kartu-ringkas tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'file bersih'
      'ke   bersih'
      'up   bersih'
      'as   bersih';
    column-gap: 12px;
    align-items: center;
    padding: 9px 12px;
  }
  table.gridlines.kartu-ringkas td:not(:last-child) { border: none; }
  table.kartu-ringkas td {
    display: block;
    padding: 0;
    border: none;
    text-align: left;
    font-size: 12px;
    color: var(--muted);
    min-width: 0;
  }
  table.kartu-ringkas td::before {
    display: inline;
    margin-right: 4px;
    font-size: 10px;
  }
  table.kartu-ringkas td.k-file {
    grid-area: file;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    word-break: break-word;
  }
  table.kartu-ringkas td.k-file::before,
  table.kartu-ringkas td.k-bersih::before { display: none; }
  table.kartu-ringkas td.k-ke { grid-area: ke; }
  table.kartu-ringkas td.k-up { grid-area: up; }
  table.kartu-ringkas td.k-as { grid-area: as; }
  table.kartu-ringkas td.k-bersih { grid-area: bersih; }
  table.kartu-ringkas td.k-bersih .assign-cell { flex-wrap: nowrap; }
  table.kartu-ringkas td.empty { display: block; grid-column: 1 / -1; text-align: center; }
  table.kartu-ringkas .time-cell { white-space: nowrap; }

  .assign-cell { flex-wrap: wrap; justify-content: flex-end; }
  .assign-info { white-space: normal; text-align: right; }
  .time-cell { white-space: normal; }
}
