/* HRHelm design system — plain CSS, no build step. */
:root {
  --ink: #14232b;
  --ink-2: #44545c;
  --ink-3: #75848b;
  --line: #e3e6e3;
  --line-2: #eef0ec;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --side: #10282f;
  --side-ink: #b9c8cb;
  --side-hover: #1a3840;
  --accent: #0d7a6b;
  --accent-ink: #ffffff;
  --accent-soft: #e2f2ee;
  --warn: #a15c07;
  --warn-soft: #fdf1df;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --info: #2457a6;
  --info-soft: #e8effa;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 35, 43, .05), 0 1px 3px rgba(20, 35, 43, .06);
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
[x-cloak] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-ink);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 800; font-size: 17px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; font-size: 14px; color: #fff;
}
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--side-ink); }
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6f8a90; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--side-ink); font-weight: 500;
}
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.crumbs a { color: var(--ink-3); }

.usermenu { position: relative; }
.usermenu-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--ink); padding: 4px; border-radius: var(--radius-sm); }
.usermenu-btn:hover { background: var(--line-2); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 35, 43, .12); padding: 6px; z-index: 30;
}
.dropdown a, .dropdown button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--line-2); text-decoration: none; }

/* ---------- Avatars ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-name { font-weight: 600; color: var(--ink); }
.person-sub { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-body { padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }

/* ---------- Definition lists ---------- */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.dl dt { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.dl dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-3);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfbf9; white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafaf7; }
.table .actions { text-align: right; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.active, .badge.success { background: var(--accent-soft); color: var(--accent); }
.badge.probation, .badge.info { background: var(--info-soft); color: var(--info); }
.badge.on_notice, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.exited, .badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; line-height: 1.3;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0a6659; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn svg { width: 16px; height: 16px; flex: none; }
.menu-btn svg { width: 20px; height: 20px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid #d5d9d5; border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; color: var(--ink);
}
textarea.input { min-height: 72px; resize: vertical; }
.input:hover { border-color: #bfc5c0; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.form-section { padding: 18px; border-top: 1px solid var(--line-2); }
.form-section:first-child { border-top: 0; }
.form-section > h3 { margin-bottom: 12px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line-2); background: #fbfbf9; border-radius: 0 0 var(--radius) var(--radius); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.input-affix { display: flex; align-items: stretch; }
.input-affix > span { display: flex; align-items: center; padding: 0 10px; border: 1px solid #d5d9d5; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--line-2); color: var(--ink-3); font-weight: 600; }
.input-affix > .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.domain-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) { .domain-grid { grid-template-columns: 1fr; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.filters .input { width: auto; min-width: 150px; }
.filters .search { flex: 1; min-width: 200px; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert.success { background: var(--accent-soft); border-color: #b7dfd5; color: #075c50; }
.alert.error { background: var(--danger-soft); border-color: #f6c9c4; color: var(--danger); }
.alert.info { background: var(--info-soft); border-color: #c7d6ef; color: var(--info); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-3); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }

/* ---------- Profile header ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; padding: 20px; }
.profile-head .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; margin-top: 6px; }

/* ---------- Directory ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.person-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.person-card .contact { font-size: 12.5px; color: var(--ink-2); display: grid; gap: 2px; }

/* ---------- Org chart: top-down reporting lines ---------- */
.oc-scroll { overflow-x: auto; padding: 24px 12px 28px; }
.oc, .oc ul { list-style: none; margin: 0; padding: 0; }
.oc { display: flex; justify-content: center; gap: 28px; min-width: max-content; }
.oc ul { display: flex; justify-content: center; padding-top: 22px; position: relative; }
.oc li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 22px 6px 0; }
.oc > li { padding-top: 0; }
/* connectors: a drop from the parent, a rail across siblings, a drop to each child */
.oc ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 1.5px solid #c3cbc6; }
.oc ul > li::before, .oc ul > li::after { content: ""; position: absolute; top: 0; width: 50%; height: 22px; border-top: 1.5px solid #c3cbc6; }
.oc ul > li::before { right: 50%; }
.oc ul > li::after { left: 50%; border-left: 1.5px solid #c3cbc6; }
.oc ul > li:first-child::before, .oc ul > li:last-child::after { border-top: 0; }
.oc ul > li:only-child::before { display: none; }
.oc ul > li:only-child::after { border-top: 0; }
.oc ul > li:last-child::after { border-left: 0; }
.oc ul > li:last-child::before { border-right: 1.5px solid #c3cbc6; border-top-right-radius: 6px; }
.oc ul > li:first-child::after { border-top-left-radius: 6px; }
/* a manager whose reports have no reports of their own: stack them in one column on a spine */
.oc ul.leaves { flex-direction: column; align-items: center; gap: 10px; padding-top: 22px; }
.oc ul.leaves::before { height: calc(100% - 30px); z-index: 0; }
.oc ul.leaves > li { padding: 0; z-index: 1; }
.oc ul.leaves > li::before, .oc ul.leaves > li::after { display: none; }
.oc details { display: flex; flex-direction: column; align-items: center; }
.oc details > summary { list-style: none; cursor: pointer; border-radius: var(--radius); }
.oc details > summary::-webkit-details-marker { display: none; }
.oc details:not([open]) > summary .oc-card { box-shadow: 3px 3px 0 -1px var(--surface), 3px 3px 0 0 var(--line), var(--shadow); }
.oc-card { display: flex; align-items: center; gap: 10px; width: 216px; padding: 10px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.oc details > summary:hover .oc-card { border-color: #9fd3c7; }
.oc details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.oc-text { display: grid; min-width: 0; line-height: 1.3; }
.oc-text .person-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-meta { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.oc-level { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--info-soft); color: var(--info); font-size: 11px; font-weight: 700; letter-spacing: .02em; }

/* ---------- Org chart: levels pyramid ---------- */
.pyramid-card { padding: 22px 18px 6px; }
.pyramid { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tier { width: var(--w); padding: 12px 16px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) var(--tint), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) calc(var(--tint) + 10%), var(--surface)); }
.tier-head { display: flex; align-items: baseline; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; text-align: center; }
.tier-level { font-weight: 800; color: var(--accent); font-size: 13px; letter-spacing: .03em; }
.tier-name { font-weight: 700; color: var(--ink); }
.tier-count { font-size: 12px; color: var(--ink-2); }
.tier-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; }
.tier-person { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 12.5px; font-weight: 600; }
.tier-person:hover { text-decoration: none; border-color: var(--accent); }
.tier-person .avatar { width: 24px; height: 24px; font-size: 10px; }
.tier-more { width: 100%; text-align: center; }
.tier-more > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); padding: 4px; }
.tier-more .tier-people { margin-top: 6px; }
.pyramid-note { text-align: center; margin: 14px 0 10px; }
@media (max-width: 640px) { .tier { width: 100%; } .oc-card { width: 184px; } }

/* ---------- Employee records (experience, KYC) ---------- */
.record { padding: 16px 18px; border-top: 1px solid var(--line-2); }
.card-head + .record { border-top: 0; }
.record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.record-head h3 { margin: 0 0 2px; font-size: 15px; }
.record-docs { margin-top: 12px; display: grid; gap: 8px; justify-items: start; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.file-list li { display: inline-flex; align-items: center; gap: 6px; }
.chip svg { width: 14px; height: 14px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--ink-3); font-weight: 500; }
.checklist li.done { color: var(--accent); }
a.chip { color: var(--ink); }
a.chip:hover { text-decoration: none; background: var(--line-2); }
.chip.missing { background: var(--warn-soft); border-color: #f1d3a6; color: var(--warn); cursor: default; font-weight: 600; }
.review-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.review-form .input { flex: 1; min-width: 200px; width: auto; }
.table tr.subrow td { padding-top: 0; background: #fbfbf9; }
.table tr.subrow .review-form { margin-top: 0; border-top: 0; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--side); color: #dfe9ea; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-size: 30px; line-height: 1.2; color: #fff; max-width: 420px; font-weight: 800; }
.auth-art ul { padding: 0; list-style: none; display: grid; gap: 10px; color: var(--side-ink); }
.auth-art li::before { content: "—  "; color: var(--accent); }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin-bottom: 4px; }
.stack { display: grid; gap: 14px; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-3); }

.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid-3, .grid-2, .form-grid, .dl { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .bar-row { grid-template-columns: 100px 1fr 30px; }
  .hide-sm { display: none; }
}
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Phase 2: time ---------- */
.nav .count { margin-left: auto; background: #f59e0b; color: #1f1300; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; }
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.bal { padding: 16px 18px; border-top: 3px solid var(--c, var(--accent)); }
.bal .stat-value { font-size: 26px; }
.bal .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); margin-right: 6px; vertical-align: 1px; }

.st { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 4px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.st-present { background: var(--accent-soft); color: var(--accent); }
.st-half_day { background: #fff4d6; color: #8a5a00; }
.st-absent { background: var(--danger-soft); color: var(--danger); }
.st-missing_punch { background: #ffe9d6; color: #a14b07; }
.st-leave { background: #ece5fb; color: #5b3aa6; }
.st-holiday { background: var(--info-soft); color: var(--info); }
.st-weekly_off { background: var(--line-2); color: var(--ink-3); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); align-items: center; }

.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { min-width: 130px; text-align: center; }

.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calgrid .dow { font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-align: center; padding-bottom: 2px; }
.calcell { min-height: 84px; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; }
.calcell.off { background: #fafaf7; }
.calcell.today { outline: 2px solid var(--accent); outline-offset: -1px; }
.calcell .dn { font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
.calcell .tm { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.calcell.empty { border: 0; background: transparent; }

table.mgrid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.mgrid th, .mgrid td { padding: 4px 3px; text-align: center; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.mgrid th { font-size: 10.5px; color: var(--ink-3); font-weight: 700; background: #fbfbf9; position: sticky; top: 0; z-index: 1; }
.mgrid th.we, .mgrid td.we { background: #f8f8f4; }
.mgrid .name { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 2; padding: 6px 10px; min-width: 190px; border-right: 1px solid var(--line); }
.mgrid th.name { z-index: 3; background: #fbfbf9; }
.mgrid .sum { font-variant-numeric: tabular-nums; padding: 4px 8px; font-weight: 600; }
.mgrid td.today { box-shadow: inset 0 0 0 2px var(--accent); }
.lcell { display: block; height: 20px; border-radius: 4px; color: #fff; font-weight: 700; font-size: 10.5px; line-height: 20px; }
.lcell.half { opacity: .6; }

.clock { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.clock .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock .times { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.clock .pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.btn.big { padding: 12px 22px; font-size: 15px; }

.trail { list-style: none; margin: 0; padding: 0; }
.trail li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.trail li:first-child { border-top: 0; }
.trail .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--line-2); color: var(--ink-3); }
.trail .approved .n { background: var(--accent-soft); color: var(--accent); }
.trail .rejected .n { background: var(--danger-soft); color: var(--danger); }
.trail .pending .n { background: #fff4d6; color: #8a5a00; }
.decide { display: grid; gap: 10px; padding: 16px 18px; border-top: 1px solid var(--line-2); background: #fbfbf9; border-radius: 0 0 var(--radius) var(--radius); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: #9fd3c7; color: var(--accent); }
.chip input { accent-color: var(--accent); }
@media (max-width: 820px) { .calcell { min-height: 58px; padding: 4px; } .calcell .tm { display: none; } }
.lcell.pending { background: var(--surface) !important; color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); border-radius: 4px; outline: 1px dashed var(--c); outline-offset: -4px; }

/* ---------- Phase 4: recruitment board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.board-col { background: #efeee8; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 220px; }
.board-col h3 { display: flex; justify-content: space-between; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 4px 4px 2px; }
.cand { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; box-shadow: var(--shadow); }
.cand a.name { font-weight: 700; color: var(--ink); }
.cand .meta { font-size: 12px; color: var(--ink-3); }
.cand .moves { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.cand .moves button { font-size: 11.5px; padding: 3px 8px; }
.stars { color: #d79a1d; letter-spacing: 1px; font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-top: 6px; }
.timeline li.stage::before { background: var(--accent); }
.timeline li.offer::before { background: #a15c07; }
.progress { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- Phase 5: notifications ---------- */
.topbar-right { display: flex; align-items: center; gap: 6px; }
.bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: none; border: 0; cursor: pointer; color: var(--ink-2); }
.bell:hover { background: var(--line-2); }
.bell svg { width: 20px; height: 20px; }
.bell .count { position: absolute; top: 3px; right: 3px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 5px; line-height: 1.3; }
.notif-menu { width: 360px; max-width: calc(100vw - 32px); }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 8px; border-bottom: 1px solid var(--line-2); }
.notif { display: grid !important; gap: 2px; padding: 10px !important; border-radius: 8px; color: var(--ink) !important; font-size: 13px; }
.notif span { color: var(--ink-2); }
.notif small { color: var(--ink-3); font-size: 11.5px; }
.notif.unread { background: var(--accent-soft); }
.notif-all { text-align: center; color: var(--accent) !important; font-weight: 700; border-top: 1px solid var(--line-2); border-radius: 0 !important; margin-top: 4px; }

/* ---------- Phase 6: feed ---------- */
.alert.warn { background: var(--warn-soft); border-color: #f1d5a8; color: var(--warn); }
.alert.warn a { color: inherit; text-decoration: underline; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.celebrate { background: #fff4d6; font-size: 17px; }
.composer form { gap: 10px; }
.post { overflow: hidden; }
.post-head { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px 0; }
.post-body { padding: 10px 18px 4px; }
.post-title { margin: 0 0 6px; font-size: 16.5px; }
.post-title a { color: var(--ink); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.post.announcement { border-left: 3px solid var(--info); }
.post.kudos { background: linear-gradient(180deg, #fffaf0 0, var(--surface) 90px); }
.post.celebration { background: linear-gradient(180deg, #f2faf7 0, var(--surface) 90px); }
.kudos-badge { display: inline-block; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: #fff1cc; color: #7a4d00; margin-bottom: 8px; }
.post-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 18px 12px; }
.reacts { display: flex; gap: 6px; flex-wrap: wrap; }
.react { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 13px; cursor: pointer; }
.react:hover { background: var(--line-2); }
.react.on { background: var(--accent-soft); border-color: #9fd3c7; color: var(--accent); font-weight: 700; }
.ack { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.ack.done { background: var(--accent-soft); color: var(--accent); justify-content: flex-start; }
.ack svg { width: 16px; height: 16px; }
.comments { border-top: 1px solid var(--line-2); padding: 10px 18px 14px; display: grid; gap: 10px; background: #fbfbf9; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment-bubble { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 10px; flex: 1; min-width: 0; font-size: 13.5px; }
.comment-form { display: flex; gap: 8px; }
.comment-form .input { flex: 1; }
.poll { display: grid; gap: 6px; margin-top: 4px; }
.poll-opt { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.poll-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.poll-row { position: relative; display: flex; justify-content: space-between; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--line-2); overflow: hidden; }
.poll-row > span, .poll-row > strong { position: relative; }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: #d6ebe5; }
.poll-row.mine .poll-bar { background: #b4dccf; }
.badge svg { width: 12px; height: 12px; }
/* Surveys */
fieldset.q { border: 1px solid var(--line); margin: 0; padding: 0; }
fieldset.q legend { float: left; width: 100%; }
fieldset.q legend + * { clear: both; }
.scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale label { cursor: pointer; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale span { display: grid; place-items: center; min-width: 44px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 700; }
.scale.nps span { min-width: 36px; }
.scale input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.scale input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-legend { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 12px; margin-top: 4px; max-width: 520px; }
.nps-bar { display: flex; border-radius: var(--radius-sm); overflow: hidden; color: #fff; font-size: 12px; font-weight: 700; }
.nps-bar span { padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nps-bar span[style*="flex:0"] { display: none; }
.quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.quotes li { padding: 8px 12px; background: var(--line-2); border-radius: var(--radius-sm); white-space: pre-wrap; }

/* ---------- Phase 6: performance ---------- */
.steps { display: flex; list-style: none; margin: 0; padding: 0; gap: 4px; counter-reset: s; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 90px; font-size: 12px; font-weight: 600; color: var(--ink-3); padding-top: 8px; border-top: 3px solid var(--line); }
.steps li.done { color: var(--accent); border-color: var(--accent); }
.steps li.now { color: var(--ink); border-color: var(--info); }
.steps.wide { margin-bottom: 18px; }
.scale.sm span { min-width: 30px; height: 30px; font-size: 13px; }
.scale.sm { gap: 4px; flex-wrap: nowrap; }
.rating { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--line-2); white-space: nowrap; }
.rating.r1 { background: var(--danger-soft); color: var(--danger); }
.rating.r2 { background: var(--warn-soft); color: var(--warn); }
.rating.r3 { background: var(--info-soft); color: var(--info); }
.rating.r4, .rating.r5 { background: var(--accent-soft); color: var(--accent); }
.goal-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.goal.dropped { opacity: .6; }
.dist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: end; height: 190px; }
.dist-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; gap: 4px; min-width: 0; }
.dist-bar { background: var(--accent); border-radius: 6px 6px 0 0; position: relative; min-height: 4px; max-height: 130px; }
.dist-bar span { position: absolute; top: -18px; left: 0; right: 0; font-size: 12px; font-weight: 700; color: var(--ink); }
.form-foot label { align-self: center; }

/* ---------- Phase 7: reports ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart .lbl { font-size: 11px; fill: var(--ink-3); text-anchor: middle; }
.chart .val { font-size: 11px; fill: var(--ink-2); text-anchor: middle; font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.donut { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.donut-total { font-size: 22px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.legend-list li { display: flex; align-items: center; gap: 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpis { margin-bottom: 16px; }
.stat .unit { font-size: 15px; color: var(--ink-3); font-weight: 600; }
.stat .up { color: var(--accent); font-weight: 600; }
.stat .down { color: var(--danger); font-weight: 600; }
.section-title { font-size: 15px; margin: 22px 0 10px; }
.report-tile { display: block; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.report-tile:hover { text-decoration: none; border-color: #9fd3c7; box-shadow: 0 4px 14px rgba(13, 122, 107, .08); }
.builder { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
.builder-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.builder-main { min-width: 0; }
.b-sum { font-weight: 700; cursor: pointer; padding: 4px 0; }
.col-picks { display: grid; gap: 4px; max-height: 260px; overflow: auto; padding: 6px 0; font-size: 13.5px; }
.col-picks label { display: flex; gap: 8px; align-items: center; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.filter-row > input { grid-column: 1 / -1; }
.filter-row.two > * { grid-column: auto; }
.result-meta { margin-bottom: 8px; }
.table.sticky thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table tfoot td { border-top: 2px solid var(--line); background: #fbfbf9; }
@media (max-width: 960px) { .builder { grid-template-columns: 1fr; } .builder-side { position: static; max-height: none; } }

/* ---------- Phase 7: assistant ---------- */
.assistant { display: grid; grid-template-columns: 280px 1fr; gap: 16px; height: calc(100vh - 120px); min-height: 520px; }
.convs { display: flex; flex-direction: column; overflow: hidden; margin: 0; }
.convs .list { flex: 1; overflow: auto; }
.convs li { gap: 6px; }
.convs li a { flex: 1; min-width: 0; color: var(--ink); }
.convs li.active { background: var(--accent-soft); }
.chat { display: flex; flex-direction: column; overflow: hidden; margin: 0; }
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.msgs { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.bubble.ai { align-self: flex-start; background: var(--line-2); border-bottom-left-radius: 4px; }
.ai-text p { margin: 0 0 8px; } .ai-text p:last-child { margin-bottom: 0; }
.ai-text ul, .ai-text ol { margin: 4px 0 8px; padding-left: 20px; }
.ai-text .table-wrap { background: var(--surface); border-radius: 8px; margin: 6px 0; }
.ai-text .table { font-size: 13px; }
.ai-text code { background: var(--surface); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.tools-used { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.action-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid #9fd3c7; }
.action-card.done { border-color: var(--line); }
.action-card.cancelled, .action-card.failed { border-color: var(--line); opacity: .75; }
.action-card.failed strong { text-decoration: line-through; }
.composer-ai { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer-ai textarea { flex: 1; resize: none; }
.welcome { margin: auto; text-align: center; max-width: 560px; }
.welcome h2 { margin: 8px 0; }
.ai-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto; background: linear-gradient(135deg, #0d7a6b, #2457a6); color: #fff; font-size: 22px; }
.thinking { display: flex; gap: 4px; padding: 14px; }
.thinking span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; } .thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ask-ai { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 820px) { .assistant { grid-template-columns: 1fr; height: auto; } .convs .card-body { display: none; } .convs .list { max-height: 132px; } .chat { height: calc(100vh - 140px); } .bubble { max-width: 92%; } }

/* ---------- Phase 7: integrations ---------- */
.integ-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.integ-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 15px; }
.secret-box { margin: 8px 0; padding: 10px 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); overflow-wrap: anywhere; user-select: all; }
.secret-box code { font-size: 13px; color: var(--ink); }

/* ---------- Phase 7: security ---------- */
.setup-2fa { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.setup-2fa .qr { width: 180px; height: 180px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; flex: none; }
.setup-2fa .qr svg { width: 100%; height: 100%; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.codes code { padding: 8px 10px; background: var(--line-2); border-radius: 6px; text-align: center; font-size: 14px; letter-spacing: .5px; }
.otp { font-size: 18px; letter-spacing: 3px; font-variant-numeric: tabular-nums; }

.brand-mark svg { width: 68%; height: 68%; display: block; }

/* ---------- Phase 8: platform ---------- */
.chip.on { background: var(--accent-soft); border-color: #9fd3c7; color: var(--accent); }
.chip.off { opacity: .55; }
a.chip { text-decoration: none; color: var(--ink); }
.inline-menu { display: inline-block; position: relative; }
.inline-menu summary { list-style: none; }
.inline-menu[open] form { position: absolute; right: 0; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 240px; box-shadow: 0 8px 24px rgba(20, 35, 43, .12); }
.banner-warn { background: var(--warn-soft); color: var(--warn); padding: 8px 16px; font-weight: 600; font-size: 13.5px; }
.banner-warn a { color: inherit; text-decoration: underline; }

/* Selfie at clock-in */
.selfie-cam { width: min(320px, 100%); margin: 0 auto; }
.selfie-cam video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: #0d1d22; transform: scaleX(-1); display: block; }
.selfie-cam .btn-row { justify-content: center; flex-wrap: wrap; }

/* Mobile app invite card on the dashboard */
.qr-box { width: 132px; flex: none; line-height: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.qr-box svg { width: 100%; height: auto; display: block; }
