/* ==========================================================================
   HRplus — design system
   HRplus is the Human Resource module of the IMSplus ecosystem, so it shares
   IMSplus's visual language rather than inventing a separate one: deep navy
   as the primary brand colour (nav, buttons, headings), a violet accent kept
   for identity (avatars, profile, role badges), the same green/amber/red
   status vocabulary, small-caps eyebrow labels, pill badges and rounded
   (12-16px) surfaces. Bootstrap's grid/utilities/components still do the
   layout work — this file restyles their look, not their structure.
   ========================================================================== */

:root {
  --sp-bg: #F1F3F8;
  --sp-surface: #FFFFFF;
  --sp-border: #E6E9F0;
  --sp-text: #1A2233;
  --sp-muted: #6B7280;

  /* Primary = IMSplus navy. */
  --sp-primary: #1B3868;
  --sp-primary-dark: #122A52;
  --sp-primary-tint: #E7ECF6;
  --sp-gradient-start: #3E62A6;
  --sp-gradient-end: #122A52;

  /* Accent = IMSplus violet (avatars, identity/profile, admin pills). */
  --sp-accent: #6D3FA8;
  --sp-accent-dark: #4B2680;
  --sp-accent-gradient-start: #7C4DBE;
  --sp-accent-gradient-end: #4B2680;

  --sp-radius-lg: 20px;
  --sp-radius-md: 14px;
  --sp-radius-sm: 10px;
  --sp-shadow-sm: 0 1px 2px rgba(26, 34, 51, 0.06), 0 1px 8px rgba(26, 34, 51, 0.04);
  --sp-shadow-md: 0 10px 30px rgba(26, 34, 51, 0.10);

  --sp-violet: #6D3FA8;    --sp-violet-bg: #EDE7F8;
  --sp-blue: #3B82F6;      --sp-blue-bg: #E7F1FF;
  --sp-green: #16A34A;     --sp-green-bg: #DCFCE7;
  --sp-amber: #D97706;     --sp-amber-bg: #FEF3C7;
  --sp-red: #DC2626;       --sp-red-bg: #FEE2E2;
  --sp-pink: #EC4899;      --sp-pink-bg: #FDEAF3;
  --sp-teal: #0EA5A5;      --sp-teal-bg: #E3FAF7;
  --sp-grey: #6B7280;      --sp-grey-bg: #EEF0F4;
}

/* ---- Base ---- */

