.page-hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.4rem;
  padding: clamp(1.2rem, 2.5vw, 2rem);
  margin-bottom: 1.35rem;
  overflow: hidden;
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius-lg);
  background:
    linear-gradient(135deg, rgba(var(--kp-primary-rgb), 0.13), rgba(255, 255, 255, 0.94) 48%, rgba(var(--kp-accent-rgb), 0.055)),
    #fff;
  box-shadow: var(--kp-shadow-sm);
}

.page-hero::after {
  position: absolute;
  right: -3.5rem;
  bottom: -5rem;
  width: 14rem;
  height: 14rem;
  content: "";
  border: 1.4rem solid rgba(var(--kp-primary-rgb), 0.07);
  border-radius: 50%;
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.page-hero.compact {
  padding: 1.25rem 1.4rem;
}

.page-hero h1 {
  max-width: 900px;
  margin: 0 0 0.4rem;
  color: var(--kp-navy);
  font-size: clamp(1.7rem, 3.2vw, 2.7rem);
  font-weight: 950;
  letter-spacing: -0.055em;
}

.page-hero p {
  max-width: 830px;
  margin: 0;
  color: var(--kp-muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.surface-card,
.kp-card {
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--kp-shadow-xs);
}

.surface-card {
  padding: 1.25rem;
}

.kp-card {
  height: 100%;
  padding: 1.25rem;
}

.kp-card-title {
  margin-bottom: 0.35rem;
  font-size: 1.03rem;
  font-weight: 850;
}

.kp-card-subtitle {
  color: var(--kp-muted);
  font-size: 0.86rem;
}

.kp-card-hover:hover {
  border-color: rgba(var(--kp-primary-rgb), 0.42);
  box-shadow: var(--kp-shadow-sm);
  transform: translateY(-2px);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  position: relative;
  min-height: 132px;
  padding: 1.15rem;
  overflow: hidden;
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius);
  background: #fff;
  box-shadow: var(--kp-shadow-xs);
}

.stat-card::after {
  position: absolute;
  right: -1.8rem;
  bottom: -2.2rem;
  width: 6rem;
  height: 6rem;
  content: "";
  border-radius: 50%;
  background: rgba(var(--kp-primary-rgb), 0.08);
}

.stat-card-icon {
  display: inline-grid;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.85rem;
  place-items: center;
  border-radius: 0.75rem;
  color: var(--kp-primary-700);
  background: var(--kp-primary-100);
  font-size: 1.05rem;
}

.stat-card span {
  display: block;
  color: var(--kp-muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 0.15rem;
  color: var(--kp-navy);
  font-size: clamp(1.55rem, 2.7vw, 2rem);
  font-weight: 950;
  line-height: 1.1;
}

.stat-card small {
  color: var(--kp-muted-2);
  font-size: 0.74rem;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--kp-border);
  background: #fff;
}

.table-toolbar h2 {
  margin: 0;
  font-size: 1rem;
}

.table-responsive {
  scrollbar-color: var(--kp-border-strong) transparent;
  scrollbar-width: thin;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--kp-primary-050);
  --bs-table-striped-bg: rgba(249, 251, 253, 0.72);
  margin-bottom: 0;
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: 0.9rem 1rem;
  border-bottom-color: var(--kp-border);
}

.table thead th {
  color: var(--kp-muted);
  background: var(--kp-surface-soft);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table tbody tr:hover {
  --bs-table-accent-bg: var(--kp-primary-050);
}

.table-primary-text {
  color: var(--kp-navy);
  font-weight: 800;
}

.table-secondary-text {
  color: var(--kp-muted);
  font-size: 0.78rem;
}

.filter-card {
  padding: 1rem;
}

.form-control,
.form-select {
  min-height: 2.72rem;
  border-color: var(--kp-border-strong);
  border-radius: 0.72rem;
  color: var(--kp-ink);
  background-color: #fff;
  box-shadow: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--kp-primary);
  box-shadow: 0 0 0 0.23rem rgba(var(--kp-primary-rgb), 0.15);
}

textarea.form-control {
  min-height: 7rem;
}

.form-label {
  margin-bottom: 0.38rem;
  color: var(--kp-navy);
  font-size: 0.82rem;
  font-weight: 780;
}

.form-text,
.helptext {
  color: var(--kp-muted);
  font-size: 0.74rem;
}

.form-check-input:checked {
  border-color: var(--kp-primary-700);
  background-color: var(--kp-primary-700);
}

