:root {
      --bg: #F7F5F0;
      --surface: #FFFFFF;
      --surface2: #F0EDE6;
      --border: #E5E0D8;
      --border2: #D5CFC5;
      --text: #1A1916;
      --text2: #6B6760;
      --text3: #A8A39C;
      --green: #0F6E56;
      --green-bg: #E1F5EE;
      --green-light: #5DCAA5;
      --red: #993C1D;
      --red-bg: #FAECE7;
      --purple: #534AB7;
      --purple-bg: #EEEDFE;
      --amber: #854F0B;
      --amber-bg: #FAEEDA;
      --radius: 16px;
      --radius-sm: 10px;
      --radius-xs: 6px;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--bg);
      color: var(--text);
      font-size: 16px;
      min-height: 100vh;
      max-width: 430px;
      margin: 0 auto;
      overflow-x: hidden;
    }

    /* ── HEADER ── */
    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 52px 20px 12px;
    }
    .header-left p:first-child { font-size: 14px; color: var(--text2); margin-bottom: 2px; }
    .header-left p:last-child  { font-size: 18px; font-weight: 600; color: var(--text); }
    .header-right {
      width: 38px; height: 38px; border-radius: 50%;
      background: var(--surface); border: 1px solid var(--border);
      display: flex; align-items: center; justify-content: center; cursor: pointer;
    }

    /* ── BALANCE CARD ── */
    .balance-card {
      margin: 0 16px 16px;
      background: #1A1916;
      border-radius: var(--radius);
      padding: 22px 22px 18px;
      color: #fff;
      position: relative;
      overflow: hidden;
    }
    .balance-card::before {
      content: '';
      position: absolute;
      top: -40px; right: -40px;
      width: 160px; height: 160px;
      border-radius: 50%;
      background: rgba(255,255,255,0.04);
    }
    .balance-card::after {
      content: '';
      position: absolute;
      bottom: -60px; left: -20px;
      width: 180px; height: 180px;
      border-radius: 50%;
      background: rgba(255,255,255,0.03);
    }
    .balance-label { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
    .balance-amount { font-size: 38px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.5px; }
    .balance-perday {
      font-size: 13px; color: rgba(255,255,255,0.55);
      margin-bottom: 16px; display: flex; align-items: center; gap: 5px;
    }
    .balance-perday strong { color: rgba(255,255,255,0.85); font-weight: 500; }

    .balance-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .balance-item {
      background: rgba(255,255,255,0.08);
      border-radius: var(--radius-sm);
      padding: 10px 12px;
    }
    .balance-item-label {
      display: flex; align-items: center; gap: 5px;
      font-size: 12px; color: rgba(255,255,255,0.5); margin-bottom: 3px;
    }
    .balance-item-amount { font-size: 18px; font-weight: 500; }

    /* ── INPUT SECTION ── */
    .input-section { padding: 0 16px 4px; }
    .input-label { font-size: 13px; color: var(--text2); margin-bottom: 8px; font-weight: 500; }

    .rec-indicator {
      display: none; align-items: center; gap: 10px;
      background: var(--red-bg); border-radius: var(--radius-sm);
      padding: 10px 14px; margin-bottom: 10px;
    }
    .rec-indicator.active { display: flex; }
    .rec-waves { display: flex; gap: 3px; align-items: center; }
    .rec-wave {
      width: 3px; border-radius: 99px; background: var(--red);
      animation: wave 0.8s ease-in-out infinite;
    }
    .rec-wave:nth-child(2) { animation-delay: 0.1s; }
    .rec-wave:nth-child(3) { animation-delay: 0.2s; }
    .rec-wave:nth-child(4) { animation-delay: 0.3s; }
    .rec-wave:nth-child(5) { animation-delay: 0.4s; }
    @keyframes wave {
      0%, 100% { height: 8px; }
      50% { height: 20px; }
    }
    .rec-timer { font-size: 14px; color: var(--red); font-weight: 500; flex: 1; }
    .rec-stop {
      font-size: 13px; color: var(--red); font-weight: 600;
      background: none; border: none; cursor: pointer; padding: 0;
    }
    .rec-preview {
      display: none; margin-bottom: 8px;
      background: var(--purple-bg); border-radius: var(--radius-sm);
      padding: 10px 14px; align-items: flex-start; gap: 8px;
      animation: slideUp 0.2s ease;
    }
    .rec-preview.active { display: flex; }
    .rec-preview-text { font-size: 14px; color: var(--purple); flex: 1; line-height: 1.4; }
    .rec-preview-label { font-size: 11px; color: var(--purple); opacity: 0.7; margin-bottom: 2px; }

    .input-bar {
      display: flex; align-items: flex-end; gap: 8px;
      background: var(--surface); border: 1.5px solid var(--border);
      border-radius: var(--radius); padding: 10px 10px 10px 14px;
      transition: border-color 0.15s;
    }
    .input-bar:focus-within { border-color: var(--border2); }
    .input-bar textarea {
      flex: 1; border: none; background: transparent;
      resize: none; font-size: 15px; font-family: 'DM Sans', sans-serif;
      color: var(--text); line-height: 1.5; outline: none;
      max-height: 80px; min-height: 22px;
    }
    .input-bar textarea::placeholder { color: var(--text3); }
    .btn-mic {
      width: 36px; height: 36px; border-radius: 50%;
      background: var(--surface2); border: 1px solid var(--border);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; flex-shrink: 0; transition: all 0.15s;
    }
    .btn-mic.recording { background: var(--red-bg); border-color: var(--red); }
    .btn-send {
      width: 36px; height: 36px; border-radius: 50%;
      background: var(--green); border: none;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; flex-shrink: 0;
      opacity: 0.35; transition: opacity 0.15s;
    }
    .btn-send.active { opacity: 1; }

    .chips {
      display: flex; gap: 6px; padding: 10px 0 16px;
      overflow-x: auto; scrollbar-width: none;
    }
    .chips::-webkit-scrollbar { display: none; }
    .chip {
      white-space: nowrap; font-size: 13px; font-family: 'DM Sans', sans-serif;
      padding: 7px 14px; border-radius: 99px;
      border: 1px solid var(--border); background: var(--surface);
      cursor: pointer; color: var(--text2);
      display: flex; align-items: center; gap: 5px;
      transition: all 0.12s; flex-shrink: 0;
    }
    .chip:active { background: var(--surface2); }

    /* ── TOAST ── */
    .toast {
      display: none; margin: 0 0 12px;
      background: var(--green-bg); border-radius: var(--radius-sm);
      padding: 10px 14px; align-items: center; gap: 8px;
      animation: slideUp 0.2s ease;
    }
    .toast.visible { display: flex; }
    .toast span { font-size: 14px; color: var(--green); font-weight: 500; }

    /* ── PROCESSING ── */
    .processing {
      display: none; margin: 0 0 12px;
      background: var(--surface2); border-radius: var(--radius-sm);
      padding: 12px 14px; align-items: center; gap: 10px;
    }
    .processing.visible { display: flex; }
    .spinner {
      width: 18px; height: 18px; border: 2px solid var(--border2);
      border-top-color: var(--purple); border-radius: 50%;
      animation: spin 0.7s linear infinite; flex-shrink: 0;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .processing span { font-size: 14px; color: var(--text2); }

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

    /* ── #7 CHECKLIST GASTOS FIJOS (colapsable) ── */
    .gastos-fijos-strip {
      margin: 0 16px 16px;
      border: 1px solid var(--border); border-radius: var(--radius);
      overflow: hidden;
    }
    .gastos-fijos-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 13px 16px; cursor: pointer; user-select: none;
      background: var(--surface);
    }
    .gastos-fijos-header-left { display: flex; align-items: center; gap: 8px; }
    .gastos-fijos-title { font-size: 14px; font-weight: 500; }
    .gastos-fijos-progress {
      font-size: 12px; color: var(--text3);
      background: var(--surface2); padding: 2px 8px; border-radius: 99px;
    }
    .gastos-fijos-progress.completo { background: var(--green-bg); color: var(--green); }
    .gastos-fijos-chevron {
      font-size: 16px; color: var(--text3);
      transition: transform 0.2s;
    }
    .gastos-fijos-chevron.open { transform: rotate(180deg); }
    .gastos-fijos-body {
      display: none; border-top: 1px solid var(--border);
    }
    .gastos-fijos-body.open { display: block; }
    .gasto-fijo-item {
      display: flex; align-items: center; gap: 10px;
      padding: 11px 16px; border-bottom: 1px solid var(--border);
      cursor: pointer; transition: background 0.12s;
    }
    .gasto-fijo-item:last-child { border-bottom: none; }
    .gasto-fijo-item:active { background: var(--surface2); }
    .gasto-fijo-cb {
      width: 20px; height: 20px; border-radius: 6px;
      border: 1.5px solid var(--border2); flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.15s;
    }
    .gasto-fijo-cb.checked { background: var(--green); border-color: var(--green); }
    .gasto-fijo-info { flex: 1; }
    .gasto-fijo-nombre { font-size: 14px; font-weight: 500; }
    .gasto-fijo-nombre.pagado { text-decoration: line-through; color: var(--text3); }
    .gasto-fijo-vto { font-size: 12px; color: var(--text3); margin-top: 1px; }
    .gasto-fijo-monto { font-size: 14px; font-weight: 500; color: var(--text2); flex-shrink: 0; }
    .gasto-fijo-monto.pagado { color: var(--green); }

    
    /* ── PANTALLA DE LOGIN ── */
    .login-screen {
      display: none; position: fixed; inset: 0; z-index: 999;
      background: var(--bg); flex-direction: column;
      align-items: center; justify-content: center;
      padding: 40px 32px;
    }
    .login-screen.visible { display: flex; }
    .login-logo {
      font-size: 32px; font-weight: 600; letter-spacing: -1px;
      color: var(--text); margin-bottom: 8px;
    }
    .login-sub {
      font-size: 15px; color: var(--text2); margin-bottom: 48px; text-align: center;
    }
    .login-form { width: 100%; max-width: 320px; }
    .login-label { font-size: 13px; color: var(--text2); margin-bottom: 6px; display: block; }
    .login-input {
      width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
      border-radius: var(--radius-sm); font-size: 15px;
      font-family: 'DM Sans', sans-serif; color: var(--text);
      background: var(--surface); outline: none; margin-bottom: 14px;
    }
    .login-input:focus { border-color: var(--border2); }
    .login-btn {
      width: 100%; padding: 13px; background: var(--text); border: none;
      border-radius: var(--radius-sm); font-size: 15px; font-weight: 500;
      font-family: 'DM Sans', sans-serif; color: #fff; cursor: pointer;
    }
    .login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .login-msg { font-size: 13px; color: var(--text2); text-align: center; margin-top: 16px; }
    .login-msg.success { color: var(--green); }
    .login-msg.error { color: var(--red); }

    /* ── BANNER CIERRE DE MES ── */
    .cierre-banner {
      display: none; margin: 0 16px 16px;
      background: #1A1916; border-radius: var(--radius);
      padding: 18px 20px; animation: slideUp 0.3s ease;
    }
    .cierre-banner.visible { display: block; }
    .cierre-banner-title {
      font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 4px;
    }
    .cierre-banner-sub {
      font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 14px;
    }
    .cierre-stats {
      display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 14px;
    }
    .cierre-stat {
      background: rgba(255,255,255,0.08); border-radius: var(--radius-sm); padding: 8px 10px;
    }
    .cierre-stat-label { font-size: 11px; color: rgba(255,255,255,0.4); margin-bottom: 2px; }
    .cierre-stat-value { font-size: 15px; font-weight: 500; color: #fff; }
    .cierre-btns { display: flex; gap: 8px; }
    .cierre-btn-confirm {
      flex: 1; padding: 10px; background: #fff; border: none;
      border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
      font-family: 'DM Sans', sans-serif; color: #1A1916; cursor: pointer;
    }
    .cierre-btn-dismiss {
      padding: 10px 16px; background: rgba(255,255,255,0.1); border: none;
      border-radius: var(--radius-sm); font-size: 14px;
      font-family: 'DM Sans', sans-serif; color: rgba(255,255,255,0.6); cursor: pointer;
    }

    /* ── MODAL EDITAR CATEGORÍA ── */
    .cat-modal-overlay {
      display: none; position: fixed; inset: 0; z-index: 200;
      background: rgba(0,0,0,0.45); align-items: flex-end; justify-content: center;
    }
    .cat-modal-overlay.open { display: flex; }
    .cat-modal-sheet {
      width: 100%; max-width: 430px;
      background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
      padding: 0 0 40px; animation: sheetUp 0.22s ease;
    }
    .cat-modal-title {
      font-size: 16px; font-weight: 600; padding: 16px 20px 12px;
      border-bottom: 1px solid var(--border);
    }
    .cat-grid {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 8px; padding: 16px 20px;
    }
    .cat-option {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 12px; border-radius: var(--radius-sm);
      border: 1.5px solid var(--border); background: var(--surface);
      cursor: pointer; font-size: 13px; font-family: 'DM Sans', sans-serif;
      color: var(--text); transition: all 0.12s;
    }
    .cat-option:active { background: var(--surface2); }
    .cat-option.selected { border-color: var(--text); background: var(--text); color: #fff; }
    .cat-option.selected i { color: #fff !important; }
    .cat-cancel {
      margin: 0 20px; width: calc(100% - 40px); padding: 13px;
      background: var(--surface2); border: none; border-radius: var(--radius-sm);
      font-size: 15px; font-family: 'DM Sans', sans-serif;
      color: var(--text2); cursor: pointer;
    }

    .gf-edit-btn {
      font-size: 12px; color: var(--text3); background: none; border: none;
      cursor: pointer; padding: 0; display: flex; align-items: center; gap: 3px;
      transition: color 0.12s;
    }
    .gf-edit-btn:active { color: var(--text2); }

    /* ── MODAL GASTOS FIJOS ── */
    .modal-overlay {
      display: none; position: fixed; inset: 0; z-index: 100;
      background: rgba(0,0,0,0.45); align-items: flex-end; justify-content: center;
    }
    .modal-overlay.open { display: flex; }
    .modal-sheet {
      width: 100%; max-width: 430px;
      background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
      padding: 0 0 40px; max-height: 88vh; overflow-y: auto;
      animation: sheetUp 0.22s ease;
    }
    @keyframes sheetUp {
      from { transform: translateY(100%); }
      to   { transform: translateY(0); }
    }
    .modal-handle {
      width: 36px; height: 4px; background: var(--border2);
      border-radius: 99px; margin: 12px auto 0;
    }
    .modal-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 16px 20px 12px;
    }
    .modal-title { font-size: 16px; font-weight: 600; }
    .modal-close {
      width: 30px; height: 30px; border-radius: 50%;
      background: var(--surface2); border: none; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
    }
    .modal-items { padding: 0 20px; }
    .modal-item {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 0; border-bottom: 1px solid var(--border);
    }
    .modal-item:last-child { border-bottom: none; }
    .modal-item-drag { color: var(--text3); cursor: grab; font-size: 18px; }
    .modal-item-inputs { flex: 1; display: flex; flex-direction: column; gap: 4px; }
    .modal-item-inputs input {
      border: 1px solid var(--border); border-radius: var(--radius-xs);
      padding: 5px 8px; font-size: 13px; font-family: 'DM Sans', sans-serif;
      color: var(--text); background: var(--bg); outline: none; width: 100%;
    }
    .modal-item-inputs input:focus { border-color: var(--border2); }
    .modal-item-row { display: flex; gap: 6px; }
    .modal-item-row input { flex: 1; }
    .modal-item-del {
      width: 30px; height: 30px; border-radius: 50%;
      background: var(--red-bg); border: none; cursor: pointer;
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .modal-add-btn {
      margin: 14px 20px 0;
      width: calc(100% - 40px); padding: 11px;
      background: var(--surface2); border: 1.5px dashed var(--border2);
      border-radius: var(--radius-sm); font-size: 14px; font-family: 'DM Sans', sans-serif;
      color: var(--text2); cursor: pointer; display: flex; align-items: center;
      justify-content: center; gap: 6px;
    }
    .modal-save-btn {
      margin: 14px 20px 0;
      width: calc(100% - 40px); padding: 13px;
      background: var(--green); border: none;
      border-radius: var(--radius-sm); font-size: 15px; font-weight: 500;
      font-family: 'DM Sans', sans-serif; color: #fff; cursor: pointer;
    }

    /* ── TX LIST ── */
    .tx-section { padding: 0 16px 100px; }
    .tx-header {
      display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
    }
    .tx-header span:first-child { font-size: 14px; font-weight: 500; }
    .tx-header button {
      font-size: 13px; color: var(--text2); background: none; border: none; cursor: pointer;
    }
    .tx-list { display: flex; flex-direction: column; }
    .tx-row {
      display: flex; align-items: center; gap: 10px;
      padding: 11px 0; border-bottom: 1px solid var(--border);
    }
    .tx-row:last-child { border-bottom: none; }
    .tx-icon {
      width: 38px; height: 38px; border-radius: var(--radius-sm);
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .tx-info { flex: 1; min-width: 0; }
    .tx-info p:first-child {
      font-size: 14px; font-weight: 500;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .tx-info p:last-child { font-size: 12px; color: var(--text2); margin-top: 1px; }
    .tx-amount { font-size: 15px; font-weight: 500; flex-shrink: 0; }

    /* ── BOTTOM NAV ── */
    .bottom-nav {
      position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
      width: 100%; max-width: 430px;
      display: grid; grid-template-columns: repeat(4, 1fr);
      background: var(--surface); border-top: 1px solid var(--border);
      padding: 10px 0 24px;
    }
    .nav-item {
      display: flex; flex-direction: column; align-items: center; gap: 3px;
      background: none; border: none; cursor: pointer; padding: 0;
    }
    .nav-item span { font-size: 11px; color: var(--text3); }
    .nav-item.active span { color: var(--text); font-weight: 500; }

    /* ── USUARIO SELECTOR ── */
    .user-selector {
      display: flex; gap: 8px; padding: 0 16px 12px;
    }
    .user-btn {
      flex: 1; padding: 8px 4px; border-radius: var(--radius-sm);
      border: 1.5px solid var(--border); background: var(--surface);
      font-size: 13px; font-family: 'DM Sans', sans-serif;
      cursor: pointer; color: var(--text2); font-weight: 500;
      transition: all 0.12s;
    }
    .user-btn.selected {
      border-color: var(--text); background: var(--text); color: #fff;
    }
/* ── TUTORIAL ── */
.tutorial-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  pointer-events: none;
}
.tutorial-overlay.visible { display: block; }

.tutorial-card {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: #1A1916; border-radius: 24px 24px 0 0;
  padding: 20px 24px 40px;
  animation: sheetUp 0.25s ease;
  pointer-events: all;
  z-index: 501;
}
.tutorial-dots {
  display: flex; gap: 6px; justify-content: center; margin-bottom: 14px;
}
.tutorial-titulo {
  font-size: 18px; font-weight: 600; color: #fff;
  margin-bottom: 8px; line-height: 1.3;
}
.tutorial-desc {
  font-size: 14px; color: rgba(255,255,255,0.6);
  line-height: 1.5; margin-bottom: 20px;
}
.tutorial-btn {
  width: 100%; padding: 13px; background: #fff; border: none;
  border-radius: 12px; font-size: 15px; font-weight: 600;
  font-family: 'DM Sans', sans-serif; color: #1A1916;
  cursor: pointer; margin-bottom: 8px;
}
.tutorial-skip {
  display: none; width: 100%; padding: 8px; background: none; border: none;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  color: rgba(255,255,255,0.4); cursor: pointer;
}

/* Highlight del elemento activo */
.tutorial-highlight {
  position: relative; z-index: 501;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.5), 0 0 0 6px rgba(255,255,255,0.15);
  border-radius: 16px;
  transition: box-shadow 0.3s ease;
}
