/* Tachiara — base styles built on WeFile tokens, overridden with custom accent */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  /* WeFile tokens (subset, redefined here so we don't depend on external file) */
  --wf-slate-50:  #F8FAFC;
  --wf-slate-100: #F1F5F9;
  --wf-slate-200: #E2E8F0;
  --wf-slate-300: #CBD5E1;
  --wf-slate-400: #94A3B8;
  --wf-slate-500: #64748B;
  --wf-slate-600: #475569;
  --wf-slate-700: #334155;
  --wf-slate-800: #1E293B;
  --wf-slate-900: #0F172A;
  --wf-slate-950: #020617;

  --wf-bg:         #FFFFFF;
  --wf-bg-subtle:  var(--wf-slate-50);
  --wf-bg-muted:   var(--wf-slate-100);
  --wf-card:       #FFFFFF;
  --wf-overlay:    rgba(15, 23, 42, 0.45);

  --wf-fg:         var(--wf-slate-900);
  --wf-fg-2:       var(--wf-slate-700);
  --wf-fg-muted:   var(--wf-slate-500);
  --wf-fg-subtle:  var(--wf-slate-400);
  --wf-fg-on-brand:#FFFFFF;

  --wf-border:       var(--wf-slate-200);
  --wf-border-strong:var(--wf-slate-300);

  /* Tweakable accent — overridden by JS */
  --accent: #0F766E;
  --accent-hover: #115E59;
  --accent-active: #134E4A;
  --accent-soft: #ECFDF5;
  --accent-soft-2: #D1FAE5;
  --accent-ring: rgba(15, 118, 110, 0.22);
  --accent-fg: #FFFFFF;

  --success: #16A34A;
  --success-soft: #DCFCE7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --warning: #B45309;
  --warning-soft: #FEF3C7;

  /* Inverted-tone for dark mode (overridden below) */
  --nav-active-bg: var(--wf-slate-900);
  --nav-active-fg: #FFFFFF;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-full: 9999px;

  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, 0.12), 0 4px 12px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.18);

  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;

  color-scheme: light;
}

/* ── Dark mode ─────────────────────────────────────────────────────────
 * Trigger with <html data-theme="dark"> or [data-theme="dark"] on root.
 * Keep the same accent colors; just invert grayscale surfaces.
 */
[data-theme="dark"] {
  color-scheme: dark;

  --wf-slate-50:  #0B1220;
  --wf-slate-100: #111827;
  --wf-slate-200: #1F2937;
  --wf-slate-300: #374151;
  --wf-slate-400: #6B7280;
  --wf-slate-500: #9CA3AF;
  --wf-slate-600: #CBD5E1;
  --wf-slate-700: #E5E7EB;
  --wf-slate-800: #F3F4F6;
  --wf-slate-900: #F9FAFB;
  --wf-slate-950: #FFFFFF;

  --wf-bg:        #0A0F1A;
  --wf-bg-subtle: #0F1623;
  --wf-bg-muted:  #1A2233;
  --wf-card:      #131B2C;
  --wf-overlay:   rgba(0, 0, 0, 0.65);

  --wf-fg:        #F9FAFB;
  --wf-fg-2:      #D1D5DB;
  --wf-fg-muted:  #94A3B8;
  --wf-fg-subtle: #64748B;

  --wf-border:        #1F2937;
  --wf-border-strong: #2D3748;

  --success-soft: rgba(22, 163, 74, 0.18);
  --danger-soft:  rgba(220, 38, 38, 0.18);
  --warning-soft: rgba(180, 83, 9, 0.20);

  --shadow-sm: 0 1px 3px 0 rgba(0,0,0,0.35), 0 1px 2px -1px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.45), 0 2px 4px -2px rgba(0,0,0,0.25);
  --shadow-lg: 0 12px 28px -8px rgba(0,0,0,0.55), 0 4px 12px -4px rgba(0,0,0,0.30);
  --shadow-xl: 0 24px 48px -12px rgba(0,0,0,0.70);

  /* Nav active should be light (pop on dark) */
  --nav-active-bg: #F9FAFB;
  --nav-active-fg: #0A0F1A;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--wf-fg);
  background: var(--wf-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; padding: 0; cursor: pointer; }

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

::selection { background: var(--accent-soft-2); color: var(--wf-fg); }