.form-section {
  padding-bottom: 1.3rem;
  margin-bottom: 1.3rem;
  border-bottom: 1px solid var(--kp-border);
}

.form-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.form-section-title {
  margin-bottom: 0.2rem;
  font-size: 1rem;
}

.form-section-description {
  margin-bottom: 1rem;
  color: var(--kp-muted);
  font-size: 0.82rem;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 1.2rem;
  margin-top: 1.3rem;
  border-top: 1px solid var(--kp-border);
}

.btn {
  min-height: 2.55rem;
  padding: 0.58rem 0.95rem;
  border-radius: 0.7rem;
  font-size: 0.84rem;
  font-weight: 750;
}

.btn-sm {
  min-height: 2.05rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.58rem;
  font-size: 0.76rem;
}

.btn-kp-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--kp-primary), var(--kp-primary-700));
  box-shadow: 0 8px 18px rgba(var(--kp-primary-rgb), 0.22);
}

.btn-kp-primary:hover,
.btn-kp-primary:focus {
  color: #fff;
  background: linear-gradient(135deg, var(--kp-primary-700), var(--kp-navy));
  transform: translateY(-1px);
}

.btn-outline-secondary {
  border-color: var(--kp-border-strong);
  color: var(--kp-navy);
  background: #fff;
}

.btn-outline-secondary:hover {
  border-color: var(--kp-navy);
  color: #fff;
  background: var(--kp-navy);
}

.btn-icon {
  display: inline-grid;
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  place-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.7rem;
  padding: 0.25rem 0.58rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.status-pill::before {
  width: 0.42rem;
  height: 0.42rem;
  content: "";
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.status-pill.success {
  color: #146c43;
  background: var(--kp-success-soft);
}

.status-pill.warning {
  color: #9a5705;
  background: var(--kp-warning-soft);
}

.status-pill.danger {
  color: #a52d3a;
  background: var(--kp-danger-soft);
}

.status-pill.info {
  color: var(--kp-primary-700);
  background: var(--kp-info-soft);
}

.status-pill.neutral {
  color: #5e6878;
  background: #eef2f5;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 1rem;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.detail-item {
  padding: 0.9rem;
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius-sm);
  background: var(--kp-surface-soft);
}

.detail-item dt {
  margin-bottom: 0.15rem;
  color: var(--kp-muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-item dd {
  margin: 0;
  color: var(--kp-navy);
  font-weight: 750;
}

.empty-state {
  display: grid;
  min-height: 230px;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.empty-state-icon {
  display: inline-grid;
  width: 4rem;
  height: 4rem;
  margin-bottom: 0.85rem;
  place-items: center;
  border-radius: 1.2rem;
  color: var(--kp-primary-700);
  background: var(--kp-primary-100);
  font-size: 1.55rem;
}

.empty-state h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.empty-state p {
  max-width: 430px;
  color: var(--kp-muted);
  font-size: 0.84rem;
}

.kp-alerts {
  position: relative;
  z-index: 3;
  margin-bottom: 1rem;
}

.kp-alerts .alert {
  border: 1px solid currentColor;
  border-radius: var(--kp-radius-sm);
  box-shadow: var(--kp-shadow-xs);
}

.pagination {
  --bs-pagination-color: var(--kp-navy);
  --bs-pagination-hover-color: var(--kp-primary-700);
  --bs-pagination-active-bg: var(--kp-primary-700);
  --bs-pagination-active-border-color: var(--kp-primary-700);
  --bs-pagination-border-color: var(--kp-border);
  gap: 0.25rem;
}

.page-link {
  border-radius: 0.55rem !important;
}

.timeline {
  position: relative;
  padding-left: 1.35rem;
  margin: 0;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 0.45rem;
  bottom: 0.45rem;
  left: 0.32rem;
  width: 1px;
  content: "";
  background: var(--kp-border-strong);
}

.timeline-item {
  position: relative;
  padding: 0 0 1rem 0.7rem;
}

.timeline-item::before {
  position: absolute;
  top: 0.4rem;
  left: -1.14rem;
  width: 0.62rem;
  height: 0.62rem;
  content: "";
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--kp-primary);
  box-shadow: 0 0 0 1px var(--kp-primary);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.kp-progress {
  height: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f6;
}

.kp-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--kp-primary), var(--kp-primary-700));
}

@media (max-width: 991.98px) {
  .page-hero,
  .page-actions,
  .form-actions {
    align-items: stretch;
  }

  .page-hero {
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .stat-grid,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }

  .table > :not(caption) > * > * {
    padding: 0.78rem;
  }
}