body {
  background: var(--sp-bg);
  color: var(--sp-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; }

a { color: var(--sp-primary-dark); }
a:hover { color: var(--sp-primary); }

.text-muted { color: var(--sp-muted) !important; }

/* ---- Buttons and form controls ---- */

.btn-primary { background: var(--sp-primary); border-color: var(--sp-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--sp-primary-dark); border-color: var(--sp-primary-dark); }
.btn-outline-primary { color: var(--sp-primary-dark); border-color: var(--sp-primary); }
.btn-outline-primary:hover { background: var(--sp-primary); border-color: var(--sp-primary); }
.btn, .form-control, .form-select, .card, .alert, .badge { border-radius: var(--sp-radius-sm); }

/* Several Bootstrap defaults key off its own blue rather than --sp-primary —
   bring them on-brand so no control reverts to a different "system" blue. */
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: var(--sp-primary); color: #fff; }
.nav-pills .nav-link { color: var(--sp-primary-dark); }
.form-control:focus, .form-select:focus {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 0.2rem rgba(27, 56, 104, 0.15);
}
.form-check-input:checked { background-color: var(--sp-primary); border-color: var(--sp-primary); }
.form-check-input:focus { border-color: var(--sp-primary); box-shadow: 0 0 0 0.2rem rgba(27, 56, 104, 0.15); }
.page-link { color: var(--sp-primary-dark); }
.page-item.active .page-link { background-color: var(--sp-primary); border-color: var(--sp-primary); }
.nav-tabs .nav-link { color: var(--sp-muted); font-weight: 600; }
.nav-tabs .nav-link.active { color: var(--sp-primary-dark); }

/* ---- Cards, tables, badges ---- */

.card { border: 1px solid var(--sp-border); border-radius: var(--sp-radius-md); box-shadow: var(--sp-shadow-sm); }
.card-header { border-radius: var(--sp-radius-md) var(--sp-radius-md) 0 0 !important; border-bottom: 1px solid var(--sp-border); background: var(--sp-surface); }

.table thead th {
  color: var(--sp-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom-width: 1px;
}
.table > :not(caption) > * > * { padding: 0.6rem 0.75rem; }

.badge { font-weight: 600; letter-spacing: 0.01em; }

/* ---- App shell: sidebar + topbar ----
   The operational area and the Admin Console share this shell but render
   distinct sidebars, so configuration never mixes into the same navigation
   as day-to-day work — only the "Admin Console" link bridges them. */

.sp-shell { display: flex; min-height: 100vh; }

.sp-sidebar {
  width: 258px;
  flex-shrink: 0;
  background: var(--sp-surface);
  border-right: 1px solid var(--sp-border);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sp-sidebar-back {
  display: flex; align-items: center; gap: 0.4rem;
  color: var(--sp-muted); font-size: 0.82rem; font-weight: 600;
  text-decoration: none; padding: 0.3rem 0.6rem 0.9rem;
}
.sp-sidebar-back:hover { color: var(--sp-primary-dark); }
.sp-sidebar-section { margin-top: 1.3rem; }
.sp-sidebar-section:first-of-type { margin-top: 0.6rem; }
.sp-sidebar-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--sp-muted); font-weight: 700; padding: 0 0.6rem; margin-bottom: 0.35rem;
}
.sp-sidebar-link {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0.6rem; border-radius: var(--sp-radius-sm);
  color: var(--sp-text); font-weight: 500; font-size: 0.9rem;
  text-decoration: none; position: relative;
}
.sp-sidebar-link:hover { background: var(--sp-bg); color: var(--sp-text); }
.sp-sidebar-link.active { background: var(--sp-primary-tint); color: var(--sp-primary-dark); font-weight: 600; }
.sp-sidebar-link .sp-icon { flex-shrink: 0; }
.sp-sidebar-link .sp-notif-dot { top: 6px; right: 6px; }
.sp-sidebar-count {
  margin-left: auto; background: var(--sp-primary-tint); color: var(--sp-primary-dark);
  border-radius: 999px; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.45rem;
}
.sp-sidebar-admin-cta { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--sp-border); }
.sp-sidebar-admin-cta .sp-sidebar-link { background: var(--sp-bg); font-weight: 600; }
.sp-sidebar-admin-cta .sp-sidebar-link:hover { background: var(--sp-primary-tint); color: var(--sp-primary-dark); }

.sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sp-topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1.5rem;
  background: var(--sp-surface);
  border-bottom: 1px solid var(--sp-border);
  position: sticky; top: 0; z-index: 20;
  transition: box-shadow 0.15s ease;
}
.sp-topbar.is-scrolled { box-shadow: var(--sp-shadow-sm); }
.sp-topbar-toggle {
  display: none; border: none; background: transparent; color: var(--sp-text);
  padding: 0.3rem; border-radius: var(--sp-radius-sm);
}
.sp-topbar-search {
  flex: 1 1 0; min-width: 0; max-width: 440px;
  background: var(--sp-bg); border-radius: 999px; padding: 0.4rem 0.9rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.sp-topbar-search input { min-width: 0; border: none; outline: none; background: transparent; flex: 1; font-size: 0.88rem; }
.sp-topbar-spacer { flex: 1; }
.sp-admin-banner {
  background: var(--sp-primary-tint); color: var(--sp-primary-dark);
  padding: 0.5rem 1.5rem; font-size: 0.84rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.5rem;
}
.sp-content { padding: 1.5rem; flex: 1; }

/* Sidebar becomes an off-canvas drawer below ~992px. */
@media (max-width: 991.98px) {
  .sp-sidebar {
    position: fixed; left: -278px; top: 0; z-index: 1050;
    box-shadow: var(--sp-shadow-md); transition: left 0.18s ease;
  }
  body.sp-sidebar-open .sp-sidebar { left: 0; }
  body.sp-sidebar-open::after {
    content: ""; position: fixed; inset: 0;
    background: rgba(33, 31, 46, 0.35); z-index: 1040;
  }
  .sp-topbar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sp-content { padding: 1rem; }
}

.sp-brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 800; font-size: 1.15rem;
  color: var(--sp-primary-dark) !important; letter-spacing: -0.01em;
  text-decoration: none;
}
.sp-wordmark-glyph { color: var(--sp-primary); font-size: 1.1rem; line-height: 1; }
.sp-brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--sp-primary-tint);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sp-primary); font-weight: 800; font-size: 0.95rem;
}
.sp-icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sp-text); background: var(--sp-bg); position: relative;
}
.sp-icon-btn:hover { background: var(--sp-primary-tint); color: var(--sp-primary-dark); }
.sp-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sp-accent-gradient-start), var(--sp-accent-gradient-end));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}
.sp-role-pill {
  background: var(--sp-violet-bg); color: var(--sp-violet);
  border-radius: 999px; padding: 0.3rem 0.8rem;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.sp-notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #EF4444; border: 2px solid var(--sp-surface);
}

