
/**
 * Santé Pro-RH - Components
 * Source de vérité: docs/design_system_santeprorh.v2.json
 * 
 * Badges, tables, forms, buttons, cards, utilities
 * Usage: @import url('assets/css/sprh.components.css');
 */

/* ===============================
   Badges
   =============================== */

/* Base badge */
.sprh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--sprh-radius-full);
  font-weight: var(--sprh-font-weight-semibold);
  font-size: var(--sprh-font-size-xs);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}

.sprh-badge i {
  font-size: 0.95em;
}

/* Badge variants */
.sprh-badge--neutral {
  background: rgba(var(--sprh-muted-rgb), 0.12);
  border-color: rgba(var(--sprh-muted-rgb), 0.2);
  color: var(--sprh-muted);
}

.sprh-badge--primary {
  background: rgba(var(--sprh-primary-rgb), 0.12);
  border-color: rgba(var(--sprh-primary-rgb), 0.22);
  color: var(--sprh-primary-dark);
}

.sprh-badge--success {
  background: rgba(var(--sprh-success-rgb), 0.12);
  border-color: rgba(var(--sprh-success-rgb), 0.22);
  color: var(--sprh-accent-dark);
}

.sprh-badge--warning {
  background: rgba(var(--sprh-warning-rgb), 0.14);
  border-color: rgba(var(--sprh-warning-rgb), 0.26);
  color: var(--sprh-text);
}

.sprh-badge--danger {
  background: rgba(var(--sprh-danger-rgb), 0.12);
  border-color: rgba(var(--sprh-danger-rgb), 0.22);
  color: var(--sprh-danger);
}

.sprh-badge--info {
  background: rgba(var(--sprh-primary-rgb), 0.12);
  border-color: rgba(var(--sprh-primary-rgb), 0.22);
  color: var(--sprh-primary);
}

/* Inverse badge (for use on dark/primary backgrounds) */
.sprh-badge--inverse {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.26);
  color: var(--sprh-surface);
}

/* RH Status badges */
.sprh-badge--status {
  /* Base RH badge (mapping centralisé via data-status ou classes) */
}

.sprh-badge--status[data-status="soumis"],
.sprh-badge--soumis,
.sprh-badge-status--soumis {
  background: rgba(var(--sprh-muted-rgb), 0.12);
  border-color: rgba(var(--sprh-muted-rgb), 0.22);
  color: var(--sprh-status-soumis);
}

.sprh-badge--status[data-status="preselection"],
.sprh-badge--preselection,
.sprh-badge-status--preselection {
  background: rgba(var(--sprh-primary-rgb), 0.12);
  border-color: rgba(var(--sprh-primary-rgb), 0.22);
  color: var(--sprh-primary-dark);
}

.sprh-badge--status[data-status="en_formation"],
.sprh-badge--status[data-status="en-formation"],
.sprh-badge--en_formation,
.sprh-badge-status--en_formation {
  background: rgba(var(--sprh-warning-rgb), 0.14);
  border-color: rgba(var(--sprh-warning-rgb), 0.26);
  color: var(--sprh-text);
}

.sprh-badge--status[data-status="shortlist"],
.sprh-badge--shortlist,
.sprh-badge-status--shortlist {
  background: rgba(var(--sprh-primary-rgb), 0.14);
  border-color: rgba(var(--sprh-primary-rgb), 0.26);
  color: var(--sprh-primary-dark);
}

.sprh-badge--status[data-status="place"],
.sprh-badge--place,
.sprh-badge-status--place {
  background: rgba(var(--sprh-success-rgb), 0.12);
  border-color: rgba(var(--sprh-success-rgb), 0.22);
  color: var(--sprh-accent-dark);
}

.sprh-badge--status[data-status="suivi"],
.sprh-badge--suivi,
.sprh-badge-status--suivi {
  background: rgba(var(--sprh-success-rgb), 0.10);
  border-color: rgba(var(--sprh-success-rgb), 0.20);
  color: var(--sprh-status-suivi);
}

.sprh-badge--status[data-status="rejete"],
.sprh-badge--status[data-status="rejeté"],
.sprh-badge--rejete,
.sprh-badge-status--rejete {
  background: rgba(var(--sprh-danger-rgb), 0.12);
  border-color: rgba(var(--sprh-danger-rgb), 0.22);
  color: var(--sprh-status-rejete);
}

/* ===============================
   Buttons
   =============================== */

