/* Web Presales Terpadu — CSS fungsional minimal.
 * Arah visual FINAL dari DES (komponen dropdown 5 status + 21 klasifikasi)
 * diterapkan belakangan; file ini menjaga keterbacaan & aksesibilitas dasar. */

* { box-sizing: border-box; }

/* Visually hidden — label aksesibilitas yang tidak tampil visual. */
.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;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
  line-height: 1.45;
}

/* ---------- Login ---------- */
.halaman-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.kartu-login {
  width: 100%;
  max-width: 384px;
  background: #fff;
  border: 1px solid #e0e5ea;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.kartu-login h1 { margin: 0 0 4px; font-size: 20px; }
.subjudul { margin: 0 0 18px; color: #52606d; font-size: 14px; }

/* ---------- Layout umum ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0b2e4f;
  color: #fff;
  padding: 10px 16px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  flex-wrap: nowrap;
}

.judul-topbar { font-weight: 600; }
.spacer { flex: 1; }
.nama-user { font-size: 14px; opacity: 0.9; }
.tombol-keluar {
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.tombol-keluar:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Navbar tab (pola tab Chrome, C-5) ---------- */
.navbar-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #0b2e4f;
  color: #fff;
  padding: 6px 12px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.navbar-tab .tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 0 14px;
  min-height: 44px; /* target sentuh HP (arah visual FINAL) */
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.navbar-tab .tab:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}
.navbar-tab .tab.aktif {
  background: #f4f6f8; /* sama dgn bg halaman → tab "menyatu" dgn konten */
  color: #0b2e4f;
  border-color: #e0e5ea;
  font-weight: 600;
}
.navbar-tab .tab:focus-visible {
  outline: 2px solid #2f6fb2;
  outline-offset: 2px;
}
.navbar-tab .spacer { flex: 1; }
.navbar-tab .nama-user {
  font-size: 13px;
  opacity: 0.9;
  margin: 0 8px;
  white-space: nowrap;
}
.navbar-tab .tombol-keluar {
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 12px;
  min-height: 44px; /* target sentuh konsisten dgn tab */
  border-radius: 6px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.navbar-tab .tombol-keluar:hover { background: rgba(255, 255, 255, 0.12); }

/* Banner penolakan peran (redirect guard halaman — temuan Direktur). */
.banner-ditolak {
  background: #fbeaea;
  border: 1px solid #eab0b0;
  color: #8e2f2f;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 8px;
  margin: 12px auto 0;
  max-width: 960px;
  width: calc(100% - 32px);
}
.banner-ditolak a { color: #7a1f1f; font-weight: 600; }

/* ---------- Sidebar kiri model iCRM (referensi Direktur 1 Des: tema terang) ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: #ffffff;
  color: #33475b;
  border-right: 1px solid #e3e8ec;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-sizing: border-box;
  transition: transform 0.18s ease;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
}
.sidebar-logo .logo-tanda { width: 32px; height: 32px; flex: none; }
.sidebar-logo .logo-teks {
  font-size: 21px;
  font-weight: 700;
  color: #0b3d66;
  letter-spacing: -0.5px;
}
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #41586c;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  min-height: 44px; /* target sentuh HP */
  border-radius: 8px;
  white-space: nowrap;
  box-sizing: border-box;
}
.menu-item svg { width: 20px; height: 20px; flex: none; }
.menu-item:hover:not(.aktif) {
  background: #f0f4f3;
  color: #14402f;
}
.menu-item.aktif {
  background: #1e5a4c; /* hijau tua ala iCRM */
  color: #ffffff;
  font-weight: 600;
}
.menu-item:focus-visible {
  outline: 2px solid #2f6fb2;
  outline-offset: 2px;
}
.sidebar-collapse-handle {
  position: absolute;
  top: 46%;
  right: -13px;
  width: 26px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e5a4c;
  color: #ffffff;
  border: none;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  z-index: 101;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}
.sidebar-collapse-handle:hover { background: #174639; }
.sidebar-collapse-handle:focus-visible {
  outline: 2px solid #2f6fb2;
  outline-offset: 2px;
}
.sidebar-aksi {
  border-top: 1px solid #e3e8ec;
  padding: 14px 16px;
}
.sidebar-aksi .nama-user {
  display: block;
  font-size: 12.5px;
  color: #7a8a99;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-aksi .tombol-keluar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d5dde2;
  border-radius: 8px;
  background: #ffffff;
  color: #41586c;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  box-sizing: border-box;
}
.sidebar-aksi .tombol-keluar svg { width: 19px; height: 19px; flex: none; }
.sidebar-aksi .tombol-keluar:hover { background: #f0f4f3; }
.sidebar-aksi .tombol-keluar:focus-visible {
  outline: 2px solid #2f6fb2;
  outline-offset: 2px;
}

/* Mode lipat: sidebar menyempit jadi rel ikon 68px ala iCRM tertutup —
   logo tinggal tanda, menu tinggal ikon (aktif = pil hijau), label hilang. */
body.sidebar-lipat .sidebar { width: 68px; }
body.sidebar-lipat .sidebar-logo { justify-content: center; padding: 18px 0 14px; }
body.sidebar-lipat .sidebar-logo .logo-teks { display: none; }
body.sidebar-lipat .menu-item { justify-content: center; padding: 10px 0; }
body.sidebar-lipat .menu-item .menu-label { display: none; }
body.sidebar-lipat .sidebar-collapse-handle { transform: rotate(180deg); }
body.sidebar-lipat .sidebar-aksi { padding: 14px 8px; }
body.sidebar-lipat .sidebar-aksi .nama-user { display: none; }
body.sidebar-lipat .sidebar-aksi .tombol-keluar { justify-content: center; padding: 10px 0; }
body.sidebar-lipat .sidebar-aksi .tombol-keluar .label-keluar { display: none; }

/* Area konten mengikuti lebar sidebar. */
.konten {
  max-width: 960px;
  margin-left: 260px;
  padding: 24px 16px;
}
body.sidebar-lipat .konten { margin-left: 68px; max-width: none; margin-right: 24px; }

/* Tombol buka (mobile saja) + overlay saat sidebar terbuka di layar kecil. */
.sidebar-buka {
  display: none;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 99;
}
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-terbuka .sidebar { transform: translateX(0); }
  body.sidebar-terbuka .sidebar-overlay { display: block; }
  .sidebar-collapse-handle { display: none; }
  .sidebar-buka {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 98;
    width: 44px;
    height: 44px;
    min-height: 44px;
    border: 1px solid #c8d2dc;
    border-radius: 6px;
    background: #fff;
    color: #0b2e4f;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  }
  .sidebar-buka:focus-visible { outline: 2px solid #2f6fb2; outline-offset: 2px; }
  body.sidebar-lipat .sidebar { width: 260px; }
  .konten, body.sidebar-lipat .konten { margin-left: 0; padding-top: 64px; }
}


/* ---------- Halaman Spreadsheet (S-01..S-04) ---------- */
.baris-judul {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.badge-sumber {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d0d6dd;
  color: #3a4653;
  background: #f4f6f8;
}
/* Batch Revisi #3 (Opsi B): embed Sheet Uji asli (Google Sheets). */
.tombol-edit-sheet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0b2e4f;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 6px;
  box-sizing: border-box;
}
.tombol-edit-sheet:hover { background: #123f6a; }
.tombol-edit-sheet:focus-visible { outline: 2px solid #2f6fb2; outline-offset: 2px; }
.bungkus-embed-sheet {
  margin-top: 12px;
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.embed-sheet {
  display: block;
  width: 100%;
  height: clamp(480px, 72vh, 85vh); /* DES tahap 2: ruang lebih baik di layar sedang tanpa melebihi viewport */
  border: 0;
}
/* Status bersama pita & badge (F-1/F-2 dikunci SPV): nilai hex existing
   dipakai ulang untuk badge dan pita (R-1 Opsi A — nol warna baru).
   Acuan resmi warna status: #eaf7ee/#1d6b3a (sukses),
   #fbf3e0/#7a5a1a (peringatan), #fbeaea/#8e2f2f (bahaya). */
.badge-sumber.asli, .pita.aman { background: #eaf7ee; color: #1d6b3a; border: 1px solid #9fd8b4; }
.badge-sumber.lokal, .pita.spare { background: #fbf3e0; color: #7a5a1a; border: 1px solid #e6c98a; }
.badge-sumber.peringatan, .pita.reject { background: #fbeaea; color: #8e2f2f; border: 1px solid #eab0b0; }

.baris-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
}
.input-cari {
  flex: 1 1 220px;
  min-width: 160px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #c6ced6;
  border-radius: 6px;
  min-height: 44px; /* target sentuh */
  box-sizing: border-box;
}
.input-cari:focus-visible { outline: 2px solid #2f6fb2; outline-offset: 2px; }
.info-jumlah { font-size: 13px; color: #4a5663; }

.bungkus-tabel {
  overflow-x: auto;
  border: 1px solid #e0e5ea;
  border-radius: 8px;
}
.tabel-sheet {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-size: 13px;
}
.tabel-sheet th {
  background: #eef1f4;
  color: #26313c;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid #d0d6dd;
  white-space: nowrap;
  font-weight: 600;
}
.tabel-sheet td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf0f3;
  vertical-align: top;
  word-break: break-word;
}
.tabel-sheet tbody tr:hover { background: #f6f9fc; }
.tabel-sheet .td-kosong {
  text-align: center;
  color: #6b7684;
  padding: 18px 10px;
}
.rekap-placeholder {
  margin-top: 14px;
  border: 1px dashed #c6ced6;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #4a5663;
  background: #fafbfc;
}

/* ---------- Halaman Cek Jarak (J-01..J-06) ---------- */
.form-jarak .baris-input {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.form-jarak label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  color: #26313c;
  gap: 4px;
  flex: 1 1 140px;
}
.form-jarak input[type="number"] {
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #c6ced6;
  border-radius: 6px;
  min-height: 44px;
  box-sizing: border-box;
  width: 100%;
}
.form-jarak input[type="number"]:focus-visible { outline: 2px solid #2f6fb2; outline-offset: 2px; }
.baris-aksi { margin-top: 14px; }

.hasil-jarak { margin-top: 14px; }
.pita {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
/* Warna .pita.aman/.spare/.reject didefinisikan bersama .badge-sumber di atas. */
.grid-hasil {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.sel-hasil {
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fafbfc;
}
.sel-hasil .label { font-size: 12px; color: #4a5663; }
.sel-hasil .nilai { font-size: 15px; font-weight: 700; color: #1f2b36; }
.peta {
  height: 360px;
  margin-top: 14px;
  border: 1px solid #e0e5ea;
  border-radius: 10px;
  z-index: 0;
}

/* DIHAPUS (hotfix SPV 1 Des): aturan .konten lama pra-sidebar ini menimpa margin-left sidebar di atas (margin: 24px auto) sehingga konten ketutup sidebar. Aturan .konten yang berlaku = blok sidebar. */
.kartu {
  background: #fff;
  border: 1px solid #e0e5ea;
  border-radius: 10px;
  padding: 20px;
}
.kartu h2 { margin: 0 0 4px; font-size: 18px; }

/* ---------- Tempel massal iCRM (Batch Revisi #1 item 1) ---------- */
.blok-tempel {
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  margin: 0 0 16px;
  padding: 8px 12px; /* Batch #2: fieldset dikecilkan */
  background: #fafbfc;
}
.blok-tempel legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.tempel-teks {
  width: 100%;
  padding: 12px 14px; /* Batch #2: textarea digedein */
  font-size: 14px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  border: 1px solid #c6ced6;
  border-radius: 6px;
  min-height: 88px; /* Batch #2: textarea digedein */
  box-sizing: border-box;
  background: #fff;
  resize: vertical;
}
.tempel-teks:focus-visible { outline: 2px solid #2f6fb2; outline-offset: 2px; }
.pesan-tempel {
  font-size: 13px;
  margin-left: 10px;
  vertical-align: middle;
}
.pesan-tempel.sukses { color: #067647; }
.pesan-tempel.gagal { color: #b42318; }

/* Penanda field auto-isi (PR DES item 4) + info lookup. */
.auto-isi {
  border-color: #9fd8b4 !important; /* aksen hijau tipis */
  background: #f6fcf8;
}
/* Real port / nilai panjang tidak memutus layout (PR DES #3). */
#k14.auto-isi, #k15.auto-isi {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-lookup {
  display: block;
  font-size: 12.5px;
  color: #4a5663;
  margin: -6px 0 10px;
}
.info-lookup.peringatan { color: #b45309; }

/* ---------- Form ---------- */
label { display: block; font-size: 14px; margin-bottom: 4px; }

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid #cbd2d9;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 14px;
}

input:focus, select:focus {
  outline: 2px solid #2f6fb2;
  outline-offset: 1px;
  border-color: #2f6fb2;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0 14px;
}

/* Batch Revisi #2: urutan kolom per baris form (arahan Direktur). */
.baris-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 14px;
  margin-bottom: 10px;
}
/* Hotfix SPV (uji live Direktur): wadah #kolom-form adalah .grid-form (display:grid)
   sehingga tiap .baris-form tampil sebagai KOLOM menyamping. Paksa block supaya
   tiap baris tampil horizontal menumpuk ke bawah. */
#kolom-form { display: block; }

.baris-form input[readonly] {
  background: #f0f3f5;
  color: #41586c;
  cursor: not-allowed;
}

.baris-toggle { margin-bottom: 8px; font-size: 14px; }
.baris-toggle label { display: inline; margin-left: 6px; }

.blok-dropdown {
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  margin: 14px 0 16px;
  padding: 12px 14px;
}
.blok-dropdown legend { font-weight: 600; font-size: 14px; padding: 0 6px; }

.tombol-utama {
  background: #0b2e4f;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 12px 22px;
  font-size: 15px;
  cursor: pointer;
  /* D-1 (review DES→SA): target sentuh aksesibel — full-width + tinggi ≥44px */
  width: 100%;
  min-height: 44px;
  display: block;
}
.tombol-utama:hover { background: #123f6a; }
.tombol-utama:disabled { opacity: 0.55; cursor: wait; }
/* Arah Visual FINAL §3.3 (BARU, non-blocking): fokus konsisten lintas browser */
.tombol-utama:focus-visible { outline: 2px solid #2f6fb2; outline-offset: 2px; }

.pesan {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin: 12px 0;
}
.pesan.gagal { background: #fdecea; color: #b42318; border: 1px solid #f3b4ad; }
.pesan.sukses { background: #ecfdf3; color: #067647; border: 1px solid #a6f4c5; }

/* Halaman Cek FAT — form + hasil (R-1: pita pakai token yang ada). */
.aksi-baris { margin-top: 14px; }
.tombol-sekunder {
  background: #ffffff;
  border: 1px solid #c8d2dc;
  color: #1f3a5f;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.tombol-sekunder:hover { background: #f4f6f8; }
.tombol-sekunder:disabled { opacity: 0.55; cursor: not-allowed; }
.baris-hasil { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.label-kecil { font-size: 12px; color: #5b6b7c; }
.detail-hasil {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 12px 0;
  font-size: 14px;
}
.detail-hasil dt { color: #5b6b7c; }
.detail-hasil dd { margin: 0; font-weight: 600; }

.catatan { font-size: 13px; color: #52606d; }
.pending { color: #b45309; font-size: 12px; margin-left: 6px; }