/* ---- Analytics bars ----
   A bar is a div, not a chart library: it reads at a glance, it prints, and it
   still means something with the stylesheet stripped out. */

.sp-bar {
  height: 8px; border-radius: 999px; background: var(--sp-bg);
  overflow: hidden; margin-top: 3px;
}
.sp-bar > span {
  display: block; height: 100%; border-radius: 999px;
  min-width: 2px; transition: width 0.2s ease;
}

/* ---- My Team / My Profile switch (top bar, beside the initials) ---- */

.sp-view-toggle {
  display: none; align-items: center; gap: 2px;
  background: var(--sp-bg); border-radius: 999px; padding: 3px;
}
@media (min-width: 768px) { .sp-view-toggle { display: inline-flex; } }
.sp-view-toggle-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 0; background: transparent; color: var(--sp-muted);
  border-radius: 999px; padding: 0.32rem 0.75rem;
  font-size: 0.78rem; font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
}
.sp-view-toggle-btn .sp-icon { width: 15px; height: 15px; }
.sp-view-toggle-btn:hover { color: var(--sp-primary-dark); }
.sp-view-toggle-btn.is-active {
  background: var(--sp-surface); color: var(--sp-primary);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  cursor: default;
}

/* ---- Eyebrow labels + KPI stat blocks ---- */

.sp-eyebrow {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--sp-muted); font-weight: 700;
}
.sp-stat-block {
  background: var(--sp-surface); border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-md); padding: 1.1rem 1.2rem;
  box-shadow: var(--sp-shadow-sm); height: 100%;
  text-decoration: none; color: var(--sp-text); display: block;
}
a.sp-stat-block:hover { border-color: var(--sp-primary); color: var(--sp-text); }
.sp-stat-block .sp-stat-value {
  font-size: 1.9rem; font-weight: 800; color: var(--sp-text);
  line-height: 1.15; margin-bottom: 0.25rem;
}
.sp-stat-block.is-danger .sp-stat-value { color: var(--sp-red); }
.sp-stat-block.is-warning .sp-stat-value { color: var(--sp-amber); }
.sp-stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- Tiles (quick actions, document type groups) ---- */

.sp-tile {
  display: flex; gap: 0.9rem; align-items: flex-start;
  background: var(--sp-surface); border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-md); padding: 1.1rem;
  text-decoration: none; color: var(--sp-text); height: 100%;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.sp-tile:hover {
  transform: translateY(-2px); box-shadow: var(--sp-shadow-md);
  border-color: transparent; color: var(--sp-text);
}
.sp-tile-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
/* The text column is a flex item too — without min-width:0 its floor is its
   content's natural width, so long titles push past the card edge instead of
   wrapping. */
