/* =============================================================================
   File: public/assets/css/app.css
   Design system for the whole application (admin + employee + auth).
   Built on Bootstrap 5.3; all colours come from the tokens below.
   ============================================================================= */

/* ---------- DM Sans (self-hosted) ---------- */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  src: url("../vendor/dm-sans/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  src: url("../vendor/dm-sans/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  src: url("../vendor/dm-sans/dm-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  src: url("../vendor/dm-sans/dm-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  src: url("../vendor/dm-sans/dm-sans-latin-ext-400-normal.woff2") format("woff2"); }
/* DM Sans has no Taka sign: borrow just "৳" (enlarged to match DM Sans digits) from Noto Sans Bengali.
   One face per exact weight, so browsers never fall back to a system font for it. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; unicode-range: U+09F3;
  src: url("../vendor/dm-sans/taka-400.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; unicode-range: U+09F3;
  src: url("../vendor/dm-sans/taka-400.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; unicode-range: U+09F3;
  src: url("../vendor/dm-sans/taka-700.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap; unicode-range: U+09F3;
  src: url("../vendor/dm-sans/taka-700.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --ems-font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ems-primary: #4f46e5;
  --ems-primary-rgb: 79, 70, 229;
  --ems-primary-hover: #4338ca;
  --ems-primary-soft: #eef2ff;
  --ems-primary-ink: #312e81;

  --ems-success: #059669;  --ems-success-soft: #ecfdf5;
  --ems-warning: #d97706;  --ems-warning-soft: #fffbeb;
  --ems-danger:  #dc2626;  --ems-danger-soft:  #fef2f2;
  --ems-info:    #0284c7;  --ems-info-soft:    #f0f9ff;
  --ems-neutral: #64748b;  --ems-neutral-soft: #f1f5f9;
  --ems-violet:  #7c3aed;  --ems-violet-soft:  #f5f3ff;

  --ems-bg: #f6f7fb;
  --ems-surface: #ffffff;
  --ems-surface-2: #f8fafc;
  --ems-border: #e5e7eb;
  --ems-border-strong: #d1d5db;
  --ems-text: #0f172a;
  --ems-text-2: #334155;
  --ems-muted: #64748b;
  --ems-subtle: #94a3b8;

  --ems-radius-sm: 8px;
  --ems-radius: 12px;
  --ems-radius-lg: 16px;
  --ems-radius-xl: 22px;

  --ems-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --ems-shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --ems-shadow: 0 4px 16px -4px rgba(15, 23, 42, .08), 0 2px 6px -2px rgba(15, 23, 42, .05);
  --ems-shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .18);
  --ems-ring: 0 0 0 4px rgba(var(--ems-primary-rgb), .15);

  /* Bootstrap bridge */
  --bs-body-font-family: var(--ems-font);
  --bs-body-color: var(--ems-text);
  --bs-body-bg: var(--ems-bg);
  --bs-border-color: var(--ems-border);
  --bs-primary: var(--ems-primary);
  --bs-primary-rgb: var(--ems-primary-rgb);
  --bs-link-color: var(--ems-primary);
  --bs-link-color-rgb: var(--ems-primary-rgb);
  --bs-link-hover-color: var(--ems-primary-hover);
  --bs-border-radius: var(--ems-radius-sm);
  --bs-border-radius-lg: var(--ems-radius);
  --bs-focus-ring-color: rgba(var(--ems-primary-rgb), .2);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ems-font);
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--ems-text);
  background: var(--ems-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 700; letter-spacing: -.015em; color: var(--ems-text); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-muted, .form-text { color: var(--ems-muted) !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.small, small { font-size: .8125rem; }
.tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--ems-ring); border-radius: var(--ems-radius-sm); }
::selection { background: rgba(var(--ems-primary-rgb), .18); }

