/* HRMS Portal styles (from the approved prototype) */

/* =====================================================================
   HRMS Portal (staff) — UI prototype, iPhone first
   Tokens
     ink      #1F1F24  text, primary surfaces
     paper    #FFFFFF  cards / grouped lists
     ground   #F2F2F5  app background (iOS grouped grey, not the admin sand)
     red      #E1181E  brand action, taken from the Your Favourites logo
     sun      #FFC20E  logo yellow, small highlights only
     leaf     #1E8E5A  worked day, approved
     mustard  #C98A12  half day, pending
     brick    #C23B2B  leave / LOP / rejected
     slate    #8A8F98  day off, muted
   Type: DM Sans for everything; Zilla Slab only for money and day counts.
   The one bold idea: the week strip — seven day tiles, half days split on the diagonal.
   ===================================================================== */
:root {
    --ink: #1F1F24; --ink-2: #5B5E66; --ink-3: #9A9DA5;
    --paper: #FFFFFF; --ground: #F2F2F5; --line: #E6E6EB; --line-2: #D5D6DC;
    --chilli: #E1181E; --chilli-dark: #A8161A; --chilli-soft: #FDE6E6; --sun: #FFC20E; --sun-soft: #FFF3CC; --deep: #A8161A;
    --leaf: #1E8E5A; --leaf-soft: #E3F4EA;
    --mustard: #C98A12; --mustard-soft: #FBF1DB;
    --brick: #C23B2B; --brick-soft: #FBE6E3;
    --slate: #8A8F98; --slate-soft: #ECEDF0;
    --r-lg: 18px; --r: 12px; --r-sm: 9px;
    --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --num: "Zilla Slab", Georgia, serif;
    --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
    --tab-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
    font-family: var(--font); font-size: 16px; line-height: 1.4; color: var(--ink);
    background: #D9D9DE; -webkit-font-smoothing: antialiased; text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(225, 24, 30, .4); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* phone column: full screen on a phone, a centred phone-width column on a desktop for review */
.app {
    position: relative; max-width: 430px; min-height: 100%; margin: 0 auto;
    background: var(--ground); overflow: hidden;
}
@media (min-width: 600px) { .app { min-height: 100vh; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 20px 60px rgba(0,0,0,.12); } }

.view { display: none; min-height: 100vh; padding: calc(var(--safe-t) + 12px) 16px calc(var(--tab-h) + var(--safe-b) + 24px); }
.view.on { display: block; }
.view.no-tabs { padding-bottom: calc(var(--safe-b) + 24px); }

/* ---------- headers ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.big-title { margin: 6px 0 14px; font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.nav-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 6px 0 0; border: 0; background: none; color: var(--chilli); font-size: 17px; }
.nav-back svg { width: 22px; height: 22px; }
.nav-title { font-size: 17px; font-weight: 600; }

/* ---------- brand ---------- */
.mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--chilli); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.mark.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }

/* ---------- grouped lists (iOS style) ---------- */
.group { margin: 0 0 22px; background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.group-title { margin: 0 4px 8px; font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; }
.group-title a, .link { color: var(--chilli); font-weight: 500; text-decoration: none; font-size: 15px; background: none; border: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border: 0; width: 100%; background: none; text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .sub { display: block; font-size: 13px; color: var(--ink-2); }
.row .val { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.row .chev { width: 8px; height: 13px; color: var(--ink-3); flex-shrink: 0; }
.row-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.row-ico svg { width: 17px; height: 17px; }
.note { margin: -12px 6px 22px; font-size: 13px; color: var(--ink-2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border: 0; border-radius: 14px; font-size: 17px; font-weight: 600; }
.btn-primary { background: var(--chilli); color: #fff; }
.btn-primary:active { background: var(--chilli-dark); }
.btn-primary[disabled] { opacity: .45; }
.btn-plain { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); }
.btn-danger-text { background: none; color: var(--brick); }
.btn-block { width: 100%; }

/* ---------- inputs ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin: 0 4px 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.input {
    width: 100%; height: 52px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r);
    background: var(--paper); font-size: 17px; outline: none; -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 31, 36, .08); }
.input.bad { border-color: var(--brick); }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.pw { position: relative; }
.pw .input { padding-right: 56px; }
.pw-eye { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; background: none; color: var(--ink-3); display: grid; place-items: center; }
.pw-eye svg { width: 22px; height: 22px; }
.hint { margin: 6px 4px 0; font-size: 13px; color: var(--ink-2); }
.hint.warn { color: var(--mustard); }
.err { display: none; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r); background: var(--brick-soft); color: var(--brick); font-size: 15px; }
.err.on { display: block; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--chilli); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }   /* honeypot */

/* segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: #E3E3E8; margin-bottom: 14px; }
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: none; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- login ---------- */
.login { display: flex; flex-direction: column; min-height: calc(100vh - var(--safe-t) - var(--safe-b) - 36px); }
.login-head {
    margin: calc(-12px - var(--safe-t)) -16px 0;
    padding: calc(var(--safe-t) + 32px) 20px 58px;
    background: var(--chilli); color: #fff;
}
.logo-card { display: inline-flex; padding: 12px 16px; border-radius: 18px; background: #fff; box-shadow: 0 6px 20px rgba(120, 0, 0, .25); }
.logo-card img { display: block; width: 220px; height: auto; }
.login-head h1 { margin: 20px 0 4px; font-size: 28px; letter-spacing: -.02em; }
.login-head h1::after { content: ""; display: block; width: 44px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--sun); }
.login-head p { margin: 0; color: rgba(255, 255, 255, .9); }
#loginForm { position: relative; padding: 18px 16px 4px; margin: -34px -2px 0; border-radius: 20px; background: var(--paper); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.login-foot { margin-top: auto; padding-top: 28px; text-align: center; font-size: 13px; color: var(--ink-2); }
.lock { display: none; margin-bottom: 14px; padding: 14px; border-radius: var(--r); background: var(--slate-soft); font-size: 15px; }
.lock.on { display: block; }
.lock b { font-variant-numeric: tabular-nums; }

/* ---------- home ---------- */
.hello { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.hello h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.hello-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink-2); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:active { background: var(--brick-soft); color: var(--brick); }
.hello p { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #F6C3AE; font-family: var(--num); font-weight: 700; font-size: 17px; border: 0; }
.avatar.xl { width: 84px; height: 84px; font-size: 30px; }

/* the week strip: 7 day tiles, half days split on the diagonal */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 14px 12px 12px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; }
.day .dn { font-size: 12px; color: var(--ink-2); }
.tile {
    position: relative; width: 100%; aspect-ratio: 1 / 1.25; border-radius: 10px; overflow: hidden;
    display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--slate-soft);
}
.tile.fd  { background: var(--leaf); }
.tile.off { background: var(--slate-soft); color: var(--ink-2); }
.tile.lv  { background: var(--brick); }
.tile.lop { background: #7E2419; }
.tile.none { background: transparent; border: 1.5px dashed var(--line-2); color: var(--ink-3); }
.tile.half { background: linear-gradient(135deg, var(--leaf) 0 49.5%, var(--c2, var(--brick)) 50.5% 100%); }
.tile.today { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.tile span { position: relative; text-shadow: 0 1px 1px rgba(0,0,0,.15); }
.day .dd { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 16px 14px; font-size: 12px; color: var(--ink-2); }
.week-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.stat { padding: 14px; border-radius: var(--r-lg); background: var(--paper); border: 0; text-align: left; }
.stat small { display: block; font-size: 13px; color: var(--ink-2); }
.stat b { display: block; margin-top: 4px; font-family: var(--num); font-size: 28px; line-height: 1.1; }
.stat em { font-style: normal; font-size: 13px; color: var(--ink-2); }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--leaf-soft); color: var(--leaf); }
.pill.wait { background: var(--mustard-soft); color: #8A5C00; }
.pill.no { background: var(--brick-soft); color: var(--brick); }
.pill.mute { background: var(--slate-soft); color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- attendance ---------- */
.att-sum { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; padding: 14px 6px; }
.att-sum b { display: block; font-family: var(--num); font-size: 24px; }
.att-sum small { font-size: 12px; color: var(--ink-2); }
.att-row .tile { width: 36px; aspect-ratio: 1; flex-shrink: 0; font-size: 11px; }

/* ---------- leave ---------- */
.bal { padding: 16px; }
.bal-head { display: flex; justify-content: space-between; align-items: baseline; }
.bal-num { font-family: var(--num); font-size: 34px; line-height: 1; }
.bal-num small { font-family: var(--font); font-size: 15px; color: var(--ink-2); font-weight: 500; }
.bar { display: flex; height: 8px; margin: 12px 0 10px; border-radius: 4px; overflow: hidden; background: var(--slate-soft); }
.bar i { display: block; height: 100%; }
.bar-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.bar-key i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.fab { position: fixed; right: max(16px, calc(50vw - 215px + 16px)); bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 20; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px; border: 0; border-radius: 26px; background: var(--chilli); color: #fff; font-weight: 600; font-size: 16px; box-shadow: 0 8px 20px rgba(225, 24, 30, .32); }
.fab svg { width: 20px; height: 20px; }
.req-msg { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--ground); font-size: 14px; color: var(--ink); }
.req-msg.mgr { background: var(--leaf-soft); }
.req-msg small { display: block; margin-bottom: 2px; font-size: 12px; color: var(--ink-2); }

/* ---------- payslip ---------- */
.pay-hero { padding: 20px 18px; text-align: left; }
.pay-hero small { font-size: 14px; color: var(--ink-2); }
.money { font-family: var(--num); font-size: 44px; line-height: 1.05; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.money.sm { font-size: inherit; font-family: var(--font); letter-spacing: 0; }
.hide-amt .amt { filter: blur(9px); user-select: none; }
.eye-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper); font-size: 14px; font-weight: 500; }
.eye-btn svg { width: 18px; height: 18px; }
.split { display: flex; height: 10px; margin: 16px 0 8px; border-radius: 5px; overflow: hidden; }
.split i { display: block; }
.pay-line { display: flex; justify-content: space-between; gap: 12px; min-height: 44px; align-items: center; padding: 8px 16px; }
.pay-line + .pay-line { border-top: 1px solid var(--line); }
.pay-line.total { font-weight: 700; }
.pay-line span:last-child { font-variant-numeric: tabular-nums; }

/* ---------- profile ---------- */
.me { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 22px; }
.me h1 { margin: 12px 0 2px; font-size: 24px; }
.me p { margin: 0; color: var(--ink-2); }
.masked { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* password strength */
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 10px 4px 8px; }
.meter i { height: 5px; border-radius: 3px; background: var(--line-2); }
.meter.s1 i:nth-child(-n+1) { background: var(--brick); }
.meter.s2 i:nth-child(-n+2) { background: var(--mustard); }
.meter.s3 i:nth-child(-n+3) { background: #7FA83A; }
.meter.s4 i { background: var(--leaf); }
.rules { list-style: none; margin: 0 4px 16px; padding: 0; font-size: 14px; color: var(--ink-2); }
.rules li { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.rules li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2); flex-shrink: 0; }
.rules li.ok { color: var(--leaf); }
.rules li.ok::before { border-color: var(--leaf); background: var(--leaf) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }

/* ---------- tab bar ---------- */
.tabs {
    position: fixed; left: 50%; bottom: 0; z-index: 30; transform: translateX(-50%);
    width: 100%; max-width: 430px; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(var(--safe-b) + 4px);
    background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid rgba(0, 0, 0, .08);
}
.tabs[hidden] { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; border: 0; background: none; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.tab svg { width: 25px; height: 25px; }
.tab.on { color: var(--chilli); }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.on { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); animation: fade .2s ease; }
.sheet-card {
    position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 100%; max-width: 430px; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 16px calc(var(--safe-b) + 18px); border-radius: 18px 18px 0 0; background: var(--ground);
    animation: up .25s cubic-bezier(.2, .8, .2, 1);
}
.sheet-grip { width: 38px; height: 5px; margin: 0 auto 8px; border-radius: 3px; background: var(--line-2); }
.sheet-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 8px; }
.sheet-top b { font-size: 17px; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: .5; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.count { text-align: right; font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.days-pill { display: inline-block; margin: -4px 4px 14px; font-size: 14px; color: var(--ink-2); }
.days-pill b { color: var(--ink); }

/* toast */
.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); z-index: 70; transform: translate(-50%, -140%); width: calc(100% - 32px); max-width: 398px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.toast.on { transform: translate(-50%, 0); }

/* privacy screen when the app goes to the background (app switcher shows this, not payslips) */
.privacy { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; background: var(--ground); }
.privacy img { width: 220px; height: auto; }
.privacy.on { display: grid; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); font-size: 15px; }

/* ================= brand inside the app (logo colours) ================= */
/* home: red band like the sign-in page */
#v-home .hello {
    margin: calc(-12px - var(--safe-t)) -16px 18px; padding: calc(var(--safe-t) + 22px) 16px 22px;
    background: var(--chilli); color: #fff;
}
#v-home .hello p { color: rgba(255, 255, 255, .88); }
#v-home .hello .avatar { background: var(--sun); color: var(--deep); }
#v-home .hello .icon-btn { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .35); color: #fff; }
#v-home .hello .icon-btn:active { background: rgba(255, 255, 255, .3); color: #fff; }
/* page titles carry the logo yellow bar */
.big-title::after { content: ""; display: block; width: 36px; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--sun); }
/* avatars in logo yellow */
.avatar { background: var(--sun); color: var(--deep); }
/* numbers and balances in the logo's deep red */
.stat b, .bal-num, .att-sum b { color: var(--deep); }
.stat { border-top: 3px solid var(--sun); }
/* waiting = logo yellow */
.pill.wait { background: var(--sun-soft); color: #8A5A00; }
.today-ring, .tile.today { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--chilli); }
/* active segment and focus in brand red */
.seg button.on { color: var(--chilli); }
.input:focus { border-color: var(--chilli); box-shadow: 0 0 0 3px rgba(225, 24, 30, .12); }
.check input { accent-color: var(--chilli); }
/* tab bar: red dot under the active tab */
.tab.on { position: relative; }
.tab.on::after { content: ""; position: absolute; bottom: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--chilli); }
/* payslip PDF pill */
.dl-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; background: var(--chilli); color: #fff; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.dl-pill svg { width: 16px; height: 16px; }

/* ================= week tiles: light colours ================= */
.tile { color: var(--ink); border: 1px solid transparent; }
.tile span { text-shadow: none; }
.tile.fd  { background: #DAF1E3; border-color: #B5DEC6; color: #16704A; }
.tile.lv  { background: #FADBD7; border-color: #EFBDB6; color: #A62A1F; }
.tile.lop { background: #F7D9D5; border-color: #E9B3AC; color: #7E2419; }
.tile.off { background: var(--slate-soft); border-color: #DDDFE4; color: var(--ink-2); }
.tile.half {
    background: linear-gradient(135deg, #CBEAD8 0 49%, rgba(0,0,0,.08) 49% 51%, var(--c2, #F5CDC7) 51% 100%);
    border-color: #E3D3CC; color: var(--ink);
}
.week-legend i { border: 1px solid rgba(0, 0, 0, .08); }

/* ---------- live data additions ---------- */
.avatar { overflow: hidden; padding: 0; }
.avatar img { display: block; }
#homeStats[hidden], #meDocsWrap[hidden], #loginsWrap[hidden] { display: none !important; }
/* leave tab: room under the list so the Request leave button never covers the last card */
#v-leave { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 100px); }
