:root {
  --bg-page: #eef3ff;
  --bg-surface: rgba(255, 255, 255, 0.9);
  --bg-sidebar: linear-gradient(180deg, #0b1220 0%, #111b34 100%);
  --bg-topbar: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #4338ca 100%);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-soft: rgba(148, 163, 184, 0.18);
  --shadow-soft: 0 14px 40px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 20px 50px rgba(15, 23, 42, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

body {
  font-family: Inter, Segoe UI, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 24%),
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f9ff 0%, var(--bg-page) 100%);
  color: var(--text-main);
}

a {
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  background: var(--bg-topbar);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.topbar .navbar-brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar-link {
  border-radius: 999px;
  padding: 0.55rem 0.8rem !important;
}

.topbar-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-shell {
  width: 290px;
}

.sidebar {
  min-height: calc(100vh - 58px);
  background: var(--bg-sidebar);
  color: #e2e8f0;
  border: 0 !important;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

@media (min-width: 992px) {
  .sidebar-shell {
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    align-self: flex-start;
  }

  .sidebar-shell .offcanvas-body {
    height: 100%;
  }

  .sidebar-shell .sidebar {
    height: 100%;
    overflow-y: auto;
  }
}

.sidebar .text-muted {
  color: #94a3b8 !important;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.3rem 0.25rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 25px rgba(96, 165, 250, 0.22);
}

.sidebar-section {
  padding-top: 0.9rem;
}

.sidebar-mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 0.75rem 0 0.25rem;
}

.sidebar-mini-stats > div {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 0.75rem 0.8rem;
}

.sidebar-mini-stats span {
  display: block;
  font-size: 0.68rem;
  color: #8da2c3;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sidebar-mini-stats strong {
  display: block;
  font-size: 1.1rem;
  color: #fff;
  margin-top: 0.2rem;
}

.sidebar-mini-link {
  display: inline-block;
  color: inherit;
  border-radius: 12px;
  transition: transform 0.18s ease, background 0.18s ease;
}

.sidebar-mini-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.sidebar-group-toggle {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.34), rgba(79, 70, 229, 0.24));
  color: #fff;
  padding: 0.8rem 0.95rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  transition: background 0.18s ease, transform 0.18s ease;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.sidebar-group-toggle:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.42), rgba(79, 70, 229, 0.30));
  transform: translateX(2px);
}

.sidebar-group-toggle.quick {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.32), rgba(59, 130, 246, 0.26));
}

.sidebar-group-toggle.quick:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.42), rgba(59, 130, 246, 0.34));
}

.sidebar-group-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.sidebar-group-toggle i {
  transition: transform 0.18s ease;
}

.sidebar-group {
  padding-top: 0.35rem;
}

.sidebar-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8da2c3;
  margin-bottom: 0.65rem;
  font-weight: 700;
}

.sidebar-nav .nav-link {
  color: #dbe5f4;
  border-radius: 14px;
  padding: 0.74rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  transition: all 0.18s ease;
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.28), rgba(167, 139, 250, 0.26));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 10px 24px rgba(15, 23, 42, 0.10);
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
}

.sidebar-nav .nav-link {
  margin-left: 0.25rem;
}

.content-surface,
.card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  background: var(--bg-surface);
  backdrop-filter: blur(10px);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-body {
  padding: 1.25rem;
}

.btn {
  border-radius: 999px;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border: 0;
}

.btn-primary:hover {
  filter: brightness(1.02);
}

.btn-outline-primary {
  border-color: rgba(37, 99, 235, 0.25);
}

.btn-outline-secondary,
.btn-outline-danger {
  border-width: 1px;
}

.form-control,
.form-select,
.form-check-input {
  border-radius: 14px;
}

.form-control,
.form-select {
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.form-control:focus,
.form-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12);
}

.table {
  color: var(--text-main);
}

.table thead th {
  border-bottom: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table-hover tbody tr {
  transition: transform 0.15s ease, background 0.15s ease;
}

.table-hover tbody tr:hover {
  background: rgba(59, 130, 246, 0.04);
  transform: translateY(-1px);
}

.badge {
  border-radius: 999px;
  font-weight: 600;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2000;
}

.page-hero,
.projects-page .page-hero {
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 52%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.eyebrow,
.projects-page .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #c7d2fe;
  font-weight: 700;
}

.project-card,
.dashboard-panel {
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(8px);
}

.project-tabs,
.dashboard-tabs {
  background: #eef2ff;
  padding: 0.4rem;
  border-radius: 999px;
  display: inline-flex;
  gap: 0.25rem;
}

.project-tabs .nav-link,
.dashboard-tabs .nav-link {
  border: 0;
  border-radius: 999px;
  color: #475569;
  font-weight: 600;
}

.project-tabs .nav-link.active,
.dashboard-tabs .nav-link.active {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
}

.payment-panel {
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  border-radius: 20px;
  padding: 1rem;
}

.payment-summary,
.dashboard-mini-stat {
  border-radius: 20px;
  padding: 1.1rem 1.15rem;
  color: #fff;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.10);
}

.payment-summary {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
}

.payment-summary span,
.dashboard-mini-stat span {
  font-size: 0.82rem;
  opacity: 0.9;
}

.payment-summary strong,
.dashboard-mini-stat strong {
  font-size: 1.75rem;
  line-height: 1.1;
  margin: 0.35rem 0;
}

.payment-summary small {
  opacity: 0.88;
}

.payment-summary-total,
.dashboard-mini-stat {
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
}

.payment-summary-received,
.dashboard-mini-stat.received {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.payment-summary-balance {
  background: linear-gradient(135deg, #b45309, #f59e0b);
}

.payment-help {
  display: grid;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #475569;
}

.project-table tbody tr,
.dashboard-table tbody tr {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.project-table tbody tr:hover,
.dashboard-table tbody tr:hover {
  background: #f8fbff;
  transform: translateY(-1px);
}

.dashboard-mini-stat {
  min-width: 180px;
}

@media (max-width: 991.98px) {
  .sidebar-shell {
    width: min(86vw, 320px);
  }

  .sidebar {
    min-height: 100vh;
  }

  .topbar .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .topbar .navbar-brand {
    font-size: 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  main {
    padding: 1rem !important;
  }

  .table {
    font-size: 0.92rem;
  }
}

@media (max-width: 575.98px) {
  body {
    background: linear-gradient(180deg, #f8fbff 0%, #eef2ff 100%);
  }

  .page-hero,
  .projects-page .page-hero {
    padding: 1.1rem;
    border-radius: 20px;
  }

  .dashboard-mini-stat {
    min-width: 100%;
  }

  .sidebar-nav .nav-link {
    padding: 0.82rem 0.95rem;
  }

  .topbar .navbar-brand {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .btn {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
}