/* ---------- Buttons ---------- */
.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-padding-y: .55rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-size: .9rem;
  --bs-btn-border-radius: var(--ems-radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-lg { --bs-btn-padding-y: .8rem; --bs-btn-padding-x: 1.25rem; --bs-btn-font-size: 1rem; --bs-btn-border-radius: var(--ems-radius); }
.btn-sm { --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8125rem; }
.btn-primary {
  --bs-btn-bg: var(--ems-primary); --bs-btn-border-color: var(--ems-primary);
  --bs-btn-hover-bg: var(--ems-primary-hover); --bs-btn-hover-border-color: var(--ems-primary-hover);
  --bs-btn-active-bg: var(--ems-primary-ink); --bs-btn-active-border-color: var(--ems-primary-ink);
  --bs-btn-disabled-bg: var(--ems-primary); --bs-btn-disabled-border-color: var(--ems-primary);
  box-shadow: 0 1px 2px rgba(var(--ems-primary-rgb), .25), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-light {
  --bs-btn-bg: var(--ems-surface); --bs-btn-border-color: var(--ems-border);
  --bs-btn-hover-bg: var(--ems-surface-2); --bs-btn-hover-border-color: var(--ems-border-strong);
  --bs-btn-color: var(--ems-text-2);
  box-shadow: var(--ems-shadow-xs);
}
.btn-soft-primary { background: var(--ems-primary-soft); color: var(--ems-primary-ink); border: 1px solid transparent; }
.btn-soft-primary:hover { background: #e0e7ff; color: var(--ems-primary-ink); }
.btn-soft-danger { background: var(--ems-danger-soft); color: var(--ems-danger); border: 1px solid transparent; }
.btn-soft-danger:hover { background: #fee2e2; color: #b91c1c; }
.btn-link { text-decoration: none; font-weight: 600; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-icon { width: 2.25rem; height: 2.25rem; padding: 0; }
.btn .spinner-border { width: 1rem; height: 1rem; border-width: .15em; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .8125rem; color: var(--ems-text-2); margin-bottom: .4rem; }
.form-label .req { color: var(--ems-danger); margin-left: 2px; }
.form-control, .form-select {
  border-color: var(--ems-border-strong);
  border-radius: var(--ems-radius-sm);
  padding: .6rem .8rem;
  font-size: .9375rem;
  color: var(--ems-text);
  background-color: var(--ems-surface);
  transition: border-color .15s, box-shadow .15s;
}
.form-select { padding-right: 2.25rem; background-position: right .75rem center; }
.table-toolbar .form-select { padding-right: 2.25rem; }
.form-control::placeholder { color: var(--ems-subtle); }
.form-control:focus, .form-select:focus { border-color: var(--ems-primary); box-shadow: var(--ems-ring); }
.form-control-lg { padding: .75rem .95rem; font-size: 1rem; border-radius: var(--ems-radius); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--ems-subtle); pointer-events: none; font-size: .95rem; }
.input-icon > .form-control { padding-left: 2.6rem; }
.input-icon > .toggle {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--ems-muted); width: 2.25rem; height: 2.25rem; border-radius: var(--ems-radius-sm);
}
.input-icon > .toggle:hover { color: var(--ems-text); background: var(--ems-surface-2); }
.input-icon.has-toggle > .form-control { padding-right: 2.9rem; }
.invalid-feedback { font-size: .8125rem; }
.form-check-input:checked { background-color: var(--ems-primary); border-color: var(--ems-primary); }
.form-check-input:focus { box-shadow: var(--ems-ring); border-color: var(--ems-primary); }

/* ---------- Alerts ---------- */
.alert {
  display: flex; gap: .75rem; align-items: flex-start;
  border-radius: var(--ems-radius); border: 1px solid transparent; padding: .8rem 1rem;
  font-size: .875rem; font-weight: 500;
}
.alert > .alert-icon { margin-top: .1rem; flex: none; }
.alert-success { background: var(--ems-success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-warning { background: var(--ems-warning-soft); color: #92400e; border-color: #fde68a; }
.alert-danger  { background: var(--ems-danger-soft);  color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--ems-info-soft);    color: #075985; border-color: #bae6fd; }
.alert .btn-close { margin-left: auto; padding: .4rem; font-size: .7rem; }

/* ---------- Cards ---------- */
.card {
  --bs-card-border-color: var(--ems-border);
  --bs-card-border-radius: var(--ems-radius-lg);
  --bs-card-inner-border-radius: calc(var(--ems-radius-lg) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  box-shadow: var(--ems-shadow-sm);
}
.card-header { border-bottom-color: var(--ems-border); padding-top: 1rem; padding-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 700; margin: 0; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .72rem; padding: .35em .65em; border-radius: 999px; letter-spacing: .01em; }
.badge-soft-success { background: var(--ems-success-soft); color: var(--ems-success); }
.badge-soft-warning { background: var(--ems-warning-soft); color: var(--ems-warning); }
.badge-soft-danger  { background: var(--ems-danger-soft);  color: var(--ems-danger); }
.badge-soft-info    { background: var(--ems-info-soft);    color: var(--ems-info); }
.badge-soft-primary { background: var(--ems-primary-soft); color: var(--ems-primary); }
.badge-soft-neutral { background: var(--ems-neutral-soft); color: var(--ems-neutral); }
.badge-soft-violet  { background: var(--ems-violet-soft);  color: var(--ems-violet); }

/* =============================================================================
   Auth screens (login, change password)
   ============================================================================= */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--ems-surface); }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(420px, 1fr) minmax(480px, 1.05fr); } }

.auth-brand {
  display: none; position: relative; overflow: hidden;
  padding: 3rem 3.25rem; color: #e0e7ff;
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(129, 140, 248, .45), transparent 60%),
    radial-gradient(800px 500px at 120% 110%, rgba(56, 189, 248, .25), transparent 60%),
    linear-gradient(160deg, #312e81 0%, #3730a3 45%, #1e1b4b 100%);
}
@media (min-width: 992px) { .auth-brand { display: flex; flex-direction: column; } }
.auth-brand::after { /* subtle grid texture */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .09;
  background-image: linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 30%, #000 30%, transparent 75%);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo { display: flex; align-items: center; gap: .75rem; color: #fff; font-weight: 700; font-size: 1.05rem; }
.auth-logo .mark {
  width: 2.5rem; height: 2.5rem; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); color: #fff; font-size: 1.05rem;
  overflow: hidden;
}
.auth-logo .mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.auth-brand h1 { color: #fff; font-size: clamp(1.9rem, 2.6vw, 2.6rem); line-height: 1.12; letter-spacing: -.03em; margin: auto 0 1rem; max-width: 18ch; }
.auth-brand .lead { color: #c7d2fe; font-size: 1.02rem; max-width: 40ch; margin-bottom: 2.25rem; }
.auth-features { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: .9rem; }
.auth-features li { display: flex; gap: .85rem; align-items: center; font-weight: 500; color: #e0e7ff; }
.auth-features .ico {
  width: 2.25rem; height: 2.25rem; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #fff; font-size: .9rem;
}
.auth-brand .foot { margin-top: 2.5rem; font-size: .8rem; color: #a5b4fc; }

.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 2rem 1.25rem; background: var(--ems-surface); }
@media (min-width: 576px) { .auth-main { padding: 3rem 2.5rem; } }
.auth-card { width: 100%; max-width: 410px; margin: 0 auto; }
.auth-card .mobile-logo { display: flex; margin-bottom: 2rem; color: var(--ems-text); }
.auth-card .mobile-logo .mark { background: var(--ems-primary); border-color: var(--ems-primary); }
@media (min-width: 992px) { .auth-card .mobile-logo { display: none; } }
.auth-card h2 { font-size: 1.65rem; margin-bottom: .35rem; letter-spacing: -.025em; }
.auth-card .sub { color: var(--ems-muted); margin-bottom: 1.75rem; }
.auth-card .form-control-lg { background: var(--ems-surface-2); }
.auth-card .form-control-lg:focus { background: var(--ems-surface); }
.auth-card .btn-lg { width: 100%; }
.auth-meta { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--ems-border); color: var(--ems-muted); font-size: .8125rem; display: flex; gap: .6rem; align-items: flex-start; }
.auth-meta i { color: var(--ems-subtle); margin-top: .2rem; }

.password-rules { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .3rem; font-size: .8125rem; color: var(--ems-muted); }
.password-rules li { display: flex; align-items: center; gap: .5rem; }
.password-rules li i { width: 1rem; text-align: center; color: var(--ems-subtle); }
.password-rules li.ok { color: var(--ems-success); }
.password-rules li.ok i { color: var(--ems-success); }

/* =============================================================================
   Error pages
   ============================================================================= */
.error-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1.25rem; background: var(--ems-bg); }
.error-card { max-width: 460px; text-align: center; }
.error-code {
  font-size: 4.5rem; font-weight: 700; letter-spacing: -.05em; line-height: 1;
  background: linear-gradient(135deg, var(--ems-primary) 0%, #0ea5e9 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 1rem;
}
.error-card h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.error-card p { color: var(--ems-muted); }
.error-ref { font-size: .75rem; color: var(--ems-subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.error-debug { text-align: left; max-height: 50vh; overflow: auto; background: #0f172a; color: #e2e8f0; border-radius: var(--ems-radius); padding: 1rem; font-size: .75rem; margin-top: 1.5rem; white-space: pre-wrap; }

/* =============================================================================
   App shells (shared)
   ============================================================================= */
.min-w-0 { min-width: 0; }
.btn-icon-plain {
  width: 2.5rem; height: 2.5rem; border: 0; background: transparent; border-radius: var(--ems-radius-sm);
  display: inline-grid; place-items: center; color: var(--ems-text-2); font-size: 1.1rem; flex: none;
}
.btn-icon-plain:hover { background: var(--ems-neutral-soft); color: var(--ems-text); text-decoration: none; }

.avatar {
  --size: 2.5rem; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; overflow: hidden;
  background: var(--ems-primary-soft); color: var(--ems-primary-ink); font-weight: 700; font-size: calc(var(--size) * .38); letter-spacing: .02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --size: 2rem; }
.avatar-lg { --size: 3.5rem; }
.avatar-xl { --size: 5rem; }
.avatar-brand { background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; }

.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--ems-primary); color: #fff; font-size: 1rem;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

.bell-badge {
  position: absolute; top: .3rem; right: .25rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem;
  border-radius: 999px; background: var(--ems-danger); color: #fff; font-size: .62rem; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--ems-surface); line-height: 1;
}

/* ---------- Admin shell ---------- */
.app-body.admin { background: var(--ems-bg); }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 1040; display: flex; flex-direction: column;
  background: var(--ems-surface); border-right: 1px solid var(--ems-border);
  transform: translateX(-100%); transition: transform .22s ease;
}
.sidebar-open .sidebar { transform: none; box-shadow: var(--ems-shadow-lg); }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
@media (min-width: 992px) {
  .sidebar { transform: none; }
  .sidebar-backdrop { display: none; }
  .app-main { margin-left: 264px; }
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1rem 1rem 1.15rem; }
.brand-link { display: flex; align-items: center; gap: .7rem; color: var(--ems-text); min-width: 0; }
.brand-link:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .72rem; color: var(--ems-subtle); font-weight: 500; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; scrollbar-width: thin; }
.nav-section { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ems-subtle); padding: 1.1rem .65rem .4rem; }
.nav-link-item {
  display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; margin-bottom: 2px; border-radius: var(--ems-radius-sm);
  color: var(--ems-text-2); font-weight: 500; font-size: .875rem; position: relative;
}
.nav-link-item i { color: var(--ems-subtle); font-size: .95rem; transition: color .15s; }
.nav-link-item:hover { background: var(--ems-surface-2); color: var(--ems-text); text-decoration: none; }
.nav-link-item:hover i { color: var(--ems-text-2); }
.nav-link-item.active { background: var(--ems-primary-soft); color: var(--ems-primary-ink); font-weight: 600; }
.nav-link-item.active i { color: var(--ems-primary); }
.nav-link-item.active::before { content: ""; position: absolute; left: -.75rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--ems-primary); }
.nav-badge { margin-left: auto; min-width: 1.35rem; padding: .1rem .4rem; border-radius: 999px; background: var(--ems-danger); color: #fff; font-size: .68rem; font-weight: 700; text-align: center; }
.sidebar-foot { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-top: 1px solid var(--ems-border); }

.topbar {
  position: sticky; top: 0; z-index: 1020; height: 64px; display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem; background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--ems-border);
}
@media (min-width: 992px) { .topbar { padding: 0 1.75rem; } }
.topbar-title { font-weight: 600; color: var(--ems-text-2); }
.topbar-search { position: relative; flex: 1; max-width: 460px; }
.topbar-search > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ems-subtle); font-size: .85rem; }
.topbar-search .form-control { padding: .5rem 2.4rem .5rem 2.3rem; background: var(--ems-surface-2); border-color: var(--ems-border); font-size: .875rem; }
.topbar-search .form-control:focus { background: var(--ems-surface); }
.topbar-search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: var(--ems-surface); color: var(--ems-muted); border: 1px solid var(--ems-border); box-shadow: none; font-size: .7rem; padding: .1rem .4rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.user-chip { display: flex; align-items: center; gap: .55rem; border: 0; background: transparent; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; color: var(--ems-text); }
.user-chip:hover { background: var(--ems-neutral-soft); }
.dropdown-menu { --bs-dropdown-border-color: var(--ems-border); --bs-dropdown-border-radius: var(--ems-radius); --bs-dropdown-link-active-bg: var(--ems-primary-soft); --bs-dropdown-link-active-color: var(--ems-primary-ink); font-size: .875rem; padding: .4rem; min-width: 14rem; }
.dropdown-item { border-radius: var(--ems-radius-sm); padding: .5rem .65rem; display: flex; align-items: center; gap: .55rem; font-weight: 500; }
.dropdown-item i { color: var(--ems-subtle); }
.dropdown-item.text-danger i { color: inherit; }
.dropdown-header { padding: .5rem .65rem; white-space: normal; }

.content { padding: 1.25rem 1rem 3rem; max-width: 1440px; }
@media (min-width: 992px) { .content { padding: 1.75rem 1.75rem 3rem; } }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; margin: 0; letter-spacing: -.025em; }
.page-subtitle { color: var(--ems-muted); margin: .25rem 0 0; font-size: .9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--ems-subtle); --bs-breadcrumb-item-active-color: var(--ems-muted); font-size: .8rem; margin-bottom: .35rem; }
.breadcrumb a { color: var(--ems-muted); }

