/* CedarNet HR — ops-console styling. Black/charcoal chrome, CedarNet green for action, lime reserved
   for "live" signals (active navigation, link-light). White work surfaces for dense data. */
:root {
  --chrome: #161a18;
  --chrome-2: #1f2421;
  --chrome-line: #2c332f;
  --chrome-text: #c9d1cc;
  --chrome-dim: #8c968f;
  --page: #f1f2ee;
  --surface: #ffffff;
  --text: #1b1f1d;
  --muted: #5b645f;
  --line: #d9ddd6;
  --line-soft: #e8ebe5;
  --green: #146131;
  --green-strong: #0e4a25;
  --green-tint: #e7f3ea;
  --lime: #04ab49;
  --red: #b42318;
  --red-tint: #fdecea;
  --amber: #8a5a00;
  --amber-tint: #fff3d1;
  --blue: #1f5f8b;
  --blue-tint: #e6f0f7;
  --radius: 6px;
  --radius-lg: 10px;
  --focus: 0 0 0 3px rgba(20, 97, 49, 0.35);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Ubuntu, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Menlo, monospace;
  font-size: 15px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--page); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: var(--green); }
a:hover { color: var(--green-strong); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 680; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 0.98rem; font-weight: 650; }
h4 { font-size: 0.85rem; font-weight: 650; color: var(--muted); }
p { margin: 0 0 0.6rem; max-width: 72ch; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--line-soft); padding: 0.05em 0.35em; border-radius: 4px; }
pre { font-family: var(--mono); font-size: 0.8rem; background: #f6f7f4; border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0.6rem; overflow: auto; max-height: 280px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.strong { font-weight: 640; }
.block { display: block; }
.grow { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 0; background: var(--lime); color: #000; padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 0.5rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; grid-template-rows: 56px 1fr; grid-template-areas: 'top top' 'side main'; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 0.75rem; padding: 0 1rem; background: #000; color: #fff; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 36px; height: 36px; margin: -4px 0; flex: none; display: block; object-fit: contain; }
.brand-mark-lg { width: 64px; height: 64px; margin: -6px 0; }
.brand-name { font-weight: 700; letter-spacing: 0.01em; }
.who { display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; color: #fff; line-height: 1.2; }
.who:hover { color: var(--lime); }
.who-name { font-size: 0.88rem; font-weight: 600; }
.who-role { font-size: 0.75rem; color: var(--chrome-dim); }
.signout { color: var(--chrome-text) !important; border-color: var(--chrome-line) !important; }
.signout:hover { background: var(--chrome-2) !important; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: #fff; margin: 4px 0; }

.sidebar { grid-area: side; background: var(--chrome); color: var(--chrome-text); padding: 1rem 0.6rem; display: flex; flex-direction: column; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.nav-group { margin-bottom: 1.1rem; }
.nav-title { font-size: 0.75rem; color: var(--chrome-dim); margin: 0 0.75rem 0.3rem; font-weight: 600; }
.nav-link { display: flex; align-items: center; padding: 0.45rem 0.75rem; border-radius: var(--radius); color: var(--chrome-text); text-decoration: none; position: relative; font-size: 0.93rem; }
.nav-link:hover { background: var(--chrome-2); color: #fff; }
/* The one signature detail: the active section shows a lit "link light", like a port LED. */
.nav-link.active { background: var(--chrome-2); color: #fff; font-weight: 600; }
.nav-link.active::before { content: ''; position: absolute; left: -0.6rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.nav-link.active::after { content: ''; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 6px rgba(4, 171, 73, 0.9); }
.nav-bottom { margin-top: auto; border-top: 1px solid var(--chrome-line); padding-top: 0.8rem; }
.nav-foot { font-size: 0.72rem; color: var(--chrome-dim); margin: 0.6rem 0.75rem 0; line-height: 1.45; }
.nav-foot a { color: var(--chrome-text); }
.main { grid-area: main; padding: 1.75rem 2rem 3rem; min-width: 0; max-width: 1280px; outline: none; }
.scrim { display: none; }
.boot { min-height: 100vh; display: grid; place-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: 'top' 'main'; }
  .nav-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 56px; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform 0.2s ease; height: auto; }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 56px 0 0; background: rgba(0, 0, 0, 0.45); z-index: 35; }
  .main { padding: 1.1rem 1rem 3rem; }
  .who { display: none; }
}

/* ---------------------------------------------------------------- page furniture */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-sub { color: var(--muted); margin: 0.3rem 0 0; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.section-title { margin-top: 2rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.9rem; }
.toolbar p { margin: 0; }
.inline-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--muted); }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.shortcut { display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); }
.shortcut:hover { border-color: var(--green); color: var(--text); }
.shortcut-title { font-weight: 650; color: var(--green-strong); }
.shortcut-text { font-size: 0.88rem; color: var(--muted); }

/* ---------------------------------------------------------------- controls */
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid #c4cac2; border-radius: var(--radius); padding: 0.5rem 0.65rem; min-height: 40px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: var(--focus); outline: none; }
input[aria-invalid='true'], select[aria-invalid='true'] { border-color: var(--red); }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .search { min-width: 240px; flex: 0 1 320px; }
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.3rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 0; }
.field-error, .form-error { font-size: 0.85rem; color: var(--red); margin: 0.3rem 0 0.6rem; }
.check { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span-all, .form-grid fieldset, .form-grid .field:has(textarea) { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.9rem 0.7rem; margin: 0 0 0.9rem; }
legend { font-weight: 600; font-size: 0.88rem; padding: 0 0.3rem; }
.role-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.stack > * + * { margin-top: 0; }
.inline-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1; min-width: 180px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; font: inherit; font-weight: 600; font-size: 0.92rem; min-height: 40px; padding: 0 1rem; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-strong); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: #c4cac2; }
.btn-secondary:hover:not(:disabled) { border-color: var(--green); color: var(--green-strong); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1c13; }
.btn-ghost { background: transparent; color: var(--green-strong); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--green-tint); }
.btn-sm { min-height: 32px; padding: 0 0.7rem; font-size: 0.85rem; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--green); text-decoration: underline; cursor: pointer; }

