/* ============================================================
   BudgetTogether — app.css
   "Noche cálida" — warm dark theme, mate-green accent.
   Signature: ledger hero strip + mate/amber split motif.
   Type: Sora (UI), Inter (body), JetBrains Mono (money).
   Fonts self-hosted (web/static/fonts) — no CDN.
   ============================================================ */

/* ---------- Self-hosted fonts (variable woff2, latin) ---------- */

@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/sora.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
  --bg: #121417;
  --bg-soft: #171b1f;
  --card: #1c2126;
  --card-2: #22282e;
  --border: #2c333a;
  --border-strong: #3b444c;
  --primary: #8fae5c;
  --primary-strong: #79a44b;
  --primary-soft: rgba(143, 174, 92, 0.14);
  --text: #f1f4f7;
  --text-muted: #9aa4af;
  --text-faint: #67717b;
  --success: #4cc38a;
  --danger: #f0786e;
  --warning: #e8b45a;
  --personal: #e8b45a;
  --shared: #9dbb6e;
  --purple: #a78bfa;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.25);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Sora", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

* {
  color-scheme: dark;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a:hover {
  color: var(--primary-strong);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--primary-soft);
  color: var(--text);
}

/* ---------- Layout shell ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--shared) 100%);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #10130b;
  letter-spacing: -0.5px;
  box-shadow: 0 0 18px rgba(143, 174, 92, 0.35);
  font-family: var(--sans);
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  font-family: var(--sans);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-family: var(--sans);
  transition: background 0.15s, color 0.15s;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.nav-link:hover {
  background: var(--card-2);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-strong), var(--personal));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #10130b;
  flex-shrink: 0;
  font-family: var(--sans);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.user-chip-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
  font-family: var(--sans);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

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

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

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 20, 23, 0.8);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.2px;
  font-family: var(--sans);
}

.content {
  padding: 24px 28px 64px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile drawer (checkbox hack) */
.nav-toggle {
  display: none;
}

.drawer-label {
  display: none;
}

.drawer-overlay {
  display: none;
}

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  .nav-toggle:checked ~ .shell .sidebar {
    transform: translateX(0);
  }

  .nav-toggle:checked ~ .shell .drawer-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
  }

  .drawer-label {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-2);
    cursor: pointer;
    color: var(--text-muted);
  }

  .drawer-label svg {
    width: 18px;
    height: 18px;
  }

  .header {
    padding: 12px 16px;
  }

  .content {
    padding: 18px 16px 48px;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
  color: var(--text);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #10130b;
  box-shadow: 0 2px 14px rgba(143, 174, 92, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 18px rgba(143, 174, 92, 0.35);
}

.btn-ghost {
  background: var(--card-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: #272e35;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  font-family: var(--sans);
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Summary / ledger hero ---------- */

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--personal));
  opacity: 0.7;
}

.summary-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-family: var(--sans);
}

.summary-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.5px;
  color: var(--text);
}

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

.summary-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* Split motif: two-tone divider under hero values */
.split-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.split-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.split-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--personal);
}

.split-pill.pill-shared::before {
  background: var(--shared);
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--sans);
}

.input,
.select {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

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

.field-error {
  color: var(--danger);
  font-size: 13px;
}

.form-error {
  background: rgba(240, 120, 110, 0.1);
  border: 1px solid rgba(240, 120, 110, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
}

.form-success {
  background: rgba(76, 195, 138, 0.1);
  border: 1px solid rgba(76, 195, 138, 0.3);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 9px 0;
  text-align: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: var(--sans);
}

.tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
}

.badge-personal {
  background: rgba(232, 180, 90, 0.13);
  color: var(--personal);
}

.badge-shared {
  background: rgba(157, 187, 110, 0.15);
  color: var(--shared);
}

.badge-pending {
  background: rgba(232, 180, 90, 0.13);
  color: var(--warning);
}

.badge-accepted {
  background: rgba(76, 195, 138, 0.13);
  color: var(--success);
}

.badge-pulse {
  position: relative;
}

.badge-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(232, 180, 90, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 180, 90, 0.4); }
  70% { box-shadow: 0 0 0 7px rgba(232, 180, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 180, 90, 0); }
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--sans);
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.12s;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.table .amount {
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
}

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

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

/* mobile: table -> cards */
@media (max-width: 767px) {
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--card);
    box-shadow: var(--shadow-soft);
  }

  .table td {
    border: none;
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: var(--sans);
  }

  .table td.amount,
  .table td.actions {
    justify-content: flex-end;
  }
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: var(--sans);
}

.page-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #10130b;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-faint);
  padding: 0 2px;
}

/* ---------- Filters ---------- */