/* ---------- Segmented tabs ---------- */
.seg-tabs { display: inline-flex; gap: .25rem; background: var(--ems-neutral-soft); padding: .25rem; border-radius: var(--ems-radius); }
.seg-tab { padding: .35rem .85rem; border-radius: calc(var(--ems-radius) - 4px); font-size: .8125rem; font-weight: 600; color: var(--ems-muted); display: inline-flex; align-items: center; gap: .4rem; }
.seg-tab:hover { color: var(--ems-text); text-decoration: none; }
button.seg-tab { background: transparent; }
.seg-tab.active { background: var(--ems-surface); color: var(--ems-text); box-shadow: var(--ems-shadow-xs); }
.seg-count { background: var(--ems-primary); color: #fff; font-size: .65rem; border-radius: 999px; padding: .05rem .4rem; }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--ems-border); }
.table-toolbar .search { position: relative; flex: 1 1 220px; max-width: 320px; }
.table-toolbar .search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--ems-subtle); font-size: .8rem; }
.table-toolbar .search .form-control { padding-left: 2.1rem; }
.table-toolbar .form-control, .table-toolbar .form-select { padding-top: .45rem; padding-bottom: .45rem; font-size: .875rem; }
.table { --bs-table-color: var(--ems-text); --bs-table-hover-bg: var(--ems-surface-2); margin: 0; font-size: .875rem; }
.table > thead th {
  background: var(--ems-surface-2); color: var(--ems-muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--ems-border); padding: .7rem 1rem; white-space: nowrap;
}
.table > tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--ems-border); }
.table > tbody tr:last-child td { border-bottom: 0; }
.table .cell-person { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.table .cell-person .name { font-weight: 600; color: var(--ems-text); }
.table .cell-person .sub { font-size: .78rem; color: var(--ems-muted); }
.table .actions { white-space: nowrap; text-align: right; }
.table-footer { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: .85rem 1.25rem; border-top: 1px solid var(--ems-border); }
.pagination { --bs-pagination-border-color: var(--ems-border); --bs-pagination-color: var(--ems-text-2); --bs-pagination-active-bg: var(--ems-primary); --bs-pagination-active-border-color: var(--ems-primary); --bs-pagination-hover-bg: var(--ems-surface-2); --bs-pagination-focus-box-shadow: var(--ems-ring); gap: .25rem; }
.pagination .page-link { border-radius: var(--ems-radius-sm) !important; min-width: 2rem; text-align: center; font-weight: 600; }

.code-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; font-weight: 600; background: var(--ems-neutral-soft); color: var(--ems-text-2); padding: .15rem .45rem; border-radius: 6px; }
.form-switch { padding-left: 3.1em; }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-top: .1em; margin-left: -3.1em; cursor: pointer; }
.form-switch .form-check-label { font-weight: 500; font-size: .875rem; cursor: pointer; }

/* ---------- Long forms (employee) ---------- */
.form-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
@media (min-width: 1200px) { .form-layout { grid-template-columns: 190px minmax(0, 1fr); } }
.form-nav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--ems-border); }
.form-nav a { padding: .4rem .9rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--ems-muted); font-size: .85rem; font-weight: 500; }
.form-nav a:hover { color: var(--ems-text); text-decoration: none; }
.form-nav a.active { color: var(--ems-primary); border-left-color: var(--ems-primary); font-weight: 600; }
.form-section { margin-bottom: 1.25rem; scroll-margin-top: 84px; }
.form-section .card-title i { color: var(--ems-subtle); margin-right: .45rem; width: 1rem; }
.form-subtitle { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ems-subtle); margin-top: .5rem; }
.form-actions {
  position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; gap: .6rem;
  padding: .9rem 1.25rem; margin: 0 -.25rem; background: rgba(246,247,251,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--ems-border);
}
.input-group-text { background: var(--ems-surface-2); border-color: var(--ems-border-strong); color: var(--ems-muted); font-size: .875rem; }
.gross-preview { font-size: .85rem; color: var(--ems-muted); }
.gross-preview strong { color: var(--ems-text); font-variant-numeric: tabular-nums; }

.seg-choice { display: inline-flex; flex-wrap: wrap; gap: .25rem; background: var(--ems-neutral-soft); padding: .25rem; border-radius: var(--ems-radius); }
.seg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.seg-choice label { padding: .4rem .85rem; border-radius: calc(var(--ems-radius) - 4px); font-size: .8125rem; font-weight: 600; color: var(--ems-muted); cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; }
.seg-choice input:checked + label { background: var(--ems-surface); color: var(--ems-text); box-shadow: var(--ems-shadow-xs); }
.seg-choice input:focus-visible + label { box-shadow: var(--ems-ring); }

.office-pick { border: 1px solid var(--ems-border); border-radius: var(--ems-radius); overflow: hidden; }
.office-pick-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem .9rem; border-top: 1px solid var(--ems-border); }
.office-pick-row:first-child { border-top: 0; }
.office-pick-row .form-check { margin: 0; }
.office-pick-row .form-check-label { display: flex; flex-direction: column; line-height: 1.3; }
.primary-pick { display: inline-flex; gap: .35rem; align-items: center; color: var(--ems-muted); cursor: pointer; white-space: nowrap; }
.primary-pick input:disabled + * , .primary-pick:has(input:disabled) { opacity: .45; cursor: default; }
.leave-table td, .leave-table th { padding: .55rem .6rem; }
.leave-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .5rem; vertical-align: middle; }

/* ---------- Profile ---------- */
.profile-head .card-body { padding: 1.5rem; }
.avatar-edit { position: relative; border: 0; background: transparent; padding: 0; border-radius: 50%; }
.avatar-edit:focus-visible { box-shadow: var(--ems-ring); }
.avatar-edit-badge {
  position: absolute; right: -2px; bottom: -2px; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--ems-surface); color: var(--ems-text-2); font-size: .72rem;
  box-shadow: var(--ems-shadow); border: 1px solid var(--ems-border);
}
.avatar-edit:hover .avatar-edit-badge { color: var(--ems-primary); }
.profile-tabs { --bs-nav-underline-link-active-color: var(--ems-primary); --bs-nav-link-color: var(--ems-muted); --bs-nav-link-hover-color: var(--ems-text); --bs-nav-link-font-weight: 600; border-bottom: 1px solid var(--ems-border); gap: 1.25rem; overflow-x: auto; flex-wrap: nowrap; }
.profile-tabs .nav-link { font-size: .875rem; white-space: nowrap; padding: .6rem 0; }
.info-list { margin: 0; display: grid; gap: .1rem; }
.info-list > div { display: grid; grid-template-columns: 150px 1fr; gap: .75rem; padding: .45rem 0; border-bottom: 1px dashed var(--ems-border); font-size: .875rem; }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt { color: var(--ems-muted); font-weight: 500; }
.info-list dd { margin: 0; color: var(--ems-text); word-break: break-word; }
@media (max-width: 575.98px) { .info-list > div { grid-template-columns: 1fr; gap: .1rem; } }
.list-group-item { border-color: var(--ems-border); }

