/* =====================================================================
   Wellness Diagnostic ERP — design system
   Brand colour #d4dde9 (steel blue, hue 214°) with a deep navy partner.
   Layout rule: every flex/grid child gets min-width:0 so nothing overlaps;
   wide tables scroll inside .table-wrap instead of pushing the page.
   ===================================================================== */

:root {
  --brand: #d4dde9;
  --brand-50: #f5f8fb;
  --brand-100: #e9eef5;
  --brand-150: #dfe6ef;
  --brand-300: #b8c6d8;
  --brand-400: #93a6bf;
  --brand-500: #6b819e;

  --navy-950: #0c1a2c;
  --navy-900: #12243b;
  --navy-800: #1a3150;
  --navy-700: #24406a;
  --navy-600: #2f5385;
  --navy-500: #3d68a3;

  --text: #15263d;
  --text-2: #42546d;
  --muted: #6c7d93;
  --faint: #94a3b6;

  --canvas: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #dde4ee;
  --border-strong: #c9d4e2;

  --success: #17845a;
  --success-bg: #e2f4ec;
  --warning: #a8690f;
  --warning-bg: #fcf1dc;
  --danger: #c0392f;
  --danger-bg: #fce8e6;
  --info: #2a64ad;
  --info-bg: #e4eefb;
  --violet: #6650c8;
  --violet-bg: #eeebfb;
  --teal: #0f7d84;
  --teal-bg: #def3f3;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(18, 36, 59, .06);
  --shadow: 0 1px 2px rgba(18, 36, 59, .05), 0 4px 14px rgba(18, 36, 59, .06);
  --shadow-lg: 0 10px 40px rgba(12, 26, 44, .18);

  --sidebar-w: 268px;
  --topbar-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--navy-800); }
h1, h2, h3, h4 { margin: 0; color: var(--navy-900); letter-spacing: -0.01em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; color: var(--navy-900); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Icons ------------------------------------------------------------- */
.i {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
}
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* App shell ----------------------------------------------------------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--brand);
  border-right: 1px solid var(--brand-300);
  display: flex; flex-direction: column;
}
.brand {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--brand-300);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg, var(--navy-700), var(--navy-950));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 14px rgba(18, 36, 59, .28);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-name { display: block; font-weight: 700; font-size: 15px; color: var(--navy-950); letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { display: block; font-size: 11.5px; color: var(--navy-600); font-weight: 500; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 24px; scrollbar-width: thin; }
.nav-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--brand-500); padding: 16px 12px 6px;
}
.nav-section:first-child { padding-top: 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  min-height: 38px; padding: 8px 12px; margin: 1px 0;
  border-radius: 10px;
  color: var(--navy-800); font-weight: 500; font-size: 13.5px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav a .i { color: var(--navy-600); }
.nav a span.lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, .5); color: var(--navy-950); }
.nav a.active {
  background: var(--surface); color: var(--navy-950); font-weight: 600;
  box-shadow: 0 1px 2px rgba(18, 36, 59, .08), 0 2px 8px rgba(18, 36, 59, .06);
}
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--navy-700);
}
.nav a.active .i { color: var(--navy-800); }
.nav .count {
  flex: none; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.nav .count.soft { background: var(--navy-800); }
.sidebar-foot {
  flex: none; padding: 14px 16px; border-top: 1px solid var(--brand-300);
  font-size: 11.5px; color: var(--navy-600);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(23, 132, 90, .18); }

.main { margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); flex: none;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
}
.topbar .menu-btn { display: none; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs .here { color: var(--navy-900); font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .sep { color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.fy-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: 9px;
  background: var(--brand-100); border: 1px solid var(--brand-150);
  color: var(--navy-800); font-weight: 600; font-size: 12.5px; white-space: nowrap;
}
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px;
  display: inline-grid; place-items: center; flex: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--navy-700);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--brand-50); border-color: var(--border-strong); color: var(--navy-900); }
.icon-btn .pip {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; border: 2px solid #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font: inherit; color: inherit; max-width: 260px;
}
.user-btn:hover { border-color: var(--border-strong); background: var(--brand-50); }
.user-btn .who { min-width: 0; text-align: left; line-height: 1.25; }
.user-btn .who b { display: block; font-size: 13px; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: none;
}
.dropdown.open { display: block; }
.dropdown .dd-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: 8px; border: 0; background: none;
  font: inherit; font-size: 13.5px; color: var(--text-2); cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--brand-50); color: var(--navy-900); }

