/* ==========================================================================
   OrbitHR — Mobile Portal stylesheet (app_pages)
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.001ms !important;transition-duration:.001ms !important}
}
@keyframes mFadeSlideUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
@keyframes mPopIn{from{opacity:0;transform:translateY(16px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
/* .m-hero and .m-nav are persistent app chrome on every mobile page (this is
   a multi-page app — full reload per navigation), so animating them meant
   the colored header and bottom tab bar visibly flashed in on every tap.
   Left static; .m-body's per-page content still animates in below. */
.m-body > *{animation:mFadeSlideUp .4s cubic-bezier(.16,1,.3,1) backwards}
.m-body > *:nth-child(1){animation-delay:.02s}
.m-body > *:nth-child(2){animation-delay:.06s}
.m-body > *:nth-child(3){animation-delay:.10s}
.m-body > *:nth-child(4){animation-delay:.14s}
.m-body > *:nth-child(n+5){animation-delay:.16s}
.m-login-card{animation:mPopIn .45s cubic-bezier(.16,1,.3,1) .05s backwards}
.m-login-top{animation:mFadeSlideUp .4s cubic-bezier(.16,1,.3,1) backwards}
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f3f4f6; color: #111827;
  margin: 0 auto; padding-bottom: 92px;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
:root {
  --m-brand: #6c4cf1; --m-brand-dark: #5a37e8; --m-brand-light: #e4e0ff;
  --m-amber: #f59e0b; --m-amber-light: #fef3c7;
  --m-green: #10b981; --m-green-light: #d1fae5;
  --m-red: #ef4444; --m-red-light: #fee2e2;
  --m-blue: #2d7dfb; --m-blue-light: #e8f0ff;
  --m-card: #fff; --m-text1: #111827; --m-text2: #4b5563; --m-text3: #9ca3af; --m-border: #e5e7eb;
  --m-shadow: 0 1px 3px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
  --m-radius: 16px;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---------- Hero ---------- */
.m-hero { background: linear-gradient(160deg, var(--m-brand) 0%, var(--m-brand-dark) 100%); padding: 0 18px 22px; color: #fff; }
.m-hero.m-hero-plain { padding-bottom: 0px; }
.m-hero-top { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 14px; gap: 12px; }
.m-hero-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.m-back { width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; flex-shrink: 0; }
.m-hero-title { font-size: 19px; font-weight: 800; line-height: 1.2; }
.m-hero-sub { font-size: 12px; opacity: .82; margin-top: 2px; }
.m-hero-avatar { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.28); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0; }

.m-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-strip-box { background: rgba(255,255,255,.18); border-radius: 12px; padding: 10px 8px; text-align: center; border: 1px solid rgba(255,255,255,.2); }
.m-strip-num { font-size: 20px; font-weight: 800; line-height: 1; color: #fff; }
.m-strip-lbl { font-size: 10px; font-weight: 700; opacity: .85; margin-top: 3px; }

/* ---------- Layout ---------- */
.m-body { padding: 14px 14px 0; }
.m-sec-title { font-size: 13px; font-weight: 800; color: var(--m-text2); margin: 18px 2px 8px; text-transform: uppercase; letter-spacing: .04em; }
.m-sec-title:first-child { margin-top: 4px; }

.m-card { background: var(--m-card); border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 16px; margin-bottom: 12px; }
.m-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.m-card-title { font-size: 14px; font-weight: 800; }

.m-toast { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.m-toast.ok { background: var(--m-green-light); color: #065f46; border: 1px solid #6ee7b7; }
.m-toast.err { background: var(--m-red-light); color: #991b1b; border: 1px solid #fca5a5; }
.m-note { background: var(--m-blue-light); border: 1px solid #bfdbfe; color: #1e40af; padding: 11px 13px; border-radius: 12px; font-size: 12px; margin-bottom: 12px; line-height: 1.5; }

/* ---------- Rows ---------- */
.m-row { display: flex; align-items: center; gap: 12px; background: var(--m-card); border-radius: 14px; padding: 13px 14px; margin-bottom: 9px; box-shadow: var(--m-shadow); }
.m-row:active { transform: scale(.985); }
.m-row-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--m-brand-light); color: var(--m-brand); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.m-row-body { flex: 1; min-width: 0; }
.m-row-title { font-size: 14px; font-weight: 700; color: var(--m-text1); }
.m-row-meta { font-size: 11.5px; color: var(--m-text3); margin-top: 2px; }
.m-row-arrow { color: var(--m-text3); font-size: 12px; }
.m-row-badge { background: var(--m-red); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 20px; }

/* ---------- Tiles ---------- */
.m-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.m-tile { background: var(--m-card); border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 16px 12px; text-align: center; position: relative; }
.m-tile:active { transform: scale(.96); }
.m-tile-ic { width: 44px; height: 44px; border-radius: 14px; background: var(--m-brand-light); color: var(--m-brand); display: flex; align-items: center; justify-content: center; font-size: 17px; margin: 0 auto 9px; }
.m-tile-ic.teal { background: #dcf7f4; color: #0ea5a3; }
.m-tile-ic.amber { background: var(--m-amber-light); color: #b45309; }
.m-tile-ic.rose { background: var(--m-red-light); color: #dc2626; }
.m-tile-ic.blue { background: var(--m-blue-light); color: var(--m-blue); }
.m-tile-ic.green { background: var(--m-green-light); color: #059669; }
.m-tile-lbl { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.m-tile-sub { font-size: 10.5px; color: var(--m-text3); margin-top: 2px; }
.m-tile-dot { position: absolute; top: 10px; right: 10px; background: var(--m-red); color: #fff; font-size: 10px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ---------- Stat pair ---------- */
.m-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.m-stat { background: var(--m-card); border-radius: 14px; box-shadow: var(--m-shadow); padding: 14px; }
.m-stat-num { font-size: 20px; font-weight: 800; line-height: 1; }
.m-stat-lbl { font-size: 11px; color: var(--m-text3); font-weight: 600; margin-top: 4px; }

/* ---------- Attendance calendar ---------- */
.m-cal-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.m-cal-stat { background: #f8fafc; border-radius: 14px; padding: 14px 8px; text-align: center; }
.m-cal-stat-num { font-size: 24px; font-weight: 800; line-height: 1; }
.m-cal-stat-lbl { font-size: 11.5px; color: var(--m-text3); font-weight: 600; margin-top: 5px; }
.m-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.m-cal-arrow { width: 32px; height: 32px; border-radius: 10px; background: #f3f4f6; color: var(--m-text2); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.m-cal-arrow:active { transform: scale(.92); }
.m-cal-month { font-size: 15px; font-weight: 800; color: var(--m-text1); }
.m-cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.m-cal-dow span { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--m-text3); }
.m-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.m-cal-day { aspect-ratio: 1 / 1; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--m-text2); background: #f9fafb; border: 1px solid var(--m-border); }
.m-cal-day.empty { background: transparent; border: none; }
.m-cal-day.present { background: var(--m-green); color: #fff; border-color: transparent; }
.m-cal-day.absent { background: var(--m-red); color: #fff; border-color: transparent; }
.m-cal-day.holiday { background: var(--m-amber); color: #fff; border-color: transparent; }
.m-cal-day.late { background: var(--m-brand); color: #fff; border-color: transparent; }
.m-cal-day.half { background: var(--m-blue); color: #fff; border-color: transparent; }
.m-cal-day.leave { background: #0ea5a3; color: #fff; border-color: transparent; }
.m-cal-day.today { box-shadow: 0 0 0 2px var(--m-brand); }
.m-cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--m-border); }
.m-cal-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--m-text2); font-weight: 600; }
.m-cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Pills ---------- */
.m-pill { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 800; }
.m-pill.ok { background: var(--m-green-light); color: #065f46; }
.m-pill.info { background: var(--m-blue-light); color: #1e40af; }
.m-pill.warn { background: var(--m-amber-light); color: #92400e; }
.m-pill.bad { background: var(--m-red-light); color: #991b1b; }
.m-pill.mut { background: #f3f4f6; color: #6b7280; }
.m-chip { display: inline-flex; align-items: center; gap: 5px; background: #f3f4f6; color: var(--m-text2); padding: 5px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }

/* ---------- Forms ---------- */
.m-field { margin-bottom: 13px; }
.m-label { display: block; font-size: 12px; font-weight: 700; color: var(--m-text2); margin-bottom: 5px; }
.m-input, select.m-input, textarea.m-input {
  width: 100%; padding: 12px 13px; border-radius: 12px; border: 1.5px solid var(--m-border);
  background: #fff; font-size: 14px; color: var(--m-text1); font-family: inherit; outline: none;
}
.m-input:focus { border-color: var(--m-brand); box-shadow: 0 0 0 3px var(--m-brand-light); }
textarea.m-input { min-height: 84px; resize: vertical; }
.m-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; background: linear-gradient(135deg, var(--m-brand), var(--m-brand-dark)); color: #fff; border: none; border-radius: 13px; font-size: 14.5px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 14px rgba(108,76,241,.32); font-family: inherit; }
.m-btn:disabled { opacity: .45; }
.m-btn.ghost { background: #f3f4f6; color: var(--m-text2); box-shadow: none; }
.m-btn.green { background: linear-gradient(135deg, var(--m-green), #059669); box-shadow: 0 4px 14px rgba(16,185,129,.3); }
.m-btn.amber { background: linear-gradient(135deg, var(--m-amber), #d97706); box-shadow: 0 4px 14px rgba(245,158,11,.3); }
.m-btn.red { background: linear-gradient(135deg, var(--m-red), #dc2626); box-shadow: 0 4px 14px rgba(239,68,68,.3); }
.m-btn.sm { padding: 9px 14px; font-size: 12.5px; width: auto; border-radius: 10px; }
.m-btn-row { display: flex; gap: 8px; }

/* ---------- Tabs ---------- */
.m-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.m-tab { flex-shrink: 0; padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; border: 1.5px solid var(--m-border); background: #fff; color: var(--m-text2); white-space: nowrap; }
.m-tab.active { background: var(--m-brand); border-color: var(--m-brand); color: #fff; }

/* ---------- Search ---------- */
.m-search { background: #fff; border-radius: 13px; box-shadow: var(--m-shadow); display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 12px; border: 1.5px solid var(--m-border); }
.m-search i { color: var(--m-text3); font-size: 13px; }
.m-search input { border: none; outline: none; background: transparent; font-size: 14px; flex: 1; font-family: inherit; }

/* ---------- Key/value ---------- */
.m-kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--m-border); font-size: 13px; }
.m-kv:last-child { border-bottom: none; }
.m-kv b { color: var(--m-text3); font-weight: 600; }
.m-kv span { font-weight: 700; text-align: right; }

/* ---------- Progress ---------- */
.m-prog { height: 7px; background: var(--m-border); border-radius: 5px; overflow: hidden; }
.m-prog > div { height: 100%; background: linear-gradient(90deg, var(--m-brand), #0ea5a3); border-radius: 5px; }

/* ---------- Empty ---------- */
.m-empty { text-align: center; padding: 38px 20px; color: var(--m-text3); font-size: 13px; }
.m-empty i { font-size: 30px; margin-bottom: 10px; display: block; opacity: .6; }

/* ---------- Avatars / people ---------- */
.m-person { display: flex; align-items: center; gap: 11px; }
.m-av { width: 40px; height: 40px; border-radius: 13px; background: var(--m-brand-light); color: var(--m-brand); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.m-av.lg { width: 62px; height: 62px; border-radius: 18px; font-size: 19px; }

/* ---------- Bottom nav ---------- */
.m-nav { position: fixed; bottom: 0; left: 0; right: 0; margin: 0 auto; background: #fff; border-top: 1px solid var(--m-border); display: flex; justify-content: space-around; padding: 8px 0 max(8px, env(safe-area-inset-bottom)); z-index: 100; box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.m-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--m-text3); padding: 5px 4px; }
.m-nav-item.active { color: var(--m-brand); }
.m-nav-ic { font-size: 18px; }
.m-nav-lbl { font-size: 10px; font-weight: 700; }

/* ---------- Login ---------- */
.m-login-wrap { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(165deg, var(--m-brand) 0%, var(--m-brand-dark) 55%, #3b1fa8 100%); padding: 0; }
.m-login-top { padding: 54px 26px 30px; color: #fff; }
.m-login-logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 21px; margin-bottom: 22px; }
.m-login-mark { width: 42px; height: 42px; border-radius: 13px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; font-size: 19px; }
.m-login-h { font-size: 25px; font-weight: 800; line-height: 1.25; }
.m-login-p { font-size: 13.5px; opacity: .85; margin-top: 7px; }
.m-login-card { background: #f3f4f6; border-radius: 26px 26px 0 0; padding: 26px 22px 40px; flex: 1; }
.m-login-foot { text-align: center; font-size: 11.5px; color: var(--m-text3); margin-top: 18px; line-height: 1.6; }
.m-demo { margin-top: 16px; padding: 13px 15px; background: #fff; border-radius: 13px; font-size: 11.5px; color: var(--m-text3); border: 1px solid var(--m-border); line-height: 1.7; }
.m-demo b { color: var(--m-text2); }

/* Password show/hide toggle */
.m-pw-field { position: relative; }
.m-pw-field .m-input { padding-right: 46px; }
.m-pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: none; background: transparent; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--m-text3); cursor: pointer;
  transition: color .15s ease, background .15s ease, transform .12s ease;
}
.m-pw-toggle:active { transform: translateY(-50%) scale(.9); }

/* Remember-me checkbox */
.m-remember { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--m-text2); margin: -4px 0 18px; cursor: pointer; user-select: none; }
.m-remember input { position: absolute; opacity: 0; width: 0; height: 0; }
.m-check {
  width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--m-border); background: #fff;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.m-check i { font-size: 10px; color: #fff; opacity: 0; transform: scale(.5); transition: opacity .12s ease, transform .12s ease; }
.m-remember input:checked + .m-check { background: linear-gradient(135deg, var(--m-brand), var(--m-brand-dark)); border-color: var(--m-brand-dark); }
.m-remember input:checked + .m-check i { opacity: 1; transform: scale(1); }
.m-remember:active .m-check { transform: scale(.9); }

/* ---------- Misc ---------- */
.m-divider { height: 1px; background: var(--m-border); margin: 14px 0; }
.m-scroll-x { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.m-mini { flex-shrink: 0; background: #fff; border-radius: 14px; box-shadow: var(--m-shadow); padding: 13px 15px; min-width: 118px; }
.m-mini-num { font-size: 19px; font-weight: 800; }
.m-mini-lbl { font-size: 10.5px; color: var(--m-text3); font-weight: 600; margin-top: 3px; }
table.m-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.m-table th { text-align: left; padding: 8px 6px; color: var(--m-text3); font-size: 10.5px; text-transform: uppercase; font-weight: 800; border-bottom: 1px solid var(--m-border); }
table.m-table td { padding: 10px 6px; border-bottom: 1px solid #f3f4f6; }
table.m-table tr:last-child td { border-bottom: none; }

/* Attendance selfies — thumbnail in a table cell, tap/touch to open an
   expanded modal (no hover on mobile, so this is a tap target, not a
   hover preview like the desktop equivalent). */
.m-selfie-thumb-btn { background: none; border: none; padding: 0; cursor: pointer; line-height: 0; -webkit-tap-highlight-color: rgba(108,76,241,.15); border-radius: 8px; }
.m-selfie-thumb-btn img { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; border: 1.5px solid var(--m-border); display: block; }
.m-selfie-emoji { font-size: 15px; opacity: .65; }

.m-selfie-modal-bg {
  position: fixed; inset: 0; z-index: 400; display: none; align-items: center; justify-content: center;
  background: rgba(17,24,39,0); padding: 20px; transition: background-color .2s ease;
}
.m-selfie-modal-bg.show { display: flex; background: rgba(17,24,39,.75); }
.m-selfie-modal-box {
  background: #fff; border-radius: 20px; padding: 10px; max-width: 320px; width: 100%;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); position: relative;
  animation: mPopIn .25s cubic-bezier(.34,1.56,.64,1);
}
.m-selfie-modal-box img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 14px; display: block; }
.m-selfie-modal-caption { text-align: center; font-size: 11.5px; color: var(--m-text3); margin-top: 8px; }
.m-selfie-modal-close {
  position: absolute; top: -14px; right: -14px; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; box-shadow: 0 6px 16px -4px rgba(0,0,0,.35); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--m-text2); font-size: 15px;
}