/* ==========================================================================
   HRMS UI — clean admin console style (white top bar, light sidebar,
   orange accent, soft cards, uppercase section titles, underline tabs).
   Built on Bootstrap 5.3; light / dark / system themes via data-bs-theme.
   ========================================================================== */
:root {
  --brand: #ff6c2c;
  --brand-600: #f15a17;
  --brand-700: #d94c0f;
  --brand-50: #fff3ec;
  --brand-100: #fde6d9;
  --brand-ink: #c2410c;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e8eaef;
  --border-strong: #d9dce3;
  --text: #1f2430;
  --text-2: #4b5260;
  --muted: #6b7280;
  --success: #0f8a5f;
  --success-bg: #e6f7ef;
  --success-border: #b8e8d2;
  --danger: #d6322f;
  --danger-bg: #fdecec;
  --warning: #b45309;
  --warning-bg: #fff6e0;
  --info-bg: #eaf2ff;
  --info: #1d4ed8;

  --topbar-h: 64px;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 76px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);

  --bs-body-font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 255, 108, 44;
  --bs-link-color: var(--brand-ink);
  --bs-link-hover-color: var(--brand-700);
  --bs-link-color-rgb: 194, 65, 12;
  --bs-focus-ring-color: rgba(255, 108, 44, .25);
}

[data-bs-theme="dark"] {
  --brand-50: #3a2418;
  --brand-100: #4a2a1a;
  --brand-ink: #ff9a66;
  --bg: #111318;
  --surface: #1a1d24;
  --surface-2: #232730;
  --border: #2b303a;
  --border-strong: #3a404c;
  --text: #e8eaef;
  --text-2: #c3c8d2;
  --muted: #9aa2b1;
  --success: #4fd1a1;
  --success-bg: #11352a;
  --success-border: #1f5a45;
  --danger: #ff7b78;
  --danger-bg: #3a1b1b;
  --warning: #fbbf24;
  --warning-bg: #3a2c10;
  --info-bg: #182640;
  --info: #93b4ff;
  --shadow: none;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-link-color: var(--brand-ink);
  --bs-link-color-rgb: 255, 154, 102;
  --bs-secondary-color: var(--muted);
}

html, body { background: var(--bg); color: var(--text); }
body { font-size: var(--bs-body-font-size); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted, .form-text { color: var(--muted) !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 1030;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem 0 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; width: calc(var(--sidebar-w) - 1rem); flex-shrink: 0; }
.brand-mark {
  font-weight: 800; font-style: italic; font-size: 1.55rem; letter-spacing: -.03em;
  color: var(--brand); line-height: 1;
}
.brand-mark small { font-size: .55em; font-style: normal; font-weight: 600; color: var(--muted); margin-left: .15rem; }
.topbar-search {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: .6rem;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 999px;
  padding: .55rem .6rem .55rem 1rem; color: var(--muted); cursor: text;
}
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search > span:not(.kbd) { flex: 1; }
.kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .1rem .45rem;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2); font-size: 1.1rem; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.theme-switch {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--border);
}
.theme-switch button {
  width: 34px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
}
.theme-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff;
  display: inline-grid; place-items: center; font-weight: 600; font-size: .95rem; border: 0;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; border-radius: 14px; }
.btn-outline-soft {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
.btn-outline-soft:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 1020;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1rem .6rem .75rem; transition: width .18s ease, transform .18s ease;
}
.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-section {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 1rem .9rem .35rem; white-space: nowrap;
}
.nav-link-x {
  display: flex; align-items: center; gap: .9rem; padding: .7rem .9rem; margin: 2px 0; border-radius: 10px;
  color: var(--text); font-size: .98rem; white-space: nowrap;
}
.nav-link-x i { font-size: 1.2rem; width: 1.4rem; text-align: center; color: var(--text-2); }
.nav-link-x:hover { background: var(--surface-2); color: var(--text); }
.nav-link-x.active { background: var(--brand-100); color: var(--text); font-weight: 500; }
.nav-link-x.active i { color: var(--brand); }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: .5rem; }
.sidebar-footer .nav-link-x { font-size: .9rem; color: var(--text-2); background: transparent; border: 0; width: 100%; }
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .nav-section { display: none; }
body.sidebar-collapsed .nav-link-x { justify-content: center; padding: .75rem 0; }
body.sidebar-collapsed .sidebar-footer i { transform: rotate(180deg); }