/* ── Layout ─────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--wf-bg-subtle);
}

.sidebar {
  background: var(--wf-bg);
  border-right: 1px solid var(--wf-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--wf-slate-900);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.04em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--wf-fg-2);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-item:hover { background: var(--wf-bg-muted); color: var(--wf-fg); }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-fg); }
.nav-item.active .icon { color: var(--nav-active-fg); }
.nav-item .icon { width: 18px; height: 18px; stroke-width: 1.75; color: var(--wf-fg-muted); }
.nav-badge { margin-left: auto; }

.sidebar-section-title {
  padding: 16px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wf-fg-muted);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--wf-border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
}
.sidebar-footer .user-info { line-height: 1.2; min-width: 0; }
.sidebar-footer .user-info .name { font-weight: 600; font-size: 14px; }
.sidebar-footer .user-info .meta { font-size: 12px; color: var(--wf-fg-muted); }

.main {
  min-width: 0;
  padding: 32px 40px 80px;
  max-width: 1440px;
  width: 100%;
  justify-self: center;
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    padding: 8px 6px;
    /* Chừa chỗ cho thanh gesture / tai thỏ trên iPhone */
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 2px;
    border-top: 1px solid var(--wf-border);
    border-right: none;
    z-index: 50;
    justify-content: space-around;
  }
  .brand, .sidebar-section-title, .sidebar-footer { display: none; }
  /* Mỗi tab chiếm phần bằng nhau → thanh nav cân đối, không méo */
  .nav-item {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    padding: 6px 4px;
  }
  .nav-item .icon { width: 22px; height: 22px; }
  /* Số thông báo → bong bóng nhỏ nổi ở góc icon chuông, thay vì xuống dòng
     thứ ba làm ô "Thông báo" cao hơn các ô khác (gây méo hình chữ nhật). */
  .nav-badge {
    position: absolute;
    top: 2px;
    left: calc(50% + 3px);
    margin: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    line-height: 16px;
    justify-content: center;
    border-radius: var(--r-full);
    box-shadow: 0 0 0 2px var(--wf-bg);
  }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  /* FAB nổi lên trên thanh nav, không đè vào tab */
  .fab { bottom: calc(84px + env(safe-area-inset-bottom)); right: 16px; }
}

/* Màn hình rất nhỏ: thu gọn padding thẻ đăng nhập cho đỡ chật */
@media (max-width: 420px) {
  .auth-card { padding: 28px 22px; }
}

/* ── Page header ───────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}
.page-subtitle {
  color: var(--wf-fg-muted);
  margin-top: 4px;
  font-size: 14px;
}

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-primary:hover:not([disabled]) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active:not([disabled]) { background: var(--accent-active); border-color: var(--accent-active); }

.btn-secondary {
  background: var(--wf-bg);
  color: var(--wf-fg);
  border-color: var(--wf-border);
}
.btn-secondary:hover:not([disabled]) { background: var(--wf-bg-muted); border-color: var(--wf-border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--wf-fg-2);
}
.btn-ghost:hover:not([disabled]) { background: var(--wf-bg-muted); color: var(--wf-fg); }

.btn-dark {
  background: var(--wf-slate-900);
  color: white;
  border-color: var(--wf-slate-900);
}
.btn-dark:hover:not([disabled]) { background: var(--wf-slate-800); border-color: var(--wf-slate-800); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-icon { padding: 8px; aspect-ratio: 1; }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
}
.btn-danger-ghost:hover:not([disabled]) { background: var(--danger-soft); }

/* ── Inputs ────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  background: var(--wf-bg);
  border: 1px solid var(--wf-border);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--wf-fg);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--wf-fg-subtle); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--wf-fg-2); }
.field-hint { font-size: 12px; color: var(--wf-fg-muted); }
.field-error { font-size: 12px; color: var(--danger); }

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--wf-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--wf-bg);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input-prefix .prefix {
  padding: 0 10px;
  color: var(--wf-fg-muted);
  font-size: 14px;
  background: var(--wf-bg-subtle);
  border-right: 1px solid var(--wf-border);
  align-self: stretch;
  display: grid;
  place-items: center;
}
.input-prefix .input { border: none; box-shadow: none; }

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--wf-card);
  border: 1px solid var(--wf-border);
  border-radius: var(--r-xl);
  padding: 20px;
}
.card-tight { padding: 16px; }
.card-hover { transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); cursor: pointer; }
.card-hover:hover { border-color: var(--wf-border-strong); box-shadow: var(--shadow-md); }

/* ── Avatar ────────────────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.avatar-sm { width: 24px; height: 24px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--wf-bg); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ── Badge ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--wf-bg-muted);
  color: var(--wf-fg-2);
  white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-accent { background: var(--accent-soft); color: var(--accent-active); }
.badge-outline { background: transparent; border: 1px solid var(--wf-border); }

/* ── Modal ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--wf-overlay);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade-in var(--dur-base) var(--ease-out);
}
.modal {
  background: var(--wf-bg);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slide-up var(--dur-slow) var(--ease-out);
}
.modal-lg { max-width: 720px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--wf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--wf-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--wf-bg-subtle);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Toast ─────────────────────────────────────── */
.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--wf-slate-900);
  color: white;
  padding: 10px 16px;
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slide-up var(--dur-slow) var(--ease-out);
  pointer-events: auto;
}