.content { flex: 1; padding: 26px 28px 40px; min-width: 0; }
.container { max-width: 1440px; margin: 0 auto; min-width: 0; }
.footer { padding: 16px 28px; color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.scrim { display: none; }

/* Page header --------------------------------------------------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.page-head .titles { min-width: 0; flex: 1 1 320px; }
.page-head h1 { font-size: 23px; font-weight: 700; line-height: 1.25; }
.page-head .sub { margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-500); margin-bottom: 6px; }

/* Buttons ------------------------------------------------------------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--navy-800); --b-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-bd);
  font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--brand-50); color: var(--navy-950); border-color: var(--brand-400); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(61, 104, 163, .35); outline-offset: 1px; }
.btn-primary {
  --b-bg: var(--navy-800); --b-fg: #fff; --b-bd: var(--navy-800);
  box-shadow: 0 1px 2px rgba(18, 36, 59, .2), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.btn-primary:hover { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.btn-success { --b-bg: var(--success); --b-fg: #fff; --b-bd: var(--success); }
.btn-success:hover { background: #126d4a; color: #fff; border-color: #126d4a; }
.btn-danger { --b-bg: var(--surface); --b-fg: var(--danger); --b-bd: #efc4bf; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--navy-700); }
.btn-ghost:hover { background: var(--brand-100); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; margin: 0; }

/* Cards --------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card + .card { margin-top: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; }
.card-head .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.card-flush .table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.grid { display: grid; gap: 20px; min-width: 0; }
.grid > * { min-width: 0; }
/* Cards side by side in a grid: the grid gap spaces them, so the stacked-card margin must not apply (keeps equal heights) */
.grid > .card + .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* KPI tiles ----------------------------------------------------------- */
.kpis { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 22px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); min-width: 0;
}
.kpi::after {
  content: ""; position: absolute; right: -36px; top: -36px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--brand-100) 0%, rgba(233, 238, 245, 0) 70%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; position: relative; z-index: 1; }