/* ---------- Content ---------- */
.content { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 1.75rem) 2rem 3rem; min-height: 100vh; transition: margin .18s ease; }
body.sidebar-collapsed .content { margin-left: var(--sidebar-w-collapsed); }
.content-inner { max-width: 1320px; }

.breadcrumb-x { display: flex; gap: .55rem; align-items: center; color: var(--muted); font-size: .95rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.breadcrumb-x a { color: var(--muted); }
.breadcrumb-x a:hover { color: var(--text); }
.breadcrumb-x .current { color: var(--text); }

.page-head { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.icon-tile {
  width: 60px; height: 60px; border-radius: 12px; background: var(--brand-100); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 1.45rem; flex-shrink: 0; font-weight: 700;
}
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
.page-sub { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .4rem; align-items: center; }
.page-actions { margin-left: auto; display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; padding: .55rem 1rem; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-brand:disabled { background: var(--brand); opacity: .55; color: #fff; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-link-muted { color: var(--muted); background: none; border: 0; padding: 0; }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 500;
  padding: .22rem .75rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.pill-lg { font-size: .95rem; padding: .3rem .9rem; }
.pill-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.pill-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.pill-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.pill-brand { background: var(--brand-50); color: var(--brand-ink); border-color: var(--brand-100); }
.pill-info { background: var(--info-bg); color: var(--info); border-color: transparent; }

/* ---------- Tabs ---------- */
.tabs-line { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: thin; }
.tabs-line a {
  display: inline-flex; align-items: center; gap: .55rem; padding: .85rem 1rem; color: var(--text-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 10px 10px 0 0;
}
.tabs-line a:hover { color: var(--text); background: var(--surface-2); }
.tabs-line a.active { color: var(--brand-ink); background: var(--brand-100); border-bottom-color: var(--brand); font-weight: 500; }

/* ---------- Panels (cards) ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.6rem; margin-bottom: 1.5rem; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.panel-flush .panel-head { padding: 1.25rem 1.6rem 0; }
.panel-title { font-size: .95rem; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; color: var(--text-2); margin: 0; }
.panel-head .ms-auto { display: flex; gap: .5rem; flex-wrap: wrap; }

.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6rem 1.5rem; }
.info-label { color: var(--muted); font-size: .9rem; margin-bottom: .3rem; display: flex; align-items: center; gap: .3rem; }
.info-value { color: var(--text); word-break: break-word; }
.info-value.ok { color: var(--success); }

.stat { display: flex; gap: 1rem; align-items: center; }
.stat .icon-tile { width: 48px; height: 48px; font-size: 1.2rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .88rem; }
a.panel:hover { border-color: var(--brand-100); }

/* ---------- Tables ---------- */
.table-x { width: 100%; margin: 0; --bs-table-bg: transparent; color: var(--text); }
.table-x thead th {
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); padding: .75rem 1rem; white-space: nowrap;
}
.table-x td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table-x .cell-user { display: flex; align-items: center; gap: .75rem; }
.table-x .avatar { width: 34px; height: 34px; font-size: .8rem; }
.table-x a.row-link { color: var(--text); font-weight: 500; }
.table-x a.row-link:hover { color: var(--brand-ink); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: 1rem 1.6rem; border-bottom: 1px solid var(--border); }
.filters .form-control, .filters .form-select { max-width: 240px; }
.filters .search-input .form-control { max-width: none; }
.search-input { position: relative; }
.search-input i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 2.2rem; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border-strong); padding: .55rem .8rem; background-color: var(--surface); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(255, 108, 44, .15); }
.form-check-input:checked, .form-check-input[type=checkbox]:indeterminate { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(255, 108, 44, .15); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffb08a'/%3e%3c/svg%3e"); }
.form-label { font-weight: 500; font-size: .9rem; color: var(--text-2); }
.errorlist { list-style: none; padding: 0; margin: .3rem 0 0; color: var(--danger); font-size: .85rem; }
.role-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.role-check label.opt {
  display: flex; gap: .65rem; align-items: flex-start; padding: .75rem .9rem; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; background: var(--surface);
}
.role-check label.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }

/* ---------- Permission matrix ---------- */
.matrix-toolbar {
  position: sticky; top: var(--topbar-h); z-index: 5; background: var(--bg); padding: .75rem 0; margin-bottom: .5rem;
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
}
.module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; box-shadow: var(--shadow); }
.module-card.hidden { display: none; }
.module-head { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.25rem; cursor: pointer; user-select: none; }
.module-head .icon-tile { width: 40px; height: 40px; font-size: 1.05rem; border-radius: 10px; }
.module-name { font-weight: 600; }
.module-desc { color: var(--muted); font-size: .85rem; }
.module-count { margin-left: auto; }
.module-body { border-top: 1px solid var(--border); padding: 1rem 1.25rem 1.25rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .6rem; }
.module-card.collapsed .module-body { display: none; }
.module-card.collapsed .chev { transform: rotate(-90deg); }
.chev { transition: transform .15s; color: var(--muted); }
.perm {
  border: 1px solid var(--border); border-radius: 10px; padding: .65rem .8rem; background: var(--surface);
  display: flex; flex-direction: column; gap: .4rem;
}
.perm.on { border-color: var(--brand); background: var(--brand-50); }
.perm.locked { opacity: .55; }
.perm .perm-top { display: flex; align-items: center; gap: .6rem; }
.perm .perm-name { font-weight: 500; }
.perm .perm-code { font-size: .75rem; color: var(--muted); }
.perm .form-select-sm { font-size: .8rem; padding: .25rem 2rem .25rem .5rem; }
.perm .form-switch { padding-left: 0; min-height: 0; margin: 0; }
.perm .form-switch .form-check-input { width: 2.2em; height: 1.2em; margin: 0; flex-shrink: 0; float: none; }
.perm input[type=checkbox]:not([role=switch]) { width: 1.15em; height: 1.15em; margin: 0; }
.savebar {
  position: sticky; bottom: 0; z-index: 6; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 -4px 20px rgba(0, 0, 0, .06); padding: .85rem 1.25rem;
  display: flex; align-items: center; gap: .75rem; margin-top: 1rem;
}

/* Read-only effective-permission matrix */
.mx th, .mx td { text-align: center; }
.mx th:first-child, .mx td:first-child { text-align: left; }
.yes { color: var(--success); font-size: 1.05rem; }
.no { color: var(--border-strong); font-size: 1.05rem; }
.na { color: var(--border); }
.scope-tag { display: block; font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Alerts ---------- */
.alert { border-radius: 10px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.alert-danger, .alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ---------- Command palette ---------- */
.palette .modal-content { border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.palette input { border: 0; font-size: 1.05rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); border-radius: 16px 16px 0 0; }
.palette input:focus { box-shadow: none; }
.palette-list { max-height: 360px; overflow: auto; padding: .4rem; }
.palette-item { display: flex; gap: .8rem; align-items: center; padding: .65rem .8rem; border-radius: 10px; color: var(--text); }
.palette-item.sel, .palette-item:hover { background: var(--brand-50); color: var(--text); }
.palette-item small { margin-left: auto; color: var(--muted); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background:
  radial-gradient(1200px 500px at 50% -10%, var(--brand-50), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 40px rgba(16, 24, 40, .06); padding: 2.25rem 2rem; }
.auth-card .brand-mark { font-size: 2.1rem; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty i { font-size: 2.2rem; color: var(--border-strong); display: block; margin-bottom: .6rem; }

/* ---------- Diff ---------- */
.diff-old { background: var(--danger-bg); color: var(--danger); border-radius: 6px; padding: .1rem .4rem; }
.diff-new { background: var(--success-bg); color: var(--success); border-radius: 6px; padding: .1rem .4rem; }
pre.json { background: var(--surface-2); border-radius: 10px; padding: 1rem; font-size: .8rem; max-height: 360px; overflow: auto; }

.dropdown-menu { border-radius: 12px; border-color: var(--border); box-shadow: 0 10px 30px rgba(16, 24, 40, .1); padding: .4rem; background: var(--surface); }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; display: flex; gap: .6rem; align-items: center; color: var(--text); }
.dropdown-item:active { background: var(--brand); }
.dropdown-item.text-danger:hover { background: var(--danger-bg); }
.pagination .page-link { color: var(--text-2); border-color: var(--border); background: var(--surface); }
.pagination .active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) { .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .nav-section { display: initial; }
  .content, body.sidebar-collapsed .content { margin-left: 0; padding: calc(var(--topbar-h) + 1.25rem) 1rem 2rem; }
  .brand { width: auto; }
  .topbar-search { max-width: none; }
  .topbar-search > span { display: none; }
  .topbar-search { flex: 0 0 auto; padding: .55rem; }
  .theme-switch, .hide-md { display: none !important; }
  .page-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 575px) {
  .info-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.4rem; }
  .panel { padding: 1.1rem; }
  .panel.panel-flush { padding: 0; }
  .panel-flush .panel-head { padding: 1rem 1rem 0; }
  .filters { padding: .8rem 1rem; }
  .filters .form-control, .filters .form-select { max-width: none; flex: 1 1 100%; }
}
.sidebar-backdrop { display: none; }
@media (max-width: 991px) { body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 1015; } }

/* ---------- Org chart ---------- */
.oc-wrap { overflow: auto; padding: 2rem 1rem; }
.oc-canvas { transform-origin: top center; transition: transform .15s ease; min-width: max-content; margin: 0 auto; }
.oc-tree, .oc-tree ul { display: flex; justify-content: center; padding: 0; margin: 0; list-style: none; }
.oc-tree ul { padding-top: 26px; position: relative; }
.oc-tree li { position: relative; padding: 26px 10px 0; display: flex; flex-direction: column; align-items: center; }
.oc-tree > li { padding-top: 0; }
.oc-tree li::before, .oc-tree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 26px; border-top: 2px solid var(--border-strong); }
.oc-tree li::after { right: auto; left: 50%; border-left: 2px solid var(--border-strong); }
.oc-tree li:only-child::before, .oc-tree li:only-child::after { display: none; }
.oc-tree li:only-child { padding-top: 26px; }
.oc-tree > li:only-child { padding-top: 0; }
.oc-tree li:first-child::before, .oc-tree li:last-child::after { border: 0 none; }
.oc-tree li:last-child::before { border-right: 2px solid var(--border-strong); border-radius: 0 8px 0 0; }
.oc-tree li:first-child::after { border-radius: 8px 0 0 0; }
.oc-tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 26px; border-left: 2px solid var(--border-strong); }
.oc-tree li:only-child::before { display: block; border: 0; border-left: 2px solid var(--border-strong); width: 0; right: auto; left: 50%; }
.oc-tree > li:only-child::before { display: none; }
.oc-node { position: relative; width: 210px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--brand);
  border-radius: 12px; padding: .75rem .85rem .65rem; box-shadow: var(--shadow); text-align: left; }
.oc-node.oc-focus { outline: 3px solid var(--brand-100); }
.oc-type { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-ink); font-weight: 600; }
.oc-name { display: block; font-weight: 600; color: var(--text); line-height: 1.25; margin: .15rem 0 .45rem; }
.oc-name:hover { color: var(--brand-ink); }
.oc-head { display: flex; align-items: center; gap: .45rem; font-size: .82rem; margin-bottom: .45rem; }
.oc-head .avatar { width: 24px; height: 24px; font-size: .62rem; }
.oc-meta { display: flex; gap: .75rem; font-size: .78rem; color: var(--muted); }
.oc-toggle { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); display: grid; place-items: center; padding: 0; z-index: 2; }
.oc-collapsed > ul { display: none; }

/* ---------- Timeline (employment history) ---------- */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: .45rem; top: .3rem; bottom: .3rem; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 1.35rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -1.5rem; top: .3rem; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--brand); }
.tl-hire .tl-dot, .tl-rehire .tl-dot, .tl-confirmation .tl-dot { border-color: var(--success); }
.tl-separation .tl-dot, .tl-suspension .tl-dot, .tl-demotion .tl-dot { border-color: var(--danger); }
img.icon-tile { padding: 0; }
.table-x .mono, .pill.mono { white-space: nowrap; }