.btn-sprh-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font-size: var(--sprh-font-size-base);
  font-weight: var(--sprh-font-weight-semibold);
  line-height: 1.4;
  color: var(--sprh-surface);
  background: var(--sprh-primary);
  border: 1px solid var(--sprh-primary);
  border-radius: var(--sprh-radius-md);
  cursor: pointer;
  box-shadow: var(--sprh-shadow-soft);
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing),
              background-color var(--sprh-duration) var(--sprh-easing),
              border-color var(--sprh-duration) var(--sprh-easing);
  text-decoration: none;
}

.btn-sprh-primary:hover {
  background: var(--sprh-primary-dark);
  border-color: var(--sprh-primary-dark);
  color: var(--sprh-surface);
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
  text-decoration: none;
}

.btn-sprh-primary:active {
  transform: translateY(0);
  box-shadow: var(--sprh-shadow-soft);
}

.btn-sprh-primary:focus-visible {
  outline: none;
  box-shadow: var(--sprh-shadow-focus);
}

.btn-sprh-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font-size: var(--sprh-font-size-base);
  font-weight: var(--sprh-font-weight-semibold);
  line-height: 1.4;
  color: var(--sprh-primary);
  background: transparent;
  border: 1px solid var(--sprh-primary);
  border-radius: var(--sprh-radius-md);
  cursor: pointer;
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing),
              background-color var(--sprh-duration) var(--sprh-easing),
              border-color var(--sprh-duration) var(--sprh-easing);
  text-decoration: none;
}

.btn-sprh-secondary:hover {
  background: var(--sprh-primary);
  color: var(--sprh-surface);
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
  text-decoration: none;
}

.btn-sprh-secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-sprh-secondary:focus-visible {
  outline: none;
  box-shadow: var(--sprh-shadow-focus);
}

.btn-sprh-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font-size: var(--sprh-font-size-base);
  font-weight: var(--sprh-font-weight-semibold);
  line-height: 1.4;
  color: var(--sprh-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--sprh-radius-md);
  cursor: pointer;
  transition: transform var(--sprh-duration) var(--sprh-easing),
              background-color var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing);
  text-decoration: none;
}

.btn-sprh-ghost:hover {
  background: rgba(var(--sprh-muted-rgb), 0.08);
  color: var(--sprh-text);
  transform: translateY(-1px);
}

.btn-sprh-ghost:active {
  transform: translateY(0);
}

.btn-sprh-ghost:focus-visible {
  outline: none;
  box-shadow: var(--sprh-shadow-focus);
}

.btn-sprh-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font-size: var(--sprh-font-size-base);
  font-weight: var(--sprh-font-weight-semibold);
  line-height: 1.4;
  color: var(--sprh-surface);
  background: var(--sprh-danger);
  border: 1px solid var(--sprh-danger);
  border-radius: var(--sprh-radius-md);
  cursor: pointer;
  box-shadow: var(--sprh-shadow-soft);
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing),
              filter var(--sprh-duration) var(--sprh-easing);
  text-decoration: none;
}

.btn-sprh-danger:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
  color: var(--sprh-surface);
  text-decoration: none;
}

.btn-sprh-danger:active {
  transform: translateY(0);
  box-shadow: var(--sprh-shadow-soft);
}

.btn-sprh-danger:focus-visible {
  outline: none;
  box-shadow: var(--sprh-shadow-focus);
}

/* ===============================
   Forms
   =============================== */

.sprh-input,
.sprh-select,
.sprh-textarea {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: var(--sprh-font-size-base);
  font-family: var(--sprh-font-sans);
  line-height: 1.4;
  color: var(--sprh-text);
  background: var(--sprh-surface);
  border: 1px solid var(--sprh-border);
  border-radius: var(--sprh-radius-md);
  transition: border-color var(--sprh-duration) var(--sprh-easing), 
              box-shadow var(--sprh-duration) var(--sprh-easing);
}

.sprh-input:focus,
.sprh-select:focus,
.sprh-textarea:focus {
  outline: none;
  border-color: var(--sprh-primary);
  box-shadow: var(--sprh-shadow-focus);
}

.sprh-input::placeholder,
.sprh-textarea::placeholder {
  color: var(--sprh-muted2);
}

.sprh-input--error,
.sprh-select--error,
.sprh-textarea--error {
  border-color: var(--sprh-danger);
}

.sprh-input--error:focus,
.sprh-select--error:focus,
.sprh-textarea--error:focus {
  box-shadow: 0 0 0 3px rgba(var(--sprh-danger-rgb), 0.18);
}

.sprh-help {
  display: block;
  margin-top: 6px;
  font-size: var(--sprh-font-size-xs);
  color: var(--sprh-muted);
}

.sprh-error {
  display: block;
  margin-top: 6px;
  font-size: var(--sprh-font-size-xs);
  color: var(--sprh-danger);
}

