/* ================================================================
   app.css — Calculate Contribution Design System
   Dark mode, glassmorphism, electric violet accent
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --bg-base:        #0b0d14;
  --bg-surface:     #13161f;
  --bg-card:        #1a1d2e;
  --bg-card-hover:  #1f2235;
  --bg-input:       #0f1120;
  --bg-input-focus: #141728;

  --accent:         #8b5cf6;
  --accent-light:   #a78bfa;
  --accent-dark:    #6d28d9;
  --accent-glow:    rgba(139, 92, 246, 0.25);

  --green:          #10b981;
  --green-light:    #34d399;
  --green-bg:       rgba(16, 185, 129, 0.1);

  --red:            #ef4444;
  --red-light:      #f87171;
  --red-bg:         rgba(239, 68, 68, 0.1);

  --amber:          #f59e0b;
  --amber-light:    #fbbf24;
  --amber-bg:       rgba(245, 158, 11, 0.1);

  --blue:           #3b82f6;
  --blue-light:     #60a5fa;

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #4b5563;

  --border:         rgba(255, 255, 255, 0.07);
  --border-focus:   rgba(139, 92, 246, 0.5);

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:    0 0 40px rgba(139,92,246,0.15);

  --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Background Decoration ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(139,92,246,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(99,102,241,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--wide { max-width: 1200px; }
.container--narrow { max-width: 620px; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(11, 13, 20, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.navbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.navbar__logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.navbar__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar__title span { color: var(--accent-light); }

.navbar__tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Cards / Glass ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.glass {
  background: rgba(26, 29, 46, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  padding: 100px 20px 60px;
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.25);
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.hero__title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #e2e8f0 30%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__sub {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 48px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
}

.btn:hover::before { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.98); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  box-shadow: 0 4px 20px rgba(139,92,246,0.35);
}

.btn--primary:hover {
  box-shadow: 0 6px 30px rgba(139,92,246,0.5);
  transform: translateY(-1px);
}

.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--accent-light);
  padding: 8px 16px;
  font-size: 14px;
}

.btn--ghost:hover { background: var(--accent-glow); }

.btn--danger {
  background: transparent;
  color: var(--red-light);
  border: 1px solid rgba(239,68,68,0.3);
  padding: 6px 12px;
  font-size: 13px;
}

.btn--danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
}

.btn--success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}

.btn--success:hover {
  box-shadow: 0 6px 24px rgba(16,185,129,0.45);
  transform: translateY(-1px);
}

.btn--sm { padding: 8px 16px; font-size: 13px; }
.btn--lg { padding: 16px 36px; font-size: 17px; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-label .required { color: var(--accent); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-input-focus);
}

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

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-error {
  font-size: 12px;
  color: var(--red-light);
}

/* ── Inline Row (Name + Email) ──────────────────────────────── */
.participant-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  margin-bottom: 10px;
}

.participant-row:hover { border-color: rgba(255,255,255,0.12); }

.participant-row .drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  user-select: none;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-light);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Split Mode Radio ───────────────────────────────────────── */
.split-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.split-mode-btn {
  position: relative;
}

.split-mode-btn input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.split-mode-btn label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.split-mode-btn label:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

.split-mode-btn input[type="radio"]:checked + label {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── Checkbox ───────────────────────────────────────────────── */
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 6px;
}

.check-item:hover { border-color: rgba(255,255,255,0.15); }

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.check-item.checked {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.check-item .amount-input {
  margin-left: auto;
  width: 110px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 6px 10px;
  outline: none;
  transition: var(--transition);
}

.check-item .amount-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Remaining Badge ────────────────────────────────────────── */
.remaining-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 8px;
}

.remaining-badge.ok   { background: var(--green-bg); color: var(--green-light); }
.remaining-badge.warn { background: var(--red-bg);   color: var(--red-light); }
.remaining-badge.zero { background: var(--amber-bg); color: var(--amber-light); }