/* ---------- Attendance ---------- */
.clock-card { text-align: center; padding: 2rem 1.5rem; }
.clock-time { font-size: 3.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; margin-bottom: .5rem; font-variant-numeric: tabular-nums; }
.btn-clock { font-size: 1.15rem; padding: .85rem 2.6rem; border-radius: 999px; box-shadow: 0 8px 24px rgba(255, 108, 44, .3); }
.ts th, .ts td { padding: .45rem .25rem; text-align: center; font-size: .8rem; }
.ts .ts-name { text-align: left; min-width: 190px; max-width: 220px; padding-left: 1rem; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.ts thead .ts-name { background: var(--surface-2); }
.ts .ts-we { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.ts-dow { font-size: .62rem; color: var(--muted); font-weight: 500; }
.ts-cell { display: inline-grid; place-items: center; min-width: 24px; height: 22px; border-radius: 6px; font-weight: 600; font-size: .72rem; }
.ts-cell.ok { background: var(--success-bg); color: var(--success); }
.ts-cell.late { background: var(--warning-bg); color: var(--warning); }
.ts-cell.bad { background: var(--danger-bg); color: var(--danger); }
.ts-cell.leave { background: var(--info-bg); color: var(--info); }
.ts-cell.off { color: var(--muted); }
.ts-legend { display: flex; gap: .8rem; flex-wrap: wrap; color: var(--muted); }
.contract-terms { font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.65; max-width: 780px; }
.contract-terms p { margin-bottom: .9rem; }
/* Module 9 — documents */
.doc-preview { background: var(--surface-2, #f3f4f6); border-radius: inherit; overflow: hidden; }
.doc-preview iframe { display: block; width: 100%; height: 72vh; min-height: 480px; border: 0; }
.doc-preview img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; object-fit: contain; }
.doc-card { display: flex; gap: .85rem; align-items: flex-start; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); height: 100%; color: inherit; transition: border-color .15s, box-shadow .15s; }
.doc-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(0,0,0,.05); color: inherit; }
.doc-card .doc-ico { font-size: 1.6rem; color: var(--brand); line-height: 1; }
.doc-card.needs-ack { border-color: var(--brand); background: var(--brand-50); }

/* Module 10 — tasks board & appraisal */
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.board-col { background: var(--surface-2); border-radius: 14px; padding: .75rem; min-height: 180px; }
.board-head { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9rem; padding: .25rem .35rem .75rem; color: var(--text-2); }
.task-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .6rem; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.task-card:hover { border-color: var(--brand); color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.task-card.overdue { border-left: 4px solid var(--danger); }
.board-empty { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 0; }
.prio { font-size: .72rem; font-weight: 600; white-space: nowrap; }
.prio-low { color: var(--muted); } .prio-medium { color: var(--info); } .prio-high { color: var(--warning); } .prio-urgent { color: var(--danger); }
.comment { display: flex; gap: .75rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment .avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand-ink); display: grid; place-items: center; font-size: .8rem; font-weight: 600; flex: none; }
.comment.system .avatar-sm { background: var(--surface-2); color: var(--muted); }
.stepper { display: flex; gap: 0; margin-bottom: 1.5rem; overflow-x: auto; }
.stepper .step { flex: 1; min-width: 120px; position: relative; padding-top: 1.6rem; font-size: .78rem; color: var(--muted); text-align: center; }
.stepper .step::before { content: ""; position: absolute; top: .45rem; left: 0; right: 0; height: 3px; background: var(--border); }
.stepper .step::after { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border); }
.stepper .step.done { color: var(--text-2); } .stepper .step.done::before { background: var(--brand); } .stepper .step.done::after { background: var(--brand); border-color: var(--brand); }
.stepper .step.current { color: var(--brand-ink); font-weight: 600; } .stepper .step.current::before { background: linear-gradient(90deg, var(--brand) 50%, var(--border) 50%); } .stepper .step.current::after { border-color: var(--brand); background: var(--brand-50); }
.rating-select { min-width: 150px; }
.score-ring { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); }
.score-ring > div { width: 84px; height: 84px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.obj-table td { vertical-align: top; }
.bar-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; font-size: .85rem; }
.bar-row .bar { flex: 1; height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }

/* Module 11 — leave */
.leave-grid th, .leave-grid td { min-width: 30px; text-align: center; padding: 4px 2px; }
.leave-grid th.wk, .leave-grid td.wk { background: var(--surface-2); }
.leave-grid th.today { color: var(--brand-ink); box-shadow: inset 0 -3px 0 var(--brand); }
.leave-grid .lv { display: block; height: 22px; border-radius: 5px; background: var(--c); color: #fff; font-size: .7rem; line-height: 22px; }
.leave-grid .lv-pending { background: repeating-linear-gradient(45deg, var(--c), var(--c) 4px, transparent 4px, transparent 8px); border: 1px solid var(--c); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.leave-steps { display: flex; gap: .5rem; flex-wrap: wrap; }
.leave-steps .ls { display: flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 999px; background: var(--surface-2); font-size: .8rem; color: var(--muted); }
.leave-steps .ls.done { background: var(--success-bg); color: var(--success); }
.leave-steps .ls.now { background: var(--brand-50); color: var(--brand-ink); font-weight: 600; }

/* Module 13 — meetings */
.mcal { width: 100%; table-layout: fixed; border-collapse: collapse; min-width: 760px; }
.mcal th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .6rem; border-bottom: 1px solid var(--border); text-align: left; }
.mcal td { vertical-align: top; height: 112px; padding: .35rem; border: 1px solid var(--border); }
.mcal td.out { background: var(--surface-2); opacity: .6; }
.mcal td.wk { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.mcal td.today .mcal-day { background: var(--brand); color: #fff; border-radius: 999px; display: inline-block; min-width: 1.6rem; text-align: center; }
.mcal-day { font-size: .78rem; font-weight: 600; margin-bottom: .25rem; padding: 0 .3rem; }
.mcal-item { display: block; font-size: .72rem; line-height: 1.25; padding: .2rem .35rem; margin-bottom: .2rem; border-radius: 6px; color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--c, #999) 14%, transparent); border-left: 3px solid var(--c, #999); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mcal-item:hover { background: color-mix(in srgb, var(--c, #999) 24%, transparent); }
.mcal-busy { --c: #94a3b8; color: var(--muted); }
.rsvp-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.rsvp-bar span { display: block; }
.agenda-num { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--brand-50); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; flex-shrink: 0; }
.mp-av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-50); color: var(--brand-ink); display: grid; place-items: center; font-size: .7rem; font-weight: 600; flex: none; }
.table-x.table-tight th, .table-x.table-tight td { padding: .55rem .6rem; font-size: .85rem; }

/* Module 16 — notifications */
.notif { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); color: var(--text); }
.notif.unread { background: color-mix(in srgb, var(--brand-50) 60%, transparent); }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.notif.unread .notif-icon { background: var(--brand-50); color: var(--brand); }
.notif.lvl-warning .notif-icon { background: var(--warning-bg); color: var(--warning); }
.notif.lvl-danger .notif-icon { background: var(--danger-bg); color: var(--danger); }
.notif.lvl-success .notif-icon { background: var(--success-bg); color: var(--success); }
.notif-title { display: block; font-weight: 600; font-size: .9rem; }
.notif-body { display: block; font-size: .82rem; color: var(--text-2); margin-top: .1rem; }
.notif-meta { display: block; font-size: .74rem; color: var(--muted); margin-top: .2rem; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: .45rem; flex: none; }
.bell-wrap { position: relative; }
.bell-badge { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.bell-menu { width: 360px; max-width: 92vw; padding: 0; overflow: hidden; }
.bell-menu .bell-list { max-height: 420px; overflow-y: auto; }
.bell-menu .notif { padding: .6rem .85rem; }
.announce { border-left: 4px solid var(--info); }
.announce.lvl-warning { border-left-color: var(--warning); }
.announce.lvl-danger { border-left-color: var(--danger); }

/* ---------- Module 17: reports & analytics charts ----------
   Palette validated with the dataviz validator: blue/orange pass all CVD checks on #ffffff (light) and
   #1a1d24 (dark); dark mode uses its own steps, not a flip. */
:root { --chart-1: #2a78d6; --chart-2: #eb6834; --chart-grid: #eceef2; --chart-base: #c9ced8; }
[data-bs-theme="dark"] { --chart-1: #3987e5; --chart-2: #d95926; --chart-grid: #2b303a; --chart-base: #4a515e; }
.chart { position: relative; }
.chart-head { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .5rem; }
.chart-head .chart-title { font-weight: 600; font-size: .95rem; }
.chart-head .chart-sub { color: var(--muted); font-size: .8rem; }
.chart-head .chart-tools { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); margin-bottom: .25rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i, .tip-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-plot { width: 100%; min-height: 60px; }
.chart-plot svg { display: block; overflow: visible; }
.chart .cs-1 { fill: var(--chart-1); stroke: var(--chart-1); background: var(--chart-1); }
.chart .cs-2 { fill: var(--chart-2); stroke: var(--chart-2); background: var(--chart-2); }
.chart .c-bar { stroke: none; }
.chart .c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .c-dot { stroke: none; }
.chart .c-marker { stroke: var(--surface); stroke-width: 2; }
.chart .c-grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .c-base { stroke: var(--chart-base); stroke-width: 1; shape-rendering: crispEdges; }
.chart .c-cross { stroke: var(--chart-base); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .c-label { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .c-cat { fill: var(--text-2); font-size: 12px; }
.chart .c-hit { fill: transparent; cursor: crosshair; }
.chart .c-band { fill: transparent; }
.chart .c-band.on { fill: var(--surface-2); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 140px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 6px 18px rgba(16,24,40,.12);
  padding: .45rem .6rem; font-size: .78rem; color: var(--text); }
.chart-tip .tip-title { font-weight: 600; margin-bottom: .2rem; }
.chart-tip .tip-row { display: flex; gap: .45rem; align-items: center; }
.chart-tip .tip-row b { margin-left: auto; padding-left: .75rem; font-variant-numeric: tabular-nums; }
.chart-table { max-height: 320px; overflow: auto; }
.kpi .stat-value { font-variant-numeric: tabular-nums; }
.kpi .stat-label { line-height: 1.25; }
.kpi .kpi-sub { color: var(--muted); font-size: .75rem; }
.report-card { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; height: 100%; }
a.report-card:hover { border-color: var(--brand); color: var(--text); }
.report-card.locked { background: var(--surface-2); color: var(--muted); }
.report-card .rc-title { font-weight: 600; }
.report-card .rc-desc { font-size: .8rem; color: var(--muted); }
.table-x td.num, .table-x th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-x tr.totals td { font-weight: 600; background: var(--surface-2); }
.filters .filter-label { font-size: .75rem; color: var(--muted); display: block; }
@media print {
  .sidebar, .topbar, .page-actions, .filters, .chart-tools, .no-print { display: none !important; }
}
.panel.filters .form-select { min-width: 8.5rem; padding-right: 2.25rem; }

/* ---------- Module 18: system configuration ---------- */
.settings-nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a.active { background: var(--brand-100); color: var(--brand-ink); font-weight: 500; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem 1.5rem; padding: 1rem 0;
  border-bottom: 1px solid var(--border); }
.setting-row:last-of-type { border-bottom: 0; }
@media (max-width: 767px) { .setting-row { grid-template-columns: 1fr; } }
.check-row { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; }
.check-row .bi { font-size: 1.1rem; margin-top: .1rem; }
.check-ok { color: var(--success); } .check-warn { color: var(--warning); } .check-fail { color: var(--danger); }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 1.5rem; font-size: 1.05rem; }
.qr-box { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; border: 1px solid var(--border); }
.qr-box svg { display: block; width: 200px; height: 200px; }
.otp-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Module 19: careers page (public) ---------- */
.careers { min-height: 100vh; background: var(--bg); }
.careers-top { background: var(--surface); border-bottom: 1px solid var(--border); padding: .9rem 0; }
.careers-wrap { max-width: 1080px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
