:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #6b7486;
  --line: #e3e7ef;
  --primary: #2f5bea;
  --primary-ink: #ffffff;
  --ok: #12925a;
  --ok-bg: #e5f6ee;
  --bad: #d23b3b;
  --bad-bg: #fdecec;
  --warn: #b7791f;
  --warn-bg: #fdf4e3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420; --card: #171e2d; --text: #e7ebf3; --muted: #97a0b3; --line: #273047;
    --primary: #5b80ff; --ok: #34c785; --ok-bg: #12301f; --bad: #ff6b6b; --bad-bg: #3a1a1d;
    --warn: #f0b552; --warn-bg: #3a2c12;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.wrap.narrow { max-width: 560px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* Buttons & inputs */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.big { padding: 14px 18px; font-size: 1.05rem; border-radius: 12px; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 0 0 4px; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type=checkbox] { width: auto; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.mute { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* Tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 12px 12px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab { display: none; }
.tab.active { display: block; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.8rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td .thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; cursor: zoom-in; display: block; background: var(--bg); }
.empty { text-align: center; color: var(--muted); padding: 24px; }

/* Map */
.map { height: 420px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }
.map.tall { height: 60vh; min-height: 360px; }
.map.small { height: 260px; }

/* Live list */
.live-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.live-list { max-height: 60vh; overflow: auto; }
.live-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; }
.live-item:hover { background: var(--bg); }
.live-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.live-item .info { flex: 1; min-width: 0; }
.live-item .nm { font-weight: 600; }
@media (max-width: 860px) { .live-grid { grid-template-columns: 1fr; } }

/* Staff page */
.cam-box { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; margin: 0 auto; }
.cam-box video, .cam-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-box video.mirror { transform: scaleX(-1); }
.cam-box .cam-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 20px; font-size: .95rem; }
.geo-box { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; margin-bottom: 12px; }
.geo-box.ok { background: var(--ok-bg); color: var(--ok); }
.geo-box.bad { background: var(--bad-bg); color: var(--bad); }
.geo-box.wait { background: var(--warn-bg); color: var(--warn); }
.geo-box .ico { font-size: 1.6rem; }
.geo-box .t { font-weight: 700; }
.geo-box .s { font-size: .85rem; opacity: .9; }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.times .box { background: var(--bg); border-radius: 12px; padding: 12px; text-align: center; }
.times .v { font-size: 1.4rem; font-weight: 800; }
.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); margin-right: 6px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(18,146,90,.6); } 100% { box-shadow: 0 0 0 10px rgba(18,146,90,0); } }

/* Auth page */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 24px; }
.auth .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 18px; }
.err { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: .9rem; display: none; }
.err.show { display: block; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 15, 30, .55); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal-bg.show { display: flex; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 860px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 10px; display: block; margin: 0 auto; }

/* Toasts */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: #1b2333; color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; font-weight: 500; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
.toast.hide { opacity: 0; transform: translateY(10px); }

@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .card { padding: 14px; }
  .hide-sm { display: none; }
}
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* ---------- Payroll ---------- */
.sec { margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; color: var(--primary); font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; }
.modal .sec:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--muted); font-weight: 600; user-select: none; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.preview { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin: 6px 0 12px; font-size: .9rem; }
.pv-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin-top: 8px; max-width: 360px; }
.pv-grid b { text-align: right; font-variant-numeric: tabular-nums; }
.pv-grid .big { font-size: 1.15rem; color: var(--ok); }
.bad-input { color: var(--bad) !important; border-color: var(--bad) !important; }
.note-box { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: .9rem; }
.note-box.info, .alert-box.info { background: color-mix(in srgb, var(--primary) 10%, var(--card)); color: var(--text); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line)); }
.note-box.warn, .alert-box.warn { background: var(--warn-bg); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); }
.alert-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 12px; flex-wrap: wrap; }
.stat .n.sm { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.num-table td, .num-table th { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.num-table td.txt, .num-table th:first-child, .num-table th:last-child { text-align: left; }
.num-table td:first-child { text-align: left; white-space: normal; min-width: 150px; }

/* Day calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-head div { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); }
.cal-cell { border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-height: 92px; display: flex; flex-direction: column; gap: 4px; background: var(--card); min-width: 0; }
.cal-cell.empty { border: 0; background: none; }
.cal-cell.manual { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-top { display: flex; justify-content: space-between; align-items: center; }
.cal-st { font-size: .72rem; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: rgba(127,127,127,.15); }
.cal-info { font-size: .72rem; color: var(--muted); line-height: 1.3; flex: 1; overflow-wrap: anywhere; }
.cal-cell select { padding: 4px 6px; font-size: .78rem; border-radius: 7px; }
.st-P { background: var(--ok-bg); }  .st-P .cal-st { background: var(--ok); color: #fff; }
.st-HD { background: var(--warn-bg); } .st-HD .cal-st { background: var(--warn); color: #fff; }
.st-A { background: var(--bad-bg); }  .st-A .cal-st { background: var(--bad); color: #fff; }
.st-L { background: color-mix(in srgb, var(--primary) 12%, var(--card)); } .st-L .cal-st { background: var(--primary); color: #fff; }
.st-WO, .st-HO { background: var(--bg); }
.st-HO .cal-st { background: #8b5cf6; color: #fff; }
.st-NJ, .st-FUT { opacity: .6; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.legend .lg { padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); }
.legend .lg.manual { box-shadow: inset 0 0 0 2px var(--primary); }
@media (max-width: 600px) {
  .cal { gap: 3px; }
  .cal-cell { padding: 4px 3px; min-height: 74px; border-radius: 7px; }
  .cal-info { display: none; }
  .cal-cell select { font-size: .68rem; padding: 2px; }
  .cal-head div { font-size: .68rem; }
}

/* Staff page: month summary */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
.mini-stats div { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.mini-stats b { display: block; font-size: 1.3rem; }
.mini-stats span { font-size: .75rem; color: var(--muted); }
.slip-list a { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }

/* Login tabs */
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 10px; }
.login-tabs button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; padding: 10px; border-radius: 9px; cursor: pointer; }
.login-tabs button.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .72rem; line-height: 18px; text-align: center; margin-left: 4px; }