/* ===============================
   Cards
   =============================== */

.sprh-card {
  background: var(--sprh-surface-elevated);
  border: 1px solid var(--sprh-border-subtle);
  border-radius: var(--sprh-radius-xl);
  box-shadow: var(--sprh-shadow-soft);
  overflow: hidden;
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing);
}

.sprh-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
}

.sprh-card-header {
  padding: var(--sprh-space-md);
  border-bottom: 1px solid var(--sprh-border-subtle);
  font-weight: var(--sprh-font-weight-semibold);
}

.sprh-card-body {
  padding: var(--sprh-space-md);
}

.sprh-card-footer {
  padding: var(--sprh-space-md);
  border-top: 1px solid var(--sprh-border-subtle);
  background: var(--sprh-surface-alt);
}

/* KPI Card */
.sprh-kpi-card {
  background: var(--sprh-surface-elevated);
  border: 1px solid var(--sprh-border-subtle);
  border-radius: var(--sprh-radius-xl);
  box-shadow: var(--sprh-shadow-soft);
  padding: var(--sprh-space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sprh-space-md);
  min-height: 92px;
  font-variant-numeric: tabular-nums;
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing);
}

.sprh-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
}

.sprh-kpi-label {
  font-size: var(--sprh-font-size-xs);
  color: var(--sprh-muted);
  font-weight: var(--sprh-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.sprh-kpi-value {
  font-family: var(--sprh-font-display);
  font-size: 1.85rem;
  font-weight: var(--sprh-font-weight-bold);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--sprh-text);
  white-space: nowrap;
}

.sprh-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--sprh-radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(var(--sprh-primary-rgb), 0.12);
  color: var(--sprh-primary);
}

.sprh-kpi-icon--neutral {
  background: rgba(var(--sprh-muted-rgb), 0.12);
  color: var(--sprh-muted);
}

.sprh-kpi-icon--success {
  background: rgba(var(--sprh-success-rgb), 0.12);
  color: var(--sprh-success);
}

.sprh-kpi-icon--warning {
  background: rgba(var(--sprh-warning-rgb), 0.14);
  color: var(--sprh-text);
}

.sprh-kpi-icon--danger {
  background: rgba(var(--sprh-danger-rgb), 0.12);
  color: var(--sprh-danger);
}

/* Panel (alias) */
.sprh-panel {
  background: var(--sprh-surface-primary);
  border: 1px solid var(--sprh-border-subtle);
  border-radius: var(--sprh-radius-xl);
  box-shadow: var(--sprh-shadow-soft);
  overflow: hidden;
}

/* ===============================
   Tables
   =============================== */

/* Wrapper (overflow-x) */
.sprh-table-wrap,
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.sprh-table-wrap {
  background: var(--sprh-surface-primary);
  border: 1px solid var(--sprh-border-subtle);
  border-radius: var(--sprh-radius-xl);
  box-shadow: var(--sprh-shadow-soft);
}