/* ---------- Clickable rows ---------- */
.row-link { position: relative; }
.row-link .stretched-link-row { color: inherit; }
.row-link .stretched-link-row::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.row-link .stretched-link-row:hover { text-decoration: none; }
.row-link .actions { position: relative; z-index: 2; }
.row-muted td { opacity: .62; }

/* ---------- Holidays calendar ---------- */
.cal-legend { display: flex; gap: 1rem; color: var(--ems-muted); }
.cal-legend .dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.dot-holiday { background: var(--ems-violet); }
.dot-off { background: var(--ems-neutral-soft); border: 1px solid var(--ems-border-strong); }
.dot-today { background: transparent; box-shadow: inset 0 0 0 2px var(--ems-primary); }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.25rem 1.5rem; }
.mini-month-title { font-weight: 700; font-size: .875rem; margin-bottom: .5rem; display: flex; justify-content: space-between; align-items: center; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-grid .dow { font-size: .65rem; font-weight: 700; color: var(--ems-subtle); text-transform: uppercase; padding-bottom: .25rem; }
.mini-grid .dow.off { color: var(--ems-muted); }
.mini-grid .day {
  border: 0; background: transparent; font-size: .78rem; font-weight: 500; color: var(--ems-text-2);
  aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center; padding: 0; font-variant-numeric: tabular-nums;
}
.mini-grid .day:hover { background: var(--ems-primary-soft); color: var(--ems-primary-ink); }
.mini-grid .day.is-off { background: var(--ems-neutral-soft); color: var(--ems-subtle); }
.mini-grid .day.is-holiday { background: var(--ems-violet); color: #fff; font-weight: 700; }
.mini-grid .day.is-holiday:hover { background: #6d28d9; color: #fff; }
.mini-grid .day.is-today { box-shadow: inset 0 0 0 2px var(--ems-primary); }
.month-row td { background: var(--ems-surface-2); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ems-subtle); padding-top: .5rem !important; padding-bottom: .5rem !important; }
.date-chip { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: .6rem; background: var(--ems-violet-soft); color: var(--ems-violet); line-height: 1; vertical-align: middle; }
.date-chip .d { font-weight: 700; font-size: .95rem; }
.date-chip .m { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: .1rem; }
.page-actions .form-select { min-width: 6.5rem; }

/* ---------- Attendance ---------- */
.status-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.status-chip {
  display: inline-flex; align-items: baseline; gap: .45rem; padding: .45rem .8rem; border-radius: var(--ems-radius);
  background: var(--ems-surface); border: 1px solid var(--ems-border); color: var(--ems-text-2); font-size: .8125rem; font-weight: 600;
  box-shadow: var(--ems-shadow-xs);
}
.status-chip .n { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.status-chip:hover { text-decoration: none; border-color: var(--ems-border-strong); color: var(--ems-text); }
.status-chip.active { border-color: var(--ems-primary); box-shadow: var(--ems-ring); color: var(--ems-text); }
.status-chip.muted { background: transparent; box-shadow: none; color: var(--ems-muted); }
.tone-chip-success .n { color: var(--ems-success); } .tone-chip-warning .n { color: var(--ems-warning); }
.tone-chip-danger .n { color: var(--ems-danger); } .tone-chip-info .n { color: var(--ems-info); }
.tone-chip-primary .n { color: var(--ems-primary); } .tone-chip-violet .n { color: var(--ems-violet); }
.tone-chip-neutral .n { color: var(--ems-text-2); }
.punch { display: flex; gap: .55rem; align-items: center; }
.punch-photo { width: 2.4rem; height: 2.4rem; border-radius: .55rem; overflow: hidden; flex: none; border: 1px solid var(--ems-border); background: var(--ems-neutral-soft); }
.punch-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame { display: block; aspect-ratio: 3 / 4; border-radius: var(--ems-radius); overflow: hidden; background: var(--ems-neutral-soft); border: 1px solid var(--ems-border); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; color: var(--ems-subtle); font-size: .8rem; }
.photo-frame.empty i { font-size: 1.5rem; }
.map-key { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; }
.key-in { background: #059669; } .key-out { background: #d97706; }
.timeline { list-style: none; margin: 0; padding: 1rem 1.25rem; display: grid; gap: 1rem; }
.timeline li { display: flex; gap: .75rem; }
.tl-dot { width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; flex: none; }

/* Monthly matrix */
.matrix-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--ems-border); color: var(--ems-muted); }
.matrix-wrap { max-height: 70vh; }
.matrix { font-size: .75rem; border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { padding: .3rem .15rem !important; text-align: center; border-bottom: 1px solid var(--ems-border); white-space: nowrap; }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--ems-surface-2); text-transform: none; letter-spacing: 0; }
.matrix .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--ems-surface); text-align: left; padding: .45rem .9rem !important; min-width: 190px; border-right: 1px solid var(--ems-border); }
.matrix thead .sticky-col { z-index: 3; background: var(--ems-surface-2); }
.day-head { min-width: 1.9rem; }
.day-head .dn { display: block; font-weight: 700; color: var(--ems-text-2); font-size: .75rem; }
.day-head .dw { display: block; font-size: .6rem; color: var(--ems-subtle); font-weight: 600; }
.day-head.h-off { background: #eef0f4 !important; }
.day-head.h-holiday { background: var(--ems-violet-soft) !important; }
.day-head.h-holiday .dn { color: var(--ems-violet); }
.day-head.h-today { box-shadow: inset 0 -3px 0 var(--ems-primary); }
.matrix .tot { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2.4rem; background: var(--ems-surface-2); }
.mcell {
  display: inline-grid; place-items: center; width: 1.55rem; height: 1.55rem; border-radius: 5px;
  font-size: .68rem; font-weight: 700; line-height: 1;
}
a.mcell:hover { text-decoration: none; outline: 2px solid var(--ems-primary); outline-offset: 1px; }
.mcell.flag { box-shadow: inset 0 0 0 2px var(--ems-danger); }
.s-present { background: var(--ems-success-soft); color: var(--ems-success); }
.s-late { background: var(--ems-warning-soft); color: var(--ems-warning); }
.s-half_day { background: var(--ems-info-soft); color: var(--ems-info); }
.s-absent { background: var(--ems-danger-soft); color: var(--ems-danger); }
.s-incomplete { background: var(--ems-violet-soft); color: var(--ems-violet); }
.s-on_leave { background: var(--ems-primary-soft); color: var(--ems-primary); }
.s-holiday, .s-weekly_off { background: #eef0f4; color: var(--ems-subtle); }
.s-pending { color: var(--ems-border-strong); }
.s-none { background: repeating-linear-gradient(45deg, transparent 0 3px, var(--ems-border) 3px 4px); }

/* Corrections */
.correction-row { padding: 1.1rem 1.25rem; }
.compare { display: grid; gap: .3rem; font-size: .8125rem; }
.compare .lbl { display: inline-block; min-width: 5.5rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ems-subtle); }
.reason { font-size: .875rem; background: var(--ems-surface-2); border-radius: var(--ems-radius-sm); padding: .55rem .75rem; }

/* ---------- Leave ---------- */
.day-list { list-style: none; margin: 0; padding: .5rem 1.25rem 1rem; display: grid; gap: .1rem; }
.day-list li { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; border-bottom: 1px dashed var(--ems-border); }
.day-list li:last-child { border-bottom: 0; }
.day-date { min-width: 7.5rem; font-weight: 600; font-size: .875rem; font-variant-numeric: tabular-nums; }
.doc-tile { width: 8.5rem; border: 1px solid var(--ems-border); border-radius: var(--ems-radius); overflow: hidden; display: flex; flex-direction: column; color: var(--ems-text-2); }
.doc-tile:hover { text-decoration: none; border-color: var(--ems-primary); }
.doc-tile img { width: 100%; height: 6.5rem; object-fit: cover; background: var(--ems-neutral-soft); }
.doc-icon { height: 6.5rem; display: grid; place-items: center; background: var(--ems-danger-soft); color: var(--ems-danger); font-size: 2rem; }
.doc-name { font-size: .72rem; padding: .4rem .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decision-card { border-color: var(--ems-primary); box-shadow: 0 0 0 3px rgba(var(--ems-primary-rgb), .08), var(--ems-shadow-sm); }
.bg-highlight { background: var(--ems-primary-soft) !important; }
.balance-table th, .balance-table td { white-space: nowrap; }
.bal-cell { min-width: 6.5rem; display: inline-block; text-align: left; }
.bal-bar { height: 4px; border-radius: 4px; background: var(--ems-neutral-soft); overflow: hidden; margin-top: .3rem; }
.bal-bar > span { display: block; height: 100%; border-radius: 4px; }
.seg-choice.w-100 { display: flex; }

/* ---------- Map picker ---------- */
.map-box { position: relative; border: 1px solid var(--ems-border); border-radius: var(--ems-radius); overflow: hidden; background: #e5e7eb; }
.map-canvas { height: 420px; width: 100%; }
@media (max-width: 991.98px) { .map-canvas { height: 300px; } }
.map-toolbar { position: absolute; top: .6rem; right: .6rem; z-index: 500; }
.map-toolbar .btn { box-shadow: var(--ems-shadow); }
.leaflet-container { font-family: var(--ems-font); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 3.5rem 1.5rem; }
.empty-icon { width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; border-radius: 1rem; display: grid; place-items: center; background: var(--ems-neutral-soft); color: var(--ems-subtle); font-size: 1.35rem; }
.empty-state h3 { font-size: 1rem; margin-bottom: .3rem; }
.empty-state p { color: var(--ems-muted); font-size: .875rem; max-width: 42ch; margin: 0 auto; }

/* ---------- Stat cards (dashboards) ---------- */
.stat-card { background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: var(--ems-radius-lg); padding: 1.1rem 1.15rem; box-shadow: var(--ems-shadow-sm); display: flex; gap: .9rem; align-items: flex-start; height: 100%; }
.stat-icon { width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.stat-label { font-size: .8rem; color: var(--ems-muted); font-weight: 500; }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: .75rem; color: var(--ems-subtle); margin-top: .15rem; }

.tone-primary { background: var(--ems-primary-soft); color: var(--ems-primary); }
.tone-success { background: var(--ems-success-soft); color: var(--ems-success); }
.tone-warning { background: var(--ems-warning-soft); color: var(--ems-warning); }
.tone-danger  { background: var(--ems-danger-soft);  color: var(--ems-danger); }
.tone-info    { background: var(--ems-info-soft);    color: var(--ems-info); }
.tone-neutral { background: var(--ems-neutral-soft); color: var(--ems-neutral); }
.tone-violet  { background: var(--ems-violet-soft);  color: var(--ems-violet); }

/* ---------- Toasts ---------- */
#toast-stack { top: 0; right: 0; z-index: 1090; }
@media (max-width: 575.98px) { #toast-stack { left: 0; right: 0; } #toast-stack .toast { width: 100%; } }
.ems-toast { border: 0; border-radius: var(--ems-radius); box-shadow: var(--ems-shadow-lg); background: var(--ems-surface); overflow: hidden; border-left: 4px solid var(--ems-info); }
.ems-toast .toast-body { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem .9rem; font-size: .875rem; font-weight: 500; }
.ems-toast .toast-text { flex: 1; }
.ems-toast .toast-icon { margin-top: .15rem; }
.ems-toast.toast-success { border-left-color: var(--ems-success); } .ems-toast.toast-success .toast-icon { color: var(--ems-success); }
.ems-toast.toast-danger  { border-left-color: var(--ems-danger); }  .ems-toast.toast-danger .toast-icon  { color: var(--ems-danger); }
.ems-toast.toast-warning { border-left-color: var(--ems-warning); } .ems-toast.toast-warning .toast-icon { color: var(--ems-warning); }
.ems-toast.toast-info .toast-icon { color: var(--ems-info); }
.btn-close-sm { font-size: .65rem; padding: .35rem; }

/* ---------- Modals ---------- */
.modal { --bs-modal-border-radius: var(--ems-radius-lg); --bs-modal-border-color: transparent; --bs-modal-header-border-color: var(--ems-border); --bs-modal-footer-border-color: var(--ems-border); }
.modal-title { font-weight: 700; font-size: 1.05rem; }
.confirm-modal .modal-body { padding: 1.5rem 1.5rem 1rem; text-align: center; }
.confirm-modal .modal-footer { border-top: 0; padding: 0 1.5rem 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.confirm-modal .modal-footer > * { margin: 0; }
.confirm-icon { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; margin: 0 auto .9rem; font-size: 1.15rem; }

/* ---------- Notifications ---------- */
.notif-menu { width: min(380px, calc(100vw - 1.5rem)); padding: 0; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1rem; border-bottom: 1px solid var(--ems-border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-list form { margin: 0; }
.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--ems-subtle); font-size: .85rem; display: grid; gap: .5rem; justify-items: center; }
.notif-empty i { font-size: 1.4rem; }
.notif-foot { display: block; text-align: center; padding: .7rem; font-size: .8125rem; font-weight: 600; border-top: 1px solid var(--ems-border); background: var(--ems-surface-2); }
.notif-row {
  width: 100%; display: flex; gap: .75rem; align-items: flex-start; text-align: left; border: 0; background: transparent;
  padding: .8rem 1rem; border-bottom: 1px solid var(--ems-border); color: inherit; position: relative;
}
.notif-row:hover { background: var(--ems-surface-2); }
.notif-row.unread, li.unread .notif-row { background: #fafaff; }
.notif-ico { width: 2.1rem; height: 2.1rem; border-radius: .65rem; display: grid; place-items: center; flex: none; font-size: .85rem; }
.notif-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: .1rem; }
.notif-title { font-weight: 600; font-size: .85rem; color: var(--ems-text); }
.notif-msg { font-size: .8rem; color: var(--ems-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: .72rem; color: var(--ems-subtle); }
.unread-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ems-primary); flex: none; margin-top: .45rem; }
.notif-page-list { list-style: none; margin: 0; padding: 0; }
.notif-page-list form { margin: 0; }
.notif-page-list li:last-child .notif-row { border-bottom: 0; }
.notif-page-list .notif-row { padding: 1rem 1.25rem; }

/* ---------- Employee shell (mobile-first) ---------- */
.app-body.employee { background: var(--ems-bg); }
.m-topbar {
  position: sticky; top: 0; z-index: 1020; background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--ems-border); padding-top: env(safe-area-inset-top);
}
.m-topbar-inner { max-width: 720px; margin: 0 auto; height: 58px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 0 .75rem 0 1rem; }
.m-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--ems-text); font-weight: 700; }
.m-brand:hover { text-decoration: none; }
.m-brand .brand-mark { width: 2rem; height: 2rem; border-radius: 9px; font-size: .9rem; }
.m-brand-name { font-size: .95rem; max-width: 52vw; }
.avatar-btn { border: 0; background: transparent; padding: .2rem; border-radius: 50%; }
.avatar-btn:focus-visible { box-shadow: var(--ems-ring); }
.m-content { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.has-tabs .m-content { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.employee .page-header { margin-bottom: 1rem; }
.employee .page-title { font-size: 1.3rem; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; justify-content: space-around;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--ems-border); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
  .bottom-nav { left: 50%; right: auto; bottom: 1rem; transform: translateX(-50%); width: min(560px, calc(100% - 2rem)); border: 1px solid var(--ems-border); border-radius: 18px; box-shadow: var(--ems-shadow-lg); padding: .35rem; }
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .4rem .25rem; border-radius: 12px;
  color: var(--ems-subtle); font-size: .68rem; font-weight: 600; min-height: 3.1rem; justify-content: center;
}
.bottom-nav-item i { font-size: 1.15rem; }
.bottom-nav-item:hover { text-decoration: none; color: var(--ems-text-2); }
.bottom-nav-item.active { color: var(--ems-primary); }
.bottom-nav-item.active i { transform: translateY(-1px); }

/* =============================================================================
   Installer
   ============================================================================= */
.install-body { background: var(--ems-bg); }
.install-shell { max-width: 1080px; margin: 0 auto; padding: 1.25rem 1rem 2rem; min-height: 100vh; display: flex; flex-direction: column; }
@media (min-width: 768px) { .install-shell { padding: 2rem 1.5rem 3rem; } }
.install-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.install-head .auth-logo { color: var(--ems-text); }
.install-head .mark { background: var(--ems-primary); border-color: var(--ems-primary); }
.install-tag { display: inline-block; margin-left: .35rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ems-primary); background: var(--ems-primary-soft); padding: .2rem .5rem; border-radius: 999px; vertical-align: middle; }
.install-progress-text { font-size: .8125rem; color: var(--ems-muted); font-weight: 500; }
.install-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; flex: 1; align-items: start; }
@media (min-width: 992px) { .install-grid { grid-template-columns: 240px 1fr; gap: 2rem; } }

