/* =========================================================
   Employee Workspace — design system
   One accent colour, navy text, light surfaces, soft status tones.
   ========================================================= */
:root {
  --ink: #14213d;
  --ink-2: #3b4a66;
  --muted: #667085;
  --line: #e4e8f0;
  --surface: #ffffff;
  --bg: #f5f7fb;
  --accent: #2456a6;
  --accent-ink: #ffffff;
  --accent-soft: #eaf0fb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .04), 0 4px 16px rgba(20, 33, 61, .04);

  --ok: #157f3b;      --ok-soft: #e7f6ec;
  --info: #1f5fbf;    --info-soft: #e8f0fc;
  --warn: #9a5b00;    --warn-soft: #fdf3e1;
  --danger: #b42318;  --danger-soft: #fdecea;
  --neutral: #4b5565; --neutral-soft: #eef1f5;

  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 36, 86, 166;
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 36, 86, 166;
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
}

html, body { background: var(--bg); color: var(--ink); }
body { min-height: 100vh; display: flex; flex-direction: column; font-size: 15px; -webkit-font-smoothing: antialiased; }
main { flex: 1 0 auto; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5 { color: var(--ink); letter-spacing: -.015em; font-weight: 650; }
.text-secondary { color: var(--muted) !important; }
a { text-underline-offset: 2px; }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 550; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: #1c4787; --bs-btn-hover-border-color: #1c4787; --bs-btn-active-bg: #183d74; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); }
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--bg); --bs-btn-hover-border-color: var(--line); }
.form-label { font-weight: 550; font-size: .9rem; color: var(--ink-2); margin-bottom: .35rem; }
.form-control, .form-select { background-color: var(--surface); border-color: #d5dbe6; border-radius: var(--radius-sm); padding: .6rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(36, 86, 166, .14); }
.form-text { color: var(--muted); }
.input-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; font-size: 1.15rem; text-align: center; }

/* ---------- Top bar ---------- */
.app-topbar { background: var(--surface); border-bottom: 1px solid var(--line); height: 60px; display: flex; align-items: center; position: sticky; top: 0; z-index: 1020; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.topnav { gap: .25rem; margin-left: 1.25rem; }
.topnav-link { display: flex; align-items: center; gap: .45rem; padding: .45rem .75rem; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .92rem; }
.topnav-link:hover { background: var(--bg); color: var(--ink); }
.topnav-link.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); text-decoration: none; font-size: 1.1rem; }
.icon-btn:hover { background: var(--bg); }
.icon-btn-dot { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .2rem .65rem .2rem .2rem; color: var(--ink); }
.user-chip-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; font-weight: 550; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.avatar-lg { width: 40px; height: 40px; font-size: .85rem; }

/* ---------- Page structure ---------- */
.page { padding-top: 1.75rem; padding-bottom: 2.5rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; margin: 0; }
.eyebrow { font-size: .75rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-body { padding: 1.25rem; }
.panel-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.panel-header h2 { font-size: 1rem; margin: 0; }
@media (min-width: 768px) { .panel-body { padding: 1.5rem; } }

/* ---------- Stat tiles ---------- */
.stat { display: block; padding: 1.1rem 1.25rem; text-decoration: none; color: inherit; height: 100%; }
a.stat:hover { border-color: #c9d3e4; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 550; display: flex; align-items: center; gap: .4rem; }
.stat-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--muted); font-size: .8rem; margin-top: .15rem; }

/* ---------- Status labels ---------- */
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-success { color: var(--ok); background: var(--ok-soft); }
.status-info { color: var(--info); background: var(--info-soft); }
.status-warning { color: var(--warn); background: var(--warn-soft); }
.status-danger { color: var(--danger); background: var(--danger-soft); }
.status-neutral { color: var(--neutral); background: var(--neutral-soft); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-color: var(--line); vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: #fafbfd; white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.cell-sub { color: var(--muted); font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }

/* Mobile: directory rows become cards */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack tbody tr { display: block; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tbody td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .3rem 0; border: 0; text-align: right; }
  .table-stack tbody td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 550; text-align: left; }
  .table-stack tbody td.cell-primary { display: block; text-align: left; padding-bottom: .5rem; }
  .table-stack tbody td.cell-primary::before { content: none; }
  .table-stack tbody td.cell-actions { justify-content: flex-end; padding-top: .6rem; }
  .table-stack tbody td.cell-actions::before { content: none; }
}

/* ---------- Onboarding checklist ---------- */
.progress-thin { height: 6px; background: var(--neutral-soft); border-radius: 999px; }
.progress-thin .progress-bar { background: var(--accent); border-radius: 999px; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: .9rem; padding: .9rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.step:last-child { border-bottom: 0; }
.step-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .9rem; border: 1.5px solid var(--line); color: var(--muted); background: var(--surface); font-weight: 650; }
.step-complete .step-icon { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-pending_review .step-icon { background: var(--warn-soft); border-color: #f0c879; color: var(--warn); }
.step-rejected .step-icon { background: var(--danger-soft); border-color: #f3b0aa; color: var(--danger); }
.step-current .step-icon { border-color: var(--accent); color: var(--accent); }
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 600; }
.step-desc { color: var(--muted); font-size: .88rem; }
.step-aside { flex: none; padding-top: .15rem; }

.next-step { border-left: 4px solid var(--accent); }
.next-step.is-rejected { border-left-color: var(--danger); }
.next-step.is-waiting { border-left-color: #f0c879; }

/* ---------- Lists ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed-title { font-weight: 600; font-size: .92rem; }
.feed-meta { color: var(--muted); font-size: .8rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state > .bi { font-size: 2rem; color: #a7b1c2; display: block; margin-bottom: .5rem; }
.empty-state h2, .empty-state h1 { color: var(--ink); }

.locked { position: relative; }
.locked-note { display: flex; gap: .75rem; align-items: center; color: var(--muted); }
.locked-note .bi { font-size: 1.4rem; color: #a7b1c2; }

/* ---------- One-time code reveal ---------- */
.code-reveal { background: var(--accent-soft); border: 1px dashed #9db5de; border-radius: var(--radius); padding: 1.25rem; }
.code-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: .1em; color: var(--ink); word-break: break-all; }

/* ---------- Auth pages ---------- */
.layout-auth .app-topbar { background: transparent; border-bottom: 0; position: static; }
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 1.5rem 1rem 3rem; }
.auth-card { width: min(100%, 460px); }
.auth-card .panel-body { padding: 2rem 1.5rem; }
@media (min-width: 576px) { .auth-card .panel-body { padding: 2.5rem; } }
.auth-steps { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.auth-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--neutral-soft); }
.auth-steps span.on { background: var(--accent); }
.identity-card { display: flex; gap: .85rem; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .85rem 1rem; }

/* ---------- Footer & mobile nav ---------- */
.app-footer { padding: 1.5rem 0; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); background: var(--surface); }
.layout-auth .app-footer { background: transparent; border-top: 0; text-align: center; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: var(--surface); border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .45rem; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.bottom-nav a .bi { font-size: 1.2rem; }
.bottom-nav a.active { color: var(--accent); }
body.has-bottom-nav { padding-bottom: 64px; }

/* ---------- Utilities ---------- */
.min-w-0 { min-width: 0; }
.flex-none { flex: none; }
.cell-actions .btn { white-space: nowrap; }

/* ---------- Phase 2: profile ---------- */
.avatar-xl { width: 56px; height: 56px; font-size: 1.05rem; }
.info-list { display: block; }
.info-row { display: flex; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row dt { width: 40%; max-width: 180px; flex: none; font-weight: 550; color: var(--muted); font-size: .88rem; }
.info-row dd { margin: 0; flex: 1; min-width: 0; word-break: break-word; }
.tabs-line { border-bottom: 1px solid var(--line); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; }
.tabs-line .nav-link { color: var(--ink-2); font-weight: 550; padding: .6rem .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-line .nav-link:hover { color: var(--ink); }
.tabs-line .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { font-size: .75rem; background: var(--neutral-soft); color: var(--neutral); border-radius: 999px; padding: .05rem .45rem; margin-left: .2rem; }
a.stretched-link-name:hover { color: var(--accent) !important; text-decoration: underline !important; }
@media (max-width: 575.98px) { .info-row { flex-direction: column; gap: .1rem; } .info-row dt { width: auto; max-width: none; } }

/* ---------- Phase 3 ---------- */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: .35rem; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1; }
.bottom-nav a { position: relative; }
.step-action { margin-top: .5rem; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.doc-tile { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fafbfd; }
.doc-tile-head { padding: .55rem .8rem; font-size: .8rem; font-weight: 650; color: var(--ink-2); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.doc-tile img { display: block; width: 100%; height: 320px; object-fit: contain; background: #f1f3f7; cursor: zoom-in; }
.doc-tile .doc-empty { height: 320px; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.camera-box { border: 1px dashed #c3cede; border-radius: var(--radius); background: #fafbfd; padding: 1rem; text-align: center; }
.camera-box video, .camera-box img.preview { width: 100%; max-width: 420px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); background: #10192b; }
.camera-box video { transform: scaleX(-1); }
.file-preview { max-width: 100%; max-height: 220px; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-top: .5rem; }
.form-step { border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 1.25rem; }
.form-step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .8rem; margin-right: .5rem; }
.consent-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; font-size: .9rem; }
.prose p { margin-bottom: .8rem; } .prose ul { padding-left: 1.2rem; margin-bottom: .8rem; }
.lightbox { position: fixed; inset: 0; background: rgba(10, 16, 30, .92); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 1rem; cursor: zoom-out; }
.lightbox.open { display: flex; } .lightbox img { max-width: 100%; max-height: 100%; }

/* ---------- Phase 4 ---------- */
.address-box { display: flex; align-items: center; justify-content: space-between; gap: .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.address-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; letter-spacing: .03em; word-break: normal; overflow-wrap: break-word; word-spacing: .15em; color: var(--ink); }
.address-box-lg .address-text { font-size: 1.25rem; letter-spacing: .06em; font-weight: 600; }
.step-setting { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.step-setting:last-child { border-bottom: 0; }
.tron-hint-ok { color: var(--ok) !important; } .tron-hint-bad { color: var(--danger) !important; }