/* ── Transaction List ───────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 10px; }

.tx-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.tx-item:hover { border-color: rgba(255,255,255,0.12); transform: translateX(2px); }

.tx-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.tx-icon--expense { background: var(--red-bg); }
.tx-icon--income  { background: var(--green-bg); }
.tx-icon--transfer{ background: var(--amber-bg); }

.tx-info {}
.tx-desc { font-size: 15px; font-weight: 600; }
.tx-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.tx-amount { font-size: 17px; font-weight: 700; text-align: right; }
.tx-amount--expense  { color: var(--red-light); }
.tx-amount--income   { color: var(--green-light); }
.tx-amount--transfer { color: var(--amber-light); }

/* ── Balances Panel ─────────────────────────────────────────── */
.balances-section {
  margin-top: 32px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.balance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.balance-card {
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.balance-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.balance-card__name { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.balance-card__amount { font-size: 22px; font-weight: 800; margin-top: 4px; }
.balance-card.positive .balance-card__amount { color: var(--green-light); }
.balance-card.negative .balance-card__amount { color: var(--red-light); }
.balance-card.zero     .balance-card__amount { color: var(--text-muted); }

/* ── Settlement Rows ────────────────────────────────────────── */
.settlement-list { display: flex; flex-direction: column; gap: 10px; }

.settlement-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  flex-wrap: wrap;
}

.settlement-item:hover { border-color: rgba(255,255,255,0.12); }

.settlement-text {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 15px;
}

.settlement-from { font-weight: 700; color: var(--red-light); }
.settlement-arrow { color: var(--text-muted); font-size: 18px; }
.settlement-to   { font-weight: 700; color: var(--green-light); }
.settlement-amount {
  font-weight: 800;
  font-size: 17px;
  color: var(--text-primary);
  background: var(--accent-glow);
  padding: 2px 10px;
  border-radius: 100px;
  border: 1px solid var(--accent);
}

/* ── Readonly Banner ────────────────────────────────────────── */
.readonly-banner {
  background: var(--amber-bg);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--amber-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

/* ── Participant Select Modal ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal__sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ── Participant Select Grid ────────────────────────────────── */
.participant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.participant-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  color: var(--text-primary);
}

.participant-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
}

.participant-btn .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}

.participant-btn .name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* ── Group Header ───────────────────────────────────────────── */
.group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 32px 0 24px;
  flex-wrap: wrap;
}

.group-title { font-size: 28px; font-weight: 800; }
.group-meta  { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.group-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.group-code:hover { border-color: var(--accent); color: var(--accent-light); }

/* ── Toast Notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast--success { border-left: 3px solid var(--green); }
.toast--error   { border-left: 3px solid var(--red); }
.toast--info    { border-left: 3px solid var(--accent); }
.toast--warning { border-left: 3px solid var(--amber); }

/* ── Home Page Specific ─────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 48px 0;
}

@media (max-width: 640px) {
  .home-grid { grid-template-columns: 1fr; }
}

.home-card {
  padding: 36px 28px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.home-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.home-card__icon { font-size: 48px; margin-bottom: 16px; }
.home-card__title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.home-card__desc  { font-size: 14px; color: var(--text-secondary); }

.home-card--primary { border-color: rgba(139,92,246,0.3); background: rgba(139,92,246,0.05); }
.home-card--primary:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }

/* ── Code Entry Form ────────────────────────────────────────── */
.code-entry {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.code-entry .form-control { font-family: 'Courier New', monospace; letter-spacing: 0.08em; }

/* ── Features Strip ─────────────────────────────────────────── */
.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 32px;
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.feature-item .icon { color: var(--accent-light); }

/* ── Utility ────────────────────────────────────────────────── */
.mt-auto  { margin-top: auto; }
.mt-0     { margin-top: 0; }
.mt-8     { margin-top: 8px; }
.mt-12    { margin-top: 12px; }
.mt-16    { margin-top: 16px; }
.mt-24    { margin-top: 24px; }
.mt-32    { margin-top: 32px; }
.mb-8     { margin-bottom: 8px; }
.mb-16    { margin-bottom: 16px; }
.mb-24    { margin-bottom: 24px; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.gap-16   { gap: 16px; }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.font-bold  { font-weight: 700; }
.text-accent { color: var(--accent-light); }
.text-green  { color: var(--green-light); }
.text-red    { color: var(--red-light); }
.text-amber  { color: var(--amber-light); }
.w-full   { width: 100%; }
.hidden   { display: none !important; }

/* ── Alert / Notice ─────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.alert--success { background: var(--green-bg); border: 1px solid rgba(16,185,129,0.3); color: var(--green-light); }
.alert--error   { background: var(--red-bg);   border: 1px solid rgba(239,68,68,0.3); color: var(--red-light); }
.alert--info    { background: var(--accent-glow); border: 1px solid var(--border-focus); color: var(--accent-light); }
.alert--warning { background: var(--amber-bg); border: 1px solid rgba(245,158,11,0.3); color: var(--amber-light); }

/* ── Form inline layout ─────────────────────────────────────── */
.form-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-inline .label-word {
  font-size: 15px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.form-inline .form-control { flex: 1; min-width: 0; }

/* ── Two-column form ────────────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .participant-row { grid-template-columns: 1fr auto; }
  .participant-row .form-control:last-of-type { display: none; }
}

/* ── Captcha ────────────────────────────────────────────────── */
.captcha-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.captcha-question {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-light);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.captcha-wrap .form-control { max-width: 90px; text-align: center; font-size: 18px; font-weight: 700; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.5); }

/* ── Selection ──────────────────────────────────────────────── */
::selection { background: rgba(139,92,246,0.35); color: #fff; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state__icon { font-size: 40px; margin-bottom: 12px; }
.empty-state__text { font-size: 15px; }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 80px;
}

footer a { color: var(--accent-light); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ════════════════════════════════════════════
   Stats Bar
   ════════════════════════════════════════════ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition);
}

.stat-item:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-1px); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-value--expense  { color: var(--red-light); }
.stat-value--income   { color: var(--green-light); }
.stat-value--transfer { color: var(--amber-light); }

/* ════════════════════════════════════════════
   Dashboard Responsive Grid
   ════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

/* ════════════════════════════════════════════
   Participant Management Panel
   ════════════════════════════════════════════ */
.participant-manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.participant-manage-row:last-child { border-bottom: none; }
.participant-manage-row:hover { background: rgba(255,255,255,0.02); }

.p-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.add-participant-wrap {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(139,92,246,0.03);
}

.add-participant-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

/* ════════════════════════════════════════════
   RESPONSIVE: Tablet (max-width 900px)
   ════════════════════════════════════════════ */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .balance-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .navbar__title { font-size: 14px; }
}

/* ════════════════════════════════════════════
   RESPONSIVE: Mobile (max-width 640px)
   ════════════════════════════════════════════ */
@media (max-width: 640px) {
  .container, .container--wide, .container--narrow {
    padding: 0 12px;
  }

  .navbar__inner { height: 54px; }
  .navbar__title { display: none; }
  .navbar__logo { width: 30px; height: 30px; font-size: 15px; }
  .navbar .btn--sm { padding: 6px 10px; font-size: 12px; }

  .hero { padding: 60px 16px 40px; }
  .hero__sub { font-size: 15px; }

  .home-grid { grid-template-columns: 1fr; gap: 12px; margin: 28px 0; }
  .home-card { padding: 24px 20px; }
  .home-card__icon { font-size: 36px; margin-bottom: 10px; }
  .home-card__title { font-size: 17px; }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-item { padding: 10px 12px; }
  .stat-value { font-size: 16px; }
  .stat-label { font-size: 10px; }

  .group-header {
    flex-direction: column;
    padding: 20px 0 16px;
    gap: 12px;
  }
  .group-title { font-size: 22px; }
  .group-code { font-size: 11px; padding: 5px 10px; }

  .tab-btn { font-size: 12px; padding: 8px 6px; gap: 3px; }

  .form-grid-2 { grid-template-columns: 1fr; gap: 12px; }

  .participant-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .participant-row input[type="email"] { display: none; }

  .add-participant-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .add-participant-form .btn { width: 100%; }

  .tx-item {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 12px 14px;
  }
  .tx-item .delete-tx-btn { opacity: 0; pointer-events: none; }
  .tx-item:hover .delete-tx-btn,
  .tx-item:focus-within .delete-tx-btn { opacity: 1; pointer-events: all; }
  .tx-icon { width: 34px; height: 34px; font-size: 16px; }
  .tx-desc { font-size: 13px; }
  .tx-amount { font-size: 14px; }
  .tx-meta { font-size: 11px; }

  .balance-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .balance-card { padding: 12px 14px; }
  .balance-card__amount { font-size: 18px; }

  .settlement-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }
  .settlement-text { flex-wrap: wrap; font-size: 14px; gap: 6px; }
  .settle-btn { width: 100%; justify-content: center; }

  .modal {
    border-radius: var(--radius-lg);
    padding: 24px 20px;
  }
  .participant-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .participant-btn { padding: 14px 8px; }
  .participant-btn .avatar { width: 36px; height: 36px; font-size: 15px; }

  .split-modes { gap: 6px; }
  .split-mode-btn label { padding: 6px 10px; font-size: 12px; }

  .check-item { padding: 8px 10px; font-size: 13px; }
  .check-item .amount-input { width: 80px; }

  .section-title { font-size: 12px; }

  .captcha-wrap { flex-wrap: wrap; }
  .captcha-question { font-size: 16px; }

  .btn--lg { padding: 13px 20px; font-size: 15px; }

  #toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: 100%; font-size: 13px; }

  .code-entry { flex-direction: column; }
  .code-entry .btn { width: 100%; }
}

/* ════════════════════════════════════════════
   RESPONSIVE: Very small (max-width 380px)
   ════════════════════════════════════════════ */
@media (max-width: 380px) {
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .balance-cards { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr; }
}
