/* Workforce Migration — design system.
 *
 * Tokens and components lifted from prototype_v1.html (its inline styles,
 * normalised into classes): navy sidebar, teal accent, IBM Plex, pill badges
 * for fitment bands. Every screen composes these; a screen that needs a new
 * look adds a component here rather than inline styles in its template.
 */
:root {
  --navy: #0d1b2a;
  --navy-2: #13263a;
  --ink: #14202c;
  --ink-2: #3c4d5e;
  --muted: #5a6b7b;
  --faint: #98a6b3;
  --line: #e2e7ec;
  --line-2: #eef1f4;
  --field: #d5dde4;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --soft: #f6f9fb;
  --accent: #0e7490;
  --accent-2: #0b5f76;
  --accent-soft: #e6f3f7;
  --accent-tint: #eef8fb;
  --good: #067647;   --good-bg: #e8f6ee;   --good-bd: #bfe5cf;
  --warn: #b45309;   --warn-bg: #fdf1e0;   --warn-bd: #eed9b8;
  --bad: #b42318;    --bad-bg: #fdecec;    --bad-bd: #f3c6c6;
  --violet: #6d28d9; --violet-bg: #ede9fe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 14px 40px rgba(13, 27, 42, .16);
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 13px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[x-cloak] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-60-40 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3, .grid-60-40 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 244px 1fr; height: 100vh; overflow: hidden; }
.side { background: var(--navy); color: #e8edf3; display: flex; flex-direction: column; overflow-y: auto; }
.brand { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; letter-spacing: .02em; color: #fff; flex-shrink: 0; }
.brand-t { font-size: 14px; font-weight: 600; line-height: 1.2; }
.brand-s { font-size: 11px; color: #8fa3b5; }
.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #6c8098; padding: 14px 10px 6px; }
.nav > div:first-child .nav-group { padding-top: 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: #c6d3de; border: 0; background: none; width: 100%; text-align: left; font-size: 13px; font-weight: 500; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(14,116,144,.35); color: #fff; }
.nav-item.sub { padding: 7px 10px 7px 38px; font-size: 12.5px; color: #a9bac8; }
.nav-item.parent-active { color: #fff; background: rgba(255,255,255,.05); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px; position: relative; }
.nav-sub::before { content: ""; position: absolute; left: 19px; top: 4px; bottom: 4px; width: 1px; background: rgba(255,255,255,.12); }
.nav-chev { font-size: 10px; opacity: .6; transition: transform .15s; }
.nav-chev.open { transform: rotate(90deg); }
.nav-ico { width: 18px; display: inline-flex; justify-content: center; opacity: .9; }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 10px; font-weight: 600; border-radius: 9px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #6c8098; }

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; align-items: center; gap: 16px; min-height: 58px; }
.topbar-title { font-size: 14px; font-weight: 600; }
.content { flex: 1; overflow-y: auto; padding: 22px 24px 60px; }
.content-inner { width: 100%; }

.page-h { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-h p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; max-width: 760px; line-height: 1.55; }
.crumb { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 6px; cursor: pointer; background: none; border: 0; padding: 0; }
.crumb:hover { color: var(--accent); }

/* ── Header controls ───────────────────────────────────────────────────── */
.ex-switch { position: relative; }
.ex-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); background: #f1f5f8; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.ex-btn:hover { border-color: var(--accent); }
.menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 60; padding: 6px; }
.menu.right { left: auto; right: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600; background: none; border: 0; width: 100%; text-align: left; }
.menu-item:hover { background: #f4fafc; }
.menu-sep { border-top: 1px solid var(--line-2); margin: 6px 0; }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.me-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.me-role { font-size: 10px; color: var(--muted); }

/* ── Cards, KPIs ───────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-h { padding: 14px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-t { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-b { padding: 16px 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-left: 3px solid var(--accent); }
.kpi-v { font-size: 24px; font-weight: 700; line-height: 1; }
.kpi-l { font-size: 12px; font-weight: 600; margin-top: 8px; }
.kpi-s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hero { background: linear-gradient(135deg, var(--navy) 0%, #0e3442 60%, var(--accent) 140%); color: #fff; border-radius: var(--radius); padding: 22px 24px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.hero h2 { margin: 0; font-size: 18px; }
.hero p { margin: 6px 0 0; color: #c6d3de; font-size: 12.5px; }
.hero-stat { text-align: center; min-width: 90px; }
.hero-stat b { display: block; font-size: 22px; font-family: var(--mono); }
.hero-stat span { font-size: 11px; color: #9fc7d6; }

/* ── Bars, donut, funnel ───────────────────────────────────────────────── */
.bar { flex: 1; background: #f1f5f8; border-radius: 6px; height: 24px; overflow: hidden; position: relative; }
.bar > i { display: flex; align-items: center; justify-content: flex-end; height: 100%; border-radius: 6px; background: var(--accent); padding-right: 8px; color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; font-style: normal; min-width: 26px; transition: width .3s; }
.bar.thin { height: 8px; }
.bar.thin > i { padding: 0; min-width: 0; }
.donut { width: 118px; height: 118px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.donut > div { width: 78px; height: 78px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Buttons & fields ──────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--field); background: #fff; color: var(--ink-2); border-radius: 7px; padding: 7px 13px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); color: #fff; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.good-o { border-color: var(--good-bd); color: var(--good); }
.btn.good-o.on { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad-o { border-color: var(--bad-bd); color: var(--bad); }
.btn.bad-o.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--field); color: var(--ink-2); }
.btn.primary:disabled:hover { background: var(--accent); color: #fff; }
.input, .select, .textarea { border: 1px solid var(--field); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; background: #fff; width: 100%; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid rgba(14,116,144,.25); border-color: var(--accent); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.search { width: 260px; max-width: 100%; }
.label { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: block; font-weight: 500; }
.field { display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.errors { color: var(--bad); font-size: 11.5px; margin-top: 4px; }

.seg { display: inline-flex; background: #e5eaef; border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; border-radius: 6px; padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; background: transparent; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(13,27,42,.08); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Pills & tags ──────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: #f1f5f8; color: var(--muted); }
.pill.High, .pill.good { background: var(--good-bg); color: var(--good); }
.pill.Medium, .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.Low, .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.violet { background: var(--violet-bg); color: var(--violet); }
.pill.dark { background: var(--navy); color: #fff; }
.tag { display: inline-flex; font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 2px 7px; background: #f1f5f8; color: var(--faint); white-space: nowrap; }
.tag.ok { background: var(--good-bg); color: var(--good); }
.tag.no { background: var(--bad-bg); color: var(--bad); }
.tag.hi { background: var(--violet-bg); color: var(--violet); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pct { font-family: var(--mono); font-weight: 600; }
.ref { display: inline-flex; font-size: 10px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; letter-spacing: .02em; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: #f8fbfc; }
.who { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.who-n { font-weight: 600; }
.who-s { font-size: 11px; color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

.pager { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.pager button { min-width: 28px; height: 28px; border: 1px solid var(--field); background: #fff; border-radius: 6px; cursor: pointer; font-size: 12px; }
.pager button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Options (role pickers) ────────────────────────────────────────────── */
.option { display: flex; align-items: center; gap: 12px; border: 1px solid #dbe3ea; border-radius: 10px; padding: 12px 14px; background: #fff; cursor: pointer; }
.option:hover { border-color: var(--accent); }
.option.on { border-color: var(--accent); background: var(--accent-tint); }
.option.off { opacity: .55; cursor: default; }
.radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c3cdd6; background: #fff; flex-shrink: 0; }
.option.on .radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
.rank { width: 24px; height: 24px; border-radius: 6px; background: #f1f5f8; color: var(--muted); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Notices ───────────────────────────────────────────────────────────── */
.notice { border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.5; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; }
.notice.info { background: var(--accent-tint); border-color: #cfe8ef; color: #0b4a5c; }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: #7a3a06; }
.notice.bad { background: var(--bad-bg); border-color: var(--bad-bd); color: #7a1a12; }
.notice.good { background: var(--good-bg); border-color: var(--good-bd); color: #054d2f; }

/* ── Drawer, modal, toast ──────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(13,27,42,.38); z-index: 80; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100%; background: #fff; z-index: 90; box-shadow: -12px 0 40px rgba(13,27,42,.18); display: flex; flex-direction: column; }
.drawer.wide { width: 720px; }
.drawer-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-t { font-size: 15px; font-weight: 700; flex: 1; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.x { border: 0; background: #f1f5f8; color: var(--muted); border-radius: 7px; width: 28px; height: 28px; cursor: pointer; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 520px; max-width: calc(100% - 32px); max-height: calc(100% - 48px); overflow: auto; background: #fff; z-index: 90; border-radius: 14px; box-shadow: var(--shadow); }
.modal.wide { width: 760px; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 120; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 9px; font-size: 12.5px; box-shadow: var(--shadow); max-width: 420px; }
.toast.bad { background: var(--bad); }
.toast.good { background: var(--good); }

/* ── Record (employee / job detail) ────────────────────────────────────── */
.record { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .record { grid-template-columns: 1fr; } }
.secnav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.secnav button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.secnav button.on { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 24px; }
.kv > div { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.kv dt { font-size: 11px; color: var(--muted); margin: 0 0 3px; }
.kv dd { margin: 0; font-size: 13px; font-weight: 500; word-break: break-word; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex-shrink: 0; }

.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.score-cell { background: var(--soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
.score-cell b { font-family: var(--mono); font-size: 15px; }
.score-cell span { display: block; font-size: 10.5px; color: var(--muted); }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

/* ── Auth & public pages ───────────────────────────────────────────────── */
.auth { display: grid; grid-template-columns: 1.2fr 1fr; min-height: 100vh; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none !important; } }
.auth-art { position: relative; background: linear-gradient(150deg, #0d1b2a 0%, #0e3442 55%, #0e7490 130%); overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 44px; color: #fff; }
.auth-art h1 { font-size: 32px; line-height: 1.2; max-width: 460px; margin: 0; }
.auth-art p { font-size: 14px; color: #c6d3de; max-width: 420px; line-height: 1.6; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h2 { font-size: 22px; margin: 0 0 6px; }
.public { max-width: 720px; margin: 0 auto; padding: 36px 20px 60px; }

[dir="rtl"] .nav-item, [dir="rtl"] .menu-item, [dir="rtl"] table.t th { text-align: right; }
[dir="rtl"] .nav-item.sub { padding-left: 10px; padding-right: 38px; }
[dir="rtl"] .nav-sub::before { left: auto; right: 19px; }
[dir="rtl"] .nav-chev { transform: rotate(180deg); }
[dir="rtl"] .nav-chev.open { transform: rotate(90deg); }
[dir="rtl"] .nav-badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .drawer { right: auto; left: 0; }
