/* ============================================================
   SIGALA — Sistem Informasi Gaji Berkala
   Palet dari logo Kemenimipas: navy #06213e · emas #dc9113
   ============================================================ */
:root {
  --navy: #06213e;
  --navy-2: #0d2f55;
  --navy-3: #16406f;
  --gold: #dc9113;
  --gold-2: #f2b64a;
  --gold-soft: #fdf3e0;
  --bg: #f3f6fb;
  --ink: #14243a;
  --muted: #64748b;
  --line: #e3e9f2;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(6, 33, 62, .05), 0 8px 24px -12px rgba(6, 33, 62, .18);
  --sidebar-w: 264px;
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: .925rem;
  min-height: 100vh;
}
@supports (font-variation-settings: normal) { body { font-optical-sizing: auto; } }

/* ---------- Sidebar ---------- */
.sg-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1045;
  display: flex; flex-direction: column;
  background: linear-gradient(178deg, var(--navy) 0%, var(--navy-2) 62%, #123a63 100%);
  color: #dbe4f0;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.sg-sidebar .brand {
  display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sg-sidebar .brand img {
  width: 46px; height: 46px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(220, 145, 19, .35), 0 4px 14px rgba(0, 0, 0, .4);
  background: #fff;
}
.sg-sidebar .brand .t1 { font-weight: 800; letter-spacing: .16em; font-size: 1.05rem; color: #fff; }
.sg-sidebar .brand .t2 { font-size: .68rem; line-height: 1.25; color: #97a9c4; }
.sg-nav { flex: 1; overflow-y: auto; padding: 12px 12px 16px; scrollbar-width: thin; }
.sg-nav .lbl {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--gold-2); margin: 16px 10px 6px; font-weight: 700;
}
.sg-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0; border-radius: 11px;
  color: #c3d0e2; text-decoration: none; font-weight: 500; font-size: .875rem;
  transition: background .15s, color .15s, transform .12s;
}
.sg-nav a i { font-size: 1.05rem; width: 22px; text-align: center; color: #8fa3c0; transition: color .15s; }
.sg-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.sg-nav a:hover i { color: var(--gold-2); }
.sg-nav a.active {
  background: linear-gradient(90deg, rgba(220, 145, 19, .22), rgba(220, 145, 19, .06));
  color: #fff; box-shadow: inset 3px 0 0 var(--gold);
}
.sg-nav a.active i { color: var(--gold-2); }

/* Backdrop mobile (dibuat oleh JS) */
.sg-backdrop {
  position: fixed; inset: 0; background: rgba(6, 33, 62, .5); backdrop-filter: blur(2px);
  z-index: 1040; opacity: 0; pointer-events: none; transition: opacity .25s;
}
body.sidebar-open .sg-backdrop { opacity: 1; pointer-events: auto; }

/* ---------- Konten & Topbar ---------- */
.sg-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.sg-topbar {
  position: sticky; top: 0; z-index: 1030;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
.sg-topbar .btn-light {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.sg-search { position: relative; flex: 1; max-width: 460px; }
.sg-search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.sg-search .form-control {
  padding-left: 38px; border-radius: 12px; border-color: var(--line); background: #fff;
  font-size: .875rem; height: 42px;
}
.sg-search .form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(220, 145, 19, .12); }
.sg-search-result {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1050;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 380px; overflow-y: auto;
}
.sg-search-result a { display: flex; gap: 10px; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid #f1f4f9; }
.sg-search-result a:hover { background: var(--gold-soft); }

/* ---------- Kartu & tabel ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { border-radius: var(--radius) var(--radius) 0 0 !important; border-bottom-color: var(--line); }
.table > :not(caption) > * > * { padding: .62rem .75rem; }
.table-light th { background: #f6f8fc; color: #40506a; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line) !important; }
.table-hover tbody tr:hover { background: #f8fafd; }

/* ---------- Stat card dashboard ---------- */
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 13px;
  box-shadow: var(--shadow); height: 100%;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(6,33,62,.06), 0 14px 30px -12px rgba(6,33,62,.24); }
.stat-card .v { font-size: 1.45rem; font-weight: 800; line-height: 1.1; color: var(--navy); }
.stat-card .l { font-size: .74rem; color: var(--muted); }
.stat-ic {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
  background: linear-gradient(135deg, var(--gold-soft), #fbe6bd); color: var(--gold);
}
.stat-card.alt .stat-ic { background: linear-gradient(135deg, #e8effa, #d7e4f6); color: var(--navy-3); }

/* ---------- Grafik batang CSS ---------- */
.sg-bar { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.sg-bar .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; min-width: 0; }
.sg-bar .b .stick {
  width: 100%; max-width: 42px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: inset 0 -3px 0 rgba(6, 33, 62, .18);
  transition: filter .15s;
}
.sg-bar .b:hover .stick { filter: brightness(1.08); }
.sg-bar .b.navy .stick { background: linear-gradient(180deg, var(--navy-3), var(--navy)); }
.sg-bar .b .cap { font-size: .66rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sg-bar .b .val { font-size: .72rem; font-weight: 700; color: var(--navy); }

/* ---------- Timeline ---------- */
.sg-timeline {
  position: relative; padding-left: 4px;
  max-height: 372px; overflow-y: auto; scrollbar-width: thin;
}
.sg-tl-item { position: relative; display: flex; gap: 10px; padding: 0 6px 12px 0; min-width: 0; }
.sg-tl-item:last-child { padding-bottom: 2px; }
.sg-tl-item:not(:last-child):before {
  content: ""; position: absolute; left: 11px; top: 26px; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--line), transparent);
}
.sg-tl-dot {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: .7rem;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line);
}
.sg-tl-isi { flex: 1; min-width: 0; }
.sg-tl-isi .badge { font-size: .66rem; }

/* ---------- Tombol & badge ---------- */
.btn { border-radius: 11px; font-weight: 600; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover, .btn-navy:focus { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-outline-navy { border: 1px solid var(--navy); color: var(--navy); }
.btn-outline-navy:hover { background: var(--navy); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: #c07f0e; border-color: #c07f0e; color: #fff; }
.bg-navy { background: var(--navy) !important; }
.bg-gold { background: var(--gold-2) !important; }
.text-navy { color: var(--navy) !important; }
.badge { font-weight: 600; border-radius: 8px; padding: .38em .6em; }
.badge-conf-hijau { background: #d9f2e3; color: #0f7a3d; }
.badge-conf-biru { background: #dbe9fb; color: #1d5fb8; }
.badge-conf-kuning { background: #fdf0d2; color: #a06a00; }
.badge-conf-merah { background: #fbdcdc; color: #b42424; }

/* ---------- Form ---------- */
.form-control, .form-select { border-radius: 11px; border-color: #d8e0ec; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(220, 145, 19, .12); }
.form-label { font-weight: 600; font-size: .82rem; color: #33455f; margin-bottom: .3rem; }
.dropzone {
  border: 2px dashed #cdd8e6; border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--muted); background: #fafcff; transition: all .2s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }

/* ---------- Modal & dropdown ---------- */
.modal-content { border-radius: var(--radius); border: none; box-shadow: 0 24px 60px -12px rgba(6, 33, 62, .35); }
.modal-header { border-bottom-color: var(--line); }
.modal-footer { border-top-color: var(--line); }
.dropdown-menu { border-radius: 14px; border: 1px solid var(--line); }

/* ---------- Nav tabs ---------- */
.nav-tabs .nav-link { border: none; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 600; font-size: .85rem; }
.nav-tabs .nav-link.active { color: var(--navy); box-shadow: inset 0 -3px 0 var(--gold); background: transparent; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(220, 145, 19, .16), transparent 60%),
    radial-gradient(700px 450px at -10% 110%, rgba(22, 64, 111, .5), transparent 55%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, #123a63 100%);
}
.login-shell {
  width: 100%; max-width: 900px; min-height: 520px; display: flex;
  background: #fff; border-radius: 24px; overflow: hidden;
  box-shadow: 0 34px 80px -20px rgba(0, 0, 0, .55);
}
.login-brand {
  position: relative; width: 46%; padding: 42px 36px; color: #e8eef7;
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-2) 55%, #143c66 100%);
  display: flex; flex-direction: column; overflow: hidden;
}
.login-brand .orn { position: absolute; border-radius: 50%; border: 2px solid rgba(242, 182, 74, .22); }
.login-brand .orn1 { width: 300px; height: 300px; right: -110px; top: -110px; }
.login-brand .orn2 { width: 190px; height: 190px; right: -40px; top: -20px; border-color: rgba(242, 182, 74, .14); }
.login-brand .orn3 { width: 260px; height: 260px; left: -120px; bottom: -130px; border-style: dashed; }
.login-brand .lg {
  width: 92px; height: 92px; border-radius: 50%; background: #fff; padding: 4px;
  box-shadow: 0 0 0 4px rgba(220, 145, 19, .4), 0 14px 30px rgba(0, 0, 0, .45); margin-bottom: 18px;
}
.login-brand .nm { font-weight: 800; letter-spacing: .24em; font-size: 1.7rem; color: #fff; }
.login-brand .ds { color: var(--gold-2); font-weight: 600; font-size: .92rem; margin-top: 2px; }
.login-brand .in { font-size: .78rem; color: #9db0ca; margin-top: 6px; }
.login-brand .ft { list-style: none; margin: 26px 0 0; padding: 0; }
.login-brand .ft li { display: flex; gap: 10px; align-items: center; font-size: .82rem; color: #c6d3e5; margin-bottom: 12px; }
.login-brand .ft i { color: var(--gold-2); font-size: 1rem; width: 22px; }
.login-brand .cp { margin-top: auto; font-size: .7rem; color: #7e91ad; }
.login-form { flex: 1; padding: 46px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-form .logo-sm { width: 74px; height: 74px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(220, 145, 19, .35), 0 8px 20px rgba(6, 33, 62, .25); }
.login-form .hi { font-size: 1.35rem; font-weight: 800; color: var(--navy); margin-bottom: 2px; }
.login-form .sub { font-size: .85rem; color: var(--muted); margin-bottom: 22px; }
.login-form .ig .input-group-text { background: #f6f8fc; border-color: #d8e0ec; color: var(--muted); border-radius: 11px 0 0 11px; }
.login-form .ig .form-control { border-left: 0; }
.login-form .ig .btn { border-color: #d8e0ec; color: var(--muted); }
.btn-masuk {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-3) 100%);
  color: #fff; font-weight: 700; padding: 11px; border-radius: 12px; border: 0;
  box-shadow: 0 10px 22px -8px rgba(6, 33, 62, .55);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn-masuk:hover { color: #fff; filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 14px 26px -8px rgba(6, 33, 62, .6); }
@media (max-width: 991.98px) {
  .login-shell { max-width: 430px; min-height: 0; }
  .login-form { padding: 32px 26px; }
}

/* ---------- Pagination ---------- */
.pagination { --bs-pagination-border-radius: 10px; }
.page-link { color: var(--navy); border-color: var(--line); }
.page-item.active .page-link { background: var(--navy); border-color: var(--navy); }

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
  .sg-sidebar { transform: translateX(-104%); box-shadow: 0 0 60px rgba(0, 0, 0, .35); width: min(84vw, 300px); }
  .sg-sidebar.show { transform: none; }
  .sg-content { margin-left: 0; }
  .sg-topbar { padding: 8px 10px; }
  .sg-search { max-width: none; }
  main.p-3 { padding: 12px !important; }
  h4 { font-size: 1.15rem; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-card .v { font-size: 1.2rem; }
  .stat-ic { width: 38px; height: 38px; flex-basis: 38px; font-size: 1.05rem; border-radius: 11px; }
  .table { font-size: .82rem; }
  .modal-dialog { margin: 10px; }
  .btn-group-sm > .btn { padding: .32rem .5rem; }
  .sg-bar { height: 120px; }
  .card { border-radius: 14px; }
  footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 575.98px) {
  .sg-topbar .dropdown-toggle span, .sg-topbar .dropdown-toggle { font-size: .8rem; }
  .modal-footer .btn { flex: 1; }
}

/* ---------- Print ---------- */
@media print {
  .sg-sidebar, .sg-topbar, footer, .noprint { display: none !important; }
  .sg-content { margin: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #bbb; }
}

/* ---------- Prefill hasil OCR (menunggu verifikasi operator) ---------- */
.ocr-fill { background: #fff8e1 !important; border-color: var(--gold) !important; }
