/* ============================================================
   THE MIGRATION — HRMS  ·  hairline UI
   Admin console. No card chrome. Sections separate via 1px
   rules. Numbers set in IBM Plex Mono with tabular figures.
   One restrained cobalt accent. Sans-serif Hanken Grotesk.
   ============================================================ */
:root {
  /* neutral canvas */
  --paper:      #fbfbfd;
  --surface:    #ffffff;
  --surface-2:  #f6f7f9;
  --rule:       #eceef1;
  --rule-2:     #e2e5ea;

  /* ink */
  --ink:        #16181d;
  --body:       #3a3f47;
  --muted:      #737985;
  --faint:      #a5abb5;

  /* accent — The Migration brand teal */
  --accent:     #006386;   /* primary teal */
  --accent-700: #005a84;   /* deep teal */
  --accent-500: #0192a9;   /* cyan (logo secondary) */
  --accent-100: #e6f1f5;   /* soft tint */

  /* semantic */
  --ok:      #12885a;  --ok-bg:      #e6f3ec;
  --late:    #b8720d;  --late-bg:    #fbeecf;
  --absent:  #c53030;  --absent-bg:  #fbe7e7;
  --leave:   #006386;  --leave-bg:   #e6f1f5;
  --off:     #737985;  --off-bg:     #eef0f3;

  --radius:    6px;
  --radius-sm: 5px;
  --shadow:    0 1px 1px rgba(22,24,29,.04);

  --sans:    "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
  --sidebar-w: 224px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--body);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-100); color: var(--accent-700); }
strong { font-weight: 700; color: var(--ink); }

/* ----------------------------------------------------- app shell */
.app { display: flex; min-height: 100vh; background: var(--paper); }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  color: var(--body);
  border-right: 1px solid var(--rule);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 10px 14px;
}

.sidebar-brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 2px 8px 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
  color: var(--ink);
}
.sidebar-brand .brand-logo {
  display: block; width: 168px; height: auto; max-width: 100%;
}
.sidebar-brand .brand-sub {
  font-family: var(--display); font-weight: 600;
  font-size: 9.5px; color: var(--muted); letter-spacing: .18em;
  text-transform: uppercase; margin-left: 2px;
}
/* legacy — kept for any callers still rendering the monogram */
.sidebar-brand .logo {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--accent-700);
  display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 11px; letter-spacing: .04em;
  font-family: var(--display);
}
.sidebar-brand .brand-name { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: -.005em; line-height: 1.2; color: var(--ink); }

.nav { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.nav-group {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); padding: 16px 12px 6px; font-weight: 600;
}
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 7px 12px 7px 14px;
  color: var(--body); font-weight: 500; font-size: 13px;
  transition: color .12s;
  border-radius: 0;
}
.nav-link:hover { color: var(--ink); text-decoration: none; background: transparent; }
.nav-link.active { color: var(--accent); font-weight: 600; background: transparent; }
.nav-link.active::before {
  content: ""; position: absolute; left: 2px; top: 6px; bottom: 6px;
  width: 2px; background: var(--accent); border-radius: 1px;
}
.nav-link svg {
  width: 16px; height: 16px; flex: 0 0 16px;
  stroke: var(--muted); stroke-width: 1.7; fill: none;
  transition: stroke .12s;
}
.nav-link:hover svg { stroke: var(--ink); }
.nav-link.active svg { stroke: var(--accent); }

.sidebar-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule);
  font-size: 12px;
}
.sidebar-foot .who { color: var(--ink); font-weight: 600; }
.sidebar-foot .ver { color: var(--faint); font-size: 11px; margin-top: 2px; }
.sidebar-foot a { color: var(--accent); display: inline-block; margin-top: 6px; font-weight: 500; font-size: 12px; }
.sidebar-foot a:hover { color: var(--accent-700); text-decoration: none; }