/* Staff portal */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .hd { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .d { border: 1px solid var(--line); border-radius: 8px; padding: 4px; min-height: 52px; font-size: .75rem; background: var(--card); }
.cal .d .n { font-weight: 700; }
.cal .d .s { display: inline-block; margin-top: 2px; padding: 0 5px; border-radius: 6px; font-weight: 700; font-size: .68rem; }
.cal .d.today { outline: 2px solid var(--primary); }
.s-P { background: var(--ok-bg); color: var(--ok); }
.s-HD { background: var(--warn-bg); color: var(--warn); }
.s-A { background: var(--bad-bg); color: var(--bad); }
.s-L { background: #e6eefc; color: #2f5bea; }
.s-WO, .s-HO, .s-NJ, .s-FUT { background: var(--bg); color: var(--muted); }
.bal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.bal { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.bal .v { font-size: 1.4rem; font-weight: 800; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ======================================================================
   Brand logo (config.php brand_badge())
   ====================================================================== */
.logo-img { height: 32px; max-width: 140px; object-fit: contain; border-radius: 6px; display: block; }

/* Login page footer */
.ep-auth { grid-template-rows: 1fr auto; gap: 12px; }
.ep-auth-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 4px 0 8px; }

/* ======================================================================
   Employee portal (staff.php) – all classes prefixed "ep-"
   ====================================================================== */
body.ep { --nav-w: 84px; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
body.ep #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* Top bar */
.ep-top {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line);
}
.ep-brand { color: var(--text); text-decoration: none; min-width: 0; flex: 1 1 auto; }
.ep-co { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ep-co-sub { font-size: .7rem; font-weight: 600; color: var(--muted); }
.ep-top-r { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ep-top-r .btn svg { width: 18px; height: 18px; }
.ep-search { position: relative; order: 3; flex: 1 1 100%; }
.ep-search input { height: 40px; padding: 8px 14px 8px 38px; border-radius: 999px; }
.ep-search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); display: flex; color: var(--muted); pointer-events: none; }
.ep-search-ico svg { width: 18px; height: 18px; }
.ep-search-res {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1200;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 36px rgba(10, 20, 40, .2); padding: 6px; max-height: 60vh; overflow: auto;
}
.ep-search-res[hidden] { display: none; }
.ep-res {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.ep-res.on, .ep-res:hover { background: color-mix(in srgb, var(--primary) 11%, var(--card)); }
.ep-res-i { width: 22px; text-align: center; flex: 0 0 auto; }
.ep-res-t { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.ep-res-g { font-size: .74rem; color: var(--muted); white-space: nowrap; }

/* Navigation: bottom tab bar on phones, vertical icon sidebar on larger screens */
.ep-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
  display: flex; justify-content: space-around; gap: 2px;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 14px rgba(10, 20, 40, .07);
}
.ep-nav a {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 10px; color: var(--muted); text-decoration: none;
  font-size: .66rem; font-weight: 600; white-space: nowrap;
}
.ep-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ep-nav a svg { width: 22px; height: 22px; }
.ep-nav a.active { color: var(--primary); }
.ep-nav a.active svg { stroke-width: 2.3; }
.ep-nav-me { display: none !important; }
.ep-badge {
  position: absolute; top: 1px; left: calc(50% + 5px); min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: .64rem; line-height: 17px; text-align: center; font-weight: 700;
}
.ep-badge[hidden] { display: none; }

/* Main area & sections */
.ep-main { max-width: 1320px; margin: 0 auto; padding: 14px; }
.ep-sec { display: none; }
.ep-sec.active { display: block; animation: epIn .22s ease; }
@keyframes epIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ep-sec [id] { scroll-margin-top: 128px; }
.ep-narrow { max-width: 900px; margin: 0 auto; }
.ep-sec-h { margin: 4px 2px 14px; }
.ep-sec-h h1 { margin: 0; font-size: 1.4rem; }
.ep-sec-h p { margin: 4px 0 0; }
.ep-empty { color: var(--muted); font-size: .88rem; text-align: center; padding: 12px 6px; }
.card.ep-empty { padding: 26px 16px; }
.ep-flash { animation: epFlash 1.6s ease; }
@keyframes epFlash { 0%, 45% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 55%, transparent); } 100% { box-shadow: var(--shadow); } }
.ep-link { appearance: none; border: 0; background: none; padding: 4px 0; color: var(--primary); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.ep-link:hover { text-decoration: underline; }
.ep-icon-btn {
  appearance: none; display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto;
  border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 1.05rem; cursor: pointer;
}
.ep-icon-btn:hover:not(:disabled) { background: var(--bg); border-color: var(--line); color: var(--text); }
.ep-icon-btn:disabled { opacity: .35; cursor: default; }
.ep-sp { flex: 1; }

/* Card header */
.ep-ch { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ep-ch h3 { margin: 0; font-size: .98rem; }
.ep-ch a { text-decoration: none; font-weight: 600; }

/* Avatars (initials circle; photo laid over it when available) */
.ep-av {
  --s: 40px; position: relative; flex: 0 0 auto; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center; background: hsl(var(--h, 220) 55% 46%); color: #fff;
  font-weight: 700; font-size: calc(var(--s) * .38); line-height: 1; user-select: none;
}
.ep-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ep-av.sm { --s: 30px; }
.ep-av.lg { --s: 52px; }
.ep-av.xl { --s: 88px; }

/* Hero banner */
.ep-hero {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 12px; padding: 22px; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow);
  background: linear-gradient(120deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #7c3aed) 60%, color-mix(in srgb, var(--primary) 45%, #06b6d4));
}
.ep-hero::before, .ep-hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none; }
.ep-hero::before { width: 280px; height: 280px; right: -70px; top: -110px; }
.ep-hero::after { width: 160px; height: 160px; right: 220px; bottom: -110px; }
.ep-hero-l, .ep-hero-r { position: relative; z-index: 1; }
.ep-hero h1 { margin: 0 0 2px; font-size: 1.6rem; }
.ep-hero p { margin: 0 0 14px; opacity: .92; }
.ep-prof {
  display: inline-flex; flex-direction: column; gap: 6px; min-width: 220px; padding: 8px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .15); color: #fff; text-decoration: none; font-size: .82rem; font-weight: 600;
}
.ep-prof:hover { background: rgba(255, 255, 255, .22); }
.ep-bar { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.ep-bar i { display: block; height: 100%; border-radius: 3px; background: #fff; transition: width .6s ease; }
.ep-hero-r { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
.ep-hero-date { font-size: 1.05rem; font-weight: 700; }
.ep-hero-btn {
  appearance: none; border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer;
  background: #fff; color: var(--primary); font: inherit; font-weight: 800; box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.ep-hero-btn:hover { transform: translateY(-1px); }
.ep-hero-btn.done { background: rgba(255, 255, 255, .2); color: #fff; box-shadow: none; }
.ep-hero-punch { font-size: .8rem; opacity: .92; }

/* Quick actions */
.ep-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.ep-quick button {
  appearance: none; border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; cursor: pointer;
  background: var(--bg); color: var(--text); font: inherit; font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ep-quick button:hover { border-color: var(--primary); color: var(--primary); }

/* Home grid: phone = 1 column, tablet = 2, desktop = 3 */
.ep-grid { display: grid; gap: 0 16px; align-items: start; grid-template-columns: minmax(0, 1fr); grid-template-areas: "l" "r" "m"; }
.ep-col-l { grid-area: l; }
.ep-col-m { grid-area: m; }
.ep-col-r { grid-area: r; }

/* Action needed */
.ep-act {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 10px; border-radius: 10px;
  background: var(--bg); border: 1px solid transparent; color: var(--text); text-decoration: none;
}
.ep-act:last-child { margin-bottom: 0; }
.ep-act:hover { border-color: var(--primary); }
.ep-act-i { font-size: 1.2rem; }
.ep-act-t { flex: 1; font-size: .87rem; font-weight: 600; }
.ep-act-c { color: var(--primary); font-size: .8rem; font-weight: 700; white-space: nowrap; }

/* People rows (celebrations) */
.ep-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ep-person:last-child { border-bottom: 0; }
.ep-person-i { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ep-person-i b { font-size: .9rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ep-today { color: var(--ok); font-weight: 700; }

/* Leave balance mini + holidays */
.ep-hbal { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.ep-hbal-i { display: flex; flex-direction: column; padding: 10px 6px; border-radius: 10px; background: var(--bg); text-align: center; }
.ep-hbal-i b { font-size: 1.35rem; color: var(--primary); line-height: 1.2; }
.ep-hbal-i span { font-size: .78rem; font-weight: 700; }
.ep-hbal-i small { font-size: .7rem; }
.ep-hol { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.ep-hol-d {
  display: flex; flex-direction: column; flex: 0 0 auto; width: 46px; padding: 4px 0; border-radius: 10px; line-height: 1.1; text-align: center;
  background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary);
}
.ep-hol-d b { font-size: 1.15rem; }
.ep-hol-d span { font-size: .66rem; font-weight: 700; text-transform: uppercase; }

/* Feed */
.ep-composer { padding: 12px; }
.ep-composer-row { display: flex; align-items: flex-start; gap: 10px; }
.ep-composer textarea { min-height: 44px; border-radius: 12px; resize: vertical; }
.ep-composer-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.ep-post { padding: 14px; }
.ep-post.ann { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.ep-post-h { display: flex; align-items: center; gap: 10px; }
.ep-post-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ep-post-who b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ep-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ep-kind { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: .75rem; font-weight: 700; }
.ep-kind.ann { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); border-color: transparent; }
.ep-kind.wish { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.ep-post-b { margin: 10px 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ep-post-f { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ep-react {
  appearance: none; border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer;
  background: none; color: var(--muted); font: inherit; font-size: .86rem; font-weight: 600;
}
.ep-react:hover { background: var(--bg); color: var(--text); }
.ep-react.on { background: color-mix(in srgb, var(--primary) 11%, var(--card)); color: var(--primary); }
.ep-cmts { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ep-cmt { display: flex; gap: 8px; margin-bottom: 8px; }
.ep-cmt-b { flex: 1; min-width: 0; padding: 6px 10px; border-radius: 10px; background: var(--bg); font-size: .88rem; }
.ep-cmt-b div { white-space: pre-wrap; overflow-wrap: anywhere; }
.ep-cmt-f { display: flex; gap: 8px; }
.ep-cmt-f input { padding: 8px 14px; border-radius: 999px; }

/* Team */
.ep-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 12px 6px; }
.ep-team .ep-empty { grid-column: 1 / -1; }
.ep-tm { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ep-tm .ep-av { --s: 44px; }
.ep-tm .ep-dot { position: absolute; top: 31px; left: calc(50% + 11px); width: 13px; height: 13px; border: 2px solid var(--card); }
.ep-tm-n { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .72rem; color: var(--muted); }
.ep-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.ep-dot.in { background: var(--ok); }
.ep-dot.out { background: #9aa3b5; }
.ep-dot.leave { background: #3b82f6; }
.ep-dot.absent { background: var(--bad); }
.ep-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 14px; font-size: .74rem; color: var(--muted); }
.ep-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* Mini calendar */
.ep-mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.ep-mcal-h { padding: 2px 0; font-size: .7rem; font-weight: 700; color: var(--muted); }
.ep-mc {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: .78rem; font-weight: 600;
}
.ep-c-P { background: var(--ok-bg); color: var(--ok); }
.ep-c-HD { background: var(--warn-bg); color: var(--warn); }
.ep-c-A { background: var(--bad-bg); color: var(--bad); }
.ep-c-L { background: color-mix(in srgb, #3b82f6 18%, var(--card)); color: #3b82f6; }
.ep-c-WO, .ep-c-HO { background: transparent; color: var(--muted); }
.ep-c-NJ, .ep-c-FUT { background: transparent; color: var(--muted); opacity: .6; }
.ep-mc.hol::after { content: ""; position: absolute; bottom: 3px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: #8b5cf6; }
.ep-mc.today { outline: 2px solid var(--primary); outline-offset: -1px; }
.ep-mcal-lg { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; font-size: .72rem; color: var(--muted); }
.ep-mcal-lg i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 3px; vertical-align: -1px; border: 1px solid var(--line); }
.ep-mcal-lg i.ep-lg-hol { background: #8b5cf6; border-color: #8b5cf6; border-radius: 50%; }
.ep-hcal-hol { margin-top: 8px; display: grid; gap: 2px; }

/* Attendance section */
.ep-att-grid { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.ep .cam-box { max-width: 420px; }

/* Policies */
.ep-pol-g { margin-bottom: 18px; }
.ep-pol-g > h3 { margin: 0 0 8px 2px; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ep-pol-g.hot > h3 { color: var(--warn); }
.ep-pol-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); font-size: .72rem; text-align: center; }
.ep-pol { padding: 14px; margin-bottom: 10px; }
.ep-pol.pending { border-left: 4px solid var(--warn); }
.ep-pol-h { display: flex; align-items: flex-start; gap: 12px; }
.ep-pol-t { flex: 1; min-width: 0; }
.ep-pol-t h4 { margin: 0 0 2px; font-size: 1rem; overflow-wrap: anywhere; }
.ep-pol-ico { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
.ep-pol-desc { margin-top: 10px; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ep-pol-desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep-pol-f { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }

/* Profile */
.ep-prof-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.ep-prof-head .info { flex: 1; min-width: 200px; }
.ep-prof-head h2 { margin: 0; font-size: 1.3rem; }
.ep-prof-bar { max-width: 340px; margin-top: 10px; }
.ep-prof-bar .ep-bar { margin: 4px 0; background: var(--line); }
.ep-prof-bar .ep-bar i { background: var(--ok); }

@media (max-width: 600px) {
  .ep-main { padding: 10px; }
  .ep-hero { padding: 18px; }
  .ep-hero h1 { font-size: 1.35rem; }
  .ep-hero-r { width: 100%; align-items: stretch; text-align: left; }
  .ep-hero-btn { width: 100%; }
  .ep-prof { width: 100%; min-width: 0; }
  .ep-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ep-composer-f .muted { display: none; }
  .ep-composer-f { justify-content: flex-end; }
}
@media (min-width: 760px) {
  body.ep { padding-bottom: 0; padding-left: var(--nav-w); }
  body.ep #toasts { bottom: 20px; }
  .ep-top { flex-wrap: nowrap; padding: 10px 20px; }
  .ep-brand { flex: 0 1 auto; }
  .ep-search { order: 0; flex: 1 1 auto; max-width: 620px; margin: 0 auto; }
  .ep-main { padding: 18px 20px; }
  .ep-sec [id] { scroll-margin-top: 80px; }
  .ep-nav {
    top: 0; right: auto; bottom: 0; width: var(--nav-w); z-index: 1100;
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 12px 8px;
    border-top: 0; border-right: 1px solid var(--line); box-shadow: none;
  }
  .ep-nav a { flex: 0 0 auto; padding: 10px 4px; font-size: .7rem; }
  .ep-nav a:hover { background: var(--bg); color: var(--text); }
  .ep-nav a.active, .ep-nav a.active:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
  .ep-nav-me { display: flex !important; margin-top: auto; }
  .ep-badge { top: 4px; }
  .ep-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "l r" "m m"; }
}
@media (min-width: 1000px) {
  .ep-att-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 1180px) {
  .ep-grid { grid-template-columns: minmax(0, 290px) minmax(0, 1fr) minmax(0, 300px); grid-template-areas: "l m r"; }
}

/* Login page: logo with the full company name underneath */
.auth .brand.brand-stack { flex-direction: column; gap: 8px; text-align: center; }
.auth .brand.brand-stack .logo-img { height: auto; width: auto; max-height: 64px; max-width: 260px; }
.auth .brand.brand-stack .brand-full { font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; }

/* ===== Login page: IT / tech 3D background ===== */
body.tech-body { background: #050b1f; }
.tech-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 600px at 15% 10%, #13265e 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 90%, #0e3a5c 0%, transparent 60%),
              linear-gradient(160deg, #060d26 0%, #0a1638 45%, #071027 100%); }
.tech-bg canvas { position: absolute; inset: 0; }
.tech-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; }
.tech-glow.g1 { width: 420px; height: 420px; background: #2f5bea; top: -120px; left: -80px; animation: techFloat 14s ease-in-out infinite; }
.tech-glow.g2 { width: 380px; height: 380px; background: #06b6d4; bottom: -140px; right: -60px; animation: techFloat 18s ease-in-out infinite reverse; }
/* 3D perspective grid "floor" */
.tech-grid { position: absolute; left: -50%; right: -50%; bottom: -10%; height: 60%;
  background-image: linear-gradient(rgba(96,165,250,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(96,165,250,.35) 1px, transparent 1px);
  background-size: 60px 60px; transform: perspective(500px) rotateX(62deg); transform-origin: center top;
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%); mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
  animation: techGrid 6s linear infinite; }
/* Floating code snippets */
.tech-code { position: absolute; margin: 0; padding: 10px 14px; border-radius: 10px; font: 12px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
  color: #93c5fd; background: rgba(15, 30, 70, .45); border: 1px solid rgba(96,165,250,.25); box-shadow: 0 0 24px rgba(47,91,234,.25);
  white-space: pre; opacity: .55; transform-style: preserve-3d; animation: techFloat 12s ease-in-out infinite; }
.tech-code.c1 { top: 9%; left: 5%; transform: perspective(700px) rotateY(18deg) rotateX(6deg); }
.tech-code.c2 { top: 16%; right: 6%; color: #67e8f9; transform: perspective(700px) rotateY(-20deg); animation-delay: -3s; }
.tech-code.c3 { bottom: 22%; left: 4%; color: #a5b4fc; transform: perspective(700px) rotateY(22deg) rotateX(-4deg); animation-delay: -6s; }
.tech-code.c4 { bottom: 14%; right: 5%; color: #86efac; transform: perspective(700px) rotateY(-18deg) rotateX(5deg); animation-delay: -9s; }
.tech-code.c5 { top: 48%; left: 50%; margin-left: -330px; color: #60a5fa; opacity: .25; font-size: 11px; animation-delay: -4s; }
@keyframes techFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -18px; } }
@keyframes techGrid { from { background-position: 0 0, 0 0; } to { background-position: 0 60px, 0 0; } }
/* Content above the background; glassy login card */
.tech-body .auth { position: relative; z-index: 1; }
.tech-body .auth .card { background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.6); box-shadow: 0 20px 60px rgba(0, 10, 40, .55), 0 0 0 1px rgba(96,165,250,.15); }
.tech-body .ep-auth-foot { color: rgba(203, 213, 245, .75); position: relative; z-index: 1; }
@media (prefers-color-scheme: dark) {
  .tech-body .auth .card { background: rgba(23, 30, 45, .9); border-color: rgba(96,165,250,.2); }
}
@media (max-width: 760px) {
  .tech-code.c2, .tech-code.c3, .tech-code.c5 { display: none; }
  .tech-code.c1 { top: 2%; left: 2%; font-size: 10px; }
  .tech-code.c4 { bottom: 2%; right: 2%; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tech-glow, .tech-grid, .tech-code { animation: none; }
}

/* ======================================================================
   Employee portal: first-login onboarding wizard ("ob-") and product tour ("tour-")
   ====================================================================== */
body.ob-open { overflow: hidden; }
.ob-wrap {
  position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: rgba(10, 15, 30, .5); backdrop-filter: blur(8px) saturate(.9); -webkit-backdrop-filter: blur(8px) saturate(.9);
}
.ob-wrap[hidden], .ob-wrap [hidden] { display: none !important; }
.ob-card {
  position: relative; width: min(100%, 520px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35); animation: obIn .3s ease both;
}
@keyframes obIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.ob-top { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.ob-prog-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.ob-prog-h b { font-size: 1rem; color: var(--primary); }
.ob-bar { display: block; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ob-bar i { display: block; width: 0; height: 100%; border-radius: 4px; transition: width .5s ease;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #06b6d4)); }
.ob-full .ob-bar i { background: var(--ok); }
.ob-full .ob-prog-h b { color: var(--ok); }
.ob-steps { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.ob-dots { display: flex; align-items: center; gap: 6px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width .25s ease, background .25s ease; }
.ob-dots i.done { background: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.ob-dots i.on { width: 22px; background: var(--primary); }
.ob-body { flex: 1 1 auto; overflow-y: auto; padding: 22px; }
.ob-h { margin: 0 0 6px; font-size: 1.35rem; }
.ob-h:focus { outline: none; }
.ob-lead { margin: 0 0 18px; color: var(--muted); }
.ob-step[data-step="welcome"], .ob-step[data-step="photo"] { text-align: center; }
.ob-logo { display: flex; justify-content: center; margin: 4px 0 16px; }
.ob-logo .logo-img { height: 56px; max-width: 220px; }
.ob-logo .logo { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: 1.6rem; font-weight: 800; }
.ob-check { list-style: none; display: grid; gap: 8px; max-width: 360px; margin: 0 auto; padding: 0; text-align: left; }
.ob-check li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: .92rem; font-weight: 600; }
.ob-check li.done { color: var(--muted); }
.ob-tick { flex: 0 0 auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); color: #fff; font-size: .75rem; font-weight: 800; }
.ob-check li.done .ob-tick { background: var(--ok); border-color: var(--ok); }
.ob-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ob-photo { display: flex; justify-content: center; margin: 6px 0 18px; }
.ep-av.ob-av { --s: 132px; box-shadow: 0 0 0 4px var(--card), 0 0 0 6px color-mix(in srgb, var(--primary) 40%, var(--line)); }
.ob-photo.busy .ep-av { opacity: .55; }
.ob-photo-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ob-c { margin: 10px 0 0; text-align: center; }
.ob-note { margin: 0; }
.ob-card textarea { resize: vertical; }
.ob-card textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.ob-card [aria-invalid="true"] { border-color: var(--bad); outline-color: var(--bad); }
.ob-str { display: flex; flex-direction: column; gap: 4px; margin: -4px 0 12px; }
.ob-str-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ob-str-bar i { height: 5px; border-radius: 3px; background: var(--line); transition: background .2s ease; }
.ob-str[data-s="1"] .ob-str-bar i:nth-child(-n+1) { background: var(--bad); }
.ob-str[data-s="2"] .ob-str-bar i:nth-child(-n+2) { background: var(--warn); }
.ob-str[data-s="3"] .ob-str-bar i:nth-child(-n+3) { background: color-mix(in srgb, var(--ok) 70%, var(--warn)); }
.ob-str[data-s="4"] .ob-str-bar i { background: var(--ok); }
.ob-err { margin: 0 22px 12px; padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: .88rem; font-weight: 600; }
.ob-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.ob-foot .btn { min-width: 110px; }
.ob-out { padding: 0 22px 12px; text-align: center; }
.ob-out .ep-link { color: var(--muted); font-weight: 500; }
.ob-done { position: relative; min-height: 240px; padding: 18px 0 6px; overflow: hidden; text-align: center; }
.ob-big { margin-bottom: 10px; font-size: 3.4rem; line-height: 1; animation: obBounce .8s ease both; }
@keyframes obBounce { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.ob-done-btns { display: flex; flex-direction: column; gap: 10px; max-width: 300px; margin: 8px auto 0; }
.ob-burst { position: absolute; left: 50%; top: 48px; width: 0; height: 0; pointer-events: none; }
.ob-burst i { position: absolute; left: -4px; top: -6px; width: 8px; height: 12px; border-radius: 2px; background: var(--c); opacity: 0;
  animation: obConfetti 1.4s cubic-bezier(.2, .7, .3, 1) var(--d, 0s) forwards; }
@keyframes obConfetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 70px)) rotate(var(--r)); }
}
@media (max-width: 600px) {
  .ob-wrap { padding: 0; place-items: stretch; }
  .ob-card { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
  .ob-top { padding: calc(14px + env(safe-area-inset-top)) 16px 12px; }
  .ob-body { padding: 18px 16px; }
  .ob-err { margin: 0 16px 10px; }
  .ob-foot { padding: 12px 16px; }
  .ob-foot .btn { flex: 1 1 0; min-width: 0; }
  .ob-foot .ep-sp { display: none; }
  .ob-out { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* Product tour */
.tour-block { position: fixed; inset: 0; z-index: 2400; background: transparent; }
.tour-spot {
  position: fixed; z-index: 2401; pointer-events: none; border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .95), 0 0 0 7px color-mix(in srgb, var(--primary) 55%, transparent), 0 0 0 9999px rgba(6, 10, 22, .62);
  transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease;
}
.tour-tip {
  position: fixed; z-index: 2402; left: 50%; top: 50%; width: min(340px, calc(100vw - 24px)); padding: 16px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35); transition: left .25s ease, top .25s ease; animation: tourIn .25s ease both;
}
@keyframes tourIn { from { opacity: 0; } to { opacity: 1; } }
.tour-tip h3 { margin: 8px 0 4px; font-size: 1.08rem; }
.tour-tip p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.tour-tip-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-count { padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); font-size: .75rem; font-weight: 800; }
.tour-skip { color: var(--muted); font-size: .8rem; }
.tour-prog { height: 3px; margin-bottom: 12px; border-radius: 2px; background: var(--line); overflow: hidden; }
.tour-prog i { display: block; height: 100%; background: var(--primary); transition: width .3s ease; }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-foot .btn { min-width: 76px; }
.tour-tip.dock { left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; transition: none; }
.tour-tip.dock.dock-top { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }

/* "Take the tour again" card on the Profile page */
.tour-again { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.tour-again-i { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; font-size: 1.6rem; background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
.tour-again-t { flex: 1; min-width: 180px; }
.tour-again-t h2 { margin: 0; }
.tour-again-t p { margin: 2px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .ob-card, .ob-big, .tour-tip { animation: none; }
  .ob-burst { display: none; }
  .ob-bar i, .ob-dots i, .tour-spot, .tour-tip, .tour-prog i { transition: none; }
}

/* Onboarding: password eye toggle, match hints, IFSC bank card */
.ob-pw { position: relative; }
.ob-pw input { padding-right: 44px; }
.ob-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 6px; border-radius: 8px; color: var(--muted); }
.ob-eye:hover, .ob-eye:focus-visible { background: var(--bg); }
.ob-ok { color: var(--ok); font-weight: 600; margin-top: 4px; }
.ob-no { color: var(--bad); font-weight: 600; margin-top: 4px; }
.ob-ifsc { margin-top: 6px; font-size: .88rem; }
.ob-bankcard { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.ob-bankcard b { color: var(--text); }

/* Onboarding: company policies step */
.ob-pol-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ob-pol { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); }
.ob-pol.is-done { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-bg); }
.ob-pol-head { display: flex; gap: 10px; align-items: flex-start; }
.ob-pol-ico { font-size: 1.3rem; }
.ob-pol-desc { margin: 8px 0 0; color: var(--muted); }
.ob-pol-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.ob-pol-hint { margin-top: 6px; }
.ob-pol-all { padding: 10px 12px; border-radius: 10px; background: var(--bg); font-weight: 600; }

/* ======================================================================
   Employee portal: Background verification (staff.php #bgv) – "bgv-" prefix
   ====================================================================== */
/* Nav: folded under Profile on phones (bottom bar stays at 6 items) */
.ep-nav a.bgv-nav.bgv-off { display: none; }
@media (max-width: 759.98px) { .ep-nav a.bgv-nav { display: none; } }
@media (min-width: 760px) { .ep-nav .bgv-mbadge { display: none; } }

/* Profile: card link */
.bgv-prof-card { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.bgv-prof-card[hidden] { display: none; }
.bgv-prof-card:hover { border-color: var(--primary); }
.bgv-prof-i { font-size: 1.5rem; line-height: 1; }
.bgv-prof-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bgv-prof-c { color: var(--primary); font-size: 1.4rem; font-weight: 700; line-height: 1; }

/* Overall status card */
.bgv-head-r { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bgv-head-r h2 { margin: 2px 0 0; font-size: 1.25rem; }
.bgv-bar { display: block; height: 8px; margin: 12px 0 10px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bgv-bar i { display: block; height: 100%; border-radius: 4px; background: var(--ok); transition: width .6s ease; }
.bgv-head-msg { margin: 8px 0 4px; font-size: .92rem; font-weight: 600; }
.bgv-head-note { margin: 0; }

/* Check cards */
.bgv-card { border-left: 4px solid var(--line); }
.bgv-card.bgv-st-verified { border-left-color: var(--ok); }
.bgv-card.bgv-st-submitted, .bgv-card.bgv-st-resubmit { border-left-color: var(--warn); }
.bgv-card.bgv-st-discrepancy { border-left-color: var(--bad); }
.bgv-card-h { display: flex; align-items: flex-start; gap: 12px; }
.bgv-ico { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 1.3rem; line-height: 1; }
.bgv-card-t { flex: 1; min-width: 0; }
.bgv-card-t h2 { margin: 0 0 2px; font-size: 1.05rem; }
.bgv-card-h .badge { margin-top: 2px; }
.bgv-help { margin: 12px 0 0; font-size: .88rem; color: var(--muted); }
.bgv-privacy { padding: 10px 12px; border-radius: 10px; color: var(--text);
  background: color-mix(in srgb, var(--primary) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line)); }
.bgv-remarks { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.bgv-remarks b { display: block; color: var(--warn); margin-bottom: 4px; }
.bgv-remarks.discrepancy { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.bgv-remarks.discrepancy b { color: var(--bad); }
.bgv-remarks-t { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 600; }

/* Form (one column on phones, two on wider screens) */
.bgv-form { margin-top: 14px; }
.bgv-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.bgv-f.wide { grid-column: 1 / -1; }
.bgv-f[hidden], .bgv-docs[hidden], .bgv-err[hidden] { display: none; }
.bgv-req { color: var(--bad); }
.bgv-check { padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; }
.bgv-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; }
.bgv-form input[data-upper] { text-transform: uppercase; }
.bgv-form textarea { resize: vertical; }
@media (min-width: 600px) { .bgv-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Documents */
.bgv-docs { margin-top: 6px; }
.bgv-docs-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.bgv-docs-h b { font-size: .9rem; }
.bgv-files { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.bgv-files:empty { display: none; }
.bgv-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.bgv-file.new { border-style: dashed; border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.bgv-file-i { flex: 0 0 auto; font-size: 1.2rem; line-height: 1; }
.bgv-file-n { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bgv-file-n b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .9rem; font-weight: 600; }
.bgv-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 14px; margin-bottom: 8px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s; }
.bgv-drop:hover, .bgv-drop.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.bgv-drop-i { font-size: 1.5rem; line-height: 1; }
.bgv-drop-t { font-size: .9rem; }

/* Errors, footer, verified (read-only) */
.bgv-err { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: .9rem; font-weight: 600; }
.bgv-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.bgv-kv { margin: 14px 0 10px; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); }
.bgv-kv dt, .bgv-kv dd { overflow-wrap: anywhere; }
.bgv-done { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-size: .88rem; font-weight: 600; }
@media (max-width: 600px) {
  .bgv-foot .btn { width: 100%; }
  .bgv-foot .ep-sp { display: none; }
  .bgv-card-h { flex-wrap: wrap; row-gap: 6px; }
  .bgv-card-t { flex-basis: calc(100% - 54px); }
  .bgv-card-h .badge { margin: 0 0 0 54px; }
}
