/* Imajireka Jurnal — tema admin elegan, responsif. Vanilla CSS + Bootstrap. */

:root {
  --brand: #1e2a4a;
  --brand-2: #2c3d6b;
  --accent: #c9a25e;
  --accent-soft: rgba(201, 162, 94, .14);
  --bg: #edf0f6;
  --surface: #ffffff;
  --ink: #1c2333;
  --muted: #6b7690;
  --line: #e3e8f1;
  --ok: #1e7e4d;
  --warn: #9a6b12;
  --danger: #b3373a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 28px rgba(30, 42, 74, .1);
  --shadow-sm: 0 2px 8px rgba(30, 42, 74, .07);
  --side-w: 248px;
}

* { -webkit-tap-highlight-color: transparent; }

html { font-size: 14.5px; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Sidebar */
.sidebar {
  width: var(--side-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand) 0%, #18223c 60%, #141c33 100%);
  color: #dbe2f1;
  padding: 18px 12px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 60;
}
.brandrow { display: flex; align-items: center; gap: 10px; padding: 2px 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.brandmark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #e8cf9a);
  color: var(--brand); font-weight: 800; font-size: 19px;
}
.brandname { color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.brandname small { display: block; font-weight: 400; opacity: .7; font-size: 11.5px; }
.sidebar .grp { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; opacity: .55; margin: 16px 0 6px 10px; }
.sidebar a.navlink {
  display: flex; align-items: center; gap: 10px;
  color: #dbe2f1; text-decoration: none;
  padding: 9px 10px; border-radius: 10px; font-size: 14px; font-weight: 500;
}
.sidebar a.navlink svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar a.navlink:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar a.navlink.active { background: rgba(201, 162, 94, .22); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }

/* Konten */
.main { flex: 1 1 auto; width: 100%; padding: 20px 26px 40px; min-width: 0; max-width: none; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 18px;
  position: sticky; top: 0; z-index: 40;
  background: rgba(237, 240, 246, .88);
  backdrop-filter: blur(10px);
  padding: 12px 0;
}
.topbar h1 { font-size: 21px; font-weight: 800; color: var(--brand); margin: 0; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.userchip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 6px 5px 14px; font-size: 13px;
  box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; color: var(--ink);
}
.userchip::after { margin-left: 2px; color: var(--muted); }
.userchip .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
}
.menubtn { display: none; }

/* Dropdown profil */
.profilemenu { min-width: 250px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 6px; }
.profilemenu .drophead { padding: 10px 14px 8px; }
.profilemenu .drophead b { display: block; font-size: 14.5px; color: var(--brand); }
.profilemenu .drophead small { color: var(--muted); font-size: 12px; }
.profilemenu .dropdown-item { border-radius: 8px; font-size: 14px; padding: 9px 14px; }
.profilemenu .dropdown-item:active { background: var(--brand); }

/* Kartu & statistik */
.cardx {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px; margin-bottom: 16px;
}
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px; position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-2); }
.stat.gold::before { background: var(--accent); }
.stat.green::before { background: var(--ok); }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.stat .val { font-size: 23px; font-weight: 800; color: var(--brand); margin-top: 4px; }

/* Tabel */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table { margin: 0; font-size: 13.5px; min-width: 560px; }
.table thead th {
  background: #f2f4f9; color: var(--brand); font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 1px solid var(--line); white-space: nowrap; padding: 11px 14px;
}
.table td { padding: 11px 14px; vertical-align: middle; }
.table tbody tr:hover { background: #f7f9fd; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 999px; background: #eef1f7; color: var(--brand-2); white-space: nowrap; }
.pill.ok { background: #e6f4ec; color: var(--ok); }
.pill.warn { background: #fdf1e3; color: var(--warn); }
.pill.bad { background: #fbe7e7; color: var(--danger); }
.pill.info { background: #e7effd; color: #2b5cb8; }

/* Form & tombol */
label { font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 4px; display: block; }
.form-select, .form-control { min-height: 44px; border-radius: var(--radius-sm); border: 1px solid #d4dae7; font-size: 14.5px; }
.form-select:focus, .form-control:focus { border-color: var(--brand-2); box-shadow: 0 0 0 .2rem rgba(30, 42, 74, .15); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-2); border-color: var(--brand-2); }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pagehead h3 { margin: 0; color: var(--brand); font-weight: 800; font-size: 20px; }
.filterrow { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filterrow .form-select, .filterrow .form-control { min-width: 180px; flex: 1; }

h3, h4, h5 { color: var(--brand); }
.alert { border-radius: var(--radius-sm); }

/* Login */
.loginwrap { max-width: 400px; margin: 8vh auto 0; padding: 0 16px; }
.loginbrand { text-align: center; margin-bottom: 18px; }
.loginbrand .brandmark { width: 60px; height: 60px; font-size: 30px; border-radius: 18px; margin: 0 auto 10px; }
.loginbrand h1 { font-size: 22px; font-weight: 800; color: var(--brand); margin: 0 0 4px; }
.logincard { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 24px 20px; }
.muted { color: var(--muted); font-size: 13px; }

/* Responsif */
.backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-105%);
    transition: transform .22s ease;
    height: 100dvh;
  }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .3); }
  .backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(20, 28, 51, .5);
  }
  .menubtn {
    display: inline-grid; place-items: center;
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    border: 1px solid var(--line); background: var(--surface); color: var(--brand);
  }
  .menubtn svg { width: 20px; height: 20px; }
  .main { padding: 14px 14px 40px; }
  .statgrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .userchip .uname { display: none; }
}