/* ----------------------------------------------------- main */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 {
  margin: 2px 0 0; font-family: var(--display);
  font-size: 20px; font-weight: 700;
  letter-spacing: -.02em; color: var(--ink);
}
.topbar .crumb {
  color: var(--muted); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; font-weight: 600;
}
.topbar .topbar-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.topbar .clock {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  padding: 5px 10px; border: 1px solid var(--rule);
  border-radius: var(--radius-sm); background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.content { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }

h2 {
  font-size: 12.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; margin: 28px 0 12px; color: var(--muted);
}
h2:first-child { margin-top: 0; }
.subtle { color: var(--muted); font-size: 12.5px; }
.small { font-size: 11.5px; }
.err { color: var(--absent); }

/* ----------------------------------------------------- KPIs (no card chrome) */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 4px 0 22px;
}
.kpi {
  position: relative;
  padding: 18px 22px 16px;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  overflow: hidden;
  transition: background .12s;
}
.kpi:last-child { border-right: 0; }
.kpi::before {
  content: ""; display: block;
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--accent); opacity: .85;
  margin-bottom: 10px;
}
.kpi.k-present::before { background: var(--ok); }
.kpi.k-absent::before  { background: var(--absent); }
.kpi.k-late::before    { background: var(--late); }
.kpi.k-leave::before   { background: var(--leave); }
.kpi .k-label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.kpi .k-value {
  font-family: var(--mono);
  font-size: 30px; font-weight: 500; letter-spacing: -.03em;
  margin: 4px 0 3px; line-height: 1.05; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi .k-sub { font-size: 11.5px; color: var(--faint); }

.kpi-click { cursor: pointer; }
.kpi-click:hover { background: var(--surface-2); }
.kpi-click:focus-visible { outline: none; background: var(--accent-100); }

.detail-panel .panel-head h3 { display: flex; align-items: center; gap: 8px; }

/* legacy card aliases */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.card-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.card-value { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.card-sub { font-size: 11.5px; color: var(--faint); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; }

/* ----------------------------------------------------- panels (region, not box) */
.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--rule);
  background: transparent;
}
.panel-head h3 {
  margin: 0; font-family: var(--display);
  font-size: 13px; font-weight: 700;
  letter-spacing: -.005em; color: var(--ink);
}
.panel-body { padding: 14px 0 6px; }
.cols { display: grid; gap: 28px; }
.cols.c2 { grid-template-columns: 1.35fr 1fr; margin-top: 22px; }
@media (max-width: 980px) {
  .cols.c2 { grid-template-columns: 1fr; gap: 20px; }
  .sidebar { display: none; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
}

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 148px; padding: 8px 2px 0; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bars .stack {
  width: 100%; max-width: 22px;
  display: flex; flex-direction: column-reverse;
  border-radius: 2px 2px 0 0; overflow: hidden;
  min-height: 2px; transition: opacity .12s;
}
.bars .bar-col:hover .stack { opacity: .82; }
.bars .seg-present { background: var(--accent); }
.bars .seg-late    { background: var(--late); }
.bars .seg-absent  { background: var(--absent-bg); }
.bars .bar-x { font-size: 10.5px; color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 1.5px; margin-right: 6px; vertical-align: -1px; }

/* ----------------------------------------------------- tables (no chrome) */
.tbl {
  width: 100%; border-collapse: collapse;
  background: transparent; border: 0; border-radius: 0;
  overflow: visible;
}
.tbl th {
  text-align: left;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  padding: 10px 14px 10px 0;
  background: transparent;
  border-bottom: 1px solid var(--rule-2);
  white-space: nowrap;
}
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px; vertical-align: middle; color: var(--body);
  font-variant-numeric: tabular-nums;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td code {
  color: var(--muted); background: transparent;
  padding: 0; border: 0; font-size: 12px;
}
.unmapped-row td { background: #fdf5f5; }
.unmapped-row:hover td { background: #fbe7e7 !important; }

/* ----------------------------------------------------- badges (soft, no ring) */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: var(--off-bg); color: var(--off);
  letter-spacing: .01em;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--late-bg); color: var(--late); }
.b-present { background: var(--ok-bg); color: var(--ok); }
.b-late    { background: var(--late-bg); color: var(--late); }
.b-absent  { background: var(--absent-bg); color: var(--absent); }
.b-leave   { background: var(--leave-bg); color: var(--leave); }
.b-off     { background: var(--off-bg); color: var(--off); }

/* ----------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--rule-2); background: var(--surface);
  color: var(--body); font: inherit; font-weight: 500; font-size: 12.5px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.btn-primary, .btn.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--accent-700); border-color: var(--accent-700); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-danger { background: var(--absent); border-color: var(--absent); color: #fff; font-weight: 600; }
.btn-danger:hover { background: #a72424; border-color: #a72424; color: #fff; }

/* ----------------------------------------------------- filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  background: transparent; border: 0; border-bottom: 1px solid var(--rule);
  padding: 0 0 16px; margin-bottom: 18px; border-radius: 0;
}
label {
  font-size: 10.5px; color: var(--muted); font-weight: 600;
  display: flex; flex-direction: column; gap: 5px;
  letter-spacing: .04em; text-transform: uppercase;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
input[type=text], input[type=date], input[type=password], input[type=search], select, input[type=time], input[type=number] {
  font: inherit; font-size: 12.5px; padding: 6px 10px;
  border: 1px solid var(--rule-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  min-width: 90px; font-variant-numeric: tabular-nums;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.row { display: flex; gap: 10px; align-items: center; }
.form-inline { display: inline; }

.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--rule-2); background: transparent;
  color: var(--muted); font-size: 11.5px; font-weight: 500;
  cursor: pointer; transition: all .12s; text-transform: none; letter-spacing: 0;
}
.chip:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.check { flex-direction: row; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; }

/* filter button */
.fbtn-wrap { display: inline-flex; }
.fbtn-wrap .btn { gap: 7px; text-transform: none; letter-spacing: 0; }
.fbtn-wrap .btn::before {
  content: ""; width: 13px; height: 13px; flex: 0 0 13px;
  background: currentColor; opacity: .7;
  -webkit-mask: var(--filter-icon) center/contain no-repeat;
          mask: var(--filter-icon) center/contain no-repeat;
}
.fbtn-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
}
:root {
  --filter-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18l-7 8v6l-4-2v-4z'/%3E%3C/svg%3E");
}