.sprh-table {
  width: 100%;
  margin-bottom: 0;
  font-size: var(--sprh-font-size-base);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.sprh-table thead th {
  background: var(--sprh-surface-alt);
  color: var(--sprh-muted);
  font-weight: var(--sprh-font-weight-bold);
  font-size: var(--sprh-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--sprh-border-subtle);
  padding: var(--sprh-space-sm) var(--sprh-space-lg);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.sprh-table tbody td {
  padding: var(--sprh-space-sm) var(--sprh-space-lg);
  border-bottom: 1px solid var(--sprh-border-subtle);
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: break-word;
}

.sprh-table tbody tr:hover {
  background: rgba(var(--sprh-primary-rgb), 0.04);
}

/* Dense variant */
.sprh-table--dense thead th,
.sprh-table--dense tbody td {
  padding: 6px 12px;
  font-size: var(--sprh-font-size-sm);
}

/* Sticky header */
.sprh-table-sticky thead th {
  position: static;
}

/* Numeric columns */
.sprh-table .sprh-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ERP: premium tables - prevent compression by enforcing a minimum width */
body.sprh-app .table-responsive > .table {
  min-width: var(--sprh-table-min-w, 960px);
}

body.sprh-app .table-responsive > .sprh-table {
  min-width: var(--sprh-table-min-w-dense, 1100px);
}

body.sprh-app .table,
body.sprh-app .sprh-table {
  table-layout: auto;
}

/* ===============================
   Badge Cards (candidat badges)
   =============================== */

.sprh-badge-grid {
  display: grid;
  gap: var(--sprh-space-md);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.sprh-badge-card {
  background: var(--sprh-surface-elevated);
  border: 1px solid var(--sprh-border-subtle);
  border-radius: var(--sprh-radius-xl);
  padding: var(--sprh-space-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  transition: transform var(--sprh-duration) var(--sprh-easing), 
              box-shadow var(--sprh-duration) var(--sprh-easing),
              border-color var(--sprh-duration) var(--sprh-easing);
}

.sprh-badge-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
}

.sprh-badge-card .sprh-badge-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--sprh-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sprh-surface);
  font-size: 1.2rem;
  background: var(--sprh-primary);
}

.sprh-badge-icon--primary { background: var(--sprh-primary); }
.sprh-badge-icon--accent { background: var(--sprh-accent); }
.sprh-badge-icon--warning { background: var(--sprh-warning); }
.sprh-badge-icon--danger { background: var(--sprh-danger); }
.sprh-badge-icon--neutral { background: var(--sprh-muted); }

.sprh-badge-card .sprh-badge-content strong {
  display: block;
  font-size: var(--sprh-font-size-lg);
}

.sprh-badge-card .sprh-badge-content .sprh-badge-progress {
  font-size: var(--sprh-font-size-sm);
  color: var(--sprh-muted);
}

.sprh-badge-card .sprh-badge-state-label {
  font-size: var(--sprh-font-size-xs);
  font-weight: var(--sprh-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sprh-muted);
}

.sprh-badge-card.sprh-badge-state-earned {
  border-color: rgba(var(--sprh-success-rgb), 0.35);
  background: rgba(var(--sprh-success-rgb), 0.06);
}

.sprh-badge-card.sprh-badge-state-in_progress {
  border-color: rgba(var(--sprh-primary-rgb), 0.35);
}

.sprh-badge-card.sprh-badge-state-locked {
  border-color: var(--sprh-border);
  background: rgba(var(--sprh-muted-rgb), 0.06);
}

/* ===============================
   Auth / Login
   =============================== */

.sprh-login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sprh-space-xl) var(--sprh-space-md);
  background: var(--sprh-bg);
}

.sprh-login-card {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--sprh-surface-elevated);
  border-radius: var(--sprh-radius-xl);
  box-shadow: var(--sprh-shadow-soft);
  border: 1px solid var(--sprh-border-subtle);
  overflow: hidden;
}

.sprh-login-brand {
  position: relative;
  padding: 48px 46px;
  background: var(--sprh-primary-darker);
  color: rgba(255, 255, 255, 0.92);
}

.sprh-login-brand-content {
  position: relative;
  z-index: 1;
}

.sprh-login-logo {
  width: 96px;
  height: 96px;
  border-radius: var(--sprh-radius-lg);
  background: var(--sprh-surface);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sprh-space-md);
}

.sprh-login-logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.sprh-login-logo span {
  font-weight: var(--sprh-font-weight-bold);
  font-size: var(--sprh-font-size-xl);
  color: var(--sprh-primary);
}

.sprh-login-brand h1 {
  font-size: var(--sprh-font-size-3xl);
  font-weight: var(--sprh-font-weight-semibold);
  margin: 0 0 6px;
  color: var(--sprh-surface);
}

.sprh-login-brand p {
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}

.sprh-login-features {
  margin-top: var(--sprh-space-lg);
  color: rgba(255, 255, 255, 0.86);
  font-size: var(--sprh-font-size-base);
  line-height: 1.7;
}

.sprh-login-features ul {
  list-style: none;
  padding: 0;
  margin: var(--sprh-space-sm) 0 0;
}

.sprh-login-features li {
  margin-bottom: var(--sprh-space-sm);
}

.sprh-login-features li::before {
  content: "•";
  color: var(--sprh-accent);
  margin-right: 8px;
}

