:root {
  --brand: #1e63d0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #dc2626;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --text: #e6e8ec;
    --muted: #9aa3af;
    --line: #262b34;
  }
}

* { box-sizing: border-box; }

/* The UA rule for [hidden] is `[hidden] { display: none }` — one attribute
   selector, which ANY id or class rule that sets `display` will outrank. That
   is how #shell (display:flex) stayed on screen underneath the sign-in page
   while still carrying the hidden attribute. Make hidden mean hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  /* Respect the iPhone notch and home indicator once installed. */
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}

/* Body is a column so the footer can sit at the bottom on short screens
   without floating over the content on long ones. */
body { min-height: 100vh; display: flex; flex-direction: column; }

.view { max-width: 460px; margin: 0 auto; padding: 24px 18px 40px; width: 100%; flex: 1; }

/* --- splash ------------------------------------------------------------- */
.splash {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: var(--bg);
}
.splash-name { font-size: 14px; color: var(--muted); margin: 16px 0 0; letter-spacing: .02em; }

/* The IndoHRM mark is a wide wordmark, so it is sized by width and left to
   find its own height. Fixed height would squash it on narrow phones. */
.wordmark { width: 200px; max-width: 62vw; height: auto; display: block; }
.splash .wordmark { width: 220px; }

/* A tenant's own logo is usually square-ish, so it is sized by height and
   centred instead of stretched to the wordmark's width. */
.company-mark { height: 72px; width: auto; max-width: 62vw; margin: 0 auto; display: block; border-radius: 12px; }

.tagline {
  font-size: 13px; color: var(--muted); margin: 2px 0 10px;
  letter-spacing: .02em;
}

.brand { text-align: center; margin: 24px 0 20px; }
.brand picture { display: block; }
.brand .wordmark { margin: 0 auto; }
.brand h1 { font-size: 17px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h1 { font-size: 18px; margin: 2px 0 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }

input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  /* 16px keeps iOS Safari from zooming the whole page on focus. */
  font-size: 16px;
}

input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid transparent;
  /* Comfortably above the 44px touch target minimum. */
  min-height: 48px;
  width: 100%;
  margin-top: 14px;
}

button:disabled { opacity: .5; cursor: not-allowed; }

.primary { background: var(--brand); color: #fff; font-weight: 600; }
.secondary { background: transparent; border-color: var(--line); color: var(--text); }
.link { background: none; color: var(--muted); min-height: 40px; text-decoration: underline; }
.icon { width: 44px; min-height: 44px; margin: 0; background: none; border: 1px solid var(--line); color: var(--muted); font-size: 18px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); font-size: 13px; margin: 12px 0 0; }

.clock { text-align: center; }
.clock-time { font-size: 44px; font-weight: 700; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.stat { font-size: 20px; font-weight: 600; margin: 2px 0 0; font-variant-numeric: tabular-nums; }

.split { display: flex; gap: 12px; justify-content: space-around; margin: 20px 0 8px; }
.split > * { flex: 1; }

/* The two attendance figures are buttons. They are styled as plain text on
   purpose — a pair of obvious buttons in the middle of the clock card would
   compete with "Rekam Absen", which is the thing people are meant to press. */
.stat-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  background: none; border: 1px solid transparent; padding: 6px 4px; margin: 0;
  min-height: 0; border-radius: 12px; width: 100%; color: inherit;
}
.stat-btn:active { background: var(--bg); border-color: var(--line); }
.stat-btn .stat { margin: 2px 0 0; }
.stat-btn::after {
  content: ''; display: block;
  width: 18px; height: 2px; margin-top: 6px; border-radius: 2px;
  background: var(--line);
}

.location { margin: 14px 0 0; }

.section { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }

.logs { list-style: none; padding: 0; margin: 0; }
.logs li {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
}

video { width: 100%; border-radius: 12px; background: #000; margin-top: 12px; }

.offline-bar {
  background: #b45309; color: #fff; text-align: center;
  padding: 10px 16px; font-size: 13px;
  position: sticky; top: 0; z-index: 10;
}

.footnote { margin-top: 26px; text-align: center; }

/* --- document reader ---------------------------------------------------- */
.doc { line-height: 1.6; font-size: 14px; }
.doc h1, .doc h2, .doc h3 { font-size: 15px; margin: 18px 0 6px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { padding-left: 20px; margin: 0 0 12px; }
.doc a { color: var(--brand); }
/* Author-supplied HTML can carry wide tables or long URLs; keep the page
   itself from scrolling sideways. */
.doc img, .doc table { max-width: 100%; }
.doc table { display: block; overflow-x: auto; }
.doc { overflow-wrap: anywhere; }

.topbar h1 { flex: 1; }

/* --- footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.site-footer .version {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: .02em;
}
.site-footer nav {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.site-footer a { color: var(--brand); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0; }

/* ====================================================================
   APP SHELL — app bar, drawer, tabs, bottom nav
   ==================================================================== */

/* The shell owns the scrolling area between a fixed app bar and a fixed
   bottom nav, so tab content scrolls under neither. */
#shell { display: flex; flex-direction: column; min-height: 100vh; }

.appbar {
  position: sticky; top: 0; z-index: 12;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px calc(8px);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.appbar h1 {
  flex: 1; text-align: center; margin: 0;
  font-size: 16px; font-weight: 600;
}
.appbar-btn {
  width: 44px; min-height: 44px; margin: 0;
  background: none; border: none; color: var(--text);
  font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* Three bars drawn rather than shipped as an icon font. */
.burger, .burger::before, .burger::after {
  display: block; width: 19px; height: 2px;
  background: var(--text); border-radius: 2px;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ''; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }

/* --- drawer ------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; z-index: 14;
  background: rgba(17, 24, 39, .45);
}

.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 15;
  width: 82vw; max-width: 320px;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: calc(18px + env(safe-area-inset-top)) 0 calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  transform: translateX(-102%);
  transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }

/* A drawer that animates in from nowhere on a slow phone looks broken, so it
   is always mounted and only slid out of view. */
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px 16px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.drawer-id { min-width: 0; }
.drawer-id strong { display: block; font-size: 15px; overflow-wrap: anywhere; }

.drawer-section {
  margin: 14px 18px 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.drawer-nav ul { list-style: none; margin: 0; padding: 0; }
.drawer-nav li { margin: 0; }
.drawer-nav a,
.drawer-nav button {
  display: block; width: 100%; text-align: left;
  padding: 12px 18px; min-height: 44px; margin: 0;
  background: none; border: none; border-radius: 0;
  color: var(--text); font-size: 14px; text-decoration: none;
}
.drawer-nav a:hover, .drawer-nav button:hover { background: var(--bg); }
.drawer-nav .danger { color: var(--danger); }

/* Planned entries are shown, not hidden: a menu that quietly lacks half the
   product is more confusing than one that says what is coming. */
.drawer-nav li.soon button {
  color: var(--muted); cursor: default;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.drawer-nav li.soon button:hover { background: none; }
.soon-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px;
  color: var(--muted); white-space: nowrap;
}

.drawer-foot { padding: 16px 18px 0; margin: 8px 0 0; border-top: 1px solid var(--line); }

/* --- tabs --------------------------------------------------------------- */
#tabs { flex: 1; }
.tab {
  max-width: 460px; margin: 0 auto; width: 100%;
  padding: 14px 18px calc(90px + env(safe-area-inset-bottom));
}

.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: none;
  position: relative; overflow: hidden;
}
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }

/* The photo covers the initials rather than replacing them, so a picture that
   fails to load leaves the initials showing instead of an empty circle. */
.avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .18s ease;
}
.avatar.has-photo img { opacity: 1; }

.greeting { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.greeting h2 { margin: 2px 0; font-size: 18px; }
.workbase { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.workbase .bi { width: 12px; height: 12px; flex: none; opacity: .8; }

.shift { margin-top: 6px; }

.rows { list-style: none; padding: 0; margin: 0 0 18px; }
.rows li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 16px; margin-bottom: 8px;
  font-size: 14px;
}
.rows li span { color: var(--muted); }
.rows li strong { text-align: right; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 34px 20px; }
.empty h2 { margin: 0 0 8px; font-size: 18px; }

/* --- seven-day strip ---------------------------------------------------- */
.weekstrip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 16px;
  /* Snap so a half-visible day never looks like the current one. */
  scroll-snap-type: x proximity;
}
/* Each day is a button — tapping opens what was actually recorded. */
.day {
  flex: 0 0 auto; width: 62px; scroll-snap-align: start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 6px 8px; text-align: center;
  margin: 0; min-height: 0; color: inherit; display: block;
}
.day:active { background: var(--bg); }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.day .dow { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0; }
.day .num { font-size: 16px; font-weight: 700; margin: 2px 0 5px; }
.day .daytime {
  font-size: 10px; color: var(--muted); margin: 5px 0 0;
  font-variant-numeric: tabular-nums;
}

.dot { width: 8px; height: 8px; border-radius: 50%; margin: 0 auto; background: var(--line); display: block; }
.dot.present { background: #16a34a; }
.dot.partial { background: #e0a800; }
.dot.none    { background: var(--danger); }
/* Slate, not orange. A rostered day off is not a problem, and next to the red
   "no record" dot an orange one was near-indistinguishable anyway. */
.dot.holiday { background: #64748b; }

/* Four colours with no key is a puzzle, not a summary. */
.legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin: -8px 0 18px; font-size: 11px; color: var(--muted);
}
.legend span { display: flex; align-items: center; gap: 5px; }
.legend .dot { margin: 0; flex: none; }

/* Label/value rows inside the day-detail sheet. */
.actions li.kv {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 14px; padding: 12px 15px;
}

/* --- leave balance ------------------------------------------------------ */
.leave-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.leave-grid div { text-align: center; }
.leave-grid .n { font-size: 22px; font-weight: 700; }
.leave-cycle { text-align: center; margin: 0 0 14px; }

/* --- announcements ------------------------------------------------------ */
.ann { background: var(--card); border: 1px solid var(--line);
       border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.ann h3 { margin: 0 0 4px; font-size: 14px; }
.ann p { margin: 0; font-size: 13px; color: var(--muted); }

/* --- bottom nav --------------------------------------------------------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav button {
  flex: 1; margin: 0; border: none; border-radius: 0;
  background: none; color: var(--muted);
  min-height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px;
}
.bottomnav button .ico { font-size: 18px; line-height: 1; }
.bottomnav button.active { color: var(--brand); font-weight: 600; }

.build-stamp { text-align: center; margin-top: 18px; }

/* --- Bootstrap Icons ----------------------------------------------------- */
.bi { width: 20px; height: 20px; fill: currentColor; display: block; }
.bi-lg { width: 24px; height: 24px; }
.bottomnav .bi { width: 21px; height: 21px; }
.drawer-nav .bi { width: 18px; height: 18px; flex: none; }
.drawer-nav a, .drawer-nav button { display: flex; align-items: center; gap: 12px; }
.drawer-nav li.soon button { justify-content: flex-start; }
.drawer-nav li.soon .soon-tag { margin-left: auto; }

/* --- device status ------------------------------------------------------- */
.status-card { text-align: center; padding: 26px 20px; }
.status-card h2 { margin: 12px 0 4px; font-size: 19px; }
.status-dot {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto;
  background: var(--brand);
  /* A ring rather than a flat disc: it reads as a live indicator without
     needing a colour the user has to decode. */
  box-shadow: 0 0 0 8px rgba(30, 99, 208, .15);
}
.status-dot.off { background: #94a3b8; box-shadow: 0 0 0 8px rgba(148, 163, 184, .18); }

/* --- location control + map sheet ---------------------------------------- */
.location-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: auto; margin: 14px auto 0; min-height: 36px;
  background: none; border: none; color: var(--muted); font-size: 12px;
}
.location-btn.ready { color: var(--brand); }
.location-btn .bi { width: 15px; height: 15px; }

.punch-result {
  margin: 12px 0 0; font-size: 13px; color: #15803d; font-weight: 600;
}

.see-all {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  width: auto; margin: 2px auto 0; min-height: 40px;
  background: none; border: none; color: var(--brand); font-size: 13px; font-weight: 600;
}
.see-all .bi { width: 14px; height: 14px; }

.sheet {
  position: fixed; inset: 0; z-index: 16;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 10px 18px; border-bottom: 1px solid var(--line);
  background: var(--card);
}
.sheet-head h2 { margin: 0; font-size: 16px; }
.sheet-body { flex: 1; display: flex; flex-direction: column; padding: 14px 18px 24px; gap: 10px; }
.sheet-body iframe { flex: 1; width: 100%; min-height: 260px; border: 1px solid var(--line); border-radius: 12px; }
.map-open {
  display: block; text-align: center; text-decoration: none;
  padding: 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--text);
}

/* --- PIN ----------------------------------------------------------------- */
.pin-avatar { margin: 0 auto 12px; }

.pindots {
  display: flex; gap: 14px; justify-content: center; margin: 22px 0 4px;
}
.pindots i {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); background: transparent;
  transition: background .12s ease, border-color .12s ease;
}
.pindots i.on { background: var(--brand); border-color: var(--brand); }
.pin-error { text-align: center; }

/* An on-screen keypad rather than a text input: iOS shows a full keyboard for
   numeric inputs in some locales, which covers the dots the user is watching. */
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 280px; margin: 22px auto 0;
}
.keypad button {
  margin: 0; min-height: 62px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); font-size: 22px; font-weight: 600;
}
.keypad button.wide { font-size: 15px; font-weight: 500; }
.keypad button:active { background: var(--bg); }
.keypad button.blank { visibility: hidden; }

.pin-setup { align-items: stretch; }

/* Two escapes from the lock screen, side by side. Neither is more correct than
   the other: one is for the person who knows their password, the other for the
   person who does not yet know that is all they need. */
.pin-links {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 4px;
}
/* width:auto — the base button rule stretches to full width, which would push
   the two links to opposite edges and strand the separator in between. */
.pin-links .link { width: auto; min-height: 44px; padding: 0 8px; margin: 0; }
.link-sep { color: var(--muted); font-size: 12px; line-height: 1; }

#pin-ident, #pin-company { margin: 2px 0 0; text-align: center; }
#pin-company { margin-bottom: 4px; }

/* --- forgot PIN ---------------------------------------------------------- */
.steps { list-style: none; padding: 0; margin: 0 0 8px; }
.step { text-align: left; margin-bottom: 12px; }
.step h2 { margin: 0 0 6px; font-size: 15px; }
.step p { margin: 0 0 8px; line-height: 1.55; }
.step .primary, .step .secondary { margin-top: 4px; }

.bullets { padding-left: 20px; margin: 0 0 10px; line-height: 1.6; }
.bullets li { margin-bottom: 3px; }

/* Not an error, not a success — a boundary of what this build can do. It reads
   as neither red nor green so it does not look like something went wrong. */
.note {
  background: var(--bg); border: 1px dashed var(--line);
  border-radius: 10px; padding: 10px 12px; margin: 4px 0 0;
  color: var(--muted); line-height: 1.5;
}

/* --- suggested actions --------------------------------------------------- */
.action-lead { margin: 0; line-height: 1.6; font-size: 14px; }

.actions { list-style: none; padding: 0; margin: 6px 0 0; }
.actions li {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 15px; margin-bottom: 9px;
}
.actions li.primary-action { border-color: var(--brand); }
.action-head { display: flex; align-items: center; gap: 9px; }
.action-head strong { font-size: 14px; }
.action-head .bi { width: 16px; height: 16px; flex: none; color: var(--muted); }
.actions li.primary-action .action-head .bi { color: var(--brand); }
.action-head .soon-tag { margin-left: auto; }
.actions li p { margin: 6px 0 0; line-height: 1.5; }
