:root {
  --bg: #111827;
  --card: #1f2937;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --border: #374151;
  --hover-bg: #374151;
  --radius: 8px;
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}

.app-logo {
  flex-shrink: 0;
}

header .user-menu {
  display: flex;
  gap: 4px;
  align-items: center;
}

header .user-name {
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: default;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--hover-bg);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
}

.btn-outline:hover {
  background: var(--hover-bg);
  border-color: var(--text-muted);
}

.btn-error {
  background: var(--danger);
  color: white;
}

.btn-error:hover {
  background: #dc2626;
}

.btn-small,
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 8px;
  border-radius: 50%;
  line-height: 0;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-icon-danger {
  background: transparent;
  color: var(--danger);
}

.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn-icon-primary {
  background: transparent;
  color: var(--primary);
}

.btn-icon-primary:hover {
  background: rgba(59, 130, 246, 0.15);
}

.btn-icon-secondary {
  background: transparent;
  color: var(--text-muted);
}

.btn-icon-secondary:hover {
  background: var(--hover);
  color: var(--text);
}

.btn-link {
  background: none;
  color: var(--primary);
  padding: 4px 8px;
}

.btn-link:hover {
  text-decoration: underline;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color-scheme: dark;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  width: 100%;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: brightness(0) invert(1);
  cursor: pointer;
}

input::placeholder {
  color: var(--text-muted);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.875rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

.total-balance-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.total-balance-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.total-balance-amount {
  font-size: 1.75rem;
  font-weight: 700;
}

.total-balance-amount .currency-balance-line {
  font-size: 1.25rem;
  line-height: 1.6;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header-actions {
  display: flex;
  gap: 8px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

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

.list-item:hover {
  background: var(--hover-bg);
}

.list-item-title {
  font-weight: 500;
}

.list-item-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.list-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-item-arrow {
  color: var(--text-muted);
}

.group-balance {
  font-weight: 600;
  font-size: 0.9rem;
}

.balance {
  font-weight: 600;
  font-size: 0.9375rem;
}

.balance.positive {
  color: var(--success);
}

.balance.negative {
  color: var(--danger);
}

.balance.zero {
  color: var(--text-muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--border);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 8px;
}

.auth-card p {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-card .btn {
  width: 100%;
}

.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.875rem;
}

.auth-pricing-info {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 12px;
  border: 1px dashed var(--primary);
}

.auth-pricing-info p {
  margin-bottom: 0 !important;
  font-size: 0.9375rem;
  color: var(--text);
}

.pricing-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stripe-card-container {
  margin-bottom: 24px;
}

.stripe-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#card-element {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.text-error {
  color: var(--danger);
}

.message {
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.message.info {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Legacy expense-item styles removed - using new .expenses-list .expense-item styles */

.expense-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.expense-desc {
  font-weight: 500;
}

.expense-amount {
  font-weight: 600;
}

.expense-amounts {
  text-align: right;
}

.expense-user-impact {
  font-size: 0.8rem;
  margin-top: 2px;
}

/* ======================
   Expense Form - New Design
   ====================== */

/* Hero Section */
.expense-hero {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 12px;
  text-align: center;
}

.expense-hero-description {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  text-align: left;
  width: 100%;
  padding: 8px;
  margin-top: 0;
  flex: 1;
}

.expense-hero-description:focus {
  outline: none;
  color: var(--text);
}

.expense-hero-description::placeholder {
  color: var(--text-muted);
}

.expense-hero-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.expense-hero-row:focus-within {
  border-color: var(--primary);
}

.category-trigger-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
}

.category-trigger-btn:hover {
  background: var(--hover-bg);
  border-color: var(--text-muted);
}

.category-trigger-btn.predicting {
  opacity: 0.5;
  pointer-events: none;
  cursor: wait;
}

.expense-hero-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.expense-hero-currency {
  font-size: 2rem;
  color: var(--text-muted);
  font-weight: 300;
}

.expense-hero-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 3.5rem;
  font-weight: 300;
  width: 200px;
  text-align: left;
  -moz-appearance: textfield;
}

.expense-hero-input::-webkit-outer-spin-button,
.expense-hero-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.expense-hero-input:focus {
  outline: none;
}

.expense-hero-input::placeholder {
  color: var(--border);
}

.expense-hero-date {
  display: inline-block;
  margin-bottom: 12px;
}

.expense-hero-date input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 0.875rem;
  cursor: pointer;
}

.expense-hero-date input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Expense Cards (Paid By, Beneficiary) */
.expense-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  cursor: pointer;
}

.expense-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.expense-card-avatar-alt {
  background: #14b8a6;
}

.expense-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.expense-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.expense-card-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.expense-card-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.expense-card-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Split Type Card */
.expense-split-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.expense-split-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.expense-split-options {
  display: flex;
  gap: 8px;
}

.expense-split-btn {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.expense-split-btn svg {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

.expense-split-btn span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.expense-split-btn:hover {
  border-color: var(--text-muted);
}

.expense-split-btn.active {
  background: var(--border);
  border-color: var(--text-muted);
}

.expense-split-btn.active svg,
.expense-split-btn.active span {
  color: var(--text);
}

/* Summary Card */
.expense-summary-card {
  background: linear-gradient(135deg,
      rgba(59, 130, 246, 0.15) 0%,
      rgba(139, 92, 246, 0.15) 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.expense-summary-card:empty {
  display: none;
}

.expense-summary-card .summary-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.expense-summary-card .summary-impact {
  font-weight: 600;
  margin-top: 4px;
}

/* Action Buttons */
.expense-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.expense-delete-btn {
  width: 56px;
  height: 56px;
  background: rgba(239, 68, 68, 0.15);
  border: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.expense-delete-btn svg {
  width: 24px;
  height: 24px;
  color: var(--danger);
}

.expense-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

.expense-save-btn {
  flex: 1;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.1s;
}

.expense-save-btn:hover {
  opacity: 0.9;
}

.expense-save-btn:active {
  transform: scale(0.98);
}

.expense-cancel-link {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 12px;
  cursor: pointer;
  text-align: center;
}

.expense-cancel-link:hover {
  color: var(--text);
}

/* Legacy expense-summary for backwards compat */
.expense-summary {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.expense-summary:empty {
  display: none;
}

.expense-summary .summary-impact {
  font-weight: 600;
  margin-top: 4px;
}

.expense-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 4px;
}

.expense-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--border);
  margin-left: 8px;
}

.expense-item.settle {
  opacity: 0.7;
  cursor: pointer;
}

.expense-item.settle:hover {
  background: var(--hover-bg);
}

.expense-type.settle {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.expenses-filter-row {
  display: flex;
  gap: 8px;
}

.expenses-filter-row input {
  flex: 1;
}

.expenses-filter-row select {
  width: auto;
  min-width: 140px;
}

.expenses-loading {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.settling-section {
  background: rgba(59, 130, 246, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  overflow: hidden;
}

.settling-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.settling-section.open .settling-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.settling-header:hover {
  background: var(--hover-bg);
}

.settling-title {
  font-weight: 600;
  font-size: 1rem;
}

.settling-toggle {
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.settling-section.open .settling-toggle {
  transform: rotate(180deg);
}

.settling-content {
  display: none;
  padding: 20px;
}

.settling-section.open .settling-content {
  display: block;
}

.settling-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settling-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.settling-item:last-of-type {
  margin-bottom: 16px;
}

.settling-amount {
  font-weight: 600;
  color: var(--primary);
}

.settling-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 12px;
}

.balance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition:
    background 0.15s,
    padding 0.15s,
    margin 0.15s;
}

.balance-item:last-child {
  border-bottom: none;
}

.balance-item:hover {
  background: var(--hover-bg);
}

.balance-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-name {
  font-weight: 500;
}

.balance-admin-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.balance-amount {
  font-size: 1.1rem;
  font-weight: 600;
}

.balance-amount.positive {
  color: var(--success);
}

.balance-amount.negative {
  color: var(--danger);
}

.balance-amount.zero {
  color: var(--text-muted);
}

.amount-positive {
  color: var(--success);
}

.amount-negative {
  color: var(--danger);
}

.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.member-item:last-child {
  border-bottom: none;
}

.member-info {
  display: flex;
  flex-direction: column;
}

.member-name {
  font-weight: 500;
}

.member-email {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.member-role {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--border);
}

.member-role.admin {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 120px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  margin-bottom: 16px;
  cursor: pointer;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

.group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.group-header .back-link {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.group-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.actions-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: stretch;
}

.actions-row .btn {
  flex: 1;
}

.actions-row .btn.btn-icon {
  flex: 0 0 auto;
}

.hidden {
  display: none !important;
}

/* Utility classes for CSP compliance */
.w-full {
  width: 100%;
}

.flex-1 {
  flex: 1;
}

.text-muted {
  color: var(--text-muted);
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mt-4 {
  margin-top: 4px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.gradient-start {
  stop-color: var(--primary);
}

.gradient-end {
  stop-color: var(--primary-hover);
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ======================
   Page Loading Spinner
   ====================== */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 12px;
}

.page-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.page-loading .spinner-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ======================
   Button Loading State
   ====================== */
.btn.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.btn-loading::after {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

.btn-danger.btn-loading::after,
.btn-error.btn-loading::after {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

.btn-secondary.btn-loading::after {
  border-color: var(--border);
  border-top-color: var(--text);
}

/* ======================
     Auth Tabs
     ====================== */
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ======================
     Profile View
     ====================== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.profile-header .back-link {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.profile-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.profile-info {
  margin-bottom: 24px;
}

.profile-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.profile-info-item:last-child {
  border-bottom: none;
}

.profile-info-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.profile-info-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-email {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.profile-email-readonly {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 8px 0;
  margin-bottom: 16px;
}

#edit-profile-form .form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

#edit-profile-form .form-actions .btn {
  flex: 1;
}

/* ======================
     Passkey List
     ====================== */
.passkey-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.passkey-item:last-child {
  border-bottom: none;
}

.passkey-info {
  flex: 1;
  min-width: 0;
}

.passkey-name {
  font-weight: 500;
  margin-bottom: 2px;
}

.passkey-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.passkey-actions {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.passkey-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.passkey-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Passkey login form */
.passkey-login-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}

.passkey-not-supported {
  text-align: center;
  padding: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 0.875rem;
}

/* Add passkey section */
.add-passkey-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 16px;
  }

  .actions-row {
    flex-direction: column;
  }

  header .user-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .balance-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .balance-left {
    min-width: 0;
    flex: 1;
  }
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Admin Styles */
.btn-icon-warning {
  background-color: var(--warning);
  color: white;
}

.btn-icon-warning:hover {
  background-color: #d97706;
}

.btn-warning {
  background-color: var(--warning);
  color: white;
}

.btn-warning:hover {
  background-color: #d97706;
}

/* Impersonation Banner */
.impersonation-banner {
  background-color: var(--warning);
  color: white;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.impersonation-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.impersonation-banner svg {
  flex-shrink: 0;
}

/* Subscription Banner */
.subscription-banner {
  background-color: var(--card);
  color: var(--text);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.subscription-banner.lapsed {
  background-color: rgba(239, 68, 68, 0.1);
  border-bottom-color: var(--danger);
}

.subscription-banner.lapsed svg {
  color: var(--danger);
}

.subscription-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
}

.subscription-banner-content svg {
  flex-shrink: 0;
}

/* Admin Stats Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 480px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Admin Search */
.admin-search {
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  width: 200px;
}

.admin-search:focus {
  outline: none;
  border-color: var(--primary);
}

/* Admin User List */
.admin-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s;
}

.admin-user-item:hover {
  background-color: var(--hover-bg);
}

.admin-user-item:last-child {
  border-bottom: none;
}

.admin-user-info-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.admin-user-email {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-user-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-admin {
  background-color: var(--primary);
  color: white;
}

.badge-banned {
  background-color: var(--danger);
  color: white;
}

.badge-unverified {
  background-color: var(--warning);
  color: white;
}

/* Admin User Modal */
.modal-wide {
  max-width: 500px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text);
}

.admin-user-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-user-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-user-detail .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-user-detail span:last-child {
  font-weight: 500;
}

.admin-user-activity {
  margin-bottom: 20px;
}

.admin-user-activity h4 {
  margin: 0 0 12px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.admin-activity-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.admin-activity-item:last-child {
  border-bottom: none;
}

.admin-activity-action {
  color: var(--text);
}

.admin-activity-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.admin-user-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* Admin Search Input */
.admin-search-input {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  width: 100%;
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Section Title */
.section-title {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 12px 0;
}

.section-title:first-child {
  margin-top: 0;
}

/* Admin User List Item Extensions */
.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.admin-user-name {
  font-weight: 600;
  color: var(--text);
}

.admin-user-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.admin-user-stats {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

/* Admin Modal Header */
.admin-modal-user-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-modal-user-main h3 {
  margin: 0 0 4px 0;
  font-size: 1.25rem;
}

.admin-modal-user-email {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.admin-modal-user-id {
  font-size: 0.75rem;
  margin-top: 4px;
}

/* Admin Modal Details */
.admin-modal-details {
  margin-bottom: 20px;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-detail-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-detail-item .value {
  font-weight: 500;
  color: var(--text);
}

/* Admin Modal Section */
.admin-modal-section {
  margin-bottom: 20px;
}

.admin-modal-section h4 {
  margin: 0 0 12px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Activity List */
.admin-activity-list {
  max-height: 150px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-action {
  color: var(--text);
}

.activity-date {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Invite List */
.admin-invites-list {
  max-height: 150px;
  overflow-y: auto;
}

.invite-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.invite-item:last-child {
  border-bottom: none;
}

.invite-email {
  color: var(--text);
  font-weight: 500;
}

.invite-group {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.invite-date {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.invite-status {
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
}

.invite-status.accepted {
  background-color: var(--success);
  color: white;
}

.invite-status.pending {
  background-color: var(--warning);
  color: white;
}

/* Empty State Small */
.empty-state-small {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-style: italic;
  padding: 8px 0;
}

/* ======================
   Category Selection Modal
   ====================== */
.modal-category {
  max-width: calc(100vw - 32px);
  width: fit-content;
}

@media (min-width: 520px) {
  .modal-category {
    max-width: 460px;
  }
}

.modal-category .btn-close {
  font-size: 2rem;
  padding: 8px;
  margin: -8px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

.category-grid::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari/Opera */
}

@media (min-width: 520px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 80px;
  aspect-ratio: 1;
  color: var(--text-muted);
}

.category-btn:hover {
  background: var(--hover-bg);
  border-color: var(--text-muted);
  color: var(--text);
}

.category-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

.category-btn-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.category-btn-label {
  font-size: 0.7rem;
  text-align: center;
  font-weight: 500;
  line-height: 1.2;
}

/* ======================
   Group View Redesign
   ====================== */

/* Group Header - Updated */
.group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.group-header .back-link {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.group-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.group-settings-btn {
  flex-shrink: 0;
}

/* Hero Status Card */
.hero-status-card {
  background: linear-gradient(135deg,
      var(--card) 0%,
      rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.hero-status-card.positive {
  background: linear-gradient(135deg,
      var(--card) 0%,
      rgba(34, 197, 94, 0.15) 100%);
  border-color: rgba(34, 197, 94, 0.3);
}

.hero-status-card.negative {
  background: linear-gradient(135deg,
      var(--card) 0%,
      rgba(239, 68, 68, 0.15) 100%);
  border-color: rgba(239, 68, 68, 0.3);
}

.hero-status-amount {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.hero-status-card.positive .hero-status-amount {
  color: var(--success);
}

.hero-status-card.negative .hero-status-amount {
  color: var(--danger);
}

.hero-status-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-action-btn {
  flex: 1;
  padding: 14px 16px;
  font-size: 0.9375rem;
  border-radius: 12px;
}

.quick-action-btn svg {
  flex-shrink: 0;
}

/* Members Horizontal Scroll */
.members-scroll-section {
  margin-bottom: 16px;
}

.members-scroll-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.members-scroll-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.members-scroll-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.members-scroll-container::-webkit-scrollbar {
  display: none;
}

.member-avatar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
  padding: 4px;
  border-radius: 12px;
  transition: background 0.15s;
}

.member-avatar-item:hover {
  background: var(--hover-bg);
}

.member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  position: relative;
}

.member-avatar.is-you {
  background: var(--primary);
  color: white;
}

.member-avatar-name {
  font-size: 0.6875rem;
  color: var(--text-muted);
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.member-avatar-balance {
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.member-avatar-balance.positive {
  color: var(--success);
}

.member-avatar-balance.negative {
  color: var(--danger);
}

.member-avatar-balance.zero {
  color: var(--text-muted);
}

/* Expenses Feed */
.expenses-feed {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.expenses-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.expenses-feed-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

/* Expenses Search Bar */
.expenses-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.expenses-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.expenses-search-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 0;
  font-size: 0.9375rem;
}

.expenses-search-input:focus {
  outline: none;
  border: none;
}

.expenses-filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.expenses-filter-btn:hover,
.expenses-filter-btn.active {
  background: var(--hover-bg);
  border-color: var(--text-muted);
  color: var(--text);
}

.expenses-filter-dropdown {
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.expenses-filter-dropdown select {
  width: 100%;
}

/* Expenses List - Redesigned */
.expenses-list {
  padding: 0;
}

.expense-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.expense-item:last-child {
  border-bottom: none;
}

.expense-item:hover {
  background: var(--hover-bg);
}

.expense-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.expense-main {
  flex: 1;
  min-width: 0;
}

.expense-desc {
  font-weight: 500;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-type {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}

.expense-type.settle {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.expense-amounts {
  text-align: right;
  flex-shrink: 0;
}

.expense-amount {
  font-weight: 600;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.expense-user-impact {
  font-size: 0.75rem;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.expense-user-impact.amount-positive::before {
  content: "You get ";
}

.expense-user-impact.amount-negative::before {
  content: "Your share: ";
}

.expense-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.8;
}

.expense-item.settle {
  opacity: 0.7;
}

/* Shimmer Loading Skeleton */
.expenses-skeleton {
  padding: 0;
}

.skeleton-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.skeleton-item::before {
  content: "";
  display: block;
  height: 14px;
  width: 60%;
  background: linear-gradient(90deg,
      var(--border) 25%,
      var(--hover-bg) 50%,
      var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-item::after {
  content: "";
  display: block;
  height: 10px;
  width: 40%;
  background: linear-gradient(90deg,
      var(--border) 25%,
      var(--hover-bg) 50%,
      var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Expenses Empty State */
.expenses-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
}

.expenses-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.expenses-empty-text {
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Hide legacy balances list (keeping for backwards compat) */
#balances-list {
  display: none;
}

/* ======================
   Home View Redesign
   ====================== */

/* Home Hero Card */
.home-hero {
  background: linear-gradient(135deg,
      var(--card) 0%,
      rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.home-hero-greeting {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.home-hero-balance {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.home-hero-balance .currency-balance-line {
  font-size: 1.5rem;
}

.home-hero-balance .amount-positive {
  color: var(--success);
}

.home-hero-balance .amount-negative {
  color: var(--danger);
}

.home-hero-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Home Create Button */
.home-create-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
  margin-bottom: 20px;
}

.home-create-btn:hover {
  background: var(--primary-hover);
}

.home-create-btn:active {
  transform: scale(0.98);
}

/* Home Section */
.home-section {
  margin-bottom: 16px;
}

.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.home-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.home-section-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Groups List */
.groups-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.groups-list .list-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}

.groups-list .list-item:last-child {
  border-bottom: none;
}

.groups-list .list-item:hover {
  background: var(--hover-bg);
}

.groups-list .list-item-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 2px;
}

.groups-list .list-item-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.groups-list .group-balance {
  font-weight: 600;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.groups-list .list-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.groups-list .list-item-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
}

/* Groups Skeleton */
.groups-skeleton {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.skeleton-group-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.skeleton-group-item:last-child {
  border-bottom: none;
}

.skeleton-group-item::before {
  content: "";
  display: block;
  height: 16px;
  width: 50%;
  background: linear-gradient(90deg,
      var(--border) 25%,
      var(--hover-bg) 50%,
      var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-group-item::after {
  content: "";
  display: block;
  height: 12px;
  width: 30%;
  background: linear-gradient(90deg,
      var(--border) 25%,
      var(--hover-bg) 50%,
      var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Home Empty State */
.home-empty {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
}

.home-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.home-empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.home-empty-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ======================
   Auth Views Redesign
   ====================== */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(180deg,
      var(--bg) 0%,
      rgba(59, 130, 246, 0.05) 100%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  border: 1px solid var(--border);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  margin-bottom: 16px;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
}

.auth-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.auth-tab svg {
  flex-shrink: 0;
}

/* Auth Form */
.auth-form {
  margin-bottom: 0;
}

.auth-input-group {
  margin-bottom: 16px;
}

.auth-input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text);
  transition: border-color 0.15s;
}

.auth-input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.auth-input-group input::placeholder {
  color: var(--text-muted);
}

.auth-otp-input {
  text-align: center;
  font-size: 1.5rem !important;
  font-weight: 600;
  letter-spacing: 0.5em;
  font-variant-numeric: tabular-nums;
}

.auth-otp-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-otp-info svg {
  color: var(--primary);
  flex-shrink: 0;
}

.auth-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}

.auth-submit-btn:hover {
  background: var(--primary-hover);
}

.auth-submit-btn:active {
  transform: scale(0.98);
}

.auth-submit-btn--passkey {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
}

.auth-submit-btn--passkey:hover {
  opacity: 0.9;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0 16px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  padding: 0 12px;
}

.auth-alt-btn {
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.auth-alt-btn:hover {
  background: var(--hover-bg);
  border-color: var(--text-muted);
}

/* Hide old auth elements */
/* .auth-footer {
  display: none;
} */

/* ======================
   Profile View Redesign
   ====================== */

.profile-hero {
  background: linear-gradient(135deg,
      var(--card) 0%,
      rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 16px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 auto 12px;
}

.profile-hero-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-hero-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Profile Edit Card */
.profile-edit-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.profile-edit-input-group {
  margin-bottom: 12px;
}

.profile-edit-input-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.profile-edit-input-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text);
}

.profile-edit-input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.profile-edit-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 8px 0;
  margin-bottom: 16px;
}

.profile-edit-actions {
  display: flex;
  gap: 12px;
}

.profile-edit-actions .btn {
  flex: 1;
}

/* Profile Section */
.profile-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.profile-section:last-of-type {
  margin-bottom: 0;
}

.profile-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.profile-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 2px;
}

.profile-section-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* Passkeys List */
.passkeys-list {
  padding: 0;
}

.passkeys-list .passkey-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.passkeys-list .passkey-item:last-child {
  border-bottom: none;
}

.passkeys-list .passkey-name {
  font-weight: 500;
  margin-bottom: 2px;
}

.passkeys-list .passkey-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Passkeys Skeleton */
.passkeys-skeleton {
  padding: 0;
}

.skeleton-passkey-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.skeleton-passkey-item:last-child {
  border-bottom: none;
}

.skeleton-passkey-item::before {
  content: "";
  display: block;
  height: 14px;
  width: 40%;
  background: linear-gradient(90deg,
      var(--border) 25%,
      var(--hover-bg) 50%,
      var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 6px;
}

.skeleton-passkey-item::after {
  content: "";
  display: block;
  height: 10px;
  width: 60%;
  background: linear-gradient(90deg,
      var(--border) 25%,
      var(--hover-bg) 50%,
      var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Profile Empty State */
.profile-empty {
  padding: 32px 24px;
  text-align: center;
}

.profile-empty-icon {
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 12px;
}

.profile-empty-text {
  font-weight: 500;
  margin-bottom: 4px;
}

.profile-empty-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Hide old profile info display, use hero instead */
#profile-info-display {
  display: none;
}

/* ======================
   Landing Page
   ====================== */

/* Landing Nav */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.landing-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-brand-text {
  font-size: 1.25rem;
  font-weight: 700;
}

.landing-nav-actions {
  display: flex;
  gap: 12px;
}

/* Landing Main */
.landing-main {
  padding-top: 72px;
}

/* Landing Hero */
.landing-hero {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  background: linear-gradient(180deg,
      var(--bg) 0%,
      rgba(59, 130, 246, 0.05) 100%);
}

.landing-hero-content {
  max-width: 680px;
  text-align: center;
}

.landing-badge {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #93c5fd;
  margin-bottom: 24px;
}

.landing-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.landing-gradient {
  background: linear-gradient(135deg,
      var(--primary) 0%,
      #8b5cf6 50%,
      #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.landing-cta-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1rem;
  border-radius: 12px;
}

.landing-trust {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Landing Features */
.landing-features {
  padding: 80px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.landing-section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.landing-section-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 48px;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.landing-feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  transition:
    border-color 0.2s,
    transform 0.2s;
}

.landing-feature-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-4px);
}

.landing-feature-icon {
  width: 56px;
  height: 56px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary);
}

.landing-feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.landing-feature-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Landing Comparison */
.landing-comparison {
  padding: 80px 24px;
  background: rgba(59, 130, 246, 0.03);
}

.landing-comparison-table {
  max-width: 700px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.comparison-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.875rem;
}

.comparison-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-feature {
  font-weight: 500;
}

.comparison-willpay,
.comparison-splitwise {
  text-align: center;
  font-size: 0.9375rem;
}

.comparison-good {
  color: var(--success);
  font-weight: 600;
}

.comparison-bad {
  color: var(--danger);
}

.comparison-neutral {
  color: var(--text-muted);
}

.comparison-footnote {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 16px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Landing CTA Section */
.landing-cta-section {
  padding: 80px 24px;
}

.landing-cta-card {
  max-width: 600px;
  margin: 0 auto;
  background: linear-gradient(135deg,
      rgba(59, 130, 246, 0.15) 0%,
      rgba(139, 92, 246, 0.15) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
}

.landing-cta-card h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.landing-cta-card p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Landing Footer */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
}

.landing-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.landing-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.landing-footer-links {
  display: flex;
  gap: 24px;
}

.landing-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.landing-footer-links a:hover {
  color: var(--text);
}

.landing-footer-copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Landing Responsive */
@media (max-width: 768px) {
  .landing-title {
    font-size: 2rem;
  }

  .landing-subtitle {
    font-size: 1rem;
  }

  .landing-features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .landing-feature-card {
    text-align: left;
    display: flex;
    gap: 16px;
    align-items: flex-start;
  }

  .landing-feature-icon {
    margin: 0;
    flex-shrink: 0;
  }

  .comparison-header,
  .comparison-row {
    grid-template-columns: 1.5fr 1fr 1fr;
    font-size: 0.8125rem;
    padding: 12px 16px;
  }

  .landing-footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .landing-footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .landing-cta-group {
    flex-direction: column;
  }

  .landing-cta-group .btn {
    width: 100%;
  }
}

/* ================================
   Invite Links
   ================================ */

/* Invite Link Modal */
.modal-lg {
  max-width: 560px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-header h2 {
  margin: 0;
}

.invite-link-create {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.invite-link-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.invite-link-options .form-group {
  margin-bottom: 0;
}

.invite-links-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.invite-links-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.invite-links-loading {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.invite-links-empty {
  text-align: center;
  padding: 24px;
}

.invite-links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invite-link-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.invite-link-info {
  flex: 1;
  min-width: 0;
}

.invite-link-url {
  font-size: 0.8125rem;
  font-family: monospace;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 4px;
}

.invite-link-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.invite-link-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ================================
   Join View (Invite Accept)
   ================================ */

.join-container {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 24px;
  text-align: center;
}

.join-logo {
  margin-bottom: 24px;
}

.join-logo svg {
  width: 64px;
  height: 64px;
}

.join-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.join-group-name {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 24px;
}

.join-message {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.join-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.join-message.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.join-login-prompt {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.join-login-prompt p {
  margin-bottom: 16px;
  color: var(--text-muted);
}

.join-login-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.join-accept-btn {
  width: 100%;
  max-width: 280px;
}

@media (max-width: 480px) {
  .invite-link-options {
    grid-template-columns: 1fr;
  }

  .invite-link-item {
    flex-direction: column;
    align-items: stretch;
  }

  .invite-link-actions {
    justify-content: flex-end;
  }

  .join-login-actions {
    flex-direction: column;
  }
}

/* ================================
   Legal Pages (Privacy, Terms)
   ================================ */

.legal-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

.legal-nav {
  margin-bottom: 32px;
}

.legal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.legal-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-updated {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.legal-content section {
  margin-bottom: 32px;
}

.legal-content section:last-child {
  margin-bottom: 0;
}

.legal-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.legal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text);
}

.legal-content p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 12px;
}

.legal-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 12px;
}

.legal-content li {
  position: relative;
  padding-left: 24px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 8px;
}

.legal-content li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: var(--primary);
}

.legal-content li strong {
  color: var(--text);
}

.legal-content a {
  color: var(--primary);
  text-decoration: none;
}

.legal-content a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .legal-content {
    padding: 24px 20px;
  }

  .legal-content h1 {
    font-size: 1.5rem;
  }
}

/* ======================
     Offline Indicator
     ====================== */
.offline-indicator {
  background-color: var(--danger);
  color: white;
  padding: 8px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
  transition: transform 0.3s ease-in-out;
}

.offline-indicator.hidden {
  transform: translateY(-100%);
  display: flex !important;
  /* Override generic hidden utility for animation */
}

/* Update Banner */
.update-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
  font-size: 14px;
}

.update-banner.hidden {
  display: none;
}

.update-banner .btn-small {
  background: white;
  color: var(--primary);
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.toggle-slider {
  background-color: var(--primary);
}

input:checked+.toggle-slider:before {
  transform: translateX(24px);
}

input:focus+.toggle-slider {
  box-shadow: 0 0 1px var(--primary);
}

/* ======================
   App Version
   ====================== */
.app-version {
  text-align: center;
  padding: 24px 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  font-size: 0.75rem;
  color: #6b7280;
}

/* Notification Settings */
.notification-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.notification-setting-row .setting-info {
  display: flex;
  flex-direction: column;
}

.notification-setting-row .setting-label {
  font-weight: 500;
  font-size: 0.95rem;
}

.notification-setting-row .setting-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ======================
   Settlement Card Design
   ====================== */

.settlement-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition:
    transform 0.15s,
    border-color 0.15s;
}

.settlement-card:hover {
  border-color: var(--primary);
}

.settlement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settlement-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  /* Text truncation */
}

.settlement-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  position: relative;
}

.settlement-avatar.from {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

.settlement-avatar.to {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}

.settlement-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.settlement-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.settlement-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.settlement-arrow-icon {
  color: var(--text-muted);
  font-size: 1.25rem;
  margin-top: -4px;
  /* Visual alignment */
}

.settlement-actions {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: center;
}

.settlement-actions .btn {
  width: auto;
  min-width: 140px;
  padding: 8px 16px;
}

.btn-soft-primary {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-soft-primary:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.3);
}

/* SVG Avatar Support */
.member-avatar,
.settlement-avatar,
.expense-card-avatar {
  overflow: hidden;
  /* Ensure SVG respects border-radius */
}

.member-avatar svg,
.settlement-avatar svg,
.expense-card-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
  /* Remove whitespace */
}

/* Profile Avatar Refresh */
.profile-avatar-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}

.profile-avatar-refresh {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}

.profile-avatar-refresh:hover {
  background: var(--hover-bg);
  color: var(--primary);
  transform: rotate(30deg);
}