/* ── Stat box ──────────────────────────────────── */
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 12px;
  color: var(--wf-fg-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-value.mono { font-family: var(--font-mono); font-size: 22px; }
.stat-meta { font-size: 12px; color: var(--wf-fg-muted); }

/* ── List rows ─────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--wf-border);
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; font-size: 14px; color: var(--wf-fg); }
.row-sub { font-size: 12px; color: var(--wf-fg-muted); margin-top: 2px; }
.row-aside { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Money helpers ─────────────────────────────── */
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-positive { color: var(--success); }
.money-negative { color: var(--danger); }
.money-zero { color: var(--wf-fg-muted); }

/* ── Tabs ──────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--wf-border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wf-fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--wf-fg-2); }
.tab.active { color: var(--wf-fg); border-bottom-color: var(--wf-slate-900); }

/* ── Empty state ───────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--wf-fg-muted);
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--wf-fg-subtle);
}
.empty-title { font-weight: 600; color: var(--wf-fg-2); font-size: 15px; margin-bottom: 4px; }

/* ── Split mode picker ─────────────────────────── */
.split-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.split-mode {
  border: 1px solid var(--wf-border);
  border-radius: var(--r-lg);
  padding: 12px;
  cursor: pointer;
  background: var(--wf-bg);
  text-align: left;
  transition: all var(--dur-fast) var(--ease-out);
}
.split-mode:hover { border-color: var(--wf-border-strong); }
.split-mode.active {
  border-color: var(--wf-slate-900);
  background: var(--wf-slate-50);
  box-shadow: 0 0 0 2px var(--wf-slate-900) inset;
}
.split-mode-title { font-weight: 600; font-size: 13px; }
.split-mode-desc { font-size: 11px; color: var(--wf-fg-muted); margin-top: 2px; line-height: 1.4; }

/* ── Person split row in modal ─────────────────── */
.person-split {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--wf-border);
}
.person-split:last-child { border-bottom: none; }
.person-split.muted { opacity: 0.55; }
.person-split .checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--wf-border-strong);
  display: grid;
  place-items: center;
  background: var(--wf-bg);
  cursor: pointer;
}
.person-split .checkbox.checked {
  background: var(--wf-slate-900);
  border-color: var(--wf-slate-900);
  color: white;
}
.person-split-name { font-size: 14px; font-weight: 500; }
.person-split-input {
  width: 110px;
  text-align: right;
  border: 1px solid var(--wf-border);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--wf-bg);
}
.person-split-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.person-split-input:disabled { background: var(--wf-bg-subtle); color: var(--wf-fg-muted); }

/* ── Activity feed item ────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--wf-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--wf-bg-muted);
  display: grid;
  place-items: center;
  color: var(--wf-fg-2);
  flex-shrink: 0;
}
.activity-icon .icon { width: 16px; height: 16px; stroke-width: 1.75; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 14px; line-height: 1.5; }
.activity-text b { font-weight: 600; }
.activity-meta { font-size: 12px; color: var(--wf-fg-muted); margin-top: 2px; }

/* ── Balance row ───────────────────────────────── */
.balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--wf-border);
}
.balance-row:last-child { border-bottom: none; }
.balance-arrow {
  font-size: 13px;
  color: var(--wf-fg-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.balance-arrow .icon { width: 14px; height: 14px; stroke-width: 2; }
.balance-arrow .name { font-weight: 600; color: var(--wf-fg); }

/* ── Grid utilities ────────────────────────────── */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

.stack { display: flex; flex-direction: column; }
.stack-sm > * + * { margin-top: 8px; }
.stack-md > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }

.row-h { display: flex; align-items: center; gap: 8px; }
.row-h-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spread { flex: 1; }

/* ── Code / mono ───────────────────────────────── */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.invite-code {
  font-family: var(--font-mono);
  background: var(--wf-bg-muted);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 13px;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--wf-fg);
}

/* ── Charts ────────────────────────────────────── */
.bar-row { display: grid; grid-template-columns: 100px 1fr 80px; align-items: center; gap: 12px; padding: 8px 0; font-size: 13px; }
.bar-track { background: var(--wf-bg-muted); height: 8px; border-radius: var(--r-full); overflow: hidden; }
.bar-fill { background: var(--wf-slate-900); height: 100%; border-radius: var(--r-full); transition: width var(--dur-slow) var(--ease-out); }

/* ── Auth ──────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: var(--wf-bg-subtle);
}
.auth-card {
  background: var(--wf-bg);
  border: 1px solid var(--wf-border);
  border-radius: var(--r-2xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-sm);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 700;
  font-size: 16px;
}
.auth-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-sub { color: var(--wf-fg-muted); font-size: 14px; margin-bottom: 24px; }
.auth-switcher { text-align: center; margin-top: 20px; font-size: 13px; color: var(--wf-fg-muted); }
.auth-switcher button { color: var(--accent); font-weight: 600; padding: 0 4px; }

/* ── QR ────────────────────────────────────────── */
.qr-frame {
  background: white;
  border: 1px solid var(--wf-border);
  border-radius: var(--r-xl);
  padding: 16px;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 260px;
}
.qr-frame img { width: 100%; height: auto; display: block; }

/* ── Misc ──────────────────────────────────────── */
.divider { height: 1px; background: var(--wf-border); border: none; margin: 16px 0; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.4; display: inline-block; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-fg-muted);
  margin-bottom: 12px;
}

.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: var(--accent-fg);
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 40;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.fab:hover { background: var(--accent-hover); }
@media (min-width: 881px) { .fab { display: none; } }

.icon { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon > svg { width: 100%; height: 100%; display: block; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }

.text-fg { color: var(--wf-fg); }
.text-fg-2 { color: var(--wf-fg-2); }
.text-muted { color: var(--wf-fg-muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }