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

:root {
  --accent: #7C6FFF;
    --accent-dim: rgba(124,111,255,0.15);
      --accent-hover: #9B91FF;
        --green: #3DD68C;
          --green-dim: rgba(61,214,140,0.12);
            --red: #FF6B6B;
              --red-dim: rgba(255,107,107,0.12);
                --bg: #0F0F13;
                  --bg2: #16161C;
                    --bg3: #1E1E26;
                      --surface: #1A1A22;
                        --surface2: #22222C;
                          --border: rgba(255,255,255,0.07);
                            --border2: rgba(255,255,255,0.12);
                              --text: #F0F0F5;
                                --text-2: #9090A8;
                                  --text-3: #55556A;
                                    --radius: 10px;
                                      --radius-lg: 14px;
                                        --radius-xl: 18px;
                                        }

                                        body {
                                          font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
                                            background: var(--bg);
                                              color: var(--text);
                                                min-height: 100vh;
                                                  font-size: 15px;
                                                    -webkit-font-smoothing: antialiased;
                                                    }

                                                    .top-bar {
                                                      background: var(--bg2);
                                                        border-bottom: 1px solid var(--border);
                                                          display: flex;
                                                            align-items: center;
                                                              justify-content: space-between;
                                                                padding: 14px 24px;
                                                                  position: sticky;
                                                                    top: 0;
                                                                      z-index: 100;
                                                                      }
                                                                      .brand { display: flex; align-items: center; gap: 10px; }
                                                                      .brand-name { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }

                                                                      .monzo-bar {
                                                                        display: flex; align-items: center; gap: 8px;
                                                                          padding: 7px 14px; border-radius: var(--radius);
                                                                            border: 1px solid var(--border); background: var(--surface); transition: all 0.2s;
                                                                            }
                                                                            .monzo-bar.monzo-connected { background: rgba(255,107,107,0.08); border-color: rgba(255,107,107,0.25); }
                                                                            .monzo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
                                                                            .monzo-connected .monzo-dot { background: #FF6B6B; box-shadow: 0 0 6px rgba(255,107,107,0.6); }
                                                                            .monzo-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
                                                                            .monzo-connected .monzo-label { color: #FF9999; }
                                                                            .monzo-amount { font-size: 15px; font-weight: 600; color: var(--text); }
                                                                            .monzo-connected .monzo-amount { color: #FFBABA; }
                                                                            .monzo-connect-btn {
                                                                              font-size: 12px; color: var(--accent); text-decoration: none;
                                                                                border: 1px solid rgba(124,111,255,0.3); border-radius: 6px; padding: 3px 10px; transition: all 0.15s;
                                                                                }
                                                                                .monzo-connect-btn:hover { background: var(--accent-dim); }
                                                                                .monzo-connected .monzo-connect-btn { display: none; }

                                                                                .profile-bar {
                                                                                  display: flex; align-items: center; gap: 6px;
                                                                                    padding: 10px 24px; background: var(--bg2);
                                                                                      border-bottom: 1px solid var(--border); flex-wrap: wrap;
                                                                                      }
                                                                                      .profile-chip {
                                                                                        padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border2);
                                                                                          background: var(--surface); font-size: 12px; font-weight: 500;
                                                                                            cursor: pointer; color: var(--text-2); transition: all 0.15s;
                                                                                            }
                                                                                            .profile-chip:hover { background: var(--surface2); color: var(--text); }
                                                                                            .profile-chip.active { color: white; border-color: transparent; }
                                                                                            .profile-settings-btn {
                                                                                              margin-left: auto; background: none; border: 1px solid var(--border);
                                                                                                border-radius: var(--radius); padding: 5px 10px; cursor: pointer;
                                                                                                  font-size: 15px; color: var(--text-3); transition: all 0.15s;
                                                                                                  }
                                                                                                  .profile-settings-btn:hover { color: var(--text); border-color: var(--border2); }
                                                                                                  .profile-list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
                                                                                                  .profile-list-row:last-child { border-bottom: none; }
                                                                                                  .profile-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
                                                                                                  .profile-list-name { flex: 1; font-size: 14px; font-weight: 500; }
                                                                                                  .profile-list-name input { width: 100%; border: 1px solid var(--border2); border-radius: var(--radius); padding: 5px 9px; font-size: 14px; background: var(--bg3); color: var(--text); }

                                                                                                  .main-content { max-width: 1020px; margin: 0 auto; padding: 24px 20px; }
                                                                                                  .cal-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
                                                                                                  .cal-title { font-size: 19px; font-weight: 600; flex: 1; text-align: center; letter-spacing: -0.4px; color: var(--text); }
                                                                                                  .nav-btn { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); padding: 7px 16px; cursor: pointer; font-size: 14px; color: var(--text-2); transition: all 0.15s; }
                                                                                                  .nav-btn:hover { background: var(--surface2); color: var(--text); }
                                                                                                  .add-btn { background: var(--accent); color: white; border: none; border-radius: var(--radius); padding: 8px 18px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s; }
                                                                                                  .add-btn:hover { background: var(--accent-hover); }

                                                                                                  .summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
                                                                                                  .summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px; transition: border-color 0.15s; }
                                                                                                  .summary-card:hover { border-color: var(--border2); }
                                                                                                  .summary-label { font-size: 11px; font-weight: 500; color: var(--text-3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
                                                                                                  .summary-val { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
                                                                                                  .summary-in .summary-val { color: var(--green); }
                                                                                                  .summary-out .summary-val { color: var(--red); }
                                                                                                  .summary-net .summary-val { color: var(--text); }

                                                                                                  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
                                                                                                  .day-label { text-align: center; font-size: 10px; font-weight: 600; color: var(--text-3); padding: 8px 0; text-transform: uppercase; letter-spacing: 0.08em; }
                                                                                                  .cal-cell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 82px; cursor: pointer; transition: all 0.15s; }
                                                                                                  .cal-cell:hover { border-color: var(--border2); background: var(--surface2); }
                                                                                                  .cal-cell.today { border-color: var(--accent); border-width: 1.5px; background: rgba(124,111,255,0.05); }
                                                                                                  .cal-cell.other-month { background: var(--bg2); opacity: 0.5; cursor: default; }
                                                                                                  .cal-cell.other-month:hover { border-color: var(--border); background: var(--bg2); }
                                                                                                  .cal-cell.selected { border-color: var(--accent); border-width: 2px; background: rgba(124,111,255,0.08); }
                                                                                                  .cal-day-num { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 5px; }
                                                                                                  .cal-cell.today .cal-day-num { color: var(--accent); }
                                                                                                  .cal-total { font-size: 10px; font-weight: 700; margin-bottom: 4px; }
                                                                                                  .cal-total.pos { color: var(--green); }
                                                                                                  .cal-total.neg { color: var(--red); }
                                                                                                  .event-pill { font-size: 10px; border-radius: 4px; padding: 2px 6px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; font-weight: 500; }
                                                                                                  .pill-out { background: var(--red-dim); color: var(--red); }
                                                                                                  .pill-in { background: var(--green-dim); color: var(--green); }
                                                                                                  .pill-recur { background: var(--accent-dim); color: var(--accent-hover); }

                                                                                                  .day-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 22px; margin-top: 16px; }
                                                                                                  .detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
                                                                                                  .detail-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
                                                                                                  .detail-close { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 13px; color: var(--text-3); transition: all 0.15s; }
                                                                                                  .detail-close:hover { color: var(--text); }
                                                                                                  .detail-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); }
                                                                                                  .detail-row:last-child { border-bottom: none; }
                                                                                                  .detail-name { font-size: 14px; font-weight: 500; color: var(--text); }
                                                                                                  .detail-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
                                                                                                  .detail-right { display: flex; align-items: center; gap: 10px; }
                                                                                                  .detail-amount { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }
                                                                                                  .detail-amount.out { color: var(--red); }
                                                                                                  .detail-amount.in { color: var(--green); }
                                                                                                  .recur-badge { font-size: 10px; font-weight: 500; background: var(--accent-dim); color: var(--accent-hover); border-radius: 4px; padding: 2px 7px; margin-left: 6px; }
                                                                                                  .icon-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; color: var(--text-3); transition: all 0.15s; }
                                                                                                  .icon-btn:hover { border-color: var(--border2); color: var(--text); }
                                                                                                  .icon-btn.del:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }
                                                                                                  .detail-empty { color: var(--text-3); font-size: 13px; padding: 16px 0; text-align: center; }

                                                                                                  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
                                                                                                  .modal { background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border2); padding: 22px 26px; width: 100%; max-width: 420px; }
                                                                                                  .modal-sm { max-width: 340px; }
                                                                                                  .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
                                                                                                  .modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text); }
                                                                                                  .modal-close { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 13px; color: var(--text-3); transition: all 0.15s; }
                                                                                                  .modal-close:hover { color: var(--text); }
                                                                                                  .form-row { margin-bottom: 14px; }
                                                                                                  .form-row label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 6px; }
                                                                                                  .optional { color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; }
                                                                                                  .form-row input[type="text"], .form-row input[type="number"], .form-row input[type="date"], .form-row select { width: 100%; padding: 9px 12px; border: 1px solid var(--border2); border-radius: var(--radius); font-size: 14px; color: var(--text); background: var(--bg3); transition: border-color 0.15s; }
                                                                                                  .form-row input:focus, .form-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
                                                                                                  .form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
                                                                                                  .toggle-row { display: flex; gap: 5px; }
                                                                                                  .toggle-opt { flex: 1; padding: 8px; border: 1px solid var(--border2); border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); background: var(--bg3); transition: all 0.15s; text-align: center; }
                                                                                                  .toggle-opt:hover { background: var(--surface2); color: var(--text); }
                                                                                                  .toggle-opt.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hover); }
                                                                                                  .modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }
                                                                                                  .btn-primary { background: var(--accent); color: white; border: none; border-radius: var(--radius); padding: 9px 22px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
                                                                                                  .btn-primary:hover { background: var(--accent-hover); }
                                                                                                  .btn-secondary { background: var(--surface2); color: var(--text-2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 9px 16px; font-size: 14px; cursor: pointer; transition: all 0.15s; }
                                                                                                  .btn-secondary:hover { color: var(--text); }
                                                                                                  .btn-danger { background: var(--red); color: white; border: none; border-radius: var(--radius); padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
                                                                                                  .btn-danger:hover { opacity: 0.85; }
                                                                                                  .delete-warning { font-size: 14px; color: var(--text-2); line-height: 1.6; margin: 10px 0 18px; }

                                                                                                  @media (max-width: 700px) {
                                                                                                    .top-bar { padding: 12px 16px; }
                                                                                                      .profile-bar { padding: 8px 16px; gap: 5px; }
                                                                                                        .main-content { padding: 16px 12px; }
                                                                                                          .cal-title { font-size: 16px; }
                                                                                                            .add-btn { padding: 7px 12px; font-size: 12px; }
                                                                                                              .summary-strip { gap: 6px; }
                                                                                                                .summary-card { padding: 10px 12px; }
                                                                                                                  .summary-val { font-size: 17px; }
                                                                                                                    .summary-label { font-size: 10px; }
                                                                                                                      .cal-grid { gap: 2px; }
                                                                                                                        .cal-cell { min-height: 58px; padding: 5px; }
                                                                                                                          .cal-day-num { font-size: 11px; margin-bottom: 2px; }
                                                                                                                            .cal-total { font-size: 9px; }
                                                                                                                              .event-pill { font-size: 9px; padding: 1px 4px; }
                                                                                                                                .day-label { font-size: 9px; padding: 6px 0; }
                                                                                                                                  .brand-name { font-size: 14px; }
                                                                                                                                    .monzo-label { display: none; }
                                                                                                                                      .modal { padding: 18px; }
                                                                                                                                        .nav-btn { padding: 6px 10px; }
                                                                                                                                        }
                                                                                                                                        @media (max-width: 400px) {
                                                                                                                                          .summary-strip { grid-template-columns: 1fr; }
                                                                                                                                            .cal-cell { min-height: 48px; }
                                                                                                                                            }