: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-error {
  background: var(--danger);
  color: white;
}

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

.btn-small {
  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-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,
    padding 0.15s,
    margin 0.15s;
}

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

.list-item:hover {
  background: var(--hover-bg);
  margin: 0 -20px;
  padding: 14px 20px;
}

.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;
}

.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);
}

.expense-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition:
    background 0.15s,
    padding 0.15s,
    margin 0.15s;
}

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

.expense-item:not(.settle):hover {
  background: var(--hover-bg);
  margin: 0 -20px;
  padding: 14px 20px;
}

.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: center;
  width: 100%;
  padding: 8px;
  margin-top: 8px;
}

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

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

.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);
  margin: 0 -20px;
  padding: 14px 20px;
}

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

.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.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

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

.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: 0 20px 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);
  margin: 0 -20px;
  padding: 14px 20px;
}

.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-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;
  flex-direction: column;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

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

.profile-info-value {
  font-size: 1rem;
  font-weight: 500;
}

.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;
}

/* 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;
}
