/* Workforce Management (KP). Navy #101B3D and gold #C9A227. Fonts are stored in this app (Inter and Poppins, SIL Open Font License) so they also work offline. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/poppins-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/poppins-latin-600-normal.woff2") format("woff2");
}

:root {
  --navy: #101B3D;
  --navy-2: #1D2B5A;
  --blue: #101B3D;
  --blue-dark: #0A1230;
  --sky: #C9A227;
  --gold-text: #7A5C00;
  --bg: #F4F5F8;
  --card: #FFFFFF;
  --line: #E1E4EC;
  --field: #C8CDDA;
  --text: #101B3D;
  --muted: #5A6379;
  --ok-bg: #DDF3E8;
  --ok: #0E5A3A;
  --warn-bg: #FDEFCF;
  --warn: #6F4300;
  --bad-bg: #FBE0E0;
  --bad: #8A1C1C;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Poppins", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; font-family: var(--font-head); font-weight: 600; }

a { color: var(--blue); }

/* ---------- shared form pieces ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }

form { display: flex; flex-direction: column; gap: 14px; }

input[type="text"], input[type="tel"], input[type="password"], input[type="date"], input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--field);
  border-radius: 10px;
}

input::placeholder { color: #5A6379; opacity: 1; }

input:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(11, 111, 184, 0.45);
  outline-offset: 2px;
}

.pinwrap { position: relative; }
.pinwrap input { padding-right: 76px; }
.pinwrap .toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}

.btn {
  min-height: 48px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--field); }
.btn.secondary:hover { background: #F4F5F8; }
.btn[disabled] { opacity: 0.6; cursor: default; }

.message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--bad-bg);
  color: var(--bad);
}
.message:empty { display: none; }
.message.info { background: #ECEEF5; color: #1D2B5A; }
.message.warn { background: var(--warn-bg); color: var(--warn); }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chip { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E7E9F0; color: #434B63; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 20px; }
.card.pad { padding: 20px; }
.card h2 { font-size: 17px; }
.card .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .k { color: var(--muted); }

/* ---------- sign-in and setup screens ---------- */

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 16px;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.brand img { width: clamp(88px, 26vw, 112px); height: auto; border-radius: 22%; }
.brand h1 { font-size: clamp(20px, 5vw, 24px); }

.panel {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 22px;
}
.panel h2 { font-size: 18px; margin-bottom: 4px; }
.panel .lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.foot { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

/* ---------- app shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 12px;
  background: var(--navy);
  color: #CDD2DE;
}

.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.side-brand img { width: 48px; height: 48px; border-radius: 22%; flex: 0 0 auto; }
.side-brand .t1 { display: block; font-family: var(--font-head); font-weight: 600; font-size: 17px; color: #fff; line-height: 1.2; }
.side-brand .t2 { display: block; font-size: 12px; color: #B8C0D8; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9AA3BD;
}

.navlink {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: #CDD2DE;
  text-decoration: none;
  font-weight: 500;
}
.navlink:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.navlink.active { background: var(--navy-2); color: #fff; font-weight: 600; }
.navlink svg { flex: 0 0 auto; }
.lbl-short { display: none; }

.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--navy-2);
}
.side-user .nm { display: block; color: #fff; font-weight: 600; line-height: 1.25; }
.side-user .rl { display: block; font-size: 12px; color: #B8C0D8; }
.side-user .txt { min-width: 0; }
.side-user .nm, .side-user .rl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sky);
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
}

.main-col { min-width: 0; display: flex; flex-direction: column; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-logo { display: none; width: 34px; height: 34px; border-radius: 22%; }
.top h1 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { position: relative; display: flex; align-items: center; gap: 12px; }

.net { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.net::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.net.off { background: var(--warn-bg); color: var(--warn); }

.userbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 6px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.userbtn:hover { background: #F4F5F8; }

.pop {
  position: absolute;
  top: 54px;
  right: 0;
  width: 270px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(1, 24, 66, 0.16);
}
.pop[hidden] { display: none; }
.pop .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pop .who strong { display: block; }
.pop .who span { display: block; font-size: 13px; color: var(--muted); }
.pop button, .pop a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.pop button:hover, .pop a:hover { background: #F4F5F8; }

.view { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; outline: none; }

.empty { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .ic { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #ECEEF5; color: #1D2B5A; margin-bottom: 8px; }
.empty h2 { font-size: 18px; }
.empty p { margin: 0; max-width: 420px; color: var(--muted); }

.tabs { display: none; }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(1, 24, 66, 0.55); }
.scrim[hidden] { display: none; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sheet[hidden] { display: none; }
.sheet .grab { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--field); margin-bottom: 8px; }
.sheet .sheet-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.sheet .sheet-link.active { background: #ECEEF5; color: #1D2B5A; font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-weight: 500;
}

.profile-actions { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 0 12px; }
.profile-actions[hidden], .pop button[hidden] { display: none; }

.row > span:last-child { text-align: right; }

.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  background: #ECEEF5;
  color: #1D2B5A;
}

.update-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 30px rgba(1, 24, 66, 0.3);
}
.update-bar button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--sky);
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Tablet: slim icon sidebar with short labels */
@media (max-width: 1023px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr); }
  .side { padding: 14px 6px; gap: 18px; align-items: stretch; }
  .side-brand { justify-content: center; padding: 0; }
  .side-brand .txt { display: none; }
  .side-brand img { width: 44px; height: 44px; }
  .nav-label { display: none; }
  .side-nav { gap: 2px; }
  .navlink { flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 2px; text-align: center; font-size: 11px; line-height: 1.2; }
  .lbl-full { display: none; }
  .lbl-short { display: block; }
  .side-user { justify-content: center; padding: 8px 0; background: transparent; }
  .side-user .txt { display: none; }
  .top { padding: 0 20px; }
  .view { padding: 20px; }
}

/* Phone: bottom tabs */
@media (max-width: 639px) {
  .shell { display: block; }
  .side { display: none; }
  .top { padding: 0 16px; min-height: 60px; }
  .top-logo { display: block; }
  .top h1 { font-size: 18px; }
  .net .net-text { display: none; }
  .net { padding: 0; width: 30px; justify-content: center; }
  .net::before { margin: 0; }
  .userbtn .uname { display: none; }
  .view { padding: 16px 16px calc(92px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    padding: 0 4px env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
  }
  .tab.active { color: var(--blue); font-weight: 600; }
  .pop { position: fixed; top: 64px; right: 12px; left: auto; width: min(270px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* ---------- users and audit screens ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .vh { font-size: 17px; }
.toolbar .sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.card.tbl { padding: 0; overflow: hidden; }
.trow { display: grid; grid-template-columns: minmax(180px, 1.4fr) auto minmax(150px, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.tmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.tmain .sub, .tmeta { color: var(--muted); font-size: 13px; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fchip { min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field); background: #fff; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fchip.on { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.more { display: flex; justify-content: center; margin: 14px 0; }
.more[hidden], .more button[hidden] { display: none; }
#a-list .trow { grid-template-columns: 1fr auto; }

.modal-scrim { position: fixed; inset: 0; background: rgba(1, 24, 66, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 18px; margin-bottom: 12px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.modal-body p { margin: 0; }
.modal .sub { color: var(--muted); font-size: 14px; margin: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal .message { margin-top: 4px; }
.pinshow { font-family: var(--font-head); font-size: 32px; letter-spacing: 0.3em; text-align: center; padding: 14px; background: var(--bg); border-radius: 12px; user-select: all; }

@media (max-width: 720px) {
  .trow { grid-template-columns: 1fr; padding: 14px 16px; }
  .tacts { justify-content: flex-start; }
  #a-list .trow { grid-template-columns: 1fr; }
}

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 420px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); min-height: 108px; }
a.tile:hover { border-color: var(--blue); }
.tile .tl { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .tv { font-family: var(--font-head); font-size: 24px; line-height: 1.2; white-space: nowrap; }
.tile .ts { font-size: 13px; color: var(--muted); }
.tile.late { border-color: #E9B4B4; background: #FFF8F7; }
.tile.late .ts { color: var(--bad); font-weight: 600; }
.rbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); margin: 12px 0; }
.seg-pos { background: #1E8E5A; } .seg-med { background: #D98E04; } .seg-neg { background: #C0392B; } .seg-none { background: #8A97AD; }
.rleg { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin-bottom: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.ch { font-size: 16px; padding: 16px 20px 6px; }
.lrow { grid-template-columns: 1fr auto; text-decoration: none; color: inherit; }
.lrow:hover { background: #F4F5F8; }
@media (max-width: 720px) { .lrow { grid-template-columns: 1fr; } }

.cache-note { position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; max-width: min(560px, calc(100vw - 24px)); z-index: 60;
  background: #fff4e0; color: #7a4a00; border: 1px solid #f0c987; border-radius: 10px; padding: 9px 14px; font-size: 13px; box-shadow: 0 4px 14px rgba(16,27,61,.18); }
@media (min-width: 900px) { .cache-note { bottom: 18px; } }

/* Page controls */
.pager-host { margin: 14px 0 6px; }
.pager { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; font-size: 13px; color: #5A6379; }
.pager-ctrl { display: flex; align-items: center; gap: 6px; }
.pager-nums { display: flex; align-items: center; gap: 4px; }
.pg { min-width: 36px; height: 36px; padding: 0 12px; border: 1px solid #CDD2DE; background: #fff; color: #101B3D; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.pg:hover:not(:disabled) { background: #EEF0F6; }
.pg:focus-visible { outline: 2px solid #101B3D; outline-offset: 2px; }
.pg.on { background: #101B3D; border-color: #101B3D; color: #fff; }
.pg:disabled { opacity: .45; cursor: default; }
.pg-gap { padding: 0 4px; color: #7a889c; }
.pager-phone { display: none; font-weight: 600; color: #101B3D; padding: 0 6px; }
@media (max-width: 640px) {
  .pager { flex-direction: column; align-items: stretch; text-align: center; }
  .pager-ctrl { justify-content: space-between; }
  .pager-nums { display: none; }
  .pager-phone { display: inline; }
  .pg { flex: 0 0 auto; }
}
@media print { .pager-host { display: none; } }

/* ----- profile photos ----- */
.avatar.has-photo { padding: 0; overflow: hidden; background: #fff; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