.install-steps ol { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.install-steps ol::-webkit-scrollbar { display: none; }
@media (min-width: 992px) { .install-steps ol { flex-direction: column; gap: .25rem; position: sticky; top: 2rem; } }
.install-steps li > a, .install-steps li > span {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: var(--ems-radius);
  color: var(--ems-muted); font-weight: 500; font-size: .875rem; white-space: nowrap; text-decoration: none;
}
.install-steps li > a:hover { background: var(--ems-surface); color: var(--ems-text); }
.install-steps .dot {
  width: 1.75rem; height: 1.75rem; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: .75rem; font-weight: 700; background: var(--ems-surface); border: 1.5px solid var(--ems-border-strong); color: var(--ems-muted);
}
.install-steps .is-current > span { background: var(--ems-surface); color: var(--ems-text); font-weight: 600; box-shadow: var(--ems-shadow-sm); }
.install-steps .is-current .dot { background: var(--ems-primary); border-color: var(--ems-primary); color: #fff; box-shadow: 0 0 0 4px rgba(var(--ems-primary-rgb), .15); }
.install-steps .is-done .dot { background: var(--ems-success); border-color: var(--ems-success); color: #fff; }
.install-steps .is-done > a { color: var(--ems-text-2); }
@media (max-width: 991.98px) { .install-steps .is-todo .label, .install-steps .is-done .label { display: none; } }

.install-card { background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: var(--ems-radius-xl); box-shadow: var(--ems-shadow); padding: 1.5rem 1.25rem; }
@media (min-width: 768px) { .install-card { padding: 2.25rem 2.5rem; } }
.install-card h1 { font-size: 1.5rem; letter-spacing: -.025em; margin-bottom: .35rem; }
.install-card .lead-text { color: var(--ems-muted); margin-bottom: 1.75rem; max-width: 60ch; }
.install-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ems-subtle); margin: 1.75rem 0 .85rem; }
.install-section-title:first-of-type { margin-top: 0; }
.install-actions { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--ems-border); }
.install-foot { text-align: center; font-size: .8rem; color: var(--ems-subtle); margin-top: 2rem; }

.check-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--ems-border); border-radius: var(--ems-radius); overflow: hidden; }
.check-list li { display: flex; gap: .85rem; align-items: flex-start; padding: .7rem 1rem; border-top: 1px solid var(--ems-border); font-size: .875rem; }
.check-list li:first-child { border-top: 0; }
.check-list .state { width: 1.4rem; height: 1.4rem; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; margin-top: .05rem; }
.check-list .ok .state { background: var(--ems-success-soft); color: var(--ems-success); }
.check-list .fail .state { background: var(--ems-danger-soft); color: var(--ems-danger); }
.check-list .warn .state { background: var(--ems-warning-soft); color: var(--ems-warning); }
.check-list .name { font-weight: 600; color: var(--ems-text); }
.check-list .detail { color: var(--ems-muted); font-size: .8125rem; }
.check-list .fail .detail { color: #b91c1c; }
.check-list .opt { font-size: .7rem; font-weight: 600; color: var(--ems-subtle); text-transform: uppercase; letter-spacing: .05em; margin-left: .35rem; }

.day-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker label {
  min-width: 3.25rem; text-align: center; padding: .5rem .7rem; border-radius: var(--ems-radius-sm); cursor: pointer; user-select: none;
  border: 1px solid var(--ems-border-strong); font-weight: 600; font-size: .8125rem; color: var(--ems-text-2); background: var(--ems-surface);
}
.day-picker input:checked + label { background: var(--ems-primary); border-color: var(--ems-primary); color: #fff; }
.day-picker input:focus-visible + label { box-shadow: var(--ems-ring); }

.logo-preview { width: 72px; height: 72px; border-radius: var(--ems-radius); border: 1px dashed var(--ems-border-strong); display: grid; place-items: center; background: var(--ems-surface-2); color: var(--ems-subtle); overflow: hidden; flex: none; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }

.summary-list { display: grid; grid-template-columns: 1fr; gap: 0; border: 1px solid var(--ems-border); border-radius: var(--ems-radius); overflow: hidden; margin: 0; }
.summary-list > div { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; padding: .7rem 1rem; border-top: 1px solid var(--ems-border); font-size: .875rem; }
.summary-list > div:first-child { border-top: 0; }
.summary-list dt { color: var(--ems-muted); font-weight: 500; }
.summary-list dd { margin: 0; font-weight: 600; color: var(--ems-text); word-break: break-word; }
@media (max-width: 575.98px) { .summary-list > div { grid-template-columns: 1fr; gap: .15rem; } }
.code-box { position: relative; background: #0f172a; color: #e2e8f0; border-radius: var(--ems-radius); padding: .85rem 3.25rem .85rem 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; word-break: break-all; }
.code-box .copy { position: absolute; top: .5rem; right: .5rem; border: 0; background: rgba(255,255,255,.1); color: #e2e8f0; width: 2rem; height: 2rem; border-radius: 6px; }
.code-box .copy:hover { background: rgba(255,255,255,.2); }
.success-burst { width: 4rem; height: 4rem; border-radius: 50%; display: grid; place-items: center; background: var(--ems-success-soft); color: var(--ems-success); font-size: 1.75rem; margin-bottom: 1.25rem; box-shadow: 0 0 0 8px rgba(5,150,105,.08); }

/* ---------- Payroll ---------- */
.calc-table { --bs-table-bg: transparent; font-size: .875rem; }
.calc-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ems-muted); font-weight: 600; background: var(--ems-neutral-soft); padding: .55rem 1.25rem; border: 0; }
.calc-table td { padding: .6rem 1.25rem; border-color: var(--ems-border); }
.calc-table tfoot td { font-weight: 700; border-bottom: 0; background: #fafbfd; }
.calc-ded { border-left: 1px solid var(--ems-border); }
@media (max-width: 767.98px) { .calc-ded { border-left: 0; border-top: 1px solid var(--ems-border); } }
.net-band { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; background: var(--ems-primary-soft); border-top: 1px solid #c7d2fe; border-radius: 0 0 var(--ems-radius) var(--ems-radius); }
.net-amount { font-size: 1.6rem; font-weight: 700; color: var(--ems-primary-ink); line-height: 1.2; white-space: nowrap; }
.count-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.count-cell { border: 1px solid var(--ems-border); border-radius: var(--ems-radius-sm); padding: .55rem .65rem; display: flex; flex-direction: column; }
.count-value { font-size: 1.2rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.count-label { font-size: .72rem; color: var(--ems-muted); }
.tone-text-success { color: var(--ems-success); } .tone-text-warning { color: var(--ems-warning); } .tone-text-danger { color: var(--ems-danger); }
.tone-text-info { color: var(--ems-info); } .tone-text-violet { color: var(--ems-violet); } .tone-text-neutral { color: var(--ems-text); }
.payroll-table tfoot td { border-bottom: 0; background: #fafbfd; }

/* ---------- Dashboard ---------- */
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ems-muted); }
.live-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ems-success); box-shadow: 0 0 0 3px var(--ems-success-soft); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 6px rgba(5,150,105,.08); } }
.stat-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat-link:hover { color: inherit; border-color: rgba(var(--ems-primary-rgb), .35); box-shadow: var(--ems-shadow); transform: translateY(-1px); }
.stat-link:focus-visible { outline: 0; box-shadow: var(--ems-ring); }
.stat-of { font-size: 1rem; font-weight: 600; color: var(--ems-subtle); }
.stat-value-sm { font-size: 1.15rem; line-height: 1.6; }
@media (max-width: 575.98px) { .stat-link { padding: .85rem; } .stat-link .stat-icon { display: none; } .stat-link .stat-value-sm { font-size: 1rem; } }
.chart-box { position: relative; height: 260px; }
.chart-box-lg { height: 300px; }
.chart-box-donut { height: 210px; }
.rate-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.rate-row > div { background: var(--ems-neutral-soft); border-radius: var(--ems-radius-sm); padding: .6rem .8rem; text-align: center; }
.rate-value { font-size: 1.35rem; font-weight: 700; color: var(--ems-text); font-variant-numeric: tabular-nums; }
.rate-label { font-size: .75rem; color: var(--ems-muted); }
.todo-list .list-group-item { padding: 0; }
.todo-row { display: flex; align-items: center; gap: .7rem; padding: .7rem 1.25rem; color: var(--ems-text); text-decoration: none; font-size: .875rem; }
.todo-row:hover { background: var(--ems-neutral-soft); color: var(--ems-text); }
.todo-icon { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .85rem; }
.activity-list { list-style: none; margin: 0; padding: .5rem 1.25rem 1rem; }
.activity-list li { display: flex; gap: .75rem; padding: .6rem 0; position: relative; }
.activity-list li + li::before { content: ""; position: absolute; left: .95rem; top: -.6rem; height: 1.2rem; border-left: 1px dashed var(--ems-border); }
.activity-icon { width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--ems-primary-soft); color: var(--ems-primary); display: grid; place-items: center; flex-shrink: 0; font-size: .75rem; }
.activity-text { font-size: .85rem; line-height: 1.35; word-break: break-word; }

