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

:root {
  --bg: #0d0f14;
  --bg2: #141720;
  --bg3: #1c2030;
  --card: #1a1e2e;
  --border: #2a2f45;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --green: #43e97b;
  --red: #ff6584;
  --yellow: #ffd166;
  --text: #e8eaf6;
  --text2: #8892b0;
  --text3: #4a5568;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 { font-family: 'Syne', sans-serif; }

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

/* ─── LAYOUT ─────────────────────────────────── */
.app-wrapper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

.page { padding: 0 0 90px; }

/* ─── HEADER ─────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.header-title span { color: var(--accent); }

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

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  color: white;
}

/* ─── BOTTOM NAV ─────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10px 4px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
}

.nav-item.active, .nav-item:hover { color: var(--accent); }
.nav-item svg { width: 20px; height: 20px; }

/* ─── CARDS ──────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 16px 14px;
}

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

/* ─── BALANCE HERO ───────────────────────────── */
.balance-hero {
  background: linear-gradient(135deg, #1a1e3a 0%, #0d1230 100%);
  border: 1px solid #2a3060;
  border-radius: var(--radius);
  padding: 28px 24px;
  margin: 16px 16px 0;
  position: relative;
  overflow: hidden;
}

.balance-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(108,99,255,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.balance-label {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  margin-bottom: 6px;
}

.balance-value {
  font-family: 'Syne', sans-serif;
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 4px;
}

.balance-positive { color: var(--green); }
.balance-negative { color: var(--red); }
.balance-neutral { color: var(--text); }

.balance-month {
  font-size: 12px;
  color: var(--text2);
}

.balance-stats {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.stat-item { flex: 1; }
.stat-label { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }
.stat-income { color: var(--green); }
.stat-expense { color: var(--red); }

/* ─── SECTION TITLE ──────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 20px 20px 10px;
}

/* ─── MOVEMENT ITEM ──────────────────────────── */
.movement-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0 16px 8px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  position: relative;
}

.movement-item:active { transform: scale(0.98); }
.movement-item:hover { border-color: var(--accent); }

.movement-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.icon-income { background: rgba(67,233,123,0.12); }
.icon-fixed { background: rgba(108,99,255,0.12); }
.icon-variable { background: rgba(255,101,132,0.12); }

.movement-info { flex: 1; min-width: 0; }
.movement-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.movement-meta { font-size: 11px; color: var(--text2); margin-top: 2px; }

.movement-right { text-align: right; flex-shrink: 0; }
.movement-value {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
}
.val-income { color: var(--green); }
.val-expense { color: var(--red); }

.paid-badge {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  margin-top: 4px;
  display: inline-block;
}
.paid-yes { background: rgba(67,233,123,0.15); color: var(--green); }
.paid-no { background: rgba(255,209,102,0.15); color: var(--yellow); }

/* ─── FORMS ──────────────────────────────────── */
.form-page {
  padding: 20px 16px 100px;
}

.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }

select.form-control {
  cursor: pointer;
  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 fill='%238892b0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

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

/* ─── BUTTONS ────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  width: 100%;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: #5a51f0; transform: translateY(-1px); }

.btn-success {
  background: rgba(67,233,123,0.15);
  color: var(--green);
  border: 1px solid rgba(67,233,123,0.3);
}

.btn-danger {
  background: rgba(255,101,132,0.15);
  color: var(--red);
  border: 1px solid rgba(255,101,132,0.3);
}

.btn-ghost {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  width: auto;
}

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

/* ─── FAB ────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 75px; right: calc(50% - 230px);
  width: 54px; height: 54px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(108,99,255,0.5);
  cursor: pointer;
  z-index: 150;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(108,99,255,0.7); }
.fab svg { width: 24px; height: 24px; color: white; }

@media (max-width: 480px) {
  .fab { right: 16px; }
}

/* ─── MODAL ──────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  padding: 0;
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 24px 20px;
  width: 100%; max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto 20px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ─── ALERTS ─────────────────────────────────── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin: 0 16px 14px;
  font-size: 13px;
  font-weight: 500;
}
.alert-success { background: rgba(67,233,123,0.1); border: 1px solid rgba(67,233,123,0.3); color: var(--green); }
.alert-error { background: rgba(255,101,132,0.1); border: 1px solid rgba(255,101,132,0.3); color: var(--red); }
.alert-info { background: rgba(108,99,255,0.1); border: 1px solid rgba(108,99,255,0.3); color: var(--accent); }

/* ─── TABS ───────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin: 0 16px 16px;
}

.tab {
  flex: 1;
  padding: 9px 8px;
  border-radius: 7px;
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text2);
  transition: all 0.2s;
}

.tab.active {
  background: var(--accent);
  color: white;
}

/* ─── TOGGLE ─────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }

.toggle {
  position: relative;
  width: 44px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ─── CHIP ───────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.chip-accent { background: rgba(108,99,255,0.15); color: var(--accent); }
.chip-green { background: rgba(67,233,123,0.15); color: var(--green); }
.chip-red { background: rgba(255,101,132,0.15); color: var(--red); }
.chip-yellow { background: rgba(255,209,102,0.15); color: var(--yellow); }

/* ─── EMPTY STATE ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 16px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ─── PARTNER ────────────────────────────────── */
.partner-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.partner-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 16px;
  color: white; flex-shrink: 0;
}

.partner-info { flex: 1; }
.partner-name { font-weight: 600; font-size: 14px; }
.partner-id { font-size: 11px; color: var(--text2); margin-top: 2px; font-family: monospace; }

/* ─── ID DISPLAY ─────────────────────────────── */
.id-box {
  background: var(--bg3);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}
.id-box .id-label { font-size: 11px; color: var(--text2); margin-bottom: 6px; }
.id-box .id-value {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent);
}

/* ─── AUTH PAGES ─────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px;
}

.auth-logo {
  font-family: 'Syne', sans-serif;
  font-size: 32px; font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
}
.auth-logo span { color: var(--accent); }

.auth-subtitle {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 40px;
  text-align: center;
}

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

.auth-card h2 {
  font-size: 20px;
  margin-bottom: 24px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text2);
}

/* ─── PROGRESS BAR ───────────────────────────── */
.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.4s ease;
}

/* ─── MONTH SELECTOR ─────────────────────────── */
.month-selector {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  justify-content: space-between;
}
.month-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 14px;
  transition: border-color 0.2s;
}
.month-btn:hover { border-color: var(--accent); }
.month-label {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px;
}

/* ─── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── DIVIDER ─────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ─── QUICK ACTION GRID ──────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 16px 0;
  margin-bottom: 4px;
}

.quick-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  text-align: left;
  color: var(--text);
  text-decoration: none;
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn:hover { border-color: var(--accent); }
.quick-btn .qb-icon { font-size: 22px; }
.quick-btn .qb-label { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; }
.quick-btn .qb-desc { font-size: 11px; color: var(--text2); }
