:root {
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --bg: #f6f7fb;
  --text: #0f172a;
  --muted: #64748b;
}

body.bg-app {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: inline-block;
}
.brand-dot-lg {
  width: 48px;
  height: 48px;
}

.balance-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border-radius: 18px;
  overflow: hidden;
}
.balance-amount {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.balance-add {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-size: 1.4rem;
  border: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.balance-add:hover {
  color: var(--brand-2);
}

.stat-card {
  border-radius: 14px;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tx-row {
  transition: background 0.15s ease;
}
.tx-row:hover {
  background: rgba(79, 70, 229, 0.04);
}
.tx-row:last-child {
  border-bottom: 0 !important;
}
.tx-icon {
  width: 36px;
  text-align: center;
}

/* Floating action button */
.fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1030;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fab:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(79, 70, 229, 0.5);
}

/* Type selector grid */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
@media (max-width: 480px) {
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.type-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.5rem;
  gap: 0.25rem;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  transition: all 0.15s ease;
}
.type-card:hover {
  border-color: #cbd5e1;
}
.type-radio:checked + .type-danger {
  border-color: #dc3545;
  background: #fff5f5;
  color: #dc3545;
}
.type-radio:checked + .type-success {
  border-color: #198754;
  background: #f1faf3;
  color: #198754;
}
.type-radio:checked + .type-primary {
  border-color: var(--brand);
  background: #eef2ff;
  color: var(--brand);
}
.type-radio:checked + .type-warning {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}

/* Debt summaries */
.debt-summary {
  border-radius: 16px;
  color: #fff;
}
.debt-summary-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.debt-summary-success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.debt-row {
  border-radius: 12px;
  border-left: 4px solid transparent !important;
}
.debt-row-danger {
  border-left-color: #dc3545 !important;
}
.debt-row-success {
  border-left-color: #198754 !important;
}

.card {
  border-radius: 14px;
}

.navbar .nav-link {
  font-weight: 500;
}
.navbar .nav-link:hover {
  color: var(--brand);
}

/* Bootstrap primary tweak */
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-2);
  border-color: var(--brand-2);
}
.text-primary {
  color: var(--brand) !important;
}
.progress-bar {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

/* Famille / membres */
.invite-code {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .15em;
  background: #f1f3ff;
  color: var(--brand);
  user-select: all;
}
.invite-card {
  background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
}
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