/* ---------- Reports ---------- */
.report-card { display: flex; align-items: center; gap: .9rem; height: 100%; padding: 1rem 1.1rem; background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: var(--ems-radius-lg); box-shadow: var(--ems-shadow-sm); color: var(--ems-text); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.report-card:hover { color: var(--ems-text); border-color: rgba(var(--ems-primary-rgb), .35); box-shadow: var(--ems-shadow); transform: translateY(-1px); }
.report-card .stat-icon { flex-shrink: 0; }
.report-title { display: block; font-weight: 700; }
.report-desc { display: block; font-size: .8rem; color: var(--ems-muted); line-height: 1.4; margin-top: .15rem; }
.report-go { margin-left: auto; color: var(--ems-subtle); font-size: .8rem; }
.preset-chip { display: inline-block; padding: .2rem .65rem; border-radius: 999px; background: var(--ems-neutral-soft); color: var(--ems-text); text-decoration: none; font-weight: 500; }
.preset-chip:hover { background: var(--ems-primary-soft); color: var(--ems-primary); }
.report-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; font-size: .875rem; }
.report-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.report-chip { background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: var(--ems-radius); padding: .7rem .9rem; }
.report-chip-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ems-muted); font-weight: 600; }
.report-chip-value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; word-break: break-word; }
.report-table .table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ems-muted); background: var(--ems-neutral-soft); }
.report-table .table td { font-size: .84rem; }
.report-table tfoot td { font-weight: 700; background: #fafbfd; border-bottom: 0; }
.report-notes { font-size: .8rem; color: var(--ems-muted); }
/* print view */
.print-page { background: #fff; }
.print-toolbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; padding: .6rem 1rem; background: var(--ems-neutral-soft); border-bottom: 1px solid var(--ems-border); }
.print-sheet { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: .75rem; margin-bottom: 1rem; border-bottom: 2px solid var(--ems-primary); }
.print-logo { width: 40px; height: 40px; object-fit: contain; }
.print-title { font-size: 1.25rem; font-weight: 700; color: var(--ems-primary); }
.print-page .report-meta { display: none; }
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  @page wide { size: A4 landscape; margin: 10mm; }
  .print-landscape .print-sheet { page: wide; }
  .no-print { display: none !important; }
  .print-sheet { max-width: none; padding: 0; }
  .print-page .card, .print-page .report-chip { box-shadow: none !important; }
  .print-page .table-responsive { overflow: visible !important; }
  .print-page .report-table { break-inside: auto; }
  .print-page .report-table tr { break-inside: avoid; }
  .print-page .report-table thead { display: table-header-group; }
  .print-page .badge { border: 1px solid currentColor; }
  .print-page .report-chips { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  html, body.print-page, .print-sheet { width: auto !important; min-width: 0 !important; }
  .print-page .report-table .table { font-size: 7.5pt; width: 100%; }
  .print-page .report-table .table th, .print-page .report-table .table td { padding: 3px 4px; font-size: 7.5pt; white-space: normal; }
  .print-page .report-table .table td.text-nowrap { white-space: nowrap; }
  .print-page .report-chip { padding: 4px 8px; }
  .print-page .report-chip-value { font-size: 10pt; }
  .print-page .report-chip-label { font-size: 6.5pt; }
  .print-page .card-header { padding: 6px 8px; }
}

/* ---------- Settings & activity log ---------- */
.settings-nav { display: flex; flex-direction: column; gap: .2rem; background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: var(--ems-radius-lg); padding: .5rem; position: sticky; top: 5.5rem; }
.settings-nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: var(--ems-radius-sm); color: var(--ems-text); text-decoration: none; font-weight: 500; font-size: .9rem; }
.settings-nav a i { width: 1.1rem; text-align: center; color: var(--ems-subtle); }
.settings-nav a:hover { background: var(--ems-neutral-soft); }
.settings-nav a.active { background: var(--ems-primary-soft); color: var(--ems-primary); }
.settings-nav a.active i { color: var(--ems-primary); }
@media (max-width: 991.98px) { .settings-nav { flex-direction: row; overflow-x: auto; position: static; } .settings-nav a { white-space: nowrap; } }
.settings-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--ems-bg, #f6f7fb) 70%, transparent); padding: .75rem 0; display: flex; justify-content: flex-end; z-index: 3; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-row { display: flex; gap: .85rem; padding: .85rem 1.25rem; border-top: 1px solid var(--ems-border); align-items: flex-start; }
.log-list .log-row:first-child { border-top: 0; }
.log-icon { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .8rem; }
.log-text { font-size: .9rem; word-break: break-word; }
.log-time { font-size: .78rem; text-align: right; white-space: nowrap; line-height: 1.35; }
.log-details summary { cursor: pointer; font-size: .8rem; color: var(--ems-primary); margin-top: .3rem; }
.log-details table { font-size: .8rem; background: var(--ems-neutral-soft); border-radius: var(--ems-radius-sm); }

/* ---------- Employee portal ---------- */
.employee .m-content > section, .employee .e-pair { margin-bottom: 1rem; }
.e-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .25rem .1rem 1rem; }
.e-greet { color: var(--ems-muted); font-size: .9rem; }
.e-name { font-size: 1.6rem; font-weight: 700; margin: 0; line-height: 1.15; letter-spacing: -.01em; }
.e-meta { font-size: .85rem; color: var(--ems-text-2, var(--ems-text)); margin-top: .2rem; }
.e-date { font-size: .8rem; color: var(--ems-muted); margin-top: .35rem; }
.e-hero .avatar { box-shadow: 0 0 0 4px var(--ems-surface), 0 6px 18px rgba(15,23,42,.12); }
.e-card { background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: 18px; padding: 1rem 1.1rem; box-shadow: var(--ems-shadow-sm); }
.e-card-title { font-size: 1rem; font-weight: 700; margin: 0; }
.e-today { border-top: 4px solid var(--ems-primary); }
.tone-border-success { border-top-color: var(--ems-success); } .tone-border-warning { border-top-color: var(--ems-warning); }
.tone-border-danger { border-top-color: var(--ems-danger); } .tone-border-info { border-top-color: var(--ems-info); }
.tone-border-violet { border-top-color: var(--ems-violet); } .tone-border-neutral { border-top-color: var(--ems-subtle); }
.e-status { font-size: .8rem; padding: .4em .7em; }
.e-times { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .9rem 0 .7rem; }
.e-times > div { background: var(--ems-neutral-soft); border-radius: 12px; padding: .55rem .7rem; display: flex; flex-direction: column; }
.e-times-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ems-muted); font-weight: 600; }
.e-times-value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.e-message { font-size: .85rem; color: var(--ems-text-2, var(--ems-text)); margin: 0 0 .8rem; display: flex; gap: .45rem; }
.e-message i { color: var(--ems-primary); margin-top: .2rem; }
.e-punch { font-weight: 700; letter-spacing: .04em; border-radius: 14px; padding: .9rem 1rem; color: #fff; border: 0; display: flex; align-items: center; justify-content: center; gap: .6rem; box-shadow: 0 8px 20px rgba(15,23,42,.15); }
.e-punch-check_in { background: linear-gradient(135deg, #059669, #10b981); }
.e-punch-check_out { background: linear-gradient(135deg, #ea580c, #f97316); }
.e-punch:hover, .e-punch:focus { color: #fff; filter: brightness(1.05); }
.e-punch:disabled { opacity: .55; color: #fff; }
.e-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.e-section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ems-muted); margin: 0 0 .5rem .1rem; }
.e-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.e-tile { background: var(--ems-surface); border: 1px solid var(--ems-border); border-radius: 14px; padding: .7rem .4rem; text-align: center; display: flex; flex-direction: column; }
.e-tile-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.e-tile-label { font-size: .72rem; color: var(--ems-muted); margin-top: .15rem; }
.e-balances { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; font-size: .9rem; }
.e-days { list-style: none; margin: 0; padding: 0; }
.e-days li { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; border-top: 1px solid var(--ems-border); }
.e-days li:first-child { border-top: 0; }
.e-day-date { width: 2.6rem; text-align: center; display: flex; flex-direction: column; line-height: 1.1; flex-shrink: 0; }
.e-day-date span { font-size: .68rem; text-transform: uppercase; color: var(--ems-muted); }
.e-day-date strong { font-size: 1.05rem; }
.e-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.e-cal-head { font-size: .68rem; text-align: center; color: var(--ems-muted); font-weight: 600; }
.e-cal-day { aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center; font-size: .78rem; font-weight: 600; background: var(--ems-neutral-soft); color: var(--ems-muted); }
.e-cal-day.today { box-shadow: 0 0 0 2px var(--ems-primary); }
.c-p { background: #d1fae5 !important; color: #047857 !important; } .c-l { background: #fef3c7 !important; color: #b45309 !important; }
.c-h { background: #fde68a !important; color: #92400e !important; } .c-a { background: #fee2e2 !important; color: #b91c1c !important; }
.c-lv { background: #e0e7ff !important; color: #4338ca !important; } .c-ho, .c-o { background: #f1f5f9 !important; color: #94a3b8 !important; }
.c-n { background: transparent !important; border: 1px dashed var(--ems-border); }
.e-cal-legend { display: flex; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .75rem; font-size: .72rem; color: var(--ems-muted); }
.e-cal-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.e-pay-amount { font-size: clamp(1rem, 4.6vw, 1.25rem); }
.e-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 380px) { .e-pair { grid-template-columns: 1fr; } .e-tile-value { font-size: 1.2rem; } }

/* check-in */
.e-back { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--ems-muted); margin: 0 0 .6rem .1rem; text-decoration: none; }
.e-clock { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.e-clock small { font-size: .7rem; margin-left: .15rem; color: var(--ems-muted); }
.e-step { margin-bottom: 1rem; }
.e-step-head { font-weight: 700; font-size: .9rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.e-step-no { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--ems-primary); color: #fff; display: grid; place-items: center; font-size: .75rem; }
.e-camera { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: #0f172a; }
.e-camera video, .e-camera img { width: 100%; height: 100%; object-fit: cover; display: block; }
.e-camera video { transform: scaleX(-1); }
.e-camera-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; color: #cbd5e1; text-align: center; padding: 1.25rem; font-size: .85rem; }
.e-camera-empty i { font-size: 2rem; opacity: .7; }
.e-file-fallback { display: block; margin-top: .6rem; }
.e-loc { display: flex; align-items: center; gap: .75rem; padding: .75rem .85rem; border-radius: 14px; border: 1px solid; }
.e-loc > i { font-size: 1.25rem; }
.e-loc-wait { background: var(--ems-neutral-soft); border-color: var(--ems-border); color: var(--ems-text); }
.e-loc-wait > i { animation: live-pulse 1.5s infinite; color: var(--ems-primary); }
.e-loc-ok { background: var(--ems-success-soft); border-color: #a7f3d0; color: #065f46; }
.e-loc-warn { background: var(--ems-warning-soft); border-color: #fde68a; color: #92400e; }
.e-loc-bad { background: var(--ems-danger-soft); border-color: #fecaca; color: #991b1b; }
.e-result { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 14px; margin-bottom: .8rem; font-size: .9rem; }
.e-result > i { font-size: 1.4rem; margin-top: .05rem; }
.e-result-ok { background: var(--ems-success-soft); color: #065f46; border: 1px solid #a7f3d0; }
.e-result-bad { background: var(--ems-danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.e-thumb { margin: 0; width: 72px; text-align: center; }
.e-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.e-thumb figcaption { font-size: .7rem; color: var(--ems-muted); }
.e-attempts { list-style: none; margin: 0; padding: 0; }
.e-attempts li { display: flex; gap: .65rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--ems-border); }
.e-attempts li:first-child { border-top: 0; }
.e-attempt-icon { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; flex-shrink: 0; }
.e-attempt-icon.ok { background: var(--ems-success-soft); color: var(--ems-success); }
.e-attempt-icon.no { background: var(--ems-danger-soft); color: var(--ems-danger); }

/* attendance history */
.e-month-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.e-month-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.e-days-link li { padding: 0; }
.e-days-link a { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; color: inherit; text-decoration: none; width: 100%; }
.e-days-link a:hover { background: var(--ems-neutral-soft); }
.e-map { height: 220px; border-radius: 14px; overflow: hidden; }
.e-correction { border: 1px solid var(--ems-border); border-radius: 12px; padding: .65rem .8rem; margin-bottom: .6rem; }
.e-fix summary { cursor: pointer; color: var(--ems-primary); font-weight: 600; font-size: .9rem; list-style: none; }
.e-fix summary::-webkit-details-marker { display: none; }

/* ---------- Utilities ---------- */
.visually-hidden-focusable:focus { position: fixed !important; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: var(--ems-radius-sm); box-shadow: var(--ems-shadow); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- employee leave (5.4) */
.e-bal-detail { display: flex; flex-direction: column; gap: .1rem; margin-top: .35rem; font-size: .78rem; color: var(--ems-muted); }
.e-bal-detail strong { color: var(--ems-text); }
.e-chips { display: flex; gap: .4rem; overflow-x: auto; margin: 1rem 0 .6rem; padding-bottom: .15rem; scrollbar-width: none; }
.e-chips::-webkit-scrollbar { display: none; }
.e-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--ems-border); background: var(--ems-surface); color: var(--ems-text); font-size: .8rem; font-weight: 600; text-decoration: none; }
.e-chip span { font-size: .7rem; color: var(--ems-muted); font-variant-numeric: tabular-nums; }
.e-chip.active { background: var(--ems-primary); border-color: var(--ems-primary); color: #fff; }
.e-chip.active span { color: rgba(255,255,255,.8); }
#lv-days li { padding: .4rem 0; }
#lv-alerts .e-result { margin-bottom: .6rem; }
.e-result-warn { background: var(--ems-warning-soft); color: #92400e; border: 1px solid #fde68a; }

/* ---------------------------------------------------------------- employee payslips (5.5) */
.e-pay-sum { display: grid; gap: .35rem; }
.e-pay-sum > div { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.e-pay-sum .e-pay-amount { white-space: nowrap; }
.e-net { display: flex; flex-direction: column; margin: .9rem 0 .2rem; }
.e-net-value { font-size: clamp(1.6rem, 8vw, 2.1rem); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.e-lines { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.e-lines li { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--ems-border); }
.e-lines li:first-child { border-top: 0; }
.e-lines li > span:first-child { min-width: 0; }
.e-lines li > span:last-child { white-space: nowrap; font-weight: 600; }
.e-lines small { display: block; color: var(--ems-muted); font-size: .75rem; }
.e-lines .e-lines-total { font-weight: 700; border-top-style: dashed; }
.e-lines-net { display: flex; justify-content: space-between; margin-top: .4rem; padding: .7rem .8rem; border-radius: 12px; background: var(--ems-primary-soft, var(--ems-neutral-soft)); font-weight: 700; }
.e-tiles-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------------------------------------------------------------- employee profile (5.6) */
.e-profile-head { display: flex; align-items: center; gap: 1rem; }
.e-profile-photo { position: relative; flex-shrink: 0; }
.e-profile-photo img, .e-profile-photo .avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; font-size: 1.6rem; }
.e-photo-btn { position: absolute; right: -4px; bottom: -4px; }
.e-photo-btn .btn { width: 2rem; height: 2rem; padding: 0; display: grid; place-items: center; border: 2px solid var(--ems-surface); }
.e-profile-head .e-name { font-size: 1.3rem; }
.e-dl { margin: 0; font-size: .9rem; }
.e-dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--ems-border); }
.e-dl > div:first-child { border-top: 0; }
.e-dl dt { font-weight: 500; color: var(--ems-muted); flex-shrink: 0; }
.e-dl dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.e-subhead { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--ems-muted); margin: 1rem 0 .1rem; }
