/* Member Portal — shared design system */

.mp-page .divider {
  margin-bottom: 1.5rem;
}

/* Cards */
.mp-card {
  border: 1px solid #e8ebf2;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, var(--bs-brand-bg) 100%);
  padding: 1.25rem 1.5rem;
  height: 100%;
  transition: box-shadow 0.2s ease;
}

.mp-card:hover {
  box-shadow: 0 6px 20px rgba(87, 97, 157, 0.1);
}

.mp-card-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bs-brand-bg);
  color: var(--bs-brand);
  font-size: 1.5rem;
}

.mp-card-icon-sm {
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
  border-radius: 8px;
}

.mp-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.mp-stat-value {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--bs-brand);
  line-height: 1.2;
  margin: 0;
}

.mp-stat-value-lg {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.mp-stat-value.is-negative {
  color: #c0392b;
}

.mp-stat-value.is-positive {
  color: #2d7a4f;
}

.mp-stat-hint {
  font-size: 0.8rem;
  color: #6c757d;
  margin: 0.35rem 0 0;
}

/* Stat grid */
.mp-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.mp-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Sections */
.mp-section {
  margin-top: 0.5rem;
}

.mp-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mp-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bs-brand);
  margin: 0;
}

.mp-section-title i {
  opacity: 0.85;
}

/* Tables */
.mp-table-card {
  border: 1px solid #e8ebf2;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.mp-table-card .table-responsive {
  margin: 0;
}

.mp-table-card table {
  margin-bottom: 0 !important;
  font-size: 0.875rem !important;
}

.mp-table-card table thead th {
  background: var(--bs-brand-bg);
  color: var(--bs-gray-900);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-color: #e8ebf2;
  white-space: nowrap;
  vertical-align: middle;
  padding: 0.75rem 0.65rem;
}

.mp-table-card table tbody td {
  vertical-align: middle;
  padding: 0.7rem 0.65rem;
  border-color: #eef0f5;
}

.mp-table-card table tbody tr {
  transition: background-color 0.15s ease;
}

.mp-table-card table tbody tr:hover {
  background-color: rgba(242, 243, 248, 0.6);
}

.mp-table-card table tbody td a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--bs-brand);
  background: var(--bs-brand-bg);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mp-table-card table tbody td a:hover {
  background: var(--bs-brand);
  color: #fff;
}

.mp-table-card .dataTables_wrapper .dataTables_length,
.mp-table-card .dataTables_wrapper .dataTables_info,
.mp-table-card .dataTables_wrapper .dataTables_paginate {
  padding: 0.75rem 1rem;
}

.mp-table-card .dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px !important;
}

.mp-table-card .dataTables_processing {
  background: rgba(255, 255, 255, 0.92) !important;
  border-radius: 8px;
  border: none !important;
  box-shadow: none !important;
  color: var(--bs-brand) !important;
  font-weight: 500;
}

div.dt-processing,
.dataTables_processing {
  border: none !important;
  box-shadow: none !important;
}

/* Modals */
.mp-modal .modal-content {
  border: none;
  border-radius: 12px;
  overflow: hidden;
}

.mp-modal .modal-header {
  background: var(--bs-brand-bg);
  border-bottom: 1px solid #e8ebf2;
  padding: 1rem 1.25rem;
}

.mp-modal .modal-title {
  font-weight: 600;
  color: var(--bs-brand);
}

.mp-modal .modal-body {
  padding: 1.25rem;
  max-height: 70vh;
  overflow-y: auto;
}

/* List card (sub-accounts, etc.) */
.mp-list-card {
  border: 1px solid #e8ebf2;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.mp-list-card .list-group-item {
  border-color: #eef0f5;
  padding: 0.85rem 1.25rem;
  transition: background-color 0.15s ease;
}

.mp-list-card .list-group-item:hover {
  background-color: rgba(242, 243, 248, 0.6);
}

.mp-list-card .list-group-item:last-child {
  border-bottom: none;
}

.mp-badge {
  background: var(--bs-brand-bg) !important;
  color: var(--bs-brand) !important;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Status badges */
.mp-status-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.mp-status-badge.is-open {
  background: #e8f5ee;
  color: #2d7a4f;
}

.mp-status-badge.is-closed {
  background: #f0f1f5;
  color: #6c757d;
}

/* Ledger summary inside modals */
.mp-ledger-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.mp-ledger-summary-item {
  border: 1px solid #e8ebf2;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff 0%, var(--bs-brand-bg) 100%);
  padding: 0.85rem 1rem;
}

/* Date / filter toolbar */
.mp-filters {
  flex: 1 1 320px;
  max-width: 480px;
}

.mp-filters-wide {
  max-width: 640px;
}

.mp-filters .row {
  --bs-gutter-x: 0.5rem;
}

.mp-filter-actions {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}

.mp-filter-actions .btn {
  flex: 1;
  min-width: 38px;
}

.mp-filter-actions .btn-clear {
  background: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
}

.mp-filter-actions .btn-clear:hover {
  background: #f8f9fa;
  color: var(--bs-brand);
  border-color: var(--bs-brand);
}

.mp-page .btn-clear {
  background: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
}

.mp-page .btn-clear:hover {
  background: #f8f9fa;
  color: var(--bs-brand);
  border-color: var(--bs-brand);
}

/* Circular icon button — close / remove */
.mp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--bs-brand-subtle, #dcdeeb);
  border-radius: 50%;
  background: #fff;
  color: var(--bs-brand);
  box-shadow: 0 1px 4px rgba(87, 97, 157, 0.12);
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
}

.mp-icon-btn i {
  font-size: 0.8rem;
  line-height: 1;
}

.mp-icon-btn:hover,
.mp-icon-btn:focus {
  background: var(--bs-brand-bg, #f2f3f8);
  color: var(--bs-brand);
  border-color: var(--bs-brand);
}

.mp-icon-btn:focus-visible {
  outline: 2px solid var(--bs-brand);
  outline-offset: 2px;
}

.mp-icon-btn-sm {
  width: 1.3rem;
  height: 1.3rem;
}

.mp-icon-btn-sm i {
  font-size: 0.6rem;
}

/* ── Shared loading spinner (mp-loading) ── */
.mp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  text-align: center;
}

.mp-loading__spinner {
  color: var(--bs-brand);
  font-size: 2rem;
  line-height: 1;
}

.mp-loading__text {
  color: #6c757d;
  font-weight: 600;
  margin: 0;
}

.mp-loading--compact {
  flex-direction: row;
  gap: 0.5rem;
  padding: 1rem;
}

.mp-loading--compact .mp-loading__spinner {
  font-size: 1rem;
}

.mp-loading--compact .mp-loading__text {
  font-weight: 500;
}

.mp-loading--inline {
  display: inline-flex;
  flex-direction: row;
  gap: 0.35rem;
  padding: 0;
}

.mp-loading--inline .mp-loading__spinner {
  font-size: 1.25rem;
}

.mp-loading--sm {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
}

.mp-loading--sm .mp-loading__spinner {
  font-size: 0.875rem;
}

.mp-loading--sm .mp-loading__text {
  font-weight: 500;
  color: inherit;
}

.mp-loading.hide {
  display: none !important;
}

@media (max-width: 575.98px) {
  .mp-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .mp-filters,
  .mp-filters-wide {
    max-width: none;
  }
}
