/* Targeted responsiveness fixes for customized template screens. */

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
  min-width: 640px;
}

.apexcharts-canvas,
.apexcharts-svg {
  max-width: 100% !important;
}

.shared-dashboard-page .shared-dashboard-filters .card-body {
  padding: 1rem;
}

.shared-display-page .shared-dashboard-filters .card-body {
  padding: 1rem;
}

.shared-dashboard-page .shared-user-card .card-body {
  padding: 1rem;
}

.shared-display-page .shared-user-card .card-body {
  padding: 1rem;
}

.shared-dashboard-page .shared-user-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.shared-display-page .shared-user-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.shared-display-page .shared-user-metrics-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shared-dashboard-page .shared-user-metric {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(145, 158, 171, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
}

.shared-display-page .shared-user-metric {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(145, 158, 171, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
}

.shared-dashboard-page .shared-user-metric h3 {
  font-size: 1.2rem;
  line-height: 1.2;
  word-break: break-word;
}

.shared-display-page .shared-user-metric h3 {
  font-size: 1.15rem;
  line-height: 1.2;
  word-break: break-word;
}

.shared-dashboard-page .shared-user-metric p {
  font-size: 0.8rem;
  line-height: 1.35;
}

.shared-display-page .shared-user-metric p {
  font-size: 0.8rem;
  line-height: 1.35;
}

.shared-dashboard-page .shared-summary-card .table-responsive > .table {
  min-width: 480px;
}

.shared-dashboard-page .shared-piggy {
  max-height: 140px;
  width: auto;
}

.shared-dashboard-page #chart-radial-multiple,
.shared-dashboard-page #chart-tree {
  min-height: 260px;
}

.shared-dashboard-page #firstUserTable,
.shared-dashboard-page #secondUserTable {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 500;
}

.shared-dashboard-page .table-responsive > .table {
  min-width: 920px;
}

/* Flat sidebar navigation: hierarchy comes from spacing and the template's native active state. */
.left-sidebar {
  background: var(--bs-body-bg);
  border-right: 1px solid var(--bs-border-color);
}

.left-sidebar .scroll-sidebar {
  padding: 0 16px;
}