.sp-tile > *:last-child { min-width: 0; flex: 1 1 auto; }
.sp-tile-title { font-weight: 700; margin-bottom: 0.15rem; overflow-wrap: break-word; }
.sp-tile-desc { color: var(--sp-muted); font-size: 0.85rem; line-height: 1.35; overflow-wrap: break-word; }
.sp-tile-count { font-size: 0.78rem; font-weight: 700; color: var(--sp-primary-dark); }

.sp-accent-violet .sp-tile-icon { background: var(--sp-violet-bg); color: var(--sp-violet); }
.sp-accent-blue   .sp-tile-icon { background: var(--sp-blue-bg);   color: var(--sp-blue); }
.sp-accent-green  .sp-tile-icon { background: var(--sp-green-bg);  color: var(--sp-green); }
.sp-accent-amber  .sp-tile-icon { background: var(--sp-amber-bg);  color: var(--sp-amber); }
.sp-accent-pink   .sp-tile-icon { background: var(--sp-pink-bg);   color: var(--sp-pink); }
.sp-accent-teal   .sp-tile-icon { background: var(--sp-teal-bg);   color: var(--sp-teal); }
.sp-accent-grey   .sp-tile-icon { background: var(--sp-grey-bg);   color: var(--sp-grey); }

/* ---- Login — split screen, matching IMSplus's own sign-in page ---- */

.sp-login-shell { min-height: 100vh; display: flex; }
.sp-login-side {
  flex: 1.1; min-height: 100vh;
  background: radial-gradient(circle at 15% 10%, var(--sp-gradient-start), var(--sp-gradient-end) 65%);
  color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: center;
}
.sp-login-side .sp-wordmark-glyph, .sp-login-side .sp-brand { color: #fff !important; }
.sp-login-side h1 { font-weight: 800; font-size: 2.2rem; line-height: 1.15; margin: 1.75rem 0 0.9rem; }
.sp-login-side p { color: rgba(255,255,255,0.78); max-width: 430px; font-size: 0.98rem; }
.sp-login-form-side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background: var(--sp-surface);
}
.sp-login-card { width: 100%; max-width: 400px; }
.sp-login-card .form-control { background: var(--sp-primary-tint); border: 1px solid transparent; }
.sp-login-card .form-control:focus {
  background: var(--sp-surface); border-color: var(--sp-primary);
  box-shadow: 0 0 0 0.2rem rgba(27, 56, 104, 0.12);
}
@media (max-width: 860px) {
  .sp-login-shell { flex-direction: column; }
  .sp-login-side { min-height: auto; padding: 2.5rem 1.75rem; }
  .sp-login-form-side { padding: 2.5rem 1.75rem; }
}

/* ---- Misc ---- */

.sp-icon { display: inline-block; vertical-align: -4px; }
.sp-icon-flip { transform: scaleX(-1); }
.sp-icon-sm { width: 14px !important; height: 14px !important; vertical-align: -2px; }
.sp-section-title { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.timeline-item { border-left: 2px solid var(--sp-border); padding-left: 1rem; margin-left: 0.25rem; padding-bottom: 1rem; }
.timeline-item:last-child { padding-bottom: 0; }
table.admin-table td { vertical-align: middle; }
.sp-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 0.35rem; }

/* ==========================================================================
   Employee file — the header card every personnel screen opens with
   ========================================================================== */

