:root {
  --brand: #0D1654;
  --brand-dark: #09103D;
  --brand-mid: #1565C0;
  --brand-soft: #E8F4FD;
  --accent: #00AEEF;
  --bg: #F5F8FF;
  --surface: #ffffff;
  --text: #1A1A2E;
  --muted: #4A5568;
  --border: #DBEAFE;
  --shadow: 0 2px 12px rgba(13, 22, 84, 0.08);
  --radius: 12px;
  --ok: #0f7b4a;
  --ok-bg: #e8f6ee;
  --warn: #b45309;
  --warn-bg: #fef3e6;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #1565C0;
  --info-bg: #E8F4FD;
  --sidebar: 272px;
  --header: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 174, 239, 0.16); }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; min-height: 100dvh; width: 100%; overflow-x: hidden; }
body.nav-open { overflow: hidden; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  gap: 16px;
}
.boot-screen img { height: auto; width: min(88vw, 360px); }

/* Auth */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 440px) 1fr;
}
.auth-brand {
  background:
    radial-gradient(circle at 88% -8%, rgba(0, 174, 239, 0.38), transparent 44%),
    linear-gradient(165deg, #1565C0 0%, var(--brand) 48%, var(--brand-dark) 100%);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-brand img { width: min(100%, 360px); margin-bottom: 20px; border-radius: 14px; }
.auth-brand h1,
.auth-brand .tag { display: none; }
.auth-brand p { margin-top: 8px !important; }
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 22px; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.auth-card p.sub { margin: 0 0 24px; color: var(--muted); }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background:
    radial-gradient(circle at 12% -8%, rgba(0, 174, 239, 0.32), transparent 42%),
    linear-gradient(180deg, #0D1654 0%, #09103D 100%);
  border-right: 1px solid rgba(0, 174, 239, 0.18);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  transition: width .2s ease, transform .2s ease;
}
.sidebar.collapsed { width: 76px; }
.sb-brand {
  background: transparent;
  color: #fff;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  overflow: hidden;
  border-bottom: 1px solid rgba(0, 174, 239, 0.2);
}
.sb-brand img {
  height: 44px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}
.sb-brand-copy { display: none; }
.sidebar.collapsed .sb-brand { justify-content: center; padding: 0 8px; }
.sidebar.collapsed .sb-brand img {
  height: 42px;
  width: 52px;
  max-width: 52px;
  object-fit: cover;
  object-position: 12% center;
  border-radius: 10px;
}
.sb-brand strong { font-size: 15px; letter-spacing: 0.06em; white-space: nowrap; }
.sb-brand span { display: block; font-size: 11px; opacity: .8; font-weight: 500; }
.sb-nav { padding: 12px 10px 24px; overflow: auto; flex: 1; }
.sb-foot {
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0, 174, 239, 0.18);
  background: rgba(9, 16, 61, 0.45);
}
.sb-foot .btn { width: 100%; justify-content: center; }
.sidebar.collapsed .sb-foot { padding: 10px 8px; }
.sb-sec {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, 0.42);
  padding: 14px 12px 6px;
  text-transform: uppercase;
}
.sidebar.collapsed .sb-sec, .sidebar.collapsed .sb-txt { display: none; }
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 2px;
}
.sb-item:hover { background: rgba(0, 174, 239, 0.16); color: #fff; }
.sb-item.active {
  background: rgba(0, 174, 239, 0.22);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sb-ico { width: 18px; text-align: center; flex-shrink: 0; }

.main {
  margin-left: var(--sidebar);
  flex: 1;
  min-width: 0;
  transition: margin-left .2s ease;
}
.sidebar.collapsed + .main, .shell.collapsed .main { margin-left: 76px; }
.topbar {
  height: var(--header);
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(13, 22, 84, 0.06);
  border-top: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.content { padding: 24px; max-width: 1400px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; }
.page-head .muted { color: var(--muted); margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-main { grid-template-columns: 1.6fr 1fr; }
.dash-stats {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}
.dash-stats .stat {
  min-width: 0;
  min-height: 124px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 3px solid var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card h3 { margin: 0; font-size: 14px; font-weight: 650; }
.card-h { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-b { padding: 16px; }

.stat {
  padding: 16px 18px;
}
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stat .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.place-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; }
.map-pin { text-decoration: none; font-size: 16px; line-height: 1; }
.stat.clickable, tr.clickable, .who-row.clickable { cursor: pointer; }
.stat.clickable:hover { box-shadow: 0 0 0 2px var(--accent); }
tr.clickable:hover td { background: var(--brand-soft); }
.who-row.clickable:hover { background: var(--brand-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-mute { background: #f2f4f7; color: #475467; }

.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.btn:hover { background: #f8fafc; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--brand-mid));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 174, 239, 0.28);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-mid), var(--brand)); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.95); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.emp-head-actions { max-width: 420px; }
.btn-accent { background: var(--brand); color: #fff; border: 0; }
.btn-lg { padding: 16px 24px; font-size: 16px; border-radius: 12px; width: 100%; }
.btn-clock {
  background: linear-gradient(135deg, var(--accent), var(--brand-mid));
  color: #fff;
  border: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 54px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 22px rgba(0, 174, 239, 0.32);
}
.btn-clock.out { background: #0f7b4a; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; }

.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: var(--brand-soft); }
.emp-cell { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(0, 174, 239, 0.35);
  border-color: var(--accent);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label .req { color: #d92d20; }
.pw-wrap { position: relative; display: flex; align-items: stretch; }
.pw-wrap input { width: 100%; padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
}
.pw-toggle:hover { color: var(--brand); background: var(--brand-soft); }
.pw-toggle:focus-visible {
  outline: 2px solid rgba(0, 174, 239, 0.35);
  outline-offset: 1px;
}
.pw-toggle svg { width: 20px; height: 20px; display: block; }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-pick img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.tab.on { color: var(--brand); border-color: var(--accent); }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.skel { background: linear-gradient(90deg, #eef1f6, #f7f8fb, #eef1f6); background-size: 200% 100%; animation: s 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes s { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.impersonate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff6d6;
  border: 1px solid #e8c547;
  color: #5c4810;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}
.toast { background: #111827; color: #fff; padding: 12px 14px; border-radius: 10px; min-width: 260px; box-shadow: var(--shadow); }
.toast.ok { background: #065f46; }
.toast.err { background: #9b1c1c; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal-h { padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 650; }
.modal-b { padding: 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.whos-list { max-height: 280px; overflow: auto; }
.whos-list.file-side { max-height: 560px; }
.file-side-detail {
  padding: 8px 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.file-side-detail p { margin: 4px 0; }
.file-side-detail strong { color: var(--text); display: inline-block; min-width: 92px; }
.file-edit-grid { gap: 8px 10px; }
.file-edit-grid .field { margin: 0; }
.file-edit-grid input { min-height: 36px; padding: 6px 10px; }
.who-row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.map { height: 420px; border-radius: 12px; border: 1px solid var(--border); width: 100%; }
.clock-map .map { height: 220px; border: 0; }
.clock-card {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.grid .clock-card { max-width: none; margin: 0; }
.clock-status {
  text-align: center;
  padding: 18px 18px 20px;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.clock-status .big { font-size: 28px; font-weight: 700; }
.clock-status p,
.clock-note {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  margin: 8px 0;
}
.clock-err {
  display: block;
  white-space: normal;
  text-align: left;
  line-height: 1.45;
  font-weight: 600;
  padding: 12px 14px;
  margin: 12px 0 14px;
  border-radius: 16px;
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}
.btn-clock:hover { background: var(--brand-dark); color: #fff; }
.btn-clock.out:hover { background: #0c6a3f; color: #fff; }
.btn-clock:disabled { opacity: 0.6; cursor: not-allowed; }

.bell { position: relative; }
.dot {
  position: absolute; top: -2px; right: -2px;
  background: #e11d48; color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; border-radius: 99px;
  display: grid; place-items: center; padding: 0 4px;
}
.userchip { display: flex; align-items: center; gap: 8px; }
.userchip-name { font-weight: 600; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { flex-shrink: 0; }
.search-global {
  min-width: 0;
  width: 220px;
  max-width: 36vw;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  background: #f6f7fb;
}
.date-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.date-nav-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
}
.date-nav-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f6f7fb;
  border: 1px solid var(--border);
}
.date-nav-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(360px, 42vw);
}
.date-nav-label input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}
.date-nav-today {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
}
.notif-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.notif-group-h {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 0 6px;
  border-top: 1px solid var(--border);
}
.notif-group-h:first-child { border-top: 0; padding-top: 0; }
.notif-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.notif-row { align-items: flex-start; }
.btn-ghost { background: #fff; }
.sb-close { display: none; margin-left: auto; background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.sb-brand { position: relative; }
.overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(8,12,28,.48); z-index: 25;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.emp-hero {
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

@media (max-width: 1200px) {
  .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g-5 { grid-template-columns: repeat(3, 1fr); }
  .g-4, .g-main { grid-template-columns: 1fr 1fr; }
}
.userchip .btn { white-space: nowrap; }

/* Tablets & phones: slide-over navigation */
@media (max-width: 1024px) {
  :root { --header: 56px; }
  .sidebar {
    transform: translateX(-110%);
    width: min(86vw, 320px);
    border-right: 0;
    border-radius: 0 22px 22px 0;
    box-shadow: 16px 0 48px rgba(16, 24, 40, 0.22);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.collapsed { width: min(86vw, 320px); }
  .sidebar.collapsed .sb-sec,
  .sidebar.collapsed .sb-txt { display: block; }
  .sidebar.collapsed .sb-brand-copy { display: none; }
  .sidebar.collapsed .sb-brand { justify-content: flex-start; padding: 0 16px; }
  .sidebar.collapsed .sb-brand img,
  .sb-brand img {
    height: 42px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
  }
  .sidebar.open { transform: none; }
  .sb-close { display: grid; place-items: center; }
  .main, .shell.collapsed .main { margin-left: 0; }
  .overlay.show { display: block; }
  .topbar {
    padding: env(safe-area-inset-top) 12px 0 max(12px, env(safe-area-inset-left));
    height: calc(var(--header) + env(safe-area-inset-top));
    gap: 8px;
  }
  .topbar-right { padding-right: env(safe-area-inset-right); }
  .content {
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
  }
  .search-global { width: 160px; max-width: 32vw; }
  .sb-item { padding: 12px 14px; min-height: 44px; border-radius: 12px; }
  .icon-btn, .menu-btn { width: 42px; height: 42px; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 42px; }
  .auth-wrap { grid-template-columns: 1fr; min-height: 100dvh; width: 100%; }
  .auth-brand {
    min-height: unset;
    padding: calc(28px + env(safe-area-inset-top)) 24px 32px;
    align-items: center;
    text-align: center;
    background:
      radial-gradient(circle at 88% -10%, rgba(0, 174, 239, 0.35), transparent 42%),
      linear-gradient(165deg, var(--brand-mid) 0%, var(--brand) 48%, var(--brand-dark) 100%);
    position: relative;
    overflow: hidden;
  }
  .auth-brand::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(0, 174, 239, 0.22);
    right: -60px;
    top: -70px;
  }
  .auth-brand img,
  .auth-brand h1,
  .auth-brand .tag,
  .auth-brand p { position: relative; z-index: 1; }
  .auth-brand img {
    width: min(320px, 86vw);
    height: auto;
    max-height: none;
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto 8px;
    box-shadow: none;
    background: transparent;
  }
  .auth-brand h1,
  .auth-brand .tag,
  .auth-brand p { display: none; }
  .auth-panel {
    padding: 12px 16px calc(28px + env(safe-area-inset-bottom));
    align-items: flex-start;
  }
  .auth-card {
    max-width: 480px;
    margin: 8px auto 0;
    padding: 28px 20px 22px;
    border-radius: 20px;
    box-shadow: 0 18px 50px rgba(16, 24, 40, 0.12);
  }
  .auth-card h2 { font-size: 22px; }
  .auth-card .btn-primary { min-height: 48px; border-radius: 12px; font-size: 16px; }
}

@media (max-width: 860px) {
  .userchip-meta { display: none; }
  .clock-card { margin: 0; }
  .btn-lg { min-height: 52px; }
  .g-5, .g-4, .g-3 { grid-template-columns: 1fr 1fr; }
  .g-2, .g-main { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: stretch; }
  .page-head h1 { font-size: 20px; }
  .page-head > .btn,
  .page-head > button { width: 100%; min-height: 44px; }
  .filters { flex-direction: column; }
  .filters input,
  .filters select,
  .filters .btn { width: 100%; min-height: 44px; }
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -14px 16px;
    padding: 0 14px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 999px 999px 0 0;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    margin-inline: -4px;
  }
  table.data { min-width: 640px; }
  table.data th:first-child,
  table.data td:first-child {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    box-shadow: 6px 0 10px -8px rgba(16, 24, 40, 0.25);
  }
  table.data thead th:first-child { background: #fafbfc; z-index: 2; }
  .emp-hero {
    flex-direction: column;
    text-align: center;
    align-items: stretch;
    padding: 20px 16px;
    border-radius: 18px;
  }
  .emp-hero .avatar { margin: 0 auto; }
  .emp-head-actions {
    max-width: none;
    width: 100%;
    justify-content: stretch;
  }
  .emp-head-actions .btn { flex: 1 1 100%; min-height: 44px; }
  .modal-bg {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: none;
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
  }
  .modal-f {
    flex-wrap: wrap;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .modal-f .btn { flex: 1; min-height: 46px; }
  .toast-wrap {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .toast { min-width: 0; width: 100%; }
  .map { height: 260px; }
  .clock-status .big { font-size: 30px; letter-spacing: -0.03em; }
  .btn-clock { width: 100%; min-height: 56px; border-radius: 999px; font-size: 17px; }
  .stat .num { font-size: 24px; }
  .row-actions { justify-content: stretch; }
  .row-actions .btn { flex: 1; min-height: 40px; }
  .photo-pick { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .g-5, .g-4, .g-3, .g-2, .g-main { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-global { display: none; }
  .date-nav-text { max-width: 52vw; font-size: 13px; }
  .userchip .btn-ghost {
    padding: 8px 10px;
    font-size: 12px;
  }
  .content { padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); }
  .card { border-radius: 16px; }
  .stat { padding: 14px 16px; }
  .auth-brand p { display: none; }
}

.impersonate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}
.kpi-rate .num { font-size: 32px; font-weight: 700; margin: 4px 0 10px; }
.kpi-panel .card-h { align-items: flex-start; gap: 8px; }
.kpi-overall { margin-bottom: 16px; }
.kpi-overall-h, .kpi-mini-h, .kpi-day-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.kpi-overall-h { margin-bottom: 8px; }
.kpi-overall-h .lbl { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi-overall-h strong { font-size: 28px; }
.kpi-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-mini {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8f9fc;
}
.kpi-mini-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi-mini-h strong, .kpi-day-top .d-pct { color: var(--text); font-size: 16px; }
.kpi-today {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
}
.kpi-today .field { margin: 0; }
.kpi-submit { min-height: 42px; white-space: nowrap; }
.kpi-cheer { margin: 8px 0 0; }
.kpi-bar {
  position: relative;
  height: 12px;
  background: #eef0f5;
  border-radius: 99px;
  overflow: visible;
}
.kpi-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #b45309, #0f7b4a);
  border-radius: 99px;
  min-width: 0;
  max-width: 100%;
  transition: width .2s ease;
  overflow: hidden;
}
.kpi-bar span.ok { background: #0f7b4a; }
.kpi-bar-lg { height: 16px; }
.kpi-bar-md { height: 10px; }
.kpi-bar-sm { height: 6px; }
.kpi-bar .kpi-min {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--brand);
  border-radius: 2px;
  pointer-events: none;
}
.kpi-days {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.kpi-day {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: #f8f9fc;
  min-width: 0;
}
.kpi-day .kpi-mini-h { margin: 8px 0 4px; }
.kpi-day.ok { background: #ecfdf3; border-color: #bbf7d0; }
.kpi-day.warn { background: #fff7ed; border-color: #fed7aa; }
.kpi-day.empty { opacity: 0.72; }
.kpi-day .d-lab { font-size: 12px; color: var(--muted); }
.kpi-day .d-pct { font-weight: 700; font-size: 18px; margin: 0; }
.kpi-day-cells { white-space: normal; }
.kpi-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  margin: 0 6px 6px 0;
  padding: 3px 8px;
  border-radius: 99px;
  background: #eef0f5;
}
.kpi-chip.ok { background: #dcfce7; color: #166534; }
.kpi-chip.warn { background: #ffedd5; color: #9a3412; }
@media (max-width: 720px) {
  .kpi-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-split, .kpi-today { grid-template-columns: 1fr; }
  .kpi-submit { width: 100%; }
}
.bday-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 12, 28, 0.42);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.bday-spark {
  position: absolute;
  bottom: -8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: bday-up 1.6s ease-out forwards;
  box-shadow: 0 0 10px currentColor;
}
@keyframes bday-up {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-110vh) scale(0.4); opacity: 0; }
}
.bday-card {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.bday-card h2 { margin: 4px 0 12px; }
.perf-week-h td {
  background: #F0F6FF;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 10px 14px;
}
tr.perf-top td { background: #F3FBF7; }
.perf-leaders {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.perf-leaders .stat { cursor: pointer; min-height: 110px; }
.perf-leaders .num { font-size: 16px; line-height: 1.25; }
.perf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.perf-filters input, .perf-filters select { min-width: 180px; }
@media (max-width: 900px) {
  .perf-leaders { grid-template-columns: 1fr 1fr; }
}
.kpi-day-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px;
}
.kpi-day-board {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.kpi-day-board .d-lab { font-weight: 650; margin-bottom: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.kpi-day-person { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 4px 0; }
.kpi-day-person.top { font-weight: 650; color: var(--ok); }
