/* myFGA — mobile-first UI (tanpa build step) */
:root {
  --brand: #0d4fc2;
  --brand-600: #0a43a6;
  --brand-50: #e8f1ff;
  --sky: #7cc4ef;
  --sky-50: #eaf6fe;
  --ink: #0b1f3a;
  --ink-2: #44546b;
  --muted: #8693a6;
  --line: #e3e9f2;
  --bg: #f3f7fc;
  --card: #ffffff;
  --ok: #0f8a5f;
  --ok-50: #e3f6ee;
  --warn: #b26a00;
  --warn-50: #fff3df;
  --bad: #c62b3b;
  --bad-50: #fde8ea;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11, 31, 58, .05), 0 6px 18px rgba(11, 31, 58, .06);
  --nav-h: 68px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.icon { width: 22px; height: 22px; flex: none; }
.icon-sm { width: 18px; height: 18px; }

/* ---------- App shell ---------- */
.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: linear-gradient(180deg, #dcecfd 0, var(--bg) 260px); position: relative; padding-bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.logo { display: flex; align-items: center; gap: 2px; font-weight: 800; font-size: 26px; letter-spacing: -.5px; color: var(--brand); }
.logo .my { background: var(--brand); color: #fff; font-style: italic; font-size: 18px; padding: 1px 8px 3px; border-radius: 8px; margin-right: 4px; transform: skew(-6deg); }
.logo .spark { color: var(--brand); margin-right: 4px; font-size: 18px; transform: rotate(-20deg); }
.bell { position: relative; width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; color: var(--brand); box-shadow: var(--shadow); }
.bell .dot { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: #e0242f; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.pagehead { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; }
.pagehead h1 { font-size: 19px; font-weight: 800; }
.back { width: 38px; height: 38px; border-radius: 12px; background: #fff; display: grid; place-items: center; color: var(--ink); box-shadow: var(--shadow); }
.content { padding: 4px 16px 16px; }

/* ---------- Bottom nav ---------- */
.bottomnav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 40; }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #9fb6d4; font-size: 12px; font-weight: 600; }
.bottomnav a .icon { width: 26px; height: 26px; }
.bottomnav a.active { color: var(--ink); }
.bottomnav a.active .icon { color: var(--ink); }

/* ---------- Cards & lists ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-label { font-size: 14px; font-weight: 800; margin: 18px 4px 8px; }
.list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.list-item:last-child { border-bottom: 0; }
.list-item .icon { color: var(--brand); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .sub { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.list-item .chev { color: var(--ink-2); width: 18px; height: 18px; }
.kv { display: grid; grid-template-columns: 40% 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 8px; color: #b7c6da; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mt { margin-top: 12px; } .mb0 { margin-bottom: 0; }

/* ---------- Presensi hero ---------- */
.hero { background: #fff; border-radius: 20px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.hero-date { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: var(--ink); }
.hero-date .icon { color: var(--brand); width: 18px; height: 18px; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.btn-presensi { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border-radius: 12px; font-weight: 700; font-size: 14.5px; color: #fff; padding: 10px; text-align: center; transition: transform .1s; }
.btn-presensi:active { transform: scale(.97); }
.btn-presensi.in { background: var(--brand); }
.btn-presensi.out { background: var(--sky); }
.btn-presensi.done { background: #e7eef8; color: var(--ink-2); pointer-events: none; }
.btn-presensi .circ { width: 22px; height: 22px; border-radius: 99px; background: #fff; display: grid; place-items: center; }
.btn-presensi.in .circ { color: var(--brand); } .btn-presensi.out .circ { color: var(--sky); }
.btn-presensi .circ .icon { width: 15px; height: 15px; }
.today-log { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); text-align: center; }
.today-log b { display: block; font-size: 16px; color: var(--ink); }

/* ---------- Stats ---------- */
.stat { background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow); text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); } .stat.info b { color: var(--brand); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b-pending { background: var(--warn-50); color: var(--warn); }
.b-approved, .b-hadir, .b-ok { background: var(--ok-50); color: var(--ok); }
.b-rejected, .b-alpha, .b-bad { background: var(--bad-50); color: var(--bad); }
.b-terlambat { background: var(--warn-50); color: var(--warn); }
.b-info, .b-cuti { background: var(--brand-50); color: var(--brand); }
.b-gray { background: #eef2f7; color: var(--ink-2); }

/* ---------- Alerts ---------- */
.alert { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-weight: 600; margin: 0 16px 12px; display: flex; gap: 8px; align-items: flex-start; }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--ok-50); color: var(--ok); }
.alert-error { background: var(--bad-50); color: var(--bad); }
.alert-info { background: var(--brand-50); color: var(--brand); }
.alert-warn { background: var(--warn-50); color: var(--warn); }
.content .alert { margin-left: 0; margin-right: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 12.5px; color: var(--bad); margin-top: 4px; font-weight: 600; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 13px; font: inherit; font-size: 15px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 79, 194, .12); }
.input[readonly] { background: #f6f8fb; }
textarea.input { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; }
.chips input { accent-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; background: var(--brand); color: #fff; transition: background .15s, transform .1s; }
.btn:hover { background: var(--brand-600); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--brand-50); color: var(--brand); }
.btn-ghost:hover { background: #d8e7ff; }
.btn-danger { background: var(--bad-50); color: var(--bad); }
.btn-danger:hover { background: #fbd5da; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #0b744f; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.fab { position: fixed; right: max(16px, calc(50% - 240px + 16px)); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(13, 79, 194, .35); z-index: 30; }

/* ---------- Profile header ---------- */
.profile-card { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 8px; }
.avatar { width: 64px; height: 64px; border-radius: 99px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 22px; overflow: hidden; flex: none; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 40px; height: 40px; font-size: 14px; }
.profile-card .no { font-size: 12px; color: var(--ink-2); }
.profile-card .nm { font-size: 18px; font-weight: 800; }
.profile-card .jb { font-size: 12.5px; color: var(--ink-2); }
.profile-card .co { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

/* ---------- ID Card ---------- */
.idcard { width: 100%; max-width: 340px; margin: 6px auto 16px; aspect-ratio: 54 / 86; border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 14px 34px rgba(11, 31, 58, .18); display: flex; flex-direction: column; position: relative; }
.idcard-top { background: linear-gradient(135deg, var(--brand) 0, #2e7be6 100%); color: #fff; padding: 18px 18px 54px; position: relative; }
.idcard-top::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: -40px; height: 80px; background: #fff; border-radius: 50%; }
.idcard-top .logo { color: #fff; font-size: 22px; }
.idcard-top .logo .my { background: #fff; color: var(--brand); }
.idcard-top .co { font-size: 10.5px; letter-spacing: 1.2px; opacity: .85; margin-top: 2px; font-weight: 700; }
.idcard-photo { width: 120px; height: 140px; border-radius: 14px; overflow: hidden; margin: -40px auto 0; position: relative; z-index: 2; border: 4px solid #fff; box-shadow: 0 6px 14px rgba(11, 31, 58, .15); background: var(--brand-50); display: grid; place-items: center; font-size: 36px; font-weight: 800; color: var(--brand); }
.idcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.idcard-body { text-align: center; padding: 12px 16px 0; flex: 1; }
.idcard-body .nm { font-size: 20px; font-weight: 800; }
.idcard-body .jb { color: var(--brand); font-weight: 700; font-size: 13.5px; margin-top: 2px; }
.idcard-body .no { font-size: 12px; color: var(--ink-2); margin-top: 8px; letter-spacing: 1px; }
.idcard-barcode { padding: 6px 26px 18px; }
.idcard-barcode svg { width: 100%; height: 54px; }
.idcard-strip { height: 10px; background: linear-gradient(90deg, var(--brand), var(--sky)); }

/* ---------- Camera ---------- */
.cam { position: relative; border-radius: 18px; overflow: hidden; background: #0b1f3a; aspect-ratio: 3 / 4; }
.cam video, .cam img, .cam canvas { width: 100%; height: 100%; object-fit: cover; }
.cam video { transform: scaleX(-1); }
.cam .overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cam .ring { width: 62%; aspect-ratio: 3 / 4; border: 3px dashed rgba(255, 255, 255, .7); border-radius: 50%; }
.cam .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 24px; font-size: 14px; }
.shutter { width: 70px; height: 70px; border-radius: 99px; border: 5px solid #fff; background: var(--brand); box-shadow: 0 0 0 3px var(--brand); margin: -46px auto 0; position: relative; z-index: 3; display: grid; place-items: center; color: #fff; cursor: pointer; }
.loc { display: flex; gap: 12px; align-items: flex-start; }
.loc .pin { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand); }
.loc.ok .pin { background: var(--ok-50); color: var(--ok); }
.loc.bad .pin { background: var(--bad-50); color: var(--bad); }
.clock { font-size: 40px; font-weight: 800; letter-spacing: -1px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Menu grid ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.menu-tile { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--ink); font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.menu-tile .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.menu-tile .ic.sky { background: var(--sky-50); color: #1a8fd0; }
.menu-tile .ic.ok { background: var(--ok-50); color: var(--ok); }
.menu-tile .ic.warn { background: var(--warn-50); color: var(--warn); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .dow { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .d { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 700; background: #f6f9fd; position: relative; }
.cal .d.off { background: transparent; color: #c3cedd; }
.cal .d.today { outline: 2px solid var(--brand); }
.cal .d i { width: 6px; height: 6px; border-radius: 99px; margin-top: 3px; }
.cal .d.hadir { background: var(--ok-50); color: var(--ok); } .cal .d.hadir i { background: var(--ok); }
.cal .d.terlambat { background: var(--warn-50); color: var(--warn); } .cal .d.terlambat i { background: var(--warn); }
.cal .d.alpha { background: var(--bad-50); color: var(--bad); } .cal .d.alpha i { background: var(--bad); }
.cal .d.cuti { background: var(--brand-50); color: var(--brand); } .cal .d.cuti i { background: var(--brand); }
.cal .d.libur { background: #fdeef4; color: #c0306a; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 99px; background: #fff; border: 3px solid var(--sky); }
.tl-item.current::before { border-color: var(--brand); background: var(--brand); }
.tl-item h4 { margin: 0; font-size: 15px; }

/* ---------- Table (owner) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafcff; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #eef2f7; }

/* ---------- Owner layout ---------- */
.owner-shell { min-height: 100dvh; background: var(--bg); }
.owner-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.owner-top .inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px 0; }
.owner-top .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.owner-tabs { display: flex; gap: 2px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.owner-tabs::-webkit-scrollbar { display: none; }
.owner-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.owner-tabs a .icon { width: 17px; height: 17px; }
.owner-tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.owner-tabs .count { background: #e0242f; color: #fff; border-radius: 99px; font-size: 10.5px; padding: 1px 6px; }
.owner-main { max-width: 1200px; margin: 0 auto; padding: 18px 16px 40px; }
.owner-main .alert { margin: 0 0 14px; }
.owner-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.owner-head h1 { font-size: 21px; font-weight: 800; }
.stats-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.cols-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .input { width: auto; padding: 9px 12px; font-size: 14px; }
.seg { display: inline-flex; background: #e9eff7; border-radius: 12px; padding: 3px; }
.seg a { padding: 7px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.seg a.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.bars .b div { width: 100%; max-width: 38px; background: var(--brand); border-radius: 8px 8px 4px 4px; min-height: 4px; }
.bars .b b { color: var(--ink); font-size: 12px; }
.diff { width: 100%; border-collapse: collapse; font-size: 14px; }
.diff th, .diff td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.diff th { color: var(--muted); font-weight: 600; width: 28%; }
.diff tr.changed td.new { background: #fff8e6; font-weight: 700; }
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 9px; background: #fff; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.pagination .on { background: var(--brand); color: #fff; }

@media (min-width: 760px) {
  .stats-4 { grid-template-columns: repeat(4, 1fr); }
  .cols-2 { grid-template-columns: 1.4fr 1fr; }
}

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; background: radial-gradient(120% 60% at 50% 0, #cfe4ff 0, var(--bg) 70%); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { justify-content: center; font-size: 38px; margin-bottom: 4px; }
.auth-card .logo .my { font-size: 26px; }

/* ---------- Payslip ---------- */
.slip-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.slip-row:last-child { border-bottom: 0; }
.slip-row.total { font-weight: 800; font-size: 16px; border-top: 2px solid var(--ink); border-bottom: 0; padding-top: 12px; margin-top: 4px; }
.minus { color: var(--bad); }

@media print {
  .bottomnav, .topbar, .pagehead .back, .no-print, .owner-top { display: none !important; }
  .shell { background: #fff; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