.kpi-value { margin-top: 10px; font-size: 26px; font-weight: 700; color: var(--navy-950); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-meta { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.kpi .progress { margin-top: 12px; }
.tone-navy { background: var(--brand-100); color: var(--navy-700); }
.tone-green { background: var(--success-bg); color: var(--success); }
.tone-amber { background: var(--warning-bg); color: var(--warning); }
.tone-red { background: var(--danger-bg); color: var(--danger); }
.tone-blue { background: var(--info-bg); color: var(--info); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-teal { background: var(--teal-bg); color: var(--teal); }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 20px; }
.delta.up { color: var(--success); background: var(--success-bg); }
.delta.down { color: var(--danger); background: var(--danger-bg); }
.delta .i { width: 13px; height: 13px; stroke-width: 2.4; }

/* Badges -------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--brand-100); color: var(--navy-700);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.b-success, .b-active, .b-completed, .b-accepted, .b-achieved, .b-on-track, .b-done, .b-verified { background: var(--success-bg); color: var(--success); }
.b-warning, .b-watch, .b-pending, .b-onboarding, .b-lead, .b-medium, .b-clarification { background: var(--warning-bg); color: var(--warning); }
.b-approved { background: var(--success-bg); color: var(--success); }
.b-rejected { background: var(--danger-bg); color: var(--danger); }
.b-on_notice { background: var(--warning-bg); color: var(--warning); }
.b-danger, .b-critical, .b-missed, .b-overdue, .b-high, .b-exited, .b-cancelled { background: var(--danger-bg); color: var(--danger); }
.b-info, .b-planned, .b-today { background: var(--info-bg); color: var(--info); }
.b-violet, .b-on-notice { background: var(--violet-bg); color: var(--violet); }
.b-neutral, .b-inactive, .b-low, .b-no-target { background: #edf0f4; color: #5b6b80; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--brand-100); color: var(--navy-700); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; color: var(--navy-600); background: var(--brand-50); border: 1px solid var(--brand-150); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }

/* Tables -------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted);
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: #fafbfd; }
.table td.strong, .table td .strong { color: var(--navy-900); }
.table tfoot td { background: var(--surface-2); font-weight: 700; color: var(--navy-900); border-top: 1px solid var(--border-strong); border-bottom: 0; }
.table .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.table .wrap { white-space: normal; min-width: 180px; overflow-wrap: anywhere; }
.table-compact td { padding: 9px 14px; }
.table-compact th { padding: 9px 14px; }
.row-link { cursor: pointer; }

.cell-user { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-user .meta { min-width: 0; line-height: 1.3; }
.cell-user .meta b { display: block; font-weight: 600; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.cell-user .meta small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

/* Avatars ------------------------------------------------------------- */
.avatar {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  background: var(--brand-100); color: var(--navy-700);
}
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 21px; }
.avatar.t0 { background: #e1e9f5; color: #24406a; }
.avatar.t1 { background: #dff1ea; color: #16714f; }
.avatar.t2 { background: #fbecd8; color: #93590b; }
.avatar.t3 { background: #ebe7fa; color: #5a45b8; }
.avatar.t4 { background: #fbe3e1; color: #a83329; }
.avatar.t5 { background: #dbf0f1; color: #0d6c72; }

/* Forms --------------------------------------------------------------- */
.form-grid { display: grid; gap: 16px 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.form-grid > * { min-width: 0; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-section + .form-section { margin-top: 26px; padding-top: 22px; border-top: 1px dashed var(--border-strong); }
.form-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.form-section-title .n { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-100); color: var(--navy-700); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.form-section-title h3 { font-size: 14.5px; }
.form-section-title p { font-size: 12.5px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c7d93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  text-overflow: ellipsis;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--brand-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(61, 104, 163, .16); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-sm, .select-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--danger); }
.field-error { font-size: 12px; color: var(--danger); font-weight: 500; }
.field-hint { font-size: 12px; color: var(--muted); }
.input-group { position: relative; display: flex; align-items: center; min-width: 0; }
.input-group .prefix { position: absolute; left: 12px; color: var(--muted); font-weight: 600; pointer-events: none; }
.input-group .input { padding-left: 30px; }
.search-box { position: relative; min-width: 0; flex: 1 1 240px; max-width: 360px; }
.search-box .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box .input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.check input { width: 17px; height: 17px; accent-color: var(--navy-700); margin: 0; flex: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.alert-box { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; font-size: 13.5px; border: 1px solid transparent; }
.alert-box .i { margin-top: 1px; }
.alert-box.error { background: var(--danger-bg); color: #8f2a22; border-color: #f2c9c4; }
.alert-box.info { background: var(--info-bg); color: #1f4e8a; border-color: #c9dbf3; }
.alert-box.warn { background: var(--warning-bg); color: #7d4e0b; border-color: #f1d9ae; }
.alert-box.ok { background: var(--success-bg); color: #10603f; border-color: #bfe5d3; }

/* Filters bar ---------------------------------------------------------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.filters .select, .filters .input { width: auto; min-width: 150px; max-width: 220px; height: 36px; font-size: 13px; }
.filters .spacer { flex: 1; }

/* Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--brand-100); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 9px; border: 0; background: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--navy-600); cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--navy-900); background: rgba(255, 255, 255, .55); }
.tabs .active { background: var(--surface); color: var(--navy-950); box-shadow: var(--shadow-sm); }
.tabs .n { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: var(--brand-150); color: var(--navy-700); }
.tabs .active .n { background: var(--navy-800); color: #fff; }
.tab-panel[hidden] { display: none; }

/* Progress -------------------------------------------------------------- */
.progress { height: 8px; border-radius: 8px; background: var(--brand-100); overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--navy-600), var(--navy-800)); }
.progress.green > span { background: linear-gradient(90deg, #2aa476, var(--success)); }
.progress.amber > span { background: linear-gradient(90deg, #e2a03c, var(--warning)); }
.progress.red > span { background: linear-gradient(90deg, #e2675d, var(--danger)); }
.progress.thin { height: 6px; }
.pct-cell { display: flex; align-items: center; gap: 10px; min-width: 112px; }
.pct-cell .progress { flex: 1; }
.pct-cell b { width: 52px; text-align: right; font-variant-numeric: tabular-nums; color: var(--navy-900); font-size: 13px; }

/* Charts (server-rendered) --------------------------------------------- */
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.colchart { display: flex; align-items: stretch; gap: 10px; height: 250px; padding: 8px 4px 0; min-width: 0; }
.colchart .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.colchart .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--border); position: relative; }
.colchart .bar { width: 30%; max-width: 18px; min-height: 2px; border-radius: 5px 5px 0 0; position: relative; transition: opacity .15s; }
.colchart .bar:hover { opacity: .8; }
.colchart .bar.target { background: var(--brand-300); }
.colchart .bar.sales { background: linear-gradient(180deg, var(--navy-600), var(--navy-800)); }
.colchart .bar.coll { background: linear-gradient(180deg, #33b383, var(--success)); }
.colchart .lbl { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.colchart .col.now .lbl { color: var(--navy-900); }
.colchart .col.now .bars { background: linear-gradient(180deg, rgba(212, 221, 233, 0), rgba(212, 221, 233, .45)); border-radius: 8px 8px 0 0; }
.chart-scroll { overflow-x: auto; }
.chart-scroll .colchart { min-width: 440px; }

.hbars { display: flex; flex-direction: column; gap: 15px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.hbar-row .name { min-width: 0; }
.hbar-row .name b { display: block; font-size: 13px; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .name small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .track { position: relative; height: 12px; background: var(--brand-100); border-radius: 8px; overflow: hidden; }
.hbar-row .track span { position: absolute; inset: 0 auto 0 0; border-radius: 8px; }
.hbar-row .val { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.hbar-row .val b { color: var(--navy-900); font-size: 13px; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { position: relative; width: 150px; height: 150px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center b { display: block; font-size: 24px; color: var(--navy-950); font-variant-numeric: tabular-nums; line-height: 1.1; }
.donut .center small { color: var(--muted); font-size: 11.5px; }
.legend-list { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 10px; }
.legend-list .li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-list .li i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-list .li span { flex: 1; color: var(--text-2); min-width: 0; }
.legend-list .li b { font-variant-numeric: tabular-nums; color: var(--navy-900); }

/* Stat strip ------------------------------------------------------------- */
.stats { display: flex; flex-wrap: wrap; gap: 1px; background: var(--border); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.stats > div { flex: 1 1 130px; background: var(--surface); padding: 14px 16px; min-width: 0; }
.stats .k { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stats .v { margin-top: 4px; font-size: 18px; font-weight: 700; color: var(--navy-950); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats .v.success { color: var(--success); }
.stats .v.danger { color: var(--danger); }

/* Lists / feeds ------------------------------------------------------------ */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; color: var(--navy-900); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 12px 20px; min-width: 0; }
.timeline li::before { content: ""; position: absolute; left: 37px; top: 46px; bottom: -12px; width: 2px; background: var(--brand-100); }
.timeline li:last-child::before { display: none; }
.timeline .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; position: relative; z-index: 1; }
.timeline .body { flex: 1; min-width: 0; }
.timeline .body .t { font-weight: 600; color: var(--navy-900); font-size: 13.5px; overflow-wrap: anywhere; }
.timeline .body .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.timeline .when { flex: none; font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Description list --------------------------------------------------------- */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 24px; margin: 0; }
.dl > div { min-width: 0; }
.dl dt { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dl dd { margin: 4px 0 0; color: var(--navy-900); font-weight: 500; overflow-wrap: anywhere; }

/* Profile header ----------------------------------------------------------- */
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 22px; }
.profile-head .info { flex: 1 1 300px; min-width: 0; }
.profile-head h2 { font-size: 20px; }
.profile-head .meta-row { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 13px; }
.profile-head .meta-row span { display: inline-flex; align-items: center; gap: 6px; }
.banner { height: 10px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: linear-gradient(120deg, var(--brand) 0%, #c4d1e2 45%, #aebfd6 100%); position: relative; overflow: hidden; }
.banner::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% -20%, rgba(255,255,255,.65), transparent 45%); }
.profile-card .profile-head { position: relative; }
.profile-card .avatar.lg { border: 4px solid var(--surface); box-shadow: var(--shadow); width: 84px; height: 84px; border-radius: 22px; font-size: 26px; }

/* Stepper ---------------------------------------------------------------- */
.stepper { display: flex; gap: 0; counter-reset: step; overflow-x: auto; padding: 4px 2px; }
.step { flex: 1 1 0; min-width: 130px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; position: relative; padding: 0 6px; }
.step::before { content: ""; position: absolute; top: 17px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 2px; background: var(--border-strong); }
.step:first-child::before { display: none; }
.step .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); font-weight: 700; font-size: 13px; position: relative; z-index: 1; }
.step .t { font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.3; }
.step .s { font-size: 11.5px; color: var(--muted); }
.step.done .dot { background: var(--success); border-color: var(--success); color: #fff; }
.step.done::before, .step.current::before { background: var(--success); }
.step.current .dot { border-color: var(--navy-700); color: var(--navy-800); box-shadow: 0 0 0 4px rgba(61, 104, 163, .15); }
.step.current .t { color: var(--navy-950); }

/* Hierarchy tree ------------------------------------------------------------ */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 26px; padding-left: 22px; border-left: 2px solid var(--brand-150); }
.tree li { position: relative; padding: 6px 0; }
.tree ul > li::before { content: ""; position: absolute; left: -22px; top: 30px; width: 18px; height: 2px; background: var(--brand-150); }
.node { display: inline-flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; max-width: 100%; }
.node .meta { min-width: 0; line-height: 1.3; }
.node .meta b { display: block; color: var(--navy-900); font-size: 13.5px; }
.node .meta small { display: block; color: var(--muted); font-size: 12px; }
.node .reports { margin-left: 6px; }
.tree-scroll { overflow-x: auto; padding: 20px; }

/* Empty state ----------------------------------------------------------------- */
.empty { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty .ico { width: 54px; height: 54px; border-radius: 16px; background: var(--brand-100); color: var(--navy-600); display: inline-grid; place-items: center; margin-bottom: 12px; }
.empty h3 { font-size: 15px; color: var(--navy-900); margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

/* Toasts ------------------------------------------------------------------------ */
.toasts { position: fixed; top: 76px; right: 24px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px 13px 16px; border-radius: 12px; background: var(--navy-900); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .25s ease-out; }
.toast .i { margin-top: 1px; }
.toast.ok .i { color: #6fe0b1; }
.toast.err { background: #7c2019; }
.toast .x { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; padding: 0; }
.toast.hide { opacity: 0; transform: translateY(-6px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Dialog ------------------------------------------------------------------------- */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal::backdrop { background: rgba(12, 26, 44, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }

/* Alerts list ---------------------------------------------------------------- */
.alert-item { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; min-width: 0; }
.alert-item:last-child { border-bottom: 0; }
.alert-item .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.alert-item .body { flex: 1; min-width: 0; }
.alert-item .body .t { font-weight: 600; color: var(--navy-900); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert-item .body .m { color: var(--text-2); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }

/* KRA cards -------------------------------------------------------------------- */
.kra { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: var(--surface); display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.kra + .kra { margin-top: 12px; }
.kra .w { flex: none; width: 54px; height: 54px; border-radius: 14px; background: var(--brand-100); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.kra .w b { font-size: 16px; color: var(--navy-900); display: block; }
.kra .w small { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.kra .body { flex: 1; min-width: 0; }
.kra .body h4 { font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kra .body p { font-size: 13px; color: var(--text-2); margin-top: 4px; overflow-wrap: anywhere; }
.kra .audit { margin-top: 10px; padding: 9px 12px; border-radius: 9px; background: var(--success-bg); color: #10603f; font-size: 12px; overflow-wrap: anywhere; }

/* Document tiles ----------------------------------------------------------------- */
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; min-width: 0; background: var(--surface); }
.doc .ext { width: 40px; height: 44px; border-radius: 8px; background: var(--brand-100); color: var(--navy-700); display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; letter-spacing: .03em; }
.doc .meta { flex: 1; min-width: 0; }
.doc .meta b { display: block; font-size: 13px; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .meta small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 18px; background: var(--surface-2); }

/* Login -------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-art {
  position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, #e3e9f2 0%, var(--brand) 45%, #b6c5d9 100%);
  color: var(--navy-950);
}
.auth-art::before { content: ""; position: absolute; width: 560px; height: 560px; right: -180px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.55), rgba(255,255,255,0) 65%); }
.auth-art::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(26,49,80,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(26,49,80,.05) 1px, transparent 1px); background-size: 34px 34px; mask-image: linear-gradient(180deg, rgba(0,0,0,.7), transparent 80%); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.025em; max-width: 520px; margin-top: 18px; }
.auth-art .lead { margin-top: 14px; font-size: 15px; color: var(--navy-700); max-width: 470px; }
.auth-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 560px; margin-top: 32px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.7); backdrop-filter: blur(6px); min-width: 0; }
.auth-point .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--navy-800); color: #fff; display: grid; place-items: center; flex: none; }
.auth-point b { display: block; font-size: 13.5px; }
.auth-point small { color: var(--navy-600); font-size: 12px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: none; }
.auth-card h2 { font-size: 26px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); margin-top: 6px; margin-bottom: 28px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-card .input { height: 46px; font-size: 14px; }
.auth-card .btn { height: 46px; margin-top: 24px; font-size: 14.5px; }
.auth-foot { margin-top: 28px; font-size: 12px; color: var(--faint); text-align: center; }

/* Letter (print) ------------------------------------------------------------------- */
.letter { max-width: 820px; margin: 0 auto; background: #fff; padding: 56px 64px; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); color: #1b2a3d; font-size: 14px; line-height: 1.7; }
.letter .lh { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--navy-800); padding-bottom: 16px; margin-bottom: 28px; }
.letter .lh h2 { font-size: 22px; color: var(--navy-900); }
.letter .lh small { color: var(--muted); display: block; font-size: 12px; line-height: 1.5; }
.letter table { border-collapse: collapse; width: 100%; margin: 14px 0; }
.letter td { border: 1px solid var(--border); padding: 8px 12px; }
.letter td:first-child { width: 38%; background: var(--surface-2); font-weight: 600; }
.letter .sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 56px; }
.letter .sign div { flex: 1; border-top: 1px solid #8a99ad; padding-top: 8px; font-size: 13px; }

/* Responsive -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .grid-side { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 1180px) {
  .grid-main, .grid-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(12, 26, 44, .4); }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: inline-grid; }
  .content { padding: 20px 16px 32px; }
  .footer { padding: 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
}
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: 1 / -1; }
  .user-btn .who, .fy-chip { display: none; }
  .user-btn { padding: 4px; }
  .page-head h1 { font-size: 20px; }
  .kpi-value { font-size: 22px; }
  .hbar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .hbar-row .track { grid-column: 1 / -1; grid-row: 2; }
  .filters .select, .filters .input { max-width: none; flex: 1 1 140px; }
  .letter { padding: 28px 22px; }
}

@media print {
  .sidebar, .topbar, .footer, .no-print, .toasts { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .letter { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

/* Role dashboards: clickable KPI tiles and shortcut cards, two-column facts in the profile card */
a.kpi, a.card-link { color: inherit; text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
a.kpi:hover, a.card-link:hover { box-shadow: var(--shadow-md, 0 6px 18px rgba(20, 40, 70, .10)); transform: translateY(-1px); }
.profile-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }

/* Sales vs target chart (inline SVG built by dashboard/TrendChart) */
.tabs-sm { padding: 3px; border-radius: 10px; }
.tabs-sm button, .tabs-sm a { height: 28px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.chart-insights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.chart-insights > div { padding: 12px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chart-insights > div + div { border-left: 1px solid var(--border); }
.chart-insights .k { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.chart-insights b { font-size: 17px; color: var(--navy-950); font-weight: 700; letter-spacing: -0.01em; }
.chart-insights small { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.tchart-wrap { position: relative; }
.tchart-wrap[hidden] { display: none; }
.tchart { display: block; width: 100%; height: auto; min-width: 620px; font-family: var(--font); overflow: visible; }
.chart-scroll .tchart-wrap { min-width: 620px; }
.tchart .grid line { stroke: #e4eaf2; stroke-width: 1; shape-rendering: crispEdges; }
.tchart .grid line:first-of-type { stroke: #c7d2e0; }
.tchart .ax-y { font-size: 11px; fill: var(--muted); font-weight: 500; }
.tchart .ax-x { font-size: 12px; fill: var(--muted); font-weight: 600; }
.tchart .ax-x.now { fill: var(--navy-950); font-weight: 700; }
.tchart .ax-pct { font-size: 10.5px; font-weight: 700; }
.tchart .ax-pct.good { fill: var(--success); }
.tchart .ax-pct.watch { fill: var(--warning); }
.tchart .ax-pct.low { fill: var(--danger); }
.tchart .now-band { fill: #d4dde9; opacity: .55; }
.tchart .bar-sales { fill: url(#gSales); }
.tchart .bar-coll { fill: url(#gColl); }
.tchart .target-line { fill: none; stroke: #d08b2a; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.tchart .cum-area { fill: url(#gArea); }
.tchart .cum-sales { fill: none; stroke: var(--navy-700); stroke-width: 2.75; stroke-linejoin: round; }
.tchart .cum-coll { fill: none; stroke: var(--success); stroke-width: 2.25; stroke-linejoin: round; }
.tchart .cum-target { fill: none; stroke: #d08b2a; stroke-width: 2; stroke-dasharray: 6 5; }
.tchart .dot-sales { fill: #fff; stroke: var(--navy-700); stroke-width: 2.25; }
.tchart .dot-coll { fill: #fff; stroke: var(--success); stroke-width: 2; }
.tchart .dot-target { fill: #d08b2a; }
.tchart .hit { fill: transparent; cursor: pointer; }
.tchart .hit.on { fill: rgba(36, 64, 106, .05); }
.chart-legend .lg-sales { background: linear-gradient(180deg, var(--navy-500), var(--navy-800)); }
.chart-legend .lg-coll { background: linear-gradient(180deg, #3fc28f, var(--success)); }
.chart-legend .lg-target { background: #d08b2a; height: 3px !important; width: 16px !important; border-radius: 2px; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 190px; padding: 10px 12px; border-radius: 10px;
  background: var(--navy-950); color: #fff; font-size: 12.5px; box-shadow: 0 10px 28px rgba(12, 26, 44, .28); }
.chart-tip[hidden] { display: none; }
.chart-tip .tt { font-weight: 700; margin-bottom: 6px; color: #fff; }
.chart-tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 2px 0; }
.chart-tip .row span { display: inline-flex; align-items: center; gap: 7px; color: #c9d4e3; }
.chart-tip .row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip .row b { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.chart-tip .foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .14); color: #c9d4e3; }
@media (max-width: 900px) {
  .chart-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-insights > div:nth-child(3) { border-left: 0; }
  .chart-insights > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* =====================================================================
   Recruitment-to-employment lifecycle
   ===================================================================== */
.b-teal { background: var(--teal-bg); color: var(--teal); }
.tone-neutral { background: #edf0f4; color: #5b6b80; }

/* Pending tasks */
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.tasks li:last-child { border-bottom: 0; }
.tasks .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.tasks .body { flex: 1; min-width: 0; }
.tasks .t { font-weight: 600; color: var(--navy-900); font-size: 13.5px; overflow-wrap: anywhere; }
.tasks .d { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; margin-top: 1px; }
.tasks a.t { display: block; }
.tasks a.t:hover { color: var(--navy-600); }

/* Funnel */
.funnel { display: grid; gap: 8px; }
.funnel a.row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 44px; gap: 12px; align-items: center; color: inherit; min-width: 0; }
.funnel .lbl { font-size: 13px; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel .bar { height: 26px; border-radius: 8px; background: var(--brand-50); border: 1px solid var(--brand-150); overflow: hidden; }
.funnel .bar span { display: block; height: 100%; min-width: 4px; border-radius: 7px; background: linear-gradient(90deg, var(--navy-600), var(--navy-800)); }
.funnel .bar.success span { background: linear-gradient(90deg, #1f9c6b, var(--success)); }
.funnel .bar.warning span { background: linear-gradient(90deg, #d08b2a, var(--warning)); }
.funnel .bar.violet span { background: linear-gradient(90deg, #8270dc, var(--violet)); }
.funnel .bar.teal span { background: linear-gradient(90deg, #22a3aa, var(--teal)); }
.funnel .num { font-weight: 700; color: var(--navy-900); text-align: right; font-variant-numeric: tabular-nums; }
.funnel a.row:hover .lbl { color: var(--navy-900); }

/* Approval steps (vertical) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.steps .lv { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 12px;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); }
.steps li.APPROVED .lv { background: var(--success); border-color: var(--success); color: #fff; }
.steps li.PENDING .lv { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.steps li.RETURNED .lv, .steps li.REJECTED .lv { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.steps .body { flex: 1; min-width: 0; }
.steps .t { font-weight: 600; color: var(--navy-900); font-size: 13px; }
.steps .d { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.steps .c { font-size: 12.5px; margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; }

/* Panels, facts, previews */
.facts { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; color: var(--navy-900); overflow-wrap: anywhere; white-space: pre-line; }
.pdf-frame { display: block; width: 100%; height: 78vh; min-height: 480px; border: 1px solid var(--border); border-radius: var(--radius); background: #525659; }
.panel-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); min-width: 0; }
.panel-box + .panel-box { margin-top: 12px; }
.panel-box h4 { font-size: 13.5px; color: var(--navy-900); margin: 0 0 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stars { color: #d08b2a; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--border-strong); }
.dup { border: 1px solid #efc4bf; background: var(--danger-bg); border-radius: var(--radius); padding: 12px 16px; }
.dup table { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 8px; }
.dup td, .dup th { padding: 6px 8px; border-top: 1px solid #f3d6d2; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chips a b { color: var(--navy-900); }
.chips a.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.chips a.active b { color: #fff; }
.check-list { display: grid; gap: 8px; }
.check-list .check { align-items: flex-start; }
.check-list .check input { margin-top: 2px; }
.field-help { font-size: 12px; color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
textarea.code-area { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; min-height: 380px; line-height: 1.55; }
.field-list { max-height: 520px; overflow: auto; font-size: 12.5px; }
.field-list div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.field-list code { color: var(--navy-700); white-space: nowrap; }
.field-list span { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.mail-body { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fff; overflow-x: auto; }
.public-wrap { min-height: 100vh; background: var(--canvas); padding: 32px 16px; }
.public-card { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.public-card .ph { padding: 22px 26px; background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: #fff; }
.public-card .ph h1 { color: #fff; font-size: 20px; margin: 4px 0 0; }
.public-card .ph small { color: var(--brand-300); }
.public-card .pb { padding: 22px 26px; }
.decide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) {
  .decide { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .funnel a.row { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 36px; }
  .pdf-frame { height: 70vh; }
}
.b-on-hold { background: var(--warning-bg); color: var(--warning); }
.b-suspended { background: var(--danger-bg); color: var(--danger); }
/* Dashboard rows: equal-height cards; long lists scroll inside the card instead of stretching the row */
.dash-row > .card { display: flex; flex-direction: column; }
.dash-row > .card > .list, .dash-row > .card > .timeline { max-height: 360px; overflow-y: auto; flex: 1 1 auto; }
.dash-row > .card > .empty { flex: 1 1 auto; display: grid; place-content: center; }
/* Column chart (server-built SVG) */
.colchart-wrap { width: 100%; min-width: 0; }
.colchart-svg { display: block; width: 100%; height: auto; max-height: 320px; font-family: var(--font); }
.colchart-svg .grid-lines line { stroke: #e3e8ef; stroke-width: 1; }
.colchart-svg .axis { stroke: #b8c6d8; stroke-width: 1; }
.colchart-svg .tick { font-size: 11px; fill: var(--muted); }
.colchart-svg .col rect { fill: #2563eb; transition: fill .15s; }
.colchart-svg .col:hover rect { fill: #1d4ed8; }
.colchart-svg .val { font-size: 11px; font-weight: 700; fill: var(--navy-900); }
.colchart-svg .cat { font-size: 11.5px; fill: var(--text-2); }
/* Email tables: fit the page, short Message ID chip with copy */
.mail-table .mail-subject { max-width: 340px; }
.mail-table .mail-to { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-table .mail-error { max-width: 260px; overflow-wrap: anywhere; }
.msgid { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 9px; border-radius: 999px;
  background: var(--brand-50); border: 1px solid var(--brand-150); color: var(--navy-700); white-space: nowrap; }
.msgid-text { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.msgid-copy { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; padding: 0; }
.msgid-copy:hover { background: var(--brand-150); color: var(--navy-800); }
.msgid-copy.copied { color: var(--success); }

.b-deactivated { background: #edf0f4; color: #5b6b80; }

/* Candidate profile: all steps on one page */
.step-head { font-size: 15px; margin: 26px 0 12px; padding: 9px 14px; background: var(--brand-100); color: var(--navy-700); border-left: 4px solid var(--navy-700); border-radius: 6px; }

/* ---------- Candidate form: one card per section, three aligned columns ---------- */
.cand-form .form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin: 0 0 14px; padding: 0; overflow: hidden; }
.cand-form .form-section + .form-section { margin-top: 0; padding-top: 0; border-top: 1px solid var(--border); }
.cand-form .form-section-title { margin: 0; padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cand-form .form-section-title .n { background: var(--navy-700); color: #fff; }
.cand-form .form-section > .form-grid { padding: 16px 18px 18px; }
.cand-form .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; align-items: start; }
.cand-form .field > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cand-form .field > label .req { color: var(--danger); }
.cand-form .field-hint { font-size: 11.5px; line-height: 1.35; }
.cand-form .placement { border-color: var(--navy-600); }
.cand-form .placement .form-section-title { background: var(--brand-100); }
.cand-form .placement-note { margin: -6px 18px 14px; font-size: 12px; color: var(--muted); }
.cand-form input.file { padding: 6px 8px; height: auto; font-size: 12.5px; }
.cand-form .form-actions { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin-top: 4px;
  padding: 12px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 1000px) { .cand-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .cand-form .form-grid { grid-template-columns: minmax(0, 1fr); }
  .cand-form .form-grid .span-2 { grid-column: auto; }
}

/* Back button in the top bar of every page */
.back-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; margin-right: 10px; flex: none;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--navy-800);
  font: 600 13px/1 inherit; cursor: pointer; }
.back-btn:hover { background: var(--brand-50); border-color: var(--navy-600); }
.back-btn .i { width: 16px; height: 16px; }
@media (max-width: 640px) { .back-btn { padding: 0 10px; margin-right: 6px; } }

/* Password field with a Show / Hide button */
.pw-field { display: flex; gap: 8px; }
.pw-field .input { flex: 1; min-width: 0; }
