/* ==========================================================================
   Absensi Karyawan - Styles (web karyawan, mobile first friendly)
   Urutan: tokens > base > komponen > layout > halaman > responsif
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --navy: #102a43;
  --blue: #1769aa;
  --blue-dark: #10588f;
  --bg: #f4f7fa;
  --ink: #203447;
  --muted: #7c8c99;
  --line: #e6edf2;
  --white: #fff;
  --radius: 13px;
  --sidebar-w: 250px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; width: 100%; }

body {
  margin: 0;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app { width: 100%; }

[hidden] { display: none !important; }

button,
input,
select,
textarea { font: inherit; }

button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: not-allowed; }

:focus-visible { outline: 2px solid #5b9bd0; outline-offset: 2px; }

h1, h2, h3, h4 { margin: 0; }

/* ---------- Form ---------- */
input,
select,
textarea {
  width: 100%;
  border: 1px solid #dce5ec;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: #263b4d;
  font-size: 13px;
  outline: none;
}

textarea { resize: vertical; min-height: 84px; }

input:focus,
select:focus,
textarea:focus {
  border-color: #5b9bd0;
  box-shadow: 0 0 0 3px #e8f3fc;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #46596a;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }

/* ---------- Tombol ---------- */
.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 40px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-light { background: #fff; border: 1px solid #dce5ec; color: #405568; }
.btn-danger { background: #fff0f0; color: #b64b4b; border: 1px solid #f4dada; }
.btn-block { width: 100%; }

/* ---------- Komponen umum ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 21px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card h3 { font: 700 15px Manrope, sans-serif; }

.muted { color: var(--muted); font-size: 12px; }

.empty { text-align: center; padding: 30px; color: #91a0ac; font-size: 12px; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1769aa, #102a43);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Halaman profil (gaya pengaturan WhatsApp) ---------- */
.profile { max-width: 520px; margin: 0 auto; }

.pf-hero { text-align: center; padding: 8px 0 24px; }
.pf-hero h2 { font: 800 22px Manrope, sans-serif; margin: 14px 0 4px; }
.pf-hero .muted { margin: 0; }

.pf-photo { position: relative; width: 128px; height: 128px; margin: 0 auto; }
.avatar-xl { width: 128px; height: 128px; font-size: 42px; box-shadow: 0 8px 24px rgba(16, 42, 67, .2); }

.pf-cam {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  background: linear-gradient(135deg, #1769aa, #102a43);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
}

.pf-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.pf-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--ink);
}
.pf-row:last-child { border-bottom: 0; }
.pf-row:hover { background: #f6f9fc; }

.pf-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e8f1ff;
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.pf-text { flex: 1; min-width: 0; }
.pf-text b { display: block; font-size: 14px; }
.pf-text small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-go { color: #b3c0cb; }
.pf-go .ico { width: 18px; height: 18px; }

.pf-edit { padding: 16px; border-bottom: 1px solid var(--line); }
.pf-edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.person { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.person .avatar { width: 40px; height: 40px; font-size: 13px; }

/* Ikon SVG */
.ico { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.nav-btn span,
.bn-btn span { display: inline-flex; }
.bn-btn .ico { width: 22px; height: 22px; }

.pill {
  display: inline-flex;
  border-radius: 20px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.blue { background: #e8f1ff; color: #2e6fc0; }
.pill.green { background: #e5f7ed; color: #228653; }
.pill.orange { background: #fff2dc; color: #b97817; }
.pill.red { background: #ffebeb; color: #c34d4d; }
.pill.gray { background: #eef1f4; color: #71808d; }

.notice { padding: 12px 14px; border-radius: 9px; font-size: 12px; margin-bottom: 14px; }
.notice.info { background: #edf6fd; color: #28628d; }
.notice.warn { background: #fff5df; color: #946514; }
.notice.error { background: #fff0f0; color: #b44343; }
.notice.success { background: #eaf8ef; color: #287e4d; }

/* Toast menempel di atas layar agar selalu terlihat saat halaman di-scroll */
#toast {
  position: sticky;
  top: 90px;           
  z-index: 30;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}

/* ---------- Statistik ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.stat strong { font: 800 25px Manrope, sans-serif; display: block; }
.stat span { font-size: 11px; color: var(--muted); }

.blue { background: #e8f1ff; color: #3478d4; }
.green { background: #e6f7ee; color: #24945a; }
.orange { background: #fff3df; color: #c7821d; }
.red { background: #ffebeb; color: #cf5959; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }

.login-art {
  background: linear-gradient(145deg, #102a43, #1769aa);
  color: #fff;
  padding: 8%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 11px; font: 800 18px Manrope, sans-serif; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; background: #ffffff22; display: grid; place-items: center; font-size: 22px; }

.login-copy { max-width: 480px; margin: auto 0; }
.login-copy h1 { font: 800 clamp(35px, 4vw, 56px) Manrope, sans-serif; line-height: 1.12; }
.login-copy p { color: #c7d9e8; line-height: 1.7; }
.login-copy small { color: #a9c5dc; }

.login-box { width: min(390px, 90%); margin: auto; display: flex; flex-direction: column; gap: 13px; }
.login-box form { display: flex; flex-direction: column; gap: 13px; }
.login-box h2 { font: 800 26px Manrope, sans-serif; text-align: center; }
.login-box > p { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.login-lang { display: flex; justify-content: flex-end; }
.login-icon { width: 54px; height: 54px; border-radius: 16px; background: #eaf3fb; color: var(--blue); display: grid; place-items: center; margin: 0 auto; font-size: 25px; }

/* ---------- Layout aplikasi ---------- */
.app { width: 100%; min-height: 100vh; min-height: 100dvh; display: flex; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  color: #fff;
  padding: 24px 15px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}

.sidebar .brand { padding: 0 10px 35px; }
.brand-mark .ico { width: 24px; height: 24px; }
.brand-text b { display: block; font: 800 18px Manrope, sans-serif; line-height: 1.2; }
.brand-text small { display: block; font-size: 12px; font-weight: 500; color: #8ea8bd; margin-top: 2px; }

.nav-caption { font-size: 10px; letter-spacing: 1.3px; color: #8ea8bd; padding: 0 12px 10px; font-weight: 700; }

.nav-btn {
  border: 0;
  background: transparent;
  color: #c4d2df;
  width: 100%;
  padding: 12px;
  border-radius: 9px;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  margin: 2px 0;
}
.nav-btn:hover,
.nav-btn.active { background: #1d496b; color: #fff; }

.side-bottom { margin-top: auto; border-top: 1px solid #31506a; padding-top: 15px; }
.mini-user { display: flex; align-items: center; gap: 9px; padding: 8px; }
.mini-user b, .mini-user span { display: block; }
.mini-user b { font-size: 12px; }
.mini-user span { font-size: 10px; color: #a8bfd1; margin-top: 3px; }

.main { flex: 1; min-width: 0; }

/* Top bar bergradasi */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 78px;
  background: linear-gradient(100deg, #1769aa 0%, #102a43 100%);
  color: #fff;
  border-bottom: 0;
  box-shadow: 0 4px 16px rgba(16, 42, 67, .15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 32px;
}

.top-title { min-width: 0; }
.top-title h3 { font: 700 16px Manrope, sans-serif; color: #fff; margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title small { color: #b9d3e8; font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-brand { display: none; align-items: center; gap: 12px; min-width: 0; }

.top-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.top-logo .ico { width: 24px; height: 24px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }


/* Dropdown bahasa & tombol pengaturan: gaya kaca di atas gradasi */
.topbar .lang-select,
.topbar .acc-icon {
  height: 38px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 10px;
  color: #fff;
}
.topbar .lang-select { width: auto; max-width: 150px; padding: 0 12px; font-size: 13px; cursor: pointer; }
.topbar .lang-select option { color: var(--ink); background: #fff; }
.topbar .lang-select:hover,
.topbar .acc-icon:hover,
.topbar .acc-icon[aria-expanded="true"] { background: rgba(255, 255, 255, .22); color: #fff; }
.topbar .lang-select:focus { border-color: rgba(255, 255, 255, .5); box-shadow: 0 0 0 3px rgba(255, 255, 255, .22); }

/* Info user, dipisah garis tipis */
.top-user { display: flex; align-items: center; gap: 10px; padding-left: 12px; margin-left: 2px; border-left: 1px solid rgba(255, 255, 255, .22); }
.top-user b { display: block; font-size: 13px; line-height: 1.2; }
.top-user span { display: block; color: #b9d3e8; font-size: 11px; margin-top: 2px; }
.top-user .avatar { width: 36px; height: 36px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); color: #fff; }


.content { padding: 28px 32px; max-width: 1100px; margin: 0 auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-head h1 { font: 800 24px Manrope, sans-serif; margin: 0 0 5px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12px; }

.acc-wrap { position: relative; }

.acc-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e3e8ee;
  background: #fff;
  border-radius: 10px;
  font-size: 17px;
  line-height: 1;
  color: #475569;
  padding: 0;
}
.acc-icon:hover,
.acc-icon[aria-expanded="true"] { background: #f1f5f9; color: #2563eb; }

.acc-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(270px, calc(100vw - 24px));
  background: #fff;
  color: var(--ink);
  border: 1px solid #e3e8ee;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  padding: 6px;
  z-index: 60;
}

.acc-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid #eef1f4; }
.acc-head .muted { font-size: 12px; }

.acc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  text-align: left;
  color: inherit;
}
.acc-item:hover { background: #f1f5f9; }

/* ---------- Dashboard: kartu hero ---------- */
.hero {
  background: linear-gradient(115deg, #1769aa, #102a43);
  color: #fff;
  border-radius: 15px;
  padding: 25px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.hero h1 { font: 800 28px Manrope, sans-serif; margin: 2px 0 14px; }
.hero h2 { font: 700 19px Manrope, sans-serif; margin: 9px 0 5px; }
.hero p { margin: 0; color: #d0e3f1; font-size: 12px; }
.hero-clock { font: 800 40px Manrope, sans-serif; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 10px; letter-spacing: 1.5px; color: #9fc7e3; font-weight: 700; }

/* ---------- Dashboard: kartu absensi GPS ---------- */
.att-card { max-width: 560px; margin: 0 auto 20px; }

/* Indikator status absensi */
.att-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 14px;
  background: #fff5df;
  color: #946514;
}
.att-status .att-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.att-status .att-time { margin-left: auto; font-size: 12px; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.att-status.in    { background: #edf6fd; color: #28628d; }
.att-status.done  { background: #eaf8ef; color: #287e4d; }
.att-status.leave { background: #eef1f4; color: #71808d; }

.att-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; }
.att-step:last-child { margin-bottom: 0; }
.att-step-center { justify-content: center; text-align: center; }
.att-step-center .att-body { flex: 0 1 360px; }

.att-body { flex: 1; min-width: 0; }
.att-body h4 { font: 700 14px Manrope, sans-serif; margin: 4px 0 10px; }

.att-loc {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e3e8ee;
  margin-bottom: 12px;
  font-size: 14px;
}
.att-loc.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.att-loc.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.att-loc .muted { font-size: 12px; color: inherit; opacity: .8; }

.att-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.att-actions .btn,
.att-single {
  width: 100%;
  min-height: 52px;
  padding: 14px 10px;
  font-size: 15px;
  border-radius: 12px;
}

.att-actions.att-actions-center {
  grid-template-columns: 1fr; /* 1 kolom = atas-bawah */
  justify-items: center;
  gap: 12px;
}
.att-actions-center .btn { width: 100%; max-width: 280px; }
.att-single { display: flex; max-width: 280px; margin: 0 auto; }

/* ---------- Bottom bar (hanya tampil di layar kecil) ---------- */
.bottom-nav { display: none; }

.bn-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  border-radius: 12px;
  color: #ababac;
}

/* Kotak kecil di sekeliling ikon */
.bn-btn span {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .2s, color .2s, box-shadow .2s;
}

.bn-btn small { font-size: 11px; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Aktif: kotak ikon bergradasi, label berwarna biru */
.bn-btn.active { color: var(--blue); background: transparent; }
.bn-btn.active span {
  background: linear-gradient(135deg, #1769aa 0%, #102a43 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(81, 171, 245, 0.35);
}

/* ==========================================================================
   Responsif
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .content { padding: 24px; }
}

/* Mobile & tablet kecil: sidebar diganti bottom bar */
@media (max-width: 860px) {
  .sidebar { display: none; }

  .bottom-nav {
    display: flex;
    gap: 4px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding: 6px 8px calc(6px + var(--safe-bottom));
    background: #ffffff;
    border-top: 0;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .12);
  }

  .main { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); }

  .topbar { height: 64px; padding: 0 16px; }
  .top-user > div:last-child { display: none; }
  .top-actions { gap: 8px; }
  .top-brand { display: flex; }
  .topbar .lang-select { max-width: 112px; }
  .top-user { padding-left: 0; margin-left: 0; border-left: 0; }
  #toast { top: 76px; }
}

/* Mobile */
@media (max-width: 650px) {
  /* 16px mencegah iOS memperbesar layar otomatis saat input difokuskan */
  input,
  select,
  textarea { font-size: 16px; padding: 12px; }

  .btn { min-height: 46px; font-size: 13px; }

  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-box { width: min(390px, 100% - 32px); min-height: 100vh; min-height: 100dvh; justify-content: center; padding: 24px 0; }

  .top-title h3 { font-size: 14px; margin-bottom: 3px; }
  .top-title small { font-size: 11px; }
  .top-user { display: none; }

  .content { padding: 16px 14px; }

  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 21px; }

  .card { padding: 16px; border-radius: 12px; }

  .hero { padding: 18px; border-radius: 14px; margin-bottom: 14px; }
  .hero h1 { font-size: 22px; margin-bottom: 10px; }
  .hero h2 { font-size: 15px; margin: 7px 0 4px; }
  .hero-clock { font-size: 30px; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px; gap: 9px; }
  .stat strong { font-size: 20px; }
  .stat-icon { width: 34px; height: 34px; font-size: 16px; }
  .stat-icon .ico { width: 18px; height: 18px; }

  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }

  .att-actions .btn,
  .att-single { min-height: 56px; font-size: 15px; }
}

/* Layar sangat sempit */
@media (max-width: 360px) {
  .topbar .lang-select { max-width: 88px; padding: 0 6px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .stats { grid-template-columns: 1fr; }
}

/* Hormati pengaturan "kurangi gerakan" */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}