.sprh-login-brand-footer {
  position: absolute;
  bottom: 20px;
  left: 46px;
  right: 46px;
  text-align: left;
  font-size: var(--sprh-font-size-xs);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.sprh-login-form {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sprh-login-form h2 {
  font-size: var(--sprh-font-size-3xl);
  font-weight: var(--sprh-font-weight-semibold);
  margin: var(--sprh-space-sm) 0 var(--sprh-space-sm);
}

.sprh-login-form p {
  color: var(--sprh-muted);
  margin-bottom: var(--sprh-space-md);
}

.sprh-login-footer {
  margin-top: var(--sprh-space-md);
  text-align: left;
  font-size: var(--sprh-font-size-xs);
  color: var(--sprh-muted);
}

.sprh-login-footer strong {
  display: block;
  margin-top: 4px;
  font-weight: var(--sprh-font-weight-bold);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sprh-muted2);
}

.sprh-login-legal {
  margin-top: var(--sprh-space-md);
  text-align: center;
  font-size: var(--sprh-font-size-xs);
  color: var(--sprh-muted);
}

@media (max-width: 991px) {
  .sprh-login-card { grid-template-columns: 1fr; }
  .sprh-login-brand { padding: 32px; }
  .sprh-login-form { padding: 32px; }
  .sprh-login-logo { width: 84px; height: 84px; }
  .sprh-login-logo img { width: 64px; height: 64px; }
  .sprh-login-brand-footer {
    position: static;
    margin-top: var(--sprh-space-lg);
  }
}

/* ===============================
   LMS / Course
   =============================== */

.sprh-course-hero {
  background: var(--sprh-primary);
  color: var(--sprh-surface);
}

.sprh-course-hero .sprh-text-muted {
  color: rgba(255, 255, 255, 0.75) !important;
}

.sprh-course-stat {
  background: var(--sprh-surface);
  border: 1px solid var(--sprh-border);
  border-radius: var(--sprh-radius-lg);
}

.sprh-lesson-card {
  border-radius: var(--sprh-radius-lg);
  background: var(--sprh-surface);
  border: 1px solid var(--sprh-border);
}

.sprh-lesson-card-done {
  border-color: var(--sprh-success);
  background: rgba(var(--sprh-success-rgb), 0.06);
}

.sprh-chapter-step {
  border-radius: var(--sprh-radius-lg);
  border: 1px solid var(--sprh-border);
  transition: all var(--sprh-duration) var(--sprh-easing);
}

.sprh-chapter-step:hover {
  transform: translateY(-2px);
  border-color: var(--sprh-primary);
}

.sprh-chapter-step-current {
  border-color: var(--sprh-primary);
  background: rgba(var(--sprh-primary-rgb), 0.08);
}

.sprh-chapter-step-done {
  border-color: var(--sprh-success);
  background: rgba(var(--sprh-success-rgb), 0.08);
}

/* ===============================
   Utilities - HOTFIX
   =============================== */

/* Rounded utilities (max 12px per charter) */
.sprh-rounded-sm { border-radius: var(--sprh-radius-sm); }
.sprh-rounded-md { border-radius: var(--sprh-radius-md); }
.sprh-rounded-lg { border-radius: var(--sprh-radius-lg); }
.sprh-rounded-xl { border-radius: var(--sprh-radius-xl); }
.sprh-rounded-full { border-radius: var(--sprh-radius-full); }

/* Background utilities using tokens */
.sprh-bg-primary { background-color: var(--sprh-primary); }
.sprh-bg-accent { background-color: var(--sprh-accent); }
.sprh-bg-surface { background-color: var(--sprh-surface); }
.sprh-bg-soft-blue { background-color: var(--sprh-primary-soft); }
.sprh-bg-soft-green { background-color: var(--sprh-accent-soft); }
.sprh-bg { background-color: var(--sprh-bg); }

/* Neutral decorative container (no gradients) */
.sprh-bg-wave {
  background: rgba(var(--sprh-primary-rgb), 0.04);
  border: 1px solid rgba(var(--sprh-primary-rgb), 0.10);
  border-radius: var(--sprh-radius-xl);
  padding: var(--sprh-space-md);
}

/* Text utilities */
.sprh-text { color: var(--sprh-text); }
.sprh-text-primary { color: var(--sprh-primary); }
.sprh-text-success { color: var(--sprh-success); }
.sprh-text-warning { color: var(--sprh-warning); }
.sprh-text-danger { color: var(--sprh-danger); }
.text-muted { color: var(--sprh-muted) !important; }

/* Shadow utilities */
.sprh-shadow-card { box-shadow: var(--sprh-shadow-card); }
.sprh-shadow-hover { box-shadow: var(--sprh-shadow-hover); }

/* Gap utilities */
.sprh-gap-1 { gap: var(--sprh-space-xs); }
.sprh-gap-2 { gap: var(--sprh-space-sm); }
.sprh-gap-3 { gap: var(--sprh-space-md); }
.sprh-gap-4 { gap: var(--sprh-space-lg); }
.sprh-gap-5 { gap: var(--sprh-space-xl); }
.sprh-gap-6 { gap: var(--sprh-space-2xl); }

/* Stack utilities */
.sprh-stack-1 > * + * { margin-top: var(--sprh-space-xs); }
.sprh-stack-2 > * + * { margin-top: var(--sprh-space-sm); }
.sprh-stack-3 > * + * { margin-top: var(--sprh-space-md); }
.sprh-stack-4 > * + * { margin-top: var(--sprh-space-lg); }
.sprh-stack-5 > * + * { margin-top: var(--sprh-space-xl); }
.sprh-stack-6 > * + * { margin-top: var(--sprh-space-2xl); }

/* Section */
.sprh-section { padding: calc(var(--sprh-space-2xl) * 2) 0; }

/* Truncate */
.sprh-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprh-truncate-180 { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprh-truncate-220 { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }

/* Media helpers */
.sprh-media-cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--sprh-radius-xl);
  display: block;
}

.sprh-media-frame {
  width: 100%;
  height: 180px;
  border-radius: var(--sprh-radius-xl);
  border: 1px solid var(--sprh-border);
  background: var(--sprh-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sprh-muted);
}

/* Sizing utilities (avoid inline styles) */
.sprh-maxw-960 { max-width: 960px; }
.sprh-maxw-320 { max-width: 320px; }
.sprh-maxw-280 { max-width: 280px; }
.sprh-maxw-260 { max-width: 260px; }
.sprh-maxw-200 { max-width: 200px; }
.sprh-maxw-180 { max-width: 180px; }
.sprh-maxw-140 { max-width: 140px; }

.sprh-maxh-90 { max-height: 90px; }
.sprh-maxh-60 { max-height: 60px; }
.sprh-maxh-48 { max-height: 48px; }

.sprh-w-320 { width: 320px; }
.sprh-w-280 { width: 280px; }
.sprh-w-260 { width: 260px; }
.sprh-w-220 { width: 220px; }
.sprh-w-200 { width: 200px; }
.sprh-w-180 { width: 180px; }
.sprh-w-140 { width: 140px; }
.sprh-w-120 { width: 120px; }
.sprh-w-100 { width: 100px; }
.sprh-w-90 { width: 90px; }
.sprh-w-80 { width: 80px; }
.sprh-w-72 { width: 72px; }
.sprh-w-70 { width: 70px; }
.sprh-w-56 { width: 56px; }
.sprh-w-48 { width: 48px; }

.sprh-h-200 { height: 200px; }
.sprh-h-120 { height: 120px; }
.sprh-h-110 { height: 110px; }
.sprh-h-72 { height: 72px; }
.sprh-h-90 { height: 90px; }
.sprh-h-60 { height: 60px; }
.sprh-h-56 { height: 56px; }
.sprh-h-48 { height: 48px; }
.sprh-h-40 { height: 40px; }
.sprh-h-36 { height: 36px; }

.sprh-square-120 { width: 120px; height: 120px; }

.sprh-object-cover { object-fit: cover; }
.sprh-object-contain { object-fit: contain; }
.sprh-preline { white-space: pre-line; }

/* Indent utilities (LMS trees, no inline padding-left) */
.sprh-indent-0 { padding-left: 0 !important; }
.sprh-indent-1 { padding-left: 24px !important; }
.sprh-indent-2 { padding-left: 48px !important; }
.sprh-indent-3 { padding-left: 72px !important; }
.sprh-indent-4 { padding-left: 96px !important; }
.sprh-indent-5 { padding-left: 120px !important; }
.sprh-indent-6 { padding-left: 144px !important; }
.sprh-indent-7 { padding-left: 168px !important; }
.sprh-indent-8 { padding-left: 192px !important; }

/* Font size utilities */
.sprh-fs-xl { font-size: var(--sprh-font-size-xl); }

/* Step / icon square (max radius 12px) */
.sprh-step {
  width: 34px;
  height: 34px;
  border-radius: var(--sprh-radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sprh-step--success {
  background: rgba(var(--sprh-success-rgb), 0.14);
  border: 1px solid rgba(var(--sprh-success-rgb), 0.22);
  color: var(--sprh-accent-dark);
}

/* Font numeric (for KPI, amounts, tables) */
.sprh-numeric { font-variant-numeric: tabular-nums; }
.table,
.sprh-table {
  font-variant-numeric: tabular-nums;
}

/* KPI Grid */
.sprh-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sprh-space-md);
}

/* Page header */
.sprh-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sprh-space-md);
  margin-bottom: var(--sprh-space-lg);
}

.sprh-page-title {
  font-family: var(--sprh-font-display);
  font-size: clamp(var(--sprh-font-size-2xl), 2.3vw, var(--sprh-font-size-3xl));
  font-weight: var(--sprh-font-weight-bold);
  margin: 0;
  color: var(--sprh-text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sprh-page-subtitle {
  margin-top: 4px;
  font-size: var(--sprh-font-size-base);
  color: var(--sprh-muted);
  line-height: 1.4;
}

/* ===============================
   Institutional zones (Level C)
   =============================== */

.sprh-decision-zone {
  background: rgba(var(--sprh-primary-rgb), 0.03);
  border: 1px solid rgba(var(--sprh-primary-rgb), 0.10);
  border-radius: var(--sprh-radius-xl);
  padding: var(--sprh-space-xl);
  margin-bottom: var(--sprh-space-xl);
}

.sprh-operational-zone {
  margin-bottom: var(--sprh-space-xl);
}

.sprh-system-zone {
  margin-bottom: var(--sprh-space-xl);
}

.sprh-zone-lead {
  max-width: 76ch;
  margin: 0 0 var(--sprh-space-lg);
  color: var(--sprh-muted);
  line-height: 1.6;
}

.sprh-zone-title {
  font-family: var(--sprh-font-display);
  font-size: clamp(var(--sprh-font-size-lg), 1.6vw, var(--sprh-font-size-2xl));
  font-weight: var(--sprh-font-weight-bold);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 var(--sprh-space-md);
  color: var(--sprh-text);
}

.sprh-zone-title + .sprh-zone-lead {
  margin-top: calc(var(--sprh-space-sm) * -1);
}

.sprh-display-title {
  font-family: var(--sprh-font-display);
  font-size: clamp(1.9rem, 2.8vw, 2.4rem);
  font-weight: var(--sprh-font-weight-bold);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--sprh-text);
}

.sprh-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sprh-space-sm);
  flex-wrap: wrap;
}

/* Fade in animation */
.sprh-fade-in { animation: sprhFadeIn 0.35s ease-out both; }
.fade-in { animation: sprhFadeIn 0.35s ease-out both; }

@keyframes sprhFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Progress bar */
.sprh-progress {
  height: 8px;
  background: rgba(var(--sprh-muted-rgb), 0.12);
  border-radius: var(--sprh-radius-full);
  overflow: hidden;
}

.sprh-progress-bar {
  height: 100%;
  background: var(--sprh-primary);
  border-radius: var(--sprh-radius-full);
  transition: width var(--sprh-duration) var(--sprh-easing);
}

.sprh-progress-bar--success { background: var(--sprh-success); }
.sprh-progress-bar--warning { background: var(--sprh-warning); }
.sprh-progress-bar--danger { background: var(--sprh-danger); }

/* Native progress (avoid inline styles for widths) */
progress.sprh-meter {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: var(--sprh-radius-full);
  background: rgba(var(--sprh-muted-rgb), 0.12);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
progress.sprh-meter::-webkit-progress-bar {
  background: rgba(var(--sprh-muted-rgb), 0.12);
  border-radius: var(--sprh-radius-full);
}
progress.sprh-meter::-webkit-progress-value {
  background: var(--sprh-primary);
  border-radius: var(--sprh-radius-full);
}
progress.sprh-meter::-moz-progress-bar {
  background: var(--sprh-primary);
  border-radius: var(--sprh-radius-full);
}
progress.sprh-meter.sprh-meter--sm { height: 8px; }
progress.sprh-meter.sprh-meter--lg { height: 16px; }
progress.sprh-meter.sprh-meter--success::-webkit-progress-value { background: var(--sprh-success); }
progress.sprh-meter.sprh-meter--success::-moz-progress-bar { background: var(--sprh-success); }
progress.sprh-meter.sprh-meter--warning::-webkit-progress-value { background: var(--sprh-warning); }
progress.sprh-meter.sprh-meter--warning::-moz-progress-bar { background: var(--sprh-warning); }
progress.sprh-meter.sprh-meter--danger::-webkit-progress-value { background: var(--sprh-danger); }
progress.sprh-meter.sprh-meter--danger::-moz-progress-bar { background: var(--sprh-danger); }

/* ===============================
   Bootstrap Compatibility Override
   (Makes existing Bootstrap classes look like design system)
   =============================== */

/* Bootstrap badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: var(--sprh-font-weight-semibold);
  font-size: var(--sprh-font-size-xs);
  border-radius: var(--sprh-radius-full);
  padding: 4px 10px;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Bootstrap text-bg-* classes */
.text-bg-primary { background-color: rgba(var(--sprh-primary-rgb), 0.12) !important; color: var(--sprh-primary) !important; }
.text-bg-success { background-color: rgba(var(--sprh-success-rgb), 0.12) !important; color: var(--sprh-accent-dark) !important; }
.text-bg-warning { background-color: rgba(var(--sprh-warning-rgb), 0.14) !important; color: var(--sprh-text) !important; }
.text-bg-danger { background-color: rgba(var(--sprh-danger-rgb), 0.12) !important; color: var(--sprh-danger) !important; }
.text-bg-secondary { background-color: rgba(var(--sprh-muted-rgb), 0.12) !important; color: var(--sprh-muted) !important; }
.text-bg-dark { background-color: var(--sprh-primary-darker) !important; color: var(--sprh-surface) !important; }
.text-bg-light { background-color: var(--sprh-bg) !important; color: var(--sprh-text) !important; }

/* Bootstrap bg-* classes */
.bg-primary { background-color: var(--sprh-primary) !important; }
.bg-secondary { background-color: var(--sprh-muted) !important; }
.bg-success { background-color: var(--sprh-success) !important; }
.bg-warning { background-color: var(--sprh-warning) !important; }
.bg-danger { background-color: var(--sprh-danger) !important; }
.bg-info { background-color: var(--sprh-info) !important; }
.bg-light { background-color: var(--sprh-bg) !important; }
.bg-dark { background-color: var(--sprh-primary-darker) !important; }
.bg-white { background-color: var(--sprh-surface) !important; }

/* Bootstrap card */
.card {
  background: var(--sprh-surface-elevated);
  border: 1px solid var(--sprh-border-subtle);
  border-radius: var(--sprh-radius-xl);
  box-shadow: var(--sprh-shadow-soft);
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing);
}
.card.border-0 { border: 1px solid var(--sprh-border-subtle) !important; }
.sprh-card.border-0,
.sprh-panel.border-0 {
  border: 1px solid var(--sprh-border-subtle) !important;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
}
.card-header { background: var(--sprh-surface-elevated); border-bottom: 1px solid var(--sprh-border-subtle); }

/* Bootstrap shadows -> DS shadow (avoid "marketing" contrast) */
.shadow-sm,
.shadow {
  box-shadow: var(--sprh-shadow-soft) !important;
}
.shadow-lg {
  box-shadow: var(--sprh-shadow-soft) !important;
}

/* Bootstrap table */
.table {
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
  table-layout: auto;
  width: 100%;
}
.table td,
.table th {
  vertical-align: middle;
}
.table td {
  word-break: normal;
  overflow-wrap: break-word;
}
.table > :not(caption) > * > * {
  padding: var(--sprh-space-sm) var(--sprh-space-lg);
}
.table.table > thead > tr > th {
  background-color: var(--sprh-surface-alt);
  color: var(--sprh-muted);
  font-weight: var(--sprh-font-weight-bold);
  font-size: var(--sprh-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--sprh-border-subtle);
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: none;
}
.table-hover tbody tr:hover {
  background: rgba(var(--sprh-primary-rgb), 0.04);
  transition: background var(--sprh-duration-fast) var(--sprh-easing);
}

/* Bootstrap forms */
.form-control, .form-select {
  border-radius: var(--sprh-radius-md);
  border-color: var(--sprh-border);
  min-height: 42px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--sprh-primary);
  box-shadow: var(--sprh-shadow-focus);
}

/* Bootstrap buttons */
.btn {
  border-radius: var(--sprh-radius-md);
  font-weight: var(--sprh-font-weight-semibold);
  min-height: 42px;
  padding: 10px 16px;
  transition: transform var(--sprh-duration) var(--sprh-easing),
              box-shadow var(--sprh-duration) var(--sprh-easing),
              background-color var(--sprh-duration) var(--sprh-easing),
              border-color var(--sprh-duration) var(--sprh-easing);
}

.btn-sm,
.btn-group-sm > .btn {
  min-height: 34px;
  padding: 6px 12px;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--sprh-shadow-focus);
}

.btn:not(:disabled):not(.disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--sprh-shadow-hover);
}

.btn:not(:disabled):not(.disabled):active {
  transform: translateY(0);
  box-shadow: var(--sprh-shadow-soft);
}
.btn-primary { background-color: var(--sprh-primary); border-color: var(--sprh-primary); }
.btn-primary:hover { background-color: var(--sprh-primary-dark); border-color: var(--sprh-primary-dark); }
.btn-secondary { background-color: var(--sprh-muted); border-color: var(--sprh-muted); }
.btn-success { background-color: var(--sprh-success); border-color: var(--sprh-success); color: var(--sprh-text); }
.btn-success:hover,
.btn-success:focus-visible,
.btn-success:active {
  color: var(--sprh-text);
}
.btn-warning { background-color: var(--sprh-warning); border-color: var(--sprh-warning); }
.btn-danger { background-color: var(--sprh-danger); border-color: var(--sprh-danger); }

/* Bootstrap progress */
.progress {
  border-radius: var(--sprh-radius-full);
  background: rgba(var(--sprh-muted-rgb), 0.12);
}
.progress-bar { transition: width var(--sprh-duration) var(--sprh-easing); }