.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); padding: 1.5rem 0; }

/* ---------------------------------------------------------------- tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-size: 0.8rem; font-weight: 650; color: var(--muted); padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); background: #fafbf8; white-space: nowrap; }
.table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: #f7faf6; }
.row-actions { text-align: right; white-space: nowrap; }
.detail-row td { background: #fbfcfa; }
.details-cell { color: var(--muted); max-width: 320px; word-break: break-word; }
.diff { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; margin-bottom: 0.5rem; }
.pager { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0; font-size: 0.88rem; }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 0.4rem 0; }
  .table td { border: 0; padding: 0.25rem 0.8rem; display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.5rem; justify-items: start; align-items: baseline; }
  .table td::before { content: attr(data-label); font-size: 0.78rem; color: var(--muted); font-weight: 600; }
  .table td.row-actions { display: block; text-align: left; }
  .table td.row-actions::before, .detail-row td::before { content: none; }
  .detail-row td { display: block; }
}

/* ---------------------------------------------------------------- chips, notes, stats */
.chip { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; margin-right: 0.3rem; white-space: nowrap; border: 1px solid transparent; }
.chip-ok { background: var(--green-tint); color: var(--green-strong); }
.chip-bad { background: var(--red-tint); color: var(--red); }
.chip-warn { background: var(--amber-tint); color: var(--amber); }
.chip-info { background: var(--blue-tint); color: var(--blue); }
.chip-neutral { background: var(--line-soft); color: var(--muted); }
.note { border: 1px solid var(--line); border-left: 4px solid var(--blue); background: var(--surface); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; }
.note p:last-child { margin-bottom: 0; }
.note-error { border-left-color: var(--red); background: var(--red-tint); }
.note-warn { border-left-color: #d29a00; background: var(--amber-tint); }
.note-ok { border-left-color: var(--green); background: var(--green-tint); }
.note-denied { border-left-color: var(--chrome); }
.empty { padding: 2.5rem 1rem; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.empty-title { font-weight: 600; margin: 0 auto 0.6rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0.9rem 1rem; display: flex; flex-direction: column; }
.stat-n { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-l { font-size: 0.82rem; color: var(--muted); }
.stat-alert { border-color: #e9b4ae; }
.stat-alert .stat-n { color: var(--red); }

/* ---------------------------------------------------------------- tabs, tree, kv, permissions */
.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.55rem 0.85rem; font: inherit; font-size: 0.92rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--green); }
.tree, .tree-children, .tree-positions { list-style: none; margin: 0; padding: 0; }
.tree { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0.75rem 1rem; }
.tree-children { margin-left: 1.1rem; border-left: 1px solid var(--line); padding-left: 0.8rem; }
.tree summary { cursor: pointer; padding: 0.3rem 0; display: flex; gap: 0.6rem; align-items: baseline; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: ''; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transform: translateY(-1px); transition: transform 0.15s; flex: none; }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree-name { font-weight: 600; }
.tree-positions { margin: 0.1rem 0 0.4rem 1.1rem; font-size: 0.9rem; }
.tree-positions li { padding: 0.15rem 0; }
.tree-positions .chip { margin-left: 0.4rem; }
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: 0.4rem 0.8rem; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.88rem; }
.kv dd { margin: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1rem; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.role-list { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.role-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0; border-bottom: 1px solid var(--line-soft); }
.action-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; border-top: 1px solid var(--line-soft); padding-top: 1rem; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; margin-top: 0.75rem; }
.perm-group ul { list-style: none; padding: 0; margin: 0; }
.perm-group li { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.88rem; }
.perm-group select { width: 150px; min-height: 32px; padding: 0.2rem 0.4rem; font-size: 0.85rem; flex: none; }
.perm-scope { color: var(--green-strong); font-weight: 600; white-space: nowrap; }
.perm-desc .chip { margin-left: 0.4rem; }
.secret { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; background: #fafbf8; margin: 0.75rem 0; }
.secret-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.secret-value { font-size: 1rem; padding: 0.35rem 0.6rem; word-break: break-all; user-select: all; }
.secret-value.block { display: block; margin: 0.4rem 0; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 0.6rem; }

/* ---------------------------------------------------------------- modal & toasts */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 12, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 1rem; z-index: 60; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 620px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; max-height: 88vh; }
.modal-wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 0.3rem; }
.modal-body { padding: 1.1rem 1.25rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.85rem 1.25rem; border-top: 1px solid var(--line-soft); align-items: center; }
@media (max-width: 640px) { .modal-backdrop { padding: 0; } .modal { max-height: 100vh; height: 100%; border-radius: 0; } }
.toasts { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 80; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--chrome); color: #fff; padding: 0.7rem 1rem; border-radius: var(--radius); border-left: 4px solid var(--lime); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); font-size: 0.92rem; }
.toast-bad { border-left-color: #ff6b5e; }

/* ---------------------------------------------------------------- sign-in screens */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--chrome); }
.auth-panel { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius-lg); padding: 2rem 1.75rem; border-top: 4px solid var(--green); }
.auth-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.5rem; }
.auth-brand .brand-name { color: var(--text); }
.auth-intro { color: var(--muted); }
.auth-panel .btn-primary { width: 100%; margin-top: 0.4rem; }
.auth-help { font-size: 0.88rem; color: var(--muted); margin: 1rem 0 0; }
.auth-foot { color: var(--chrome-dim); font-size: 0.78rem; text-align: center; margin-top: 1.5rem; line-height: 1.6; }
.auth-foot a { color: var(--chrome-text); }

/* ---------------------------------------------------------------- Phase 2: people */
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--line-soft); }
.avatar-initials { display: inline-grid; place-items: center; background: #dfe9e1; color: var(--green-strong); font-weight: 700; letter-spacing: 0.02em; }
.person { display: flex; align-items: center; gap: 0.65rem; }
.profile-head { display: flex; gap: 1.1rem; align-items: center; margin-bottom: 1rem; }
.profile-title h1 { margin: 0; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.45rem 0 0; }
.profile-meta code { margin-right: 0.3rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.panel-head h2 { margin: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 1.5rem 0 0.75rem; }
.section-head h2 { margin: 0; }
.crumbs { font-size: 0.88rem; color: var(--muted); margin: 0 0 0.4rem; }
.crumbs a { color: var(--muted); }
.stack-lg > * + * { margin-top: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.5rem 0 2rem; }
.pre, .job-summary { white-space: pre-wrap; }
.job-summary { margin-top: 0.9rem; color: var(--muted); }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list > li { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
.card-list > li:last-child { border-bottom: 0; }
.card-list p { margin: 0 0 0.2rem; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 0.2rem 0; }
.file-picker { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0 0.8rem; }
.narrow { max-width: 5.5rem; }

/* timeline (employment history, application history) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); position: relative; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item p { margin: 0 0 0.2rem; }
.timeline-date { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.timeline-item.state-scheduled .timeline-date { color: var(--blue); }
.timeline-item.state-cancelled { opacity: 0.6; }
.timeline.compact .timeline-item { grid-template-columns: 6.5rem 1fr; padding: 0.45rem 0; }
.changes { margin: 0.2rem 0 0.4rem; padding-left: 1.1rem; font-size: 0.9rem; }
@media (max-width: 640px) { .timeline-item { grid-template-columns: 1fr; gap: 0.2rem; } }

/* skills */
.skill-list { list-style: none; padding: 0; margin: 0; }
.skill-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line-soft); }
.level { font-size: 0.8rem; font-weight: 650; padding: 0.05rem 0.5rem; border-radius: 999px; text-transform: capitalize; }
.level-learning { background: var(--line-soft); color: var(--muted); }
.level-competent { background: var(--blue-tint); color: var(--blue); }
.level-advanced { background: var(--green-tint); color: var(--green-strong); }
.level-expert { background: var(--green); color: #fff; }

/* onboarding */
.progress { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin: 0.3rem 0 0.4rem; }
.progress-bar { height: 100%; background: var(--green); border-radius: 999px; }
.small-progress { width: 7rem; display: inline-block; vertical-align: middle; margin: 0 0.4rem 0 0; }
.task-group { margin-top: 1rem; }
.task-group h3 { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.2rem; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks > li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); }
.tasks > li:last-child { border-bottom: 0; }
.tasks p { margin: 0 0 0.15rem; }
ul.tasks.panel { padding: 0.25rem 1.25rem; }
.task-done p:first-child { color: var(--muted); }
.tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #b9c1b7; flex: none; margin-top: 2px; position: relative; }
.tick-done { background: var(--green); border-color: var(--green); }
.tick-done::after { content: ''; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tick-not_applicable { background: var(--line-soft); border-color: var(--line); }
.task-editor { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.6rem 0; }
.task-edit-row { display: grid; grid-template-columns: minmax(12rem, 1fr) 8rem 9rem 5.5rem auto auto; gap: 0.4rem; align-items: center; padding-bottom: 0.4rem; border-bottom: 1px solid var(--line-soft); }
.task-edit-row .check { white-space: nowrap; font-size: 0.85rem; }
@media (max-width: 900px) { .task-edit-row { grid-template-columns: 1fr 1fr; } .task-edit-row > input:first-child { grid-column: 1 / -1; } }

/* recruitment board */
.board { display: grid; grid-template-columns: repeat(6, minmax(170px, 1fr)); gap: 0.6rem; overflow-x: auto; padding-bottom: 0.5rem; }
.board-col { background: #e9ebe5; border-radius: var(--radius-lg); padding: 0.6rem; min-height: 6rem; }
.board-col h3 { font-size: 0.85rem; margin: 0 0 0.5rem; display: flex; justify-content: space-between; }
.board-card { display: flex; flex-direction: column; gap: 0.1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.55rem 0.65rem; margin-bottom: 0.45rem; text-decoration: none; color: var(--text); }
.board-card:hover { border-color: var(--green); color: var(--text); }
@media (max-width: 900px) { .board { grid-template-columns: repeat(6, 72vw); scroll-snap-type: x mandatory; } .board-col { scroll-snap-align: start; } }
.interview, .offer { padding: 0.8rem 0; border-bottom: 1px solid var(--line-soft); }
.interview:last-child, .offer:last-child { border-bottom: 0; }
.score-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; border: 0; padding: 0; margin: 0 0 0.75rem; }
.score-row legend { width: 100%; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; padding: 0; }
.score-pill { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid #c4cac2; border-radius: var(--radius); cursor: pointer; font-weight: 650; }
.score-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.score-pill.on { background: var(--green); border-color: var(--green); color: #fff; }
.score-pill:focus-within { box-shadow: var(--focus); }

/* letters */
.letter { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.75rem; font-family: Georgia, 'Times New Roman', serif; line-height: 1.6; max-width: 70ch; }
.letter p { white-space: pre-wrap; }

/* home alerts */
.alerts h2 { margin-bottom: 0.4rem; }
.alert-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.5rem 1.5rem; }
.alert-groups h3 { font-size: 0.9rem; margin: 0.6rem 0 0.25rem; }

@media print {
  .topbar, .sidebar, .modal-head, .modal-foot, .toasts, .nav-toggle { display: none !important; }
  .modal-backdrop { position: static; background: none; padding: 0; }
  .modal { box-shadow: none; max-height: none; }
  .letter { border: 0; padding: 0; }
}
.two-col > *, .detail-grid > * { min-width: 0; }
.kv dd { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 640px) {
  .kv { grid-template-columns: 7rem 1fr; }
  .profile-head { gap: 0.75rem; }
  .profile-head .avatar { width: 56px !important; height: 56px !important; }
  .panel { padding: 1rem; }
}

/* ---------------------------------------------------------------- phase 3: time, leave, rosters, NOC, kiosk */
.toolbar .field { margin: 0; }
.toolbar:has(.field) { align-items: flex-end; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
.swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 3px; vertical-align: middle; background: var(--muted); }
.pre-wrap { white-space: pre-wrap; }
.clock-panel { text-align: center; }
.clock-now { font-size: 1.6rem; font-weight: 700; margin: 0.4rem 0; }
.clock-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin: 1rem 0; }
.clock-buttons .btn { min-width: 9.5rem; min-height: 3rem; font-size: 1.05rem; }
.gps-note { text-align: left; }
.balance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.6rem; }
.balance { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 0.1rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: var(--radius-lg); padding: 0.8rem 1rem; }
.balance:hover { background: #f7faf6; }
.balance:focus-visible { box-shadow: var(--focus); }
.balance-name { font-weight: 640; }
.balance-n { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 1rem; }
.cal, .roster { border-collapse: collapse; font-size: 0.82rem; min-width: 100%; }
.cal th, .cal td, .roster th, .roster td { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); padding: 0.3rem; text-align: center; vertical-align: top; }
.cal thead th, .roster thead th { background: #fafbf8; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cal .cal-name, .roster .cal-name { text-align: left; position: sticky; left: 0; background: var(--surface); min-width: 9rem; font-weight: 600; z-index: 1; }
.cal td { min-width: 1.9rem; height: 2rem; padding: 0.25rem 0.1rem; }
.cal-hol { background: #f4f1e6 !important; }
.cal-bar { display: block; height: 1.1rem; border-radius: 3px; }
.cal-pending { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 4px, transparent 4px 8px) !important; }
.roster td { min-width: 7.2rem; }
.shift { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: var(--green-tint); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 4px; padding: 0.2rem 0.35rem; margin-bottom: 0.25rem; font: inherit; color: var(--text); cursor: pointer; }
.shift:disabled { cursor: default; }
.shift.draft { background: repeating-linear-gradient(45deg, #fff 0 6px, #f3f5f1 6px 12px); border-style: dashed; }
.shift-code { font-weight: 650; font-size: 0.75rem; }
.shift-time { font-variant-numeric: tabular-nums; }
.add-shift { width: 100%; border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 4px; cursor: pointer; font-size: 1rem; line-height: 1.2; padding: 0.1rem 0; }
.add-shift:hover { color: var(--green); border-color: var(--green); }
.leave-tag { display: block; background: var(--blue-tint); color: var(--blue); border-radius: 4px; font-weight: 600; margin-bottom: 0.25rem; padding: 0.1rem 0.3rem; }
.leave-tag.pending { background: var(--amber-tint); color: var(--amber); }
.shift-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.shift-row { display: flex; gap: 0.75rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: var(--radius-lg); padding: 0.7rem 1rem; }
.shift-row p { margin: 0; }
.handover-item { margin: 0; }
.bell-wrap { position: relative; }
.bell { position: relative; background: transparent; border: 0; color: #fff; padding: 0.4rem; cursor: pointer; border-radius: 6px; display: flex; }
.bell:hover { background: var(--chrome-2); }
.bell-count { position: absolute; top: -2px; right: -4px; background: var(--lime); color: #000; font-size: 0.68rem; font-weight: 700; border-radius: 999px; padding: 0 0.35rem; line-height: 1.3rem; min-width: 1.3rem; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, calc(100vw - 1.5rem)); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 40; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line-soft); }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.bell-item { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; width: 100%; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line-soft); font-size: 0.88rem; }
.bell-item:hover, .bell-item:focus-visible { background: #f7faf6; }
.bell-item.unread { border-left: 3px solid var(--green); font-weight: 600; }
.bell-empty { padding: 0.9rem; margin: 0; }
.kiosk { min-height: 100vh; background: var(--chrome); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; gap: 1rem; }
.kiosk-card { background: var(--surface); border-radius: var(--radius-lg); padding: 1.5rem; width: min(460px, 100%); }
.kiosk-time { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; line-height: 1.1; }
.kiosk-card input { font-size: 1.3rem; }
.kiosk-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.8rem; }
.kiosk-buttons .btn { min-height: 3.4rem; font-size: 1.05rem; }
.kiosk-foot { color: var(--chrome-dim); font-size: 0.8rem; text-align: center; }
.kiosk-foot a { color: var(--chrome-text); }
@media (max-width: 700px) {
  .clock-buttons .btn { flex: 1 1 100%; }
  .roster td { min-width: 6.2rem; }
}
.panel h3 { margin-top: 1rem; }

/* ---------------------------------------------------------------- phase 4: work orders */
.job-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.job-card { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); overflow: hidden; }
.job-card:hover { background: #f7faf6; color: var(--text); }
.job-bar { width: 6px; flex: none; background: var(--green); }
.job-main { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.75rem 0.9rem; min-width: 0; }
.job-top { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.job-title { font-weight: 600; }
.wo-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.8rem; }
.wo-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.8rem; position: sticky; top: 56px; z-index: 5; background: var(--page); padding: 0.5rem 0; }
.wo-actions .btn { min-height: 2.8rem; }
.verify-panel { border-color: var(--amber); background: var(--amber-tint); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
.photo-grid figure { margin: 0; }
.photo-grid img, .photo-ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--line-soft); display: block; }
.photo-ph { display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--muted); }
.photo-grid .pending img { opacity: 0.6; outline: 2px dashed var(--amber); }
.photo-pick { display: inline-flex; gap: 0.35rem; align-items: center; }
.photo-pick select { width: auto; }
.signature-img { display: block; max-width: 220px; max-height: 90px; margin-top: 0.3rem; border: 1px solid var(--line-soft); border-radius: 4px; background: #fff; }
.sigpad { width: 100%; height: 170px; border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; touch-action: none; display: block; }
.safety-list { padding-left: 1.2rem; display: grid; gap: 0.6rem; }
.safety-list li > span:first-child { display: block; font-weight: 550; }
.yn { display: inline-flex; gap: 0.4rem; margin: 0.3rem 0; }
.yn button { min-width: 4.5rem; min-height: 2.4rem; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); font: inherit; cursor: pointer; }
.yn button.yn-on.yes { background: var(--green); color: #fff; border-color: var(--green); }
.yn button.yn-on.no { background: var(--red); color: #fff; border-color: var(--red); }
.timeline-item.pending { opacity: 0.75; font-style: italic; }
.panel-head .chip + .btn, .panel-head .muted + .btn { margin-left: auto; }
.toasts { pointer-events: none; }

/* ---------------------------------------------------------------- phase 5: payroll */
.stepper { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.25rem; counter-reset: step; }
.stepper li { counter-increment: step; font-size: 0.8rem; padding: 0.3rem 0.6rem 0.3rem 0.4rem; border-radius: 999px; background: var(--line-soft); color: var(--muted); }
.stepper li::before { content: counter(step); display: inline-block; width: 1.2rem; height: 1.2rem; line-height: 1.2rem; text-align: center; border-radius: 50%; background: #fff; margin-right: 0.35rem; font-weight: 700; }
.stepper li.done { background: var(--green-tint); color: var(--green-strong); }
.stepper li.done::before { content: '✓'; }
.stepper li.current { background: var(--green); color: #fff; font-weight: 650; }
.stepper li.current::before { color: var(--green); }
.form-actions.start { justify-content: flex-start; }
.pay-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.pay-table caption { text-align: left; font-weight: 650; padding-bottom: 0.3rem; }
.pay-table td { padding: 0.35rem 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pay-table td.num { text-align: right; padding-left: 1rem; white-space: nowrap; }
.pay-table tr.total td { font-weight: 700; border-bottom: 2px solid var(--line); }
.net-pay { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; font-weight: 700; background: var(--green-tint); border-radius: var(--radius); padding: 0.7rem 1rem; margin: 1rem 0 0.6rem; max-width: none; }
.net-pay span { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.payslip-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--chrome); padding-bottom: 0.6rem; margin-bottom: 0.8rem; }
.payslip-head p { margin: 0; }
.payslip-list li { padding: 0.45rem 0; border-bottom: 1px solid var(--line-soft); }
@media print {
  body.modal-open .main, body.modal-open .sidebar, body.modal-open .topbar { display: none !important; }
  .modal-backdrop { position: static !important; background: none !important; }
  .modal { box-shadow: none !important; max-width: none !important; width: 100% !important; }
  .modal-head .modal-close, .modal-foot { display: none !important; }
}

/* ---------------------------------------------------------------- phase 6: performance, training, safety, assets, expenses, cases */
.back-link { margin: 0 0 0.5rem; }
.objective-row { display: grid; grid-template-columns: 2fr 2fr 6rem auto; gap: 0 0.75rem; align-items: end; border-bottom: 1px solid var(--line-soft); padding-bottom: 0.4rem; margin-bottom: 0.6rem; }
.objective-row .btn { margin-bottom: 0.9rem; }
.rating-row { border-bottom: 1px solid var(--line-soft); padding: 0.5rem 0 0.2rem; }
.rating-row:last-of-type { border-bottom: 0; }
.rating-row p { margin: 0 0 0.3rem; }
.fieldset legend { font-weight: 650; font-size: 0.9rem; padding: 0 0.3rem; }
.fieldset .inline-form { margin-bottom: 0.4rem; }
.claim-total { text-align: right; margin: 0.6rem 0 0; }
.page-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .objective-row { grid-template-columns: 1fr; }
  .objective-row .btn { margin-bottom: 0.4rem; justify-self: start; }
  .page-actions .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------- phase 7: dashboards, reports, offboarding, integrations */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(7rem, 38%) 1fr auto; gap: 0.6rem; align-items: center; padding: 0.22rem 0; font-size: 0.88rem; }
.bars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { height: 10px; background: transparent; }
.bars-fill { display: block; height: 10px; background: var(--green); border-radius: 0 4px 4px 0; }
.bars-value { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3ch; text-align: right; }
.cols-block { min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 120px; align-items: end; border-bottom: 1px solid var(--line); }
.col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.col-bar { width: 70%; max-width: 22px; min-height: 1px; border-radius: 4px 4px 0 0; background: var(--green); }
.col-bar.leavers { background: var(--muted); }
.col-value { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-label { position: absolute; bottom: -1.2rem; font-size: 0.68rem; color: var(--muted); }
.cols-block { padding-bottom: 1.3rem; }
.warn-text { color: #8a5a00; }
@media (max-width: 640px) { .bars li { grid-template-columns: 1fr auto; } .bars-track { grid-column: 1 / -1; grid-row: 2; } }