/* ----------------------------------------------------- flash */
.flash {
  padding: 9px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: 12.5px; border: 1px solid transparent;
}
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #b7e2ca; }
.flash-error   { background: var(--absent-bg); color: var(--absent); border-color: #f2c9c9; }
.flash-warning { background: var(--late-bg); color: var(--late); border-color: #f2dda1; }

/* ----------------------------------------------------- login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--paper);
}
.login-card {
  background: var(--surface); border-radius: 8px; padding: 32px;
  width: 360px; border: 1px solid var(--rule);
  box-shadow: 0 24px 60px -28px rgba(22,24,29,.2);
}
.login-card .name { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 0 24px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); }
.login-brand .brand-logo { display: block; width: 220px; max-width: 100%; height: auto; }
.login-brand .brand-sub { font-family: var(--display); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.login-card .logo {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--ink);
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 11px; letter-spacing: .04em;
}

/* ----------------------------------------------------- filter modal */
.fmodal-overlay {
  position: fixed; inset: 0; background: rgba(22,24,29,.42);
  backdrop-filter: blur(3px); display: none;
  align-items: center; justify-content: center; z-index: 1000;
}
.fmodal-overlay.open { display: flex; }
.fmodal {
  background: var(--surface); border-radius: 8px;
  width: min(760px, 94vw); max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 70px -22px rgba(22,24,29,.35), 0 1px 2px rgba(22,24,29,.06);
  border: 1px solid var(--rule); overflow: hidden;
}
.fmodal-head {
  padding: 14px 18px; border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 12px; background: var(--surface);
}
.fmodal-head h3 { font-family: var(--display); font-size: 14px; font-weight: 700; margin: 0; color: var(--ink); }
.fmodal-head .fclose { margin-left: auto; background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.fmodal-head .fclose:hover { color: var(--ink); }
.fsearch { flex: 1; max-width: 300px; }
.fsearch input { width: 100%; }
.fmodal-body { display: flex; min-height: 0; flex: 1; height: 54vh; }
.fpane { overflow-y: auto; padding: 6px 0; }
.fpane-dept { width: 44%; border-right: 1px solid var(--rule); background: var(--surface-2); }
.fpane-emp { flex: 1; }
.fpane-title {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 8px 18px;
}
.fitem {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 18px; cursor: pointer; font-size: 13px;
  transition: background .1s;
}
.fitem:hover { background: var(--accent-100); }
.fitem.sel { background: var(--accent-100); }
.fitem input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.fitem .fname { flex: 1; color: var(--body); }
.fitem .fpin { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.fdept-row { justify-content: space-between; }
.fdept-row.active { background: var(--accent-100); font-weight: 600; color: var(--accent-700); }
.fdept-row .fcaret { color: var(--muted); font-size: 11px; }
.fpane-emp .fhint { color: var(--faint); font-size: 12.5px; padding: 14px 18px; }
.fmodal-foot {
  padding: 12px 18px; border-top: 1px solid var(--rule);
  display: flex; align-items: center; gap: 10px; background: var(--surface-2);
}
.fmodal-foot .fselinfo { font-size: 12px; color: var(--muted); margin-right: auto; }
.fmodal-foot .fclear { font-size: 12px; }

/* ----------------------------------------------------- misc */
.spacer { flex: 1; }
.sep { height: 1px; background: var(--rule); margin: 12px 0; }
.empty { color: var(--faint); text-align: center; padding: 30px 20px; font-size: 12.5px; }
.tablewrap { overflow: auto; }
.log-box {
  background: #0f1216; color: #d5d9e0;
  font-family: var(--mono); font-size: 12px;
  border-radius: var(--radius); padding: 14px;
  max-height: 320px; overflow: auto; white-space: pre-wrap;
  border: 1px solid #1e232b;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   AUDIT ADDITIONS — appended for the 20-item audit
   Uses existing tokens only (--paper --surface --surface-2 --rule --rule-2
   --accent --accent-500 --accent-100 --accent-700 --ink --body --muted
   --faint --mono --sans --display --ok --late --absent --leave --off).
   ========================================================================== */

/* A) STICKY table headers */
.tblwrap-sticky { max-height: 70vh; overflow: auto; }
.tblwrap-sticky .tbl thead th {
  position: sticky; top: 0; background: var(--surface-2); z-index: 2;
}

/* B) SORTABLE headers */
.sortable-table th.sortable {
  cursor: pointer; user-select: none;
  padding-right: 20px; position: relative;
}
.sortable-table th.sortable::after {
  content: "↕"; margin-left: 6px; opacity: .35; font-size: 10px;
}
.sortable-table th.sortable.sort-asc::after {
  content: "↑"; opacity: 1; color: var(--accent);
}
.sortable-table th.sortable.sort-desc::after {
  content: "↓"; opacity: 1; color: var(--accent);
}

/* C) LOADING SPINNER on buttons */
.btn.is-loading {
  position: relative; color: transparent !important; pointer-events: none;
}
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn:not(.btn-primary).is-loading::after {
  border-color: rgba(0, 0, 0, .15);
  border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* D) TOAST */
.toast-holder {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 6px; font-size: 13px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .4);
  animation: toast-in .18s cubic-bezier(.2, .7, .2, 1);
}
.toast .toast-action {
  background: transparent; color: var(--accent-500);
  border: 0; font-weight: 600; cursor: pointer;
  padding: 4px 8px; font-size: 12.5px;
}
.toast .toast-close {
  background: transparent; color: #aaa; border: 0; cursor: pointer;
  padding: 0 4px; font-size: 16px; line-height: 1;
}
.toast.toast-error { background: var(--absent); }
.toast.toast-warn  { background: var(--late); color: #fff; }
.toast.toast-ok    { background: var(--ok); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* E) TOOLTIP */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-size: 11px; padding: 6px 8px; border-radius: 4px;
  white-space: normal; max-width: 260px; text-align: left;
  opacity: 0; pointer-events: none;
  transition: opacity .12s; z-index: 20; line-height: 1.35;
}
[data-tip]:hover::after { opacity: .96; }

/* F) SEARCH MODAL */
.search-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(22, 24, 29, .42);
  backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh; z-index: 1100;
}
.search-modal-overlay.open { display: flex; }
.search-modal {
  width: min(560px, 92vw);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.search-modal .search-input {
  width: 100%; padding: 14px 18px; border: 0;
  font-size: 15px; background: var(--surface);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
.search-modal .search-input:focus { outline: none; box-shadow: none; }
.search-modal ul.results {
  list-style: none; margin: 0; padding: 6px 0;
  max-height: 60vh; overflow: auto;
}
.search-modal ul.results li {
  padding: 8px 18px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.search-modal ul.results li.active {
  background: var(--accent-100); color: var(--accent-700);
}
.search-modal ul.results li .kind {
  font-size: 10px; text-transform: uppercase; color: var(--muted);
  letter-spacing: .1em; padding: 2px 6px; border-radius: 3px;
  background: var(--surface-2); font-weight: 600;
}
.search-modal ul.results li .lbl { flex: 1; }
.search-modal ul.results li .sub {
  color: var(--muted); font-family: var(--mono); font-size: 11.5px;
}
.search-modal .search-empty {
  padding: 22px 18px; color: var(--faint);
  font-size: 13px; text-align: center;
}

/* G) TOPBAR search + company switcher */
.topbar .search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border: 1px solid var(--rule);
  background: var(--surface); border-radius: 6px;
  color: var(--muted); font-size: 12px; cursor: pointer;
  min-width: 240px; justify-content: space-between;
  font-family: var(--sans);
}
.topbar .search-trigger:hover { border-color: var(--ink); color: var(--ink); }
.kbd {
  font-family: var(--mono); font-size: 10.5px;
  padding: 1px 5px; border: 1px solid var(--rule-2);
  border-radius: 3px; color: var(--muted); background: var(--surface-2);
}
.topbar .company-switcher {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1px solid var(--rule);
  border-radius: 6px; background: var(--surface);
  font-size: 12px; color: var(--body); cursor: pointer;
}

/* H) EMPLOYEE PROFILE */
.profile-header {
  display: flex; align-items: baseline; gap: 14px;
  padding-bottom: 14px; border-bottom: 1px solid var(--rule);
  margin-bottom: 20px; flex-wrap: wrap;
}
.profile-header h1 {
  font-family: var(--display); font-size: 24px; font-weight: 700;
  letter-spacing: -.02em; margin: 0;
}
.profile-header .pin {
  font-family: var(--mono); color: var(--muted); font-size: 13px;
}
.profile-header .meta {
  color: var(--muted); font-size: 12.5px; margin-left: auto;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0; background: var(--surface);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 22px;
}
.profile-stats .stat {
  padding: 12px 16px; border-right: 1px solid var(--rule);
}
.profile-stats .stat:last-child { border-right: 0; }
.profile-stats .stat .label {
  font-size: 10px; text-transform: uppercase;
  color: var(--muted); letter-spacing: .1em; font-weight: 600;
}
.profile-stats .stat .val {
  font-family: var(--mono); font-size: 22px; font-weight: 500;
  color: var(--ink); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.events-list { list-style: none; padding: 0; margin: 0; }
.event-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.event-item:last-child { border-bottom: 0; }
.event-item .kind {
  font-size: 10px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 3px;
  background: var(--accent-100); color: var(--accent-700);
  letter-spacing: .06em; height: fit-content;
  font-weight: 600; flex: 0 0 auto;
}
.event-item .body { flex: 1; font-size: 13px; }
.event-item .ts {
  color: var(--muted); font-size: 11.5px; font-family: var(--mono);
}

/* I) STEPPER */
.stepper {
  display: flex; gap: 32px; margin-bottom: 22px;
  padding-bottom: 14px; border-bottom: 1px solid var(--rule);
}
.stepper .step { display: flex; align-items: center; gap: 10px; }
.stepper .step .num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px;
}
.stepper .step.on .num { background: var(--accent); color: #fff; }
.stepper .step .label {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.stepper .step.on .label { color: var(--ink); font-weight: 600; }

/* J) PAYROLL */
.payroll-row td { font-variant-numeric: tabular-nums; }
.payroll-row .stage-warn { color: var(--late);   font-weight: 600; }
.payroll-row .stage-bad  { color: var(--absent); font-weight: 600; }

/* K) ANOMALY WIDGET */
.anomaly-widget {
  border: 1px dashed var(--rule-2); border-radius: 8px;
  padding: 14px 16px; margin: 8px 0 22px;
  background: var(--surface);
}
.anomaly-widget h3 {
  font-family: var(--display); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.anomaly-widget ul { list-style: none; padding: 0; margin: 0; }
.anomaly-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed var(--rule);
  font-size: 13px;
}
.anomaly-item:last-child { border-bottom: 0; }
.anomaly-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex: 0 0 8px;
}
.anomaly-item.level-high .dot { background: var(--absent); }
.anomaly-item.level-mid  .dot { background: var(--late); }
.anomaly-item.level-low  .dot { background: var(--accent-500); }
.anomaly-item .body { flex: 1; }
.anomaly-item .link { color: var(--accent); font-size: 12px; font-weight: 500; }
.anomaly-widget .empty {
  color: var(--muted); font-size: 12.5px; padding: 8px 0;
}

/* L) FILTER BUTTON label state */
.fbtn-wrap .btn .fbtn-label { font-weight: 500; }
.fbtn-wrap .btn .fbtn-state {
  color: var(--muted); font-weight: 500; font-size: 11.5px;
}

/* M) BULK BAR */
.bulk-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--accent-100);
  border: 1px solid var(--accent);
  border-radius: 6px; margin-bottom: 14px;
}
.bulk-bar.hidden { display: none; }
.bulk-bar #bulkCount {
  font-weight: 600; font-size: 12.5px; color: var(--accent-700);
}

/* N) DOT indicators (alerts page) */
.dot-high { background: var(--absent); }
.dot-mid  { background: var(--late); }
.dot-low  { background: var(--accent-500); }

/* ============================================================
   O) DASHBOARD v2 — pulse strip, shift board, trend, feeds
   ============================================================ */

/* pulse strip */
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 4px 0 22px;
}
.pulse-tile {
  padding: 14px 18px;
  border-right: 1px solid var(--rule);
  cursor: pointer;
  transition: background .12s;
}
.pulse-tile:last-child { border-right: 0; }
.pulse-tile:hover { background: var(--surface-2); }
.pulse-tile .lbl {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.pulse-tile .val {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: -.03em;
  margin-top: 6px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.pulse-tile .sub {
  font-size: 11px;
  color: var(--faint);
  margin-top: 2px;
}
.pulse-tile.pulse-attn {
  background: linear-gradient(180deg, var(--surface), #fff8f3);
}

/* shift board */
.shift-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.shift-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
}
.shift-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.shift-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.shift-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.shift-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}
.shift-stats > span {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.shift-stats > span em {
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.shift-stats .stat-late { color: var(--late); }
.shift-stats .stat-absent { color: var(--absent); }
.shift-stats .stat-present { color: var(--ok); }
.shift-bar {
  position: relative;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.shift-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
}
.shift-pct {
  position: absolute;
  right: 0;
  top: -18px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.shift-foot {
  font-size: 11px;
  color: var(--muted);
}

/* 30-day trend */
.trend-panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.trend-head h3 {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.trend-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}
#trend30-canvas {
  width: 100%;
  height: 110px;
  display: block;
}
#trend30-canvas .grid { stroke: var(--rule); stroke-width: 1; }
#trend30-canvas .line { stroke: var(--accent); stroke-width: 2; fill: none; }
#trend30-canvas .area { fill: var(--accent-100); opacity: .55; }
#trend30-canvas .dot { fill: var(--accent); }

/* live feed */
.live-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.live-feed li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.live-feed li:last-child { border-bottom: 0; }
.dir-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}
.dir-in { background: var(--ok); }
.dir-out { background: var(--muted); }
.live-name {
  flex: 1;
  color: var(--ink);
  font-weight: 500;
}
.live-name .dept {
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
  margin-left: 6px;
}
.live-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.live-ago {
  color: var(--faint);
  font-size: 11px;
  margin-left: 6px;
}

/* upcoming leaves */
.upcoming-leaves {
  list-style: none;
  margin: 0;
  padding: 0;
}
.upcoming-leaves li {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.upcoming-leaves li:last-child { border-bottom: 0; }
.up-lv-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.up-lv-name {
  color: var(--ink);
  font-weight: 500;
}
.up-lv-when {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}
.up-lv-type {
  color: var(--accent);
  font-size: 11.5px;
}

/* activity feed */
.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.activity-feed li {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.activity-feed li:last-child { border-bottom: 0; }
.activity-feed .event-kind {
  font-size: 9.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent-100);
  color: var(--accent-700);
  letter-spacing: .06em;
  height: fit-content;
  font-weight: 600;
  flex: 0 0 auto;
}
.activity-feed .event-body { flex: 1; }
.activity-feed .event-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}
.activity-feed .event-ago {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

/* quick actions */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 14px 0 0;
  border-top: 1px solid var(--rule);
}
.quick-actions .btn { min-width: auto; }