.emp-header {
  background: var(--sp-surface); border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-md); overflow: hidden; box-shadow: var(--sp-shadow-sm);
  margin-bottom: 1rem;
}
.emp-header-banner { height: 54px; background: linear-gradient(120deg, var(--sp-accent-gradient-start) 0%, var(--sp-accent-gradient-end) 100%); }
.emp-header-body { padding: 0 1.25rem 1.1rem; margin-top: -30px; }
.emp-avatar {
  width: 62px; height: 62px; border-radius: 16px;
  background: linear-gradient(135deg, var(--sp-accent-gradient-start), var(--sp-accent-gradient-end));
  color: #fff; border: 3px solid var(--sp-surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.25rem; margin-bottom: 0.6rem;
}
.emp-name { font-weight: 700; font-size: 1.1rem; }
.emp-meta { color: var(--sp-muted); font-size: 0.86rem; }
.emp-facts { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 0.85rem; }
.emp-fact .sp-eyebrow { display: block; margin-bottom: 0.1rem; }
.emp-fact div:last-child { font-weight: 600; font-size: 0.9rem; }
.emp-tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; border-bottom: 1px solid var(--sp-border); margin-bottom: 1rem; }
.emp-tabs a {
  padding: 0.5rem 0.9rem; font-size: 0.88rem; font-weight: 600;
  color: var(--sp-muted); text-decoration: none; border-bottom: 2px solid transparent;
}
.emp-tabs a:hover { color: var(--sp-primary-dark); }
.emp-tabs a.active { color: var(--sp-primary-dark); border-bottom-color: var(--sp-primary); }

/* ==========================================================================
   Import dropzone
   ========================================================================== */

.sp-dropzone {
  border: 2px dashed var(--sp-border); border-radius: var(--sp-radius-md);
  padding: 2.5rem 1.5rem; text-align: center; color: var(--sp-muted);
  background: var(--sp-surface); cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sp-dropzone:hover, .sp-dropzone.is-dragover { border-color: var(--sp-primary); background: var(--sp-primary-tint); }
.sp-dropzone-icon { color: var(--sp-primary); margin-bottom: 0.5rem; }
.sp-dropzone input[type="file"] { display: none; }
.sp-file-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--sp-primary-tint); color: var(--sp-primary-dark);
  border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem; font-weight: 600;
}

/* ==========================================================================
   The three HR forms — on-screen editors
   ========================================================================== */

/* A grid whose rows are the form's own rows. Kept as a real <table> so it
   prints and reads the way the paper form does, with inputs sized to the
   content rather than stretched to fill. */
.form-grid { width: 100%; }
.form-grid th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--sp-muted); font-weight: 700; vertical-align: bottom;
}
.form-grid td { vertical-align: top; padding: 0.35rem 0.3rem; }
.form-grid textarea, .form-grid input, .form-grid select { font-size: 0.86rem; }
.form-grid textarea { min-height: 62px; resize: vertical; }
.form-grid .col-num { width: 86px; }
.form-grid .col-score { width: 96px; }
.form-grid tfoot td { border-top: 2px solid var(--sp-border); font-weight: 700; padding-top: 0.6rem; }

.calc-cell {
  display: inline-block; min-width: 56px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 600;
}

/* The running score panel that follows you down a long appraisal. */
.score-rail { position: sticky; top: 76px; }
.score-rail .sp-stat-block { padding: 0.9rem 1rem; margin-bottom: 0.75rem; }
.score-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.3rem 0; font-size: 0.88rem; }
.score-row + .score-row { border-top: 1px dashed var(--sp-border); }
.score-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.score-final { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }

/* Competency rubric: one clickable row per score, so a rater picks the
   descriptor rather than a bare number — which is what the paper form's
   scoring rubric column is for. */
.rubric { border: 1px solid var(--sp-border); border-radius: var(--sp-radius-sm); overflow: hidden; }
.rubric-head {
  display: grid; grid-template-columns: 1fr 86px 86px;
  background: var(--sp-bg); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 700; color: var(--sp-muted);
}
.rubric-head > div { padding: 0.45rem 0.6rem; text-align: center; }
.rubric-head > div:first-child { text-align: left; }
.rubric-row {
  display: grid; grid-template-columns: 1fr 86px 86px;
  border-top: 1px solid var(--sp-border); font-size: 0.85rem;
}
.rubric-row > div { padding: 0.5rem 0.6rem; }
.rubric-row .rubric-pick { text-align: center; border-left: 1px solid var(--sp-border); }
.rubric-row:hover { background: var(--sp-bg); }
.rubric-row label { cursor: pointer; display: block; margin: 0; }
.rubric-row input[type="radio"] { margin-right: 0.3rem; }
.rubric-row.is-mid-selected { background: var(--sp-blue-bg); }
.rubric-row.is-end-selected { background: var(--sp-green-bg); }
.rubric-row.is-mid-selected.is-end-selected {
  background: linear-gradient(90deg, var(--sp-blue-bg) 0%, var(--sp-green-bg) 100%);
}

@media (max-width: 767.98px) {
  .rubric-head, .rubric-row { grid-template-columns: 1fr 64px 64px; }
  .rubric-row > div { padding: 0.45rem 0.4rem; }
}

/* ---- Approval chain (training) ---- */

.chain { list-style: none; padding: 0; margin: 0; }
.chain li { display: flex; gap: 0.85rem; padding-bottom: 1.1rem; position: relative; }
.chain li:not(:last-child)::before {
  content: ""; position: absolute; left: 15px; top: 30px; bottom: 0;
  width: 2px; background: var(--sp-border);
}
.chain-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sp-bg); color: var(--sp-muted); z-index: 1;
  border: 2px solid var(--sp-surface);
}
.chain-dot.is-done { background: var(--sp-green-bg); color: var(--sp-green); }
.chain-dot.is-current { background: var(--sp-primary-tint); color: var(--sp-primary); }
.chain-dot.is-declined { background: var(--sp-red-bg); color: var(--sp-red); }
.chain-body { min-width: 0; flex: 1; }
.chain-title { font-weight: 600; font-size: 0.92rem; }
.chain-meta { color: var(--sp-muted); font-size: 0.8rem; }

/* ---- Keyword list (document view / indexing) ---- */

.kw-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.kw-item { background: var(--sp-bg); border-radius: var(--sp-radius-sm); padding: 0.55rem 0.75rem; }
.kw-item .sp-eyebrow { display: block; margin-bottom: 0.1rem; }
.kw-item .v { font-weight: 600; font-size: 0.9rem; overflow-wrap: break-word; }
.kw-required { color: var(--sp-red); font-weight: 700; }

/* ---- Privilege / access matrix ---- */

.matrix { font-size: 0.85rem; }
.matrix th { white-space: nowrap; }
.matrix td, .matrix th { text-align: center; vertical-align: middle; }
.matrix td:first-child, .matrix th:first-child { text-align: left; min-width: 220px; }
.matrix tbody tr:hover { background: var(--sp-bg); }
.matrix .form-check-input { margin: 0; }

/* ---- Empty states ---- */

.sp-empty { text-align: center; padding: 2.5rem 1rem; color: var(--sp-muted); }
.sp-empty .sp-icon { width: 40px; height: 40px; color: var(--sp-border); margin-bottom: 0.6rem; }
.sp-empty-title { font-weight: 700; color: var(--sp-text); margin-bottom: 0.25rem; }

/* ==========================================================================
   App-styled alert/confirm/prompt replacements — see assets/js/sp_dialog.js.
   ========================================================================== */
@keyframes sp-dlg-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.sp-dlg-overlay {
  position: fixed; inset: 0; background: rgba(26, 34, 51, 0.45); z-index: 1060;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.sp-dlg-card {
  background: var(--sp-surface); border-radius: var(--sp-radius-lg);
  box-shadow: 0 20px 60px rgba(26, 34, 51, 0.30);
  width: min(400px, 100%); padding: 1.75rem 1.75rem 1.5rem; text-align: center;
  animation: sp-dlg-pop 0.15s ease-out;
}
.sp-dlg-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem;
}
.sp-dlg-icon-info { background: var(--sp-blue-bg); color: var(--sp-blue); }
.sp-dlg-icon-warning { background: var(--sp-amber-bg); color: var(--sp-amber); }
.sp-dlg-icon-question { background: var(--sp-primary-tint); color: var(--sp-primary); }
.sp-dlg-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.4rem; }
.sp-dlg-message { color: var(--sp-muted); font-size: 0.88rem; margin-bottom: 1.1rem; }
.sp-dlg-input { margin-bottom: 1.1rem; text-align: left; }
.sp-dlg-actions { display: flex; gap: 0.6rem; justify-content: center; }
