    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    }

    body {
      background: #f5f7fb;
      display: flex;
      justify-content: center;
      min-height: 100vh;
    }

    #app {
      width: 100%;
      max-width: 600px;
      background: #ffffff;
      min-height: 100vh;
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
      display: flex;
      flex-direction: column;
      position: relative;
    }

    /* header */
    .header {
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: #ffffff;
      border-bottom: 1px solid #eef1f5;
    }

    .header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .header-title {
      display: flex;
      align-items: center;
      min-width: 0;
    }

    .header-title h1 {
      font-size: 1rem;
      font-weight: 700;
      color: #1e293b;
      letter-spacing: -0.01em;
    }

    .header-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-shrink: 0;
    }

    .icon-btn {
      background: #f1f5f9;
      border: none;
      border-radius: 50%;
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      cursor: pointer;
      color: #1e293b;
      transition: background 0.15s;
    }

    .icon-btn:active {
      background: #e2e8f0;
    }

    .file-label {
      background: #4f46e5;
      color: white;
      padding: 6px 11px;
      border-radius: 30px;
      font-size: 0.78rem;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 5px;
      cursor: pointer;
      white-space: nowrap;
      border: none;
    }

    .file-label input {
      display: none;
    }

    /* stats */
    .stats {
      padding: 10px 14px;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      font-size: 0.78rem;
      color: #334155;
      background: #f8fafc;
      border-bottom: 1px solid #eef1f5;
    }

    .stat-item {
      background: white;
      padding: 5px 11px;
      border-radius: 30px;
      font-weight: 500;
      box-shadow: 0 1px 2px rgba(0,0,0,0.02);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .stat-item span {
      font-weight: 700;
      color: #0f172a;
    }

    .stat-item.income span {
      color: #0b7e3e;
    }

    .stat-item.expense span {
      color: #b91c1c;
    }

    /* lista */
    .transaction-list {
      flex: 1;
      padding: 0 14px 20px 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: #ffffff;
    }

    .month-separator {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 14px 0 4px 0;
      color: #475569;
      font-size: 1rem;
      font-weight: 700;
      text-transform: capitalize;
      letter-spacing: 0.03em;
    }

    .transaction-item {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 12px 14px;
      background: #ffffff;
      border-radius: 12px;
      border: 1px solid #f0f2f5;
      border-left: 4px solid #cbd5e1;
      box-shadow: 0 1px 2px rgba(0,0,0,0.02);
      transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
      cursor: pointer;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
    }

    .transaction-item.income {
      border-left-color: #10b981;
    }

    .transaction-item.expense {
      border-left-color: #ef4444;
    }

    .transaction-item:active {
      background: #fafbff;
    }

    .transaction-item.selected {
      background: #eef2ff;
      border-color: #4f46e5;
      border-left-color: #4f46e5;
      box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15), 0 2px 8px rgba(79, 70, 229, 0.12);
    }

    .tx-counterparty {
      font-size: 0.92rem;
      font-weight: 600;
      color: #1e293b;
      line-height: 1.3;
      white-space: normal;
      word-break: break-word;
      overflow-wrap: anywhere;
    }

    .tx-meta {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 8px;
      flex-wrap: wrap;
    }

    .tx-date {
      font-size: 0.78rem;
      color: #64748b;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .tx-amount {
      font-weight: 700;
      font-size: 0.95rem;
      white-space: nowrap;
    }

    .tx-amount.income {
      color: #0b7e3e;
    }

    .tx-amount.expense {
      color: #b91c1c;
    }

    .tx-message {
      font-size: 1rem;
      color: #64748b;
      white-space: normal;
      word-break: break-word;
      overflow-wrap: anywhere;
      font-style: italic;
      line-height: 1.35;
    }

    .empty-state {
      text-align: center;
      padding: 40px 16px;
      color: #94a3b8;
      font-size: 0.9rem;
    }

    .empty-state .big {
      font-size: 2.5rem;
      margin-bottom: 8px;
    }

    /* ============ MODAL ============ */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      backdrop-filter: blur(2px);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
      z-index: 100;
    }

    .modal-overlay.open {
      display: flex;
    }

    .modal {
      background: #ffffff;
      width: 100%;
      max-width: 420px;
      border-radius: 20px;
      box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
      display: flex;
      flex-direction: column;
      max-height: calc(100vh - 32px);
      overflow: hidden;
      animation: modalIn 0.18s ease-out;
    }

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

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      border-bottom: 1px solid #eef1f5;
    }

    .modal-header h2 {
      font-size: 0.95rem;
      font-weight: 700;
      color: #1e293b;
    }

  .modal-close {
      background: #c80505;
      border: none;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      cursor: pointer;
      color: #ffffff;
      transition: background 0.15s;
  }

    .modal-close:active {
      background: #e2e8f0;
    }

    .modal-body {
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      overflow-y: auto;
    }

    .filter-row {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .filter-row > label {
      font-size: 0.7rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.02em;
      color: #000000;
    }

    .filter-input,
    .filter-select {
      padding: 10px 11px;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      font-size: 0.88rem;
      background: #f8fafc;
      width: 100%;
      outline: none;
      transition: border 0.15s;
      color: #1e293b;
    }

    .filter-input:focus,
    .filter-select:focus {
      border-color: #4f46e5;
      background: white;
    }

    input[type="search"].filter-input::-webkit-search-cancel-button {
      -webkit-appearance: none;
      appearance: none;
      height: 15px;
      width: 15px;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'><path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>");
      background-size: contain;
      background-repeat: no-repeat;
      cursor: pointer;
      margin-right: 4px;
    }
    input[type="search"].filter-input::-webkit-search-cancel-button:hover {
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'><path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>");
    }

    /* Radio buttons de modo */
    .time-options {
      display: flex;
      gap: 8px;
      margin-bottom: 4px;
    }

    .time-option {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 9px 8px;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      background: #f8fafc;
      font-size: 0.8rem;
      font-weight: 500;
      color: #475569;
      cursor: pointer;
      transition: all 0.15s;
      text-align: center;
      user-select: none;
    }

    .time-option input[type="radio"] {
      display: none;
    }

    .time-option.selected {
      background: #eef2ff;
      border-color: #4f46e5;
      color: #4f46e5;
      font-weight: 600;
    }

    .time-content {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .time-content.hidden {
      display: none;
    }

    .date-range-row {
      display: flex;
      gap: 10px;
    }

    .date-range-row .filter-input {
      flex: 1;
    }

    /* Filtro de montos */
    .amount-mode-options {
      display: flex;
      gap: 6px;
      margin-bottom: 4px;
    }

    .amount-mode-option {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 8px 4px;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      background: #f8fafc;
      font-size: 0.72rem;
      font-weight: 500;
      color: #475569;
      cursor: pointer;
      transition: all 0.15s;
      text-align: center;
      user-select: none;
      line-height: 1.15;
    }

    .amount-mode-option input[type="radio"] {
      display: none;
    }

    .amount-mode-option.selected {
      background: #eef2ff;
      border-color: #4f46e5;
      color: #4f46e5;
      font-weight: 600;
    }

    .amount-content {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .amount-content.hidden {
      display: none;
    }

    .input-with-prefix {
      position: relative;
      display: flex;
      align-items: center;
    }

    .input-with-prefix .prefix {
      position: absolute;
      left: 11px;
      font-size: 0.88rem;
      color: #94a3b8;
      pointer-events: none;
      font-weight: 500;
    }

    .input-with-prefix .filter-input {
      padding-left: 32px;
    }

    /* Footer del modal */
    .modal-footer {
      padding: 12px 16px 14px;
      border-top: 1px solid #eef1f5;
      display: flex;
      gap: 8px;
    }

    .btn {
      flex: 1;
      padding: 11px 14px;
      border-radius: 10px;
      font-size: 0.88rem;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: background 0.15s;
    }

    .btn-secondary {
      background: #f1f5f9;
      color: #334155;
    }

    .btn-secondary:active {
      background: #e2e8f0;
    }

    .btn-primary {
      background: #4f46e5;
      color: white;
      flex: 2;
    }

    .btn-primary:active {
      background: #4338ca;
    }

    @media (min-width: 640px) {
      body {
        background: #eef1f5;
        padding: 20px 0;
      }
      #app {
        margin: 0 auto;
        border-radius: 24px;
        overflow: hidden;
      }
    }

    .flatpickr-calendar {
      font-size: 0.9rem;
    }