@media (max-width: 575.98px) {
  html { font-size: 14px; }
  .statgrid { grid-template-columns: 1fr 1fr; }
  .stat .val { font-size: 19px; }
  .topbar h1 { font-size: 18px; }
  .filterrow .form-select, .filterrow .form-control { min-width: 100%; }
}

@media (min-width: 768px) {
  html { font-size: 16px; }
  .table { font-size: 14px; }
}

/* Kalender Detail Pegawai — mirip Riwayat di app Absensi:
   kartu putih, angka bulat berisi warna status, klik hari = detail. */
.cal-section { color: var(--brand); font-size: 16px; font-weight: 800; margin: 4px 2px 10px; }
.cal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 16px 14px; }
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-nav {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: inline-grid; place-items: center;
  background: #eef1f7; border: 1px solid var(--line); color: var(--brand);
  font-size: 17px; font-weight: 800; line-height: 1; text-decoration: none; cursor: pointer;
}
a.cal-nav:hover { background: #e2e8f3; color: var(--brand); }
span.cal-nav[aria-disabled="true"] { opacity: .4; cursor: default; }
.cal-title { font-size: 14px; font-weight: 800; color: var(--brand); letter-spacing: .1px; text-transform: capitalize; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.cal-week span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-empty { min-height: 48px; }
.cal-day {
  position: relative; min-height: 48px; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 4px 0 6px; border-radius: 10px; font-family: inherit;
}
.cal-day:active { transform: scale(.94); }
.cal-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1;
  font-variant-numeric: tabular-nums; background: transparent;
  border: 1.5px solid transparent;
}
.cal-hadir .cal-num { background: #22A06B; color: #fff; font-weight: 700; }
.cal-telat .cal-num { background: #22A06B; color: #fff; font-weight: 700; display: grid; place-items: center; }
.cal-badge-telat {
  width: 20px; height: 20px; border-radius: 50%;
  background: #FFD21F; color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cal-izin .cal-num, .cal-sakit .cal-num, .cal-cuti .cal-num,
.cal-pending .cal-num { background: #7C3AED; color: #fff; font-weight: 700; }
.cal-alpha .cal-num { background: #E53935; color: #fff; font-weight: 700; }
.cal-libur .cal-num, .cal-libur-cabang .cal-num { background: #3B82F6; color: #fff; font-weight: 700; }
.cal-mendatang .cal-num { color: var(--ink); }
.cal-belum .cal-num { background: #fff; border: 1.5px dashed #EE7A1E; color: #C96A12; }
.cal-day.sel .cal-num { border: 1.5px solid var(--brand); background: #fff; box-shadow: 0 2px 8px rgba(30, 42, 74, .18); }
.cal-hadir.sel .cal-num, .cal-telat.sel .cal-num { background: #22A06B; color: #fff; border: 1.5px solid var(--brand); }
.cal-alpha.sel .cal-num { background: #E53935; color: #fff; border: 1.5px solid var(--brand); }
.cal-izin.sel .cal-num, .cal-sakit.sel .cal-num,
.cal-cuti.sel .cal-num, .cal-pending.sel .cal-num { background: #7C3AED; color: #fff; border: 1.5px solid var(--brand); }
.cal-libur.sel .cal-num, .cal-libur-cabang.sel .cal-num { background: #3B82F6; color: #fff; border: 1.5px solid var(--brand); }
.cal-day.is-today .cal-num { outline: 1.5px dashed #EE7A1E; outline-offset: 3px; }
.cal-belum.is-today .cal-num { outline: none; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.cal-lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.cal-sample { width: 16px; height: 16px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; line-height: 0; }
.cal-sample-hadir { background: #22A06B; }
.cal-sample-telat { background: #22A06B; display: grid; place-items: center; }
.cal-sample-telat i { width: 8px; height: 8px; border-radius: 50%; background: #FFD21F; display: block; }
.cal-sample-ungu { background: #7C3AED; }
.cal-sample-biru { background: #3B82F6; }
.cal-sample-alpha { background: #E53935; }
.cal-next { width: 11px; height: 11px; border-radius: 50%; flex: none; border: 1.5px solid transparent; background: #fff; display: inline-block; outline: 1.5px dashed #EE7A1E; outline-offset: 2px; }
.cal-detail { margin-top: 10px; background: #f7f9fd; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.cal-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-detail-pills { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-detail-ket { margin: 8px 0 0; line-height: 1.55; }
.cal-detail-rows { margin-top: 8px; display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.cal-detail-rows b { color: var(--ink); }
.cal-libur-list { margin-top: 12px; font-size: 13px; }
.cal-libur-list ul { margin: 6px 0 0; padding-left: 20px; }
.cal-libur-list li { margin-bottom: 3px; }

/* Thumbnail foto absen / bukti izin-lembur + lightbox */
.foto-thumb {
  width: 56px; height: 42px; border-radius: 8px; object-fit: cover; cursor: zoom-in;
  border: 1.5px solid var(--line); background: #eef1f7; vertical-align: middle;
}
.foto-thumb:hover { border-color: var(--brand-2); }
.foto-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.foto-cap { font-size: 11px; color: var(--muted); }
/* Avatar foto profil di daftar pegawai */
.peg-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; vertical-align: middle;
  background: #eef1f7; border: 1.5px solid var(--line);
}
span.peg-avatar.peg-avatar-fallback {
  display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
}
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 22, 40, .82);
  display: none; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox.show { display: flex; }
.lightbox img { max-width: min(92vw, 720px); max-height: 86vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lightbox-cap { position: fixed; bottom: 22px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; }

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