.sidebar-nav ul .sidebar-item .sidebar-link {
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--bs-body-color);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-nav ul .sidebar-item > .sidebar-link > span:first-child {
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  transform: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-nav ul .sidebar-item > .sidebar-link:hover {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
}

.sidebar-nav ul .sidebar-item > .sidebar-link:hover > span:first-child {
  background: transparent;
  color: inherit;
  transform: none;
}

.sidebar-nav ul .sidebar-item.selected > .sidebar-link.active,
.sidebar-nav ul .sidebar-item.selected > .sidebar-link,
.sidebar-nav ul .sidebar-item > .sidebar-link.active {
  background: var(--bs-primary-bg-subtle) !important;
  border-left: 3px solid var(--bs-primary);
  box-shadow: none !important;
  color: var(--bs-primary) !important;
}

.sidebar-nav ul .sidebar-item.selected > .sidebar-link > span:first-child,
.sidebar-nav ul .sidebar-item > .sidebar-link.active > span:first-child {
  background: transparent;
  color: inherit;
  transform: none;
}

.sidebar-nav ul .sidebar-item .first-level .sidebar-item > .sidebar-link > div:first-child,
.sidebar-nav ul .sidebar-item .first-level .sidebar-item > .sidebar-link:hover > div:first-child,
.sidebar-nav ul .sidebar-item .first-level .sidebar-item > .sidebar-link.active > div:first-child {
  background: transparent;
  color: inherit;
}

.sidebar-nav ul .sidebar-item .first-level .sidebar-item > .sidebar-link {
  padding: 8px 12px;
}

.fixed-profile {
  border: 1px solid var(--bs-border-color);
  box-shadow: none;
}

@media (max-width: 991.98px) {
  .nav.nav-pills.card.flex-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav.nav-pills.card.flex-row .nav-item {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .nav.nav-pills.card.flex-row .nav-item.d-flex {
    flex: 1 1 100%;
    align-items: stretch !important;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .nav.nav-pills.card.flex-row .nav-item.d-flex label {
    margin: 0 !important;
    min-width: 96px;
    align-self: center;
  }

  .nav.nav-pills.card.flex-row .form-control,
  .nav.nav-pills.card.flex-row .form-select {
    flex: 1 1 220px;
    min-width: 0;
  }

  .nav.nav-pills.card.flex-row .nav-item.ms-auto {
    margin-inline-start: 0 !important;
    width: 100%;
  }

  .nav.nav-pills.card.flex-row .btn {
    width: 100%;
    justify-content: center;
  }

  .nav.nav-pills .nav-link {
    white-space: normal;
    text-align: center;
  }

  .shared-dashboard-page .shared-user-metrics {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .shared-display-page .shared-user-metrics {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .shared-dashboard-page .shared-summary-card .card-body {
    padding: 0.85rem;
  }

  .shared-dashboard-page .table-responsive > .table {
    min-width: 760px;
  }
}

@media (max-width: 767.98px) {
  .body-wrapper {
    overflow-x: hidden;
  }

  .table-responsive > .table {
    min-width: 560px;
  }

  #financial,
  #chart,
  #chart-bar-stacked,
  #chart-area-spline,
  #category-overview {
    min-height: 220px;
  }

  .shared-dashboard-page .shared-dashboard-filters .form-control,
  .shared-dashboard-page .shared-dashboard-filters .form-select {
    height: 42px;
  }

  .shared-display-page .shared-dashboard-filters .form-control,
  .shared-display-page .shared-dashboard-filters .form-select {
    height: 42px;
  }

  .shared-dashboard-page .shared-user-card .card-body {
    padding: 0.8rem;
  }

  .shared-display-page .shared-user-card .card-body {
    padding: 0.8rem;
  }

  .shared-dashboard-page .shared-user-metric h3 {
    font-size: 1.05rem;
  }

  .shared-display-page .shared-user-metric h3 {
    font-size: 1.05rem;
  }

  .shared-dashboard-page .shared-user-metric p {
    font-size: 0.75rem;
  }

  .shared-display-page .shared-user-metric p {
    font-size: 0.75rem;
  }

  .shared-dashboard-page .shared-piggy {
    max-height: 96px;
  }

  .shared-dashboard-page #chart-radial-multiple,
  .shared-dashboard-page #chart-tree {
    min-height: 220px;
  }

  .shared-dashboard-page .table-responsive > .table {
    min-width: 660px;
  }
}

/* Home dashboard, Budget dashboard, Investments dashboard, Money/Banks:
   same chart-min-height / table-min-width treatment already proven on the
   shared-account pages, applied to the other chart-heavy dashboards. */

.home-page #networth-change-chart,
.home-page #bank-overview,
.budget-dashboard-page #chart,
.budget-dashboard-page #chart-radial-multiple,
.budget-dashboard-page #chart-tree,
.investments-dashboard-page #allocationChart,
.investments-dashboard-page #performersChart,
.investments-dashboard-page #monthlyGrowthChart,
.investments-dashboard-page #categoryGrowthChart {
  min-height: 260px;
}

.home-page .expenses-table.table-responsive > .table {
  min-width: 1100px;
}

/* The bank entries table only has 3 narrow columns (bank, date, amount) --
   the generic 640px floor below forces an unnecessary horizontal scroll
   on phones for a table that would otherwise fit. */
.money-banks-page #bankAmountTable {
  min-width: 0;
}

@media (max-width: 991.98px) {
  .home-page #financial,
  .home-page #networth-change-chart,
  .home-page #category-overview,
  .home-page #bank-overview,
  .budget-dashboard-page #chart,
  .budget-dashboard-page #chart-radial-multiple,
  .budget-dashboard-page #chart-tree,
  .investments-dashboard-page #allocationChart,
  .investments-dashboard-page #performersChart,
  .investments-dashboard-page #monthlyGrowthChart,
  .investments-dashboard-page #categoryGrowthChart {
    min-height: 240px;
  }

  .home-page .expenses-table.table-responsive > .table {
    min-width: 920px;
  }
}

@media (max-width: 767.98px) {
  .home-page #financial,
  .home-page #networth-change-chart,
  .home-page #category-overview,
  .home-page #bank-overview,
  .budget-dashboard-page #chart,
  .budget-dashboard-page #chart-radial-multiple,
  .budget-dashboard-page #chart-tree,
  .investments-dashboard-page #allocationChart,
  .investments-dashboard-page #performersChart,
  .investments-dashboard-page #monthlyGrowthChart,
  .investments-dashboard-page #categoryGrowthChart {
    min-height: 220px;
  }

  .home-page .expenses-table.table-responsive > .table {
    min-width: 760px;
  }
}