/* Period picker: ◀ [month] [year] ▶ */
.period-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 6px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}

.period-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.05s;
}

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

.period-btn:active {
  transform: scale(0.92);
}

.period-btn svg {
  width: 15px;
  height: 15px;
}

.period-select {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.period-select:hover {
  background: var(--card-2);
}

.period-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.period-select option {
  background: var(--card);
  color: var(--text);
}

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

@media (max-width: 767px) {
  .period-picker {
    width: 100%;
    border-radius: var(--radius-sm);
  }

  .period-picker form {
    flex: 1;
    display: flex;
  }

  .period-select {
    flex: 1;
  }
}

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar .input {
  flex: 1;
  min-width: 180px;
}

.segmented {
  display: flex;
  gap: 4px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.segmented .seg-btn {
  padding: 7px 13px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.15s, color 0.15s;
}

.segmented .seg-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.segmented .seg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Progress & bars ---------- */

.progress {
  height: 10px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.progress-fill.blue { background: linear-gradient(90deg, var(--primary), #a9c97c); }
.progress-fill.amber { background: linear-gradient(90deg, #c9852f, var(--warning)); }
.progress-fill.orange { background: linear-gradient(90deg, #c96a3d, #e89a6e); }
.progress-fill.red { background: linear-gradient(90deg, #c94f45, var(--danger)); }

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

.hbar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hbar-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}

.hbar-name {
  font-weight: 600;
  font-family: var(--sans);
}

.hbar-meta {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.hbar-track {
  height: 8px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--shared));
}

.hbar-fill.c0 { background: linear-gradient(90deg, #8fae5c, #a9c97c); }
.hbar-fill.c1 { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }
.hbar-fill.c2 { background: linear-gradient(90deg, #c96a3d, #e89a6e); }
.hbar-fill.c3 { background: linear-gradient(90deg, #4cc38a, #7ed8ac); }
.hbar-fill.c4 { background: linear-gradient(90deg, #64748b, #94a3b8); }
.hbar-fill.c5 { background: linear-gradient(90deg, #d47ba1, #f2aec8); }
.hbar-fill.c6 { background: linear-gradient(90deg, #4aa8b8, #6ecfde); }
.hbar-fill.c7 { background: linear-gradient(90deg, #c9852f, var(--warning)); }

.vbar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding-top: 10px;
}

.vbar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.vbar {
  width: 100%;
  max-width: 42px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  min-height: 3px;
  position: relative;
  transition: height 0.5s ease;
}

.vbar:hover {
  filter: brightness(1.15);
}

.vbar-value {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.vbar-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--sans);
  white-space: nowrap;
}

/* Variante compacta del vbar-chart para el strip de historial (dashboard):
   usa todo el ancho de su card; las barras crecen hasta 64px y los labels
   de 12 meses quedan en una sola línea a 10px. */
.vbar-chart--sm {
  height: 110px;
  gap: 8px;
}

.vbar-chart--sm .vbar {
  max-width: 64px;
}

/* Mes sin gastos: la columna conserva su espacio con una base neutra. */
.vbar-chart--sm .vbar.vbar-empty {
  background: var(--card-2);
  border: 1px dashed var(--border);
}

.vbar-chart--sm .vbar-label {
  font-size: 10px;
}

/* Pantallas muy angostas: el año y el monto de cada barra se ocultan para
   que 12 columnas entren sin desbordar (el tooltip conserva el valor). */
@media (max-width: 479px) {
  .vbar-chart--sm .vbar-label-year {
    display: none;
  }

  .vbar-chart--sm .vbar-value {
    display: none;
  }
}

/* ---------- Auth pages ---------- */

.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-promo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 60px;
  gap: 18px;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* Signature element: mate/amber glow + wave */
.auth-promo::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(143, 174, 92, 0.22), transparent 60%),
    radial-gradient(900px 400px at 10% 110%, rgba(232, 180, 90, 0.14), transparent 60%);
}

.auth-promo > * {
  position: relative;
}

.wave {
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 120px;
  opacity: 0.5;
  background: linear-gradient(180deg, transparent, rgba(143, 174, 92, 0.25));
  animation: wave-drift 14s ease-in-out infinite alternate;
}

@keyframes wave-drift {
  from { transform: translateX(0) scaleY(1); }
  to { transform: translateX(-4%) scaleY(1.06); }
}

.promo-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: #f6f3ea;
  font-family: var(--sans);
}

.promo-title em {
  font-style: normal;
  color: var(--primary);
}

.promo-sub {
  color: var(--text-muted);
  max-width: 340px;
}

@media (max-width: 900px) {
  .auth-split {
    grid-template-columns: 1fr;
  }

  .auth-promo {
    display: none;
  }
}

/* ---------- Alerts / banners ---------- */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-top: 12px;
}

.alert-success {
  background: rgba(76, 195, 138, 0.1);
  border: 1px solid rgba(76, 195, 138, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(240, 120, 110, 0.1);
  border: 1px solid rgba(240, 120, 110, 0.3);
  color: var(--danger);
}

.alert-warning {
  background: rgba(232, 180, 90, 0.1);
  border: 1px solid rgba(232, 180, 90, 0.3);
  color: var(--warning);
}

/* ---------- Misc ---------- */

.amount-lg {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

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

.stat-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-value {
  font-family: var(--mono);
  font-weight: 600;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

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

.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.htmx-swapping {
  opacity: 0.4;
  transition: opacity 0.15s;
}

.empty {
  text-align: center;
  color: var(--text-faint);
  padding: 28px 0;
  font-size: 14px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ---------- Dashboard: tools row (period picker + ticker USD) ---------- */

.dash-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.dash-tools .period-picker {
  margin-bottom: 0;
}

.usd-ticker {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.usd-ticker.is-loaded {
  display: inline-flex;
}

.usd-ticker-flag {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.usd-ticker-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Dashboard: delta vs mes anterior ---------- */

.delta-pill {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
  border: 1px solid var(--border);
}

.delta-up {
  color: var(--danger);
  background: rgba(240, 120, 110, 0.08);
  border-color: rgba(240, 120, 110, 0.35);
}

.delta-down {
  color: var(--success);
  background: rgba(76, 195, 138, 0.08);
  border-color: rgba(76, 195, 138, 0.35);
}

.delta-flat {
  color: var(--text-muted);
  background: var(--card-2);
}

/* ---------- Dashboard: leyenda fusionada (pills + promedio) ---------- */

.split-pill-meta {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
}

/* ---------- Cards: título + acción en la misma fila ---------- */

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.card-head .card-title {
  margin-bottom: 0;
}

.card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

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

/* ---------- Budgets: estado actual del mes ---------- */

.budget-state .progress {
  margin-top: 12px;
}

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

/* ---------- Toasts (feedback UX) ---------- */

.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

/* ---------- Empty states con CTA (onboarding) ---------- */

.empty-state {
  text-align: center;
  padding: 26px 0;
}

.empty-state-title {
  margin-bottom: 6px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.empty-state-text {
  margin-bottom: 14px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- Badge de invitaciones pendientes en la nav ---------- */

.nav-link .nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

/* ---------- Spinner inline como indicador HTMX ----------
   NOTA: .spinner (definido arriba) se REUTILIZA para los indicadores de
   carga — Batch 5 NO debe eliminarlo de la lista de CSS muerto. */

.btn .spinner {
  margin-right: 8px;
  vertical-align: -3px;
}

.period-btn {
  position: relative;
}

.period-btn .spinner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-width: 2px;
  margin: 0;
}

.period-btn.htmx-request svg {
  visibility: hidden;
}

/* ---------- Split configurables (form de gastos) ---------- */

.split-control {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.split-readout-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.split-readout-input {
  appearance: textfield;
  -moz-appearance: textfield;
  width: 96px;
  min-height: 44px; /* objetivo táctil ≥44px */
  text-align: right;
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

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

.split-readout-unit {
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
}

/* Slider: track/thumb custom (webkit + moz), appearance:none, thumb 22px
   sobre un control de ≥44px de alto (objetivo táctil). accent-color queda
   como fallback para navegadores sin soporte de pseudo-elementos. */
.split-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--primary);
}

.split-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
}

.split-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -6px; /* (track 8px + bordes 2px − thumb 22px) / 2 */
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #10130b;
  box-shadow: 0 0 0 2px var(--primary-strong);
  cursor: grab;
}

.split-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
}

.split-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #10130b;
  box-shadow: 0 0 0 2px var(--primary-strong);
  cursor: grab;
}

.split-slider:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.split-slider:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.split-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.split-chip {
  min-height: 44px; /* objetivo táctil ≥44px */
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.split-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.split-chip:active {
  background: var(--primary-soft);
  color: var(--primary);
}

.split-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Barra two-tone: ancho de cada segmento lo pinta el servidor (y JS lo
   mantiene) — --personal = "tu parte" (ámbar), --shared = pareja (mate). */
.split-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--card-2);
  border: 1px solid var(--border);
}

.split-bar-seg {
  height: 100%;
  transition: width 0.15s ease;
}

.split-bar-personal {
  background: var(--personal);
}

.split-bar-shared {
  background: var(--shared);
}

.split-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

.split-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  color: var(--text-muted);
}

.split-preview-amt {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
