/* Hide entire budget app until auth check finishes */
html.auth-block body {
  visibility: hidden;
}

:root {
  --bg: #F5F9FF;
  --text-main: #1A1F2B;
  --text-sub: #4B5563;
  --card-bg: #ffffff;
  --card-bg-soft: #EAF3FF;
  --border: #C5D7F2;
  --border-soft: #D9E4FF;
  --accent: #4A90E2;
  --danger: #FF6B6B;
  --danger-soft: #FEE2E2;
  --shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

/* 🔒 Prevent auth flicker */
#budget-content {
  display: none;
}

/* DELETE THIS IF SCROLL REFRESH DOESN'T WORK*/
/*#screen-budget { 
  position: relative;
  height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}*/
/* DELETE THIS IF SCROLL REFRESH DOESN'T WORK* - END/

    /*html, body {
      margin: 0;
      padding: 0;
      overflow-x: hidden;
    }*/

    * {
      box-sizing: border-box;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    body {
  background: var(--bg);
  color: var(--text-color);
}
    body.no-select {
      user-select: none;
      -webkit-user-select: none;
    }

   .app {
      width: 100%;
      max-width: none;      /* remove 960px cap */
      padding: 0 6px;       /* small side padding only */
      margin: 0 auto;
      position: relative;   /* keep this for the menu */
    }


    @media (max-width: 640px) {
  .app {
    padding: 8px;        /* was 16px – gives ~16px extra width total */
  }

   .section-box {
    padding: 8px;
  }

  /* Make income and expense cards breathe more */
  .income-wrapper,
  .category-card {
    padding: 8px 6px; /* slightly less side padding = wider feeling inputs */
  }
}

  .section-box {
    padding: 8px;       /* slightly tighter padding so the inside feels roomier */
  }

    
    .app-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 2px;
      margin-bottom: 8px;
    }


    .app-header h1 {
      flex: 1;
      text-align: center;
      margin: 0;
    }
    
    .app-header h1 {
      flex: 1;
      margin: 0;
      font-size: 1.6rem;
      text-align: center;
      text-shadow: 0 1px 3px rgba(15, 23, 42, 0.4); /* subtle shadow */
    }

  
    .card {
      background: var(--card-bg);
      border-radius: 12px;
      padding: 12px 16px;
      margin-bottom: 16px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
    }

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

    .row + .row {
      margin-top: 6px;
    }

    .row.compact-row {
      align-items: flex-start;
            flex-wrap: nowrap;    /* 🔹 keep description / amount / date on one line */
    }

/* Keep labels on a single line in compact rows so inputs stay aligned */
.row.compact-row > div {
  min-width: 0;
}

.row.compact-row label {
  white-space: nowrap;
}


/* 🔹 Stop iOS from auto-zooming on inputs */
input,
select,
textarea {
  font-size: 16px;
}

    label {
      font-size: 0.75rem;
      color: var(--text-sub);
      display: block;
        padding-right: 6px; /* 👈 add this line */

    }

    input[type="text"],
    input[type="number"],
    select {
      width: 100%;
      padding: 6px 8px;
      border-radius: 6px;
      border: 1px solid var(--border-soft);
      background: var(--card-bg);
      color: var(--text-main);
      font-size: 16px;
    }

    input[type="number"] {
      text-align: right;
    }

    

    .summary-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: space-between;
      font-size: 0.9rem;
    }

    .summary-item {
      flex: 1;
      min-width: 150px;
      padding: 8px;
      border-radius: 8px;
      background: var(--card-bg-soft);
      border: 1px solid var(--border);
      text-align: center;
    }

    .summary-label {
      font-size: 0.75rem;
      color: var(--text-sub);
    }

    .summary-value {
  font-weight: 600;
  margin-top: 4px;
  color: var(--text-main);   /* ✅ keeps totals readable in dark mode */
}


    .summary-value.positive {
      color: #11a949;
    }

    .summary-value.negative {
      color: #f97373;
    }

    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
      gap: 8px;
    }

    .section-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--text-main);   /* ✅ adjusts automatically for dark/light */
}

    .section-sub {
      font-size: 0.8rem;
      color: var(--text-sub);
    }

    .section-header-total {
      font-size: 0.8rem;
      color: var(--text-sub);
    }

/* ---------- Buttons: default (dark-mode look) ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: #020617;           /* dark text – this is how it was originally */
  font-weight: 600;
  white-space: nowrap;
}

.btn.secondary {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn.danger {
  background: var(--danger);
  color: var(--danger-soft);
}

.btn.category-add {
  background: rgba(34, 197, 94, 0.14);       /* original soft green */
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.btn.small {
  font-size: 0.85rem;
  padding: 6px 10px;
}

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

/* 🔹 Category footer + bottom drag handle */
.category-footer {
  /* JS sets display:flex when expanded; collapsed state still hidden via existing CSS */
  align-items: center;
  gap: 8px;
}

.category-drag-footer {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Handle styling for bottom drag icon + item handles */
.drag-handle,
.item-drag-handle {
  font-size: 1rem;
  opacity: 0.7;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;   /* 🔹 prevent scroll while dragging on mobile */
  color: var(--text-sub); /* 👈 light gray in light mode, soft gray in dark mode */
}

/* Slight “lift” effect when an item row is being dragged */
.swipe-row.dragging {
  z-index: 0;
  position: relative;
}



/* 🔹 Trash icon (for deleting categories) */
.delete-cat-icon {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--danger);
}

.delete-cat-icon:hover {
  opacity: 0.9;
  transform: translateY(1px);
}

.edit-cat-icon {
  border: none;
  background: transparent;
  padding-left: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-sub);  /* soft gray that fits the app */
  opacity: 0.9;
}

.edit-cat-icon:hover {
  opacity: 1;
  transform: translateY(1px);
}


    /* Softer delete button style for categories */
.delete-cat-btn {
  background: rgba(239, 68, 68, 0.15);   /* soft red background */
  color: #ef4444;                        /* red text */
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.delete-cat-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  transition: background 0.15s ease-in-out;
}


    .divider {
      height: 1px;
      background: var(--border);
      margin: 8px 0;
    }

    .category-card {
      background: var(--card-bg-soft);
      border-radius: 10px;
      padding: 8px 10px;
      border: 1px solid var(--border-soft);
      margin-bottom: 12px;
      margin-top: 4px;
      cursor: default;
      overflow: hidden;
      transition: box-shadow 0.1s ease-out, transform 0.1s ease-out;
    }

    .category-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }

    /* Category title: looks like plain text until editing *//* Category title: looks like plain text until editing */
input.category-title {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0;                    /* no big input padding */
  border-radius: 0;
  border: none;                  /* no box border */
  background: transparent;       /* same as card background */
  min-width: 140px;
  outline: none;
  color: var(--text-sub);        /* same tone as 'Retirement' label */
}

/* Edit mode: only when actually editing */
input.category-title:focus {
  color: var(--text-main);       /* darker while editing */
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  background: transparent;
}



    .category-title.locked {
      background: transparent;
      border-color: transparent;
      color: var(--text-sub);
      pointer-events: none;
    }

    .drag-handle {
      font-size: 1rem;
      opacity: 0.7;
      cursor: grab;
      user-select: none;
      -webkit-user-select: none;
    }

    .category-card.collapsed [data-type="cat-items"],
    .category-card.collapsed .category-footer {
      display: none;
    }

    .category-collapse {
      border: none;
      background: none;
      color: var(--text-sub);
      cursor: pointer;
      font-size: 0.9rem;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .category-collapse-icon {
      display: inline-block;
      transition: transform 0.15s ease-out;
      font-size: 0.9rem;
    }

    .category-card.collapsed .category-collapse-icon {
      transform: rotate(-90deg);
    }

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

    .category-subtotal {
      font-size: 0.8rem;
      color: var(--text-sub);
      margin-left: auto;
    }

    .footer-note {
      font-size: 0.75rem;
      text-align: center;
      color: var(--text-sub);
      margin-top: 2px;
    }


.year-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  margin-top: 50px; /* CONTROLS YEAR SPACE UNDER STICKY HEADER */
}


.year-display {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.year-pager-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-sub);
  padding: 0;
}

.year-pager-btn:disabled {
  opacity: 0.3;
  cursor: default;
}


    .month-grid {
      display: flex;
      flex-wrap: nowrap;
      gap: 8px;
      margin-top: 8px;
      overflow-x: auto;
      padding-bottom: 4px;
    }

    .month-card {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg-soft);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column; /* stack month + year */
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* Month name (Jan, Feb, etc.) */
.month-card .month-name {
  font-weight: 600;
}

/* Tiny year under the month */
.month-card .month-year-label {
  font-size: 0.7rem;
  color: var(--text-sub);
}


    /* Past months look slightly faded */
.month-card.past {
  opacity: 0.4;
}

.month-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#resetMonthBtn {
  margin: 0;
}


    .month-card:active {
      transform: scale(0.97);
    }

    canvas {
      width: 100%;
      max-width: 320px;
      display: block;
    }

    .drop-indicator {
      height: 3px;
      background: var(--accent);
      border-radius: 999px;
      margin: 4px 0;
    }


    .chart-layout {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      justify-content: center;
    }

    .chart-legend {
      font-size: 0.8rem;
      display: flex;
      flex-direction: column;
      gap: 4px;
      width: 100%;
      align-items: center;
      text-align: center;
    }

    .chart-legend-item {
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      justify-content: center;
    }

    .chart-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 3px;
    }

    .chart-legend-label {
      color: var(--text-main);
    }

    .chart-legend-item.selected .chart-legend-label {
      font-weight: 600;
      text-decoration: underline;
    }

    .collapse-toggle {
      border: none;
      background: none;
      color: var(--text-sub);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 0.8rem;
    }

    .collapse-toggle-icon {
      display: inline-block;
      transition: transform 0.15s ease-out;
    }

    .card.collapsed .collapse-toggle-icon {
      transform: rotate(-90deg);
    }

    .section-body {
      margin-top: 6px;
    }

    .card.collapsed .section-body {
      display: none;
    }

    .delete-btn {
      display: none;
    }
    
    .delete-cat-btn {
  display: inline-flex;
}

    .total-expenses-row {
      padding: 6px 8px;
      border-radius: 8px;
      background: rgba(56, 189, 248, 0.06);
      border: 1px dashed var(--accent);
      font-weight: 600;
    }

    .income-wrapper {
      background: var(--card-bg-soft);
      border-radius: 10px;
      padding: 8px 10px;
      border: 1px solid var(--border-soft);
      margin-bottom: 8px;
      overflow: hidden;
    }

    .swipe-row {
      position: relative;
      transition: transform 0.2s ease-out;
      border-radius: 8px;
    }

    .swipe-row.swiping {
      transition: none;
    }

    .swipe-row::before {
      content: "";
      position: absolute;
      inset: 0;
      background: #b91c1c;
      border-radius: 8px;
      z-index: -1;
      opacity: 0;
      transition: opacity 0.2s ease-out;
    }

    .swipe-row.show-trash::before {
      opacity: 1;
    }

    .trash-icon {
      position: absolute;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 1.1rem;
      opacity: 0;
      transition: opacity 0.2s ease-out;
      pointer-events: none;
    }

    .swipe-row.show-trash .trash-icon {
      opacity: 1;
    }

   .year-row {
  display: none;
}

/* Wrap that holds the Year label + select */
.year-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Row that holds saveStatus + Reset button */
.year-actions {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* On smaller screens, center everything */
@media (max-width: 640px) {
  .year-row {
    justify-content: center;
  }

  .year-wrap {
    align-items: center;
    text-align: center;
  }

  .year-actions {
    justify-content: center;  /* ✅ center Reset + status under Year */
    text-align: center;
  }
}


#yearSelect {
  display: block;
  margin: 0 auto;
  text-align: center;
}


    .disclaimer-strong {
      font-weight: 700;
      text-transform: uppercase;
    }

    @media (max-width: 600px) {
      .row {
        flex-direction: column;
        align-items: stretch;
      }
      .row.compact-row {
        flex-direction: row;
        align-items: flex-start;
              flex-wrap: nowrap;    /* 🔹 keep description / amount / date on one line */

      }

      /* Keep labels on a single line in compact rows so inputs stay aligned */
.row.compact-row > div {
  min-width: 0;
}

.row.compact-row label {
  white-space: nowrap;
}

      .summary-bar {
        flex-direction: column;
      }
    }

   

    /* Onboarding overlay */
  .onboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  animation: onboardOverlayFadeIn 0.35s ease-out; /* a bit slower */
}

.onboard-hidden {
  display: none;
}

.onboard-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 18px 16px 14px;
  border: 1px solid var(--border-soft);
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow);
  text-align: left;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

/* Animation class that we can re-trigger on each step */
.onboard-card.animate-in {
  animation: onboardCardPopIn 0.45s ease-out forwards; /* slower & smoother */
}



    .onboard-title {
      margin: 0 0 6px;
      font-size: 1.05rem;
      font-weight: 600;
    }

    .onboard-body {
      margin: 0 0 10px;
      font-size: 0.85rem;
      color: var(--text-sub);
      line-height: 1.4;
    }

    .onboard-step-dots {
      display: flex;
      justify-content: center;
      gap: 4px;
      margin-bottom: 8px;
    }

    .onboard-step-dots .dot {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: var(--border-soft);
    }

    .onboard-step-dots .dot.active {
      width: 16px;
      background: var(--accent);
    }

    .onboard-buttons {
  display: flex;
  flex-direction: column-reverse; /* Skip on bottom, primary on top */
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
}

/* Make onboarding buttons full-width & comfy */
.onboard-buttons .btn {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

/* Skip looks like a subtle text button */
.onboard-buttons .btn.secondary {
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding-top: 4px;
  padding-bottom: 4px;
}


    
 @keyframes onboardOverlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes onboardCardPopIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


   /* Generic modal overlay (month reset, copy options, delete confirm, etc.) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 140;
  animation: onboardOverlayFadeIn 0.35s ease-out;
}

.modal-hidden {
  display: none;
}


  .modal-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 14px 10px; /* less vertical padding */
  border: 1px solid var(--border-soft);
  max-width: 360px;
  width: 92%;
  max-height: 80vh;        /* limit height */
  overflow-y: auto;        /* scroll inside modal if needed */
  box-shadow: var(--shadow);
  text-align: left;
}

    .modal-title {
      font-size: 1rem;
      font-weight: 600;
      margin-bottom: 4px;
    }

    .modal-message {
      font-size: 0.85rem;
      color: var(--text-sub);
      margin-bottom: 10px;
      white-space: pre-wrap;
    }


    .modal-buttons {
  display: flex;
  flex-direction: column-reverse; /* Cancel under primary on phones */
  align-items: stretch;
  gap: 6px;
  margin-top: 12px;
}

/* Make modal buttons comfy & modern on mobile */
.modal-buttons .btn {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

/* Secondary in modals feels like a quiet outline/text button */
.modal-buttons .btn.secondary {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-sub);
}

/* Softer danger style for delete/reset confirmations */
.modal-buttons .btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* On bigger screens, go side-by-side */
@media (min-width: 640px) {
  .modal-buttons {
    flex-direction: row-reverse; /* primary on the right */
    justify-content: flex-end;
    align-items: center;
  }

  .modal-buttons .btn {
    width: auto;
    min-width: 96px;
  }
}


    .modal-footer {
      margin-top: 8px;
      font-size: 0.75rem;
      color: var(--text-sub);
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .modal-footer input[type="checkbox"] {
      width: auto;
    }

/* ====== FULL-WIDTH MOBILE VIEW (Break the Space) ====== */
@media (max-width: 640px) {
  /* Tiny side gutter so numbers aren't cut off */
  .app {
    padding: 0 10px 16px;  /* 🔹 add a bit more space on left/right */
  }

  /* Sections still feel edge-to-edge but a bit softer */
  .section-box {
    margin: 0 0 16px;
    border-radius: 12px;
  }

  .income-wrapper,
  .category-card {
    border-radius: 12px;
    padding: 10px 10px;
  }

  .summary-item {
    border-radius: 12px;
  }

  /* Extra safety so the (1–30) label never hugs the edge */
  .row.compact-row > div:nth-child(3) label {
    padding-right: 12px;   /* you can bump to 10–12 if needed */
  }
}



/* ===== HEADER WITH LOGO + MENU ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;

  /* Sticky header */
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);

  /* FIX: maintain height without adding bottom gap */
  height: 64px;           /* <— critical */
  padding: 0 12px;        /* side padding only */
  margin: 0 !important;
}



.app-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-main);
  text-shadow: none; /* remove previous shadow */
}

.app-logo {
  width: 32px;
  height: auto;
  border-radius: 10px;
}

.header-menu-btn {
  position: absolute;
  right: 16px;
  top: 20px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--card-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
}


/* Make all main cards use more horizontal space */
.app {
  max-width: none;     /* remove the 960px cap */
  padding: 0 6px;      /* tighter side padding */
}

/* Give cards slightly softer edges so it still looks clean */
.card {
  border-radius: 6px;
  margin-left: 0;
  margin-right: 0;
}

/* Prevent mobile browsers from auto-zooming inputs */
input,
select,
textarea {
  font-size: 16px;
}

/* When a modal is open, stop background scrolling */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
}
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
.icon-btn:active {
  background: rgba(0, 0, 0, 0.15);
}
.tiny-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  display: inline-block;
  color: var(--text-sub, #444);
  font-size: 12px;
  white-space: nowrap;  /* <<< keeps "Expand All" on one line */
}
.tiny-icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
.tiny-icon-btn:active {
  background: rgba(0, 0, 0, 0.15);
}


/* Category titles: extra bold, slightly bigger */
input[data-type="cat-name"] {
  font-weight: 800;
  font-size: 1rem;
}

/* Flatten expense + income inputs in the real rows */
.row.compact-row input[type="text"],
.row.compact-row input[type="number"] {
  border: none;
  background: transparent;
  padding: 0;
  outline: none;
  box-shadow: none;
  font-size: 0.9rem;
}

/* Subtle underline only while editing */
.row.compact-row input:focus {
  border-bottom: 1px solid var(--accent);
}


.row.compact-row input[type="text"],
.row.compact-row input[type="number"] {
  border: none;
  border-bottom: 2.5px solid var(--border);
  background: transparent;
  padding: 4px 0;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.2s ease;
}

.row.compact-row input:focus {
  border-bottom-color: var(--accent);
}

/* Make date dropdowns flat like the text fields */
.row.compact-row select[data-type="income-date"],
.row.compact-row select[data-type="cat-item-date"] {
  border: none;
  border-bottom: 2.5px solid var(--border);
  background: transparent;
  padding: 4px 0;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  color: var(--text-main);
  transition: border-color 0.2s ease;

  /* Remove the chunky native look */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Accent color when focused */
.row.compact-row select[data-type="income-date"]:focus,
.row.compact-row select[data-type="cat-item-date"]:focus {
  border-bottom-color: var(--accent);
}


/* 2) Tell touch to only pan vertically (prevents horizontal nudges) */
body {
  touch-action: auto;            /* Chrome/Edge/Android */
  overscroll-behavior-x: none;    /* Blocks sideways bounce */
}

/* 3) Make sure nothing grows wider than the viewport */
*, *::before, *::after { box-sizing: border-box; }
img, svg, canvas, video { max-width: 100%; height: auto; }

/* 4) Common culprits: rows/cards/chips—force them to respect width */
.container, .content, .card, .summary-card, .category-card, .row, .year-row, .months-row {
  max-width: 100%;
}

/* If your month chips scroll sideways, keep it inside its lane */
.months-row {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}



input, select, textarea {
  font-size: 16px;
}


/* === Summary (single-row, no wrap, fits all phones) === */
#summaryCard .summary-row{
  display:flex;
  flex-wrap:nowrap;            /* force one line */
  align-items:stretch;
  gap:8px;                     /* small gaps so it fits */
  overflow:hidden;             /* no sideways scroll */
  padding:6px 4px;
}

/* each chip auto-shrinks to fit the row */
#summaryCard .summary-chip{
  flex:1 1 0;                  /* 3 equal columns */
  min-width:0;                 /* allow shrinking instead of overflow */
  padding:8px 10px;            /* tighter padding */
  border-radius:12px;
}

/* label smaller */
#summaryCard .summary-label{
  font-size:.78rem;            /* smaller than before */
  line-height:1.15;
  opacity:.9;
  font-weight:600;
}

/* value responsive + non-wrapping */
#summaryCard .summary-value{
  font-weight:800;
  line-height:1.1;
  white-space:nowrap;
  /* smaller clamp so 3 chips fit comfortably */
  font-size:clamp(18px, 4.6vw, 24px);
}

/* Color rules for Remaining */
#summaryCard .summary-chip.remaining .summary-value {
  color: #22c55e;      /* green when positive */
}

#summaryCard .summary-chip.remaining.negative .summary-value {
  color: #ef4444;      /* red when negative */
}


/* tiny phones tightening */
@media (max-width: 390px){
  #summaryCard .summary-row{ gap:6px; }
  #summaryCard .summary-chip{ padding:6px 8px; }
  #summaryCard .summary-value{ font-size:clamp(16px, 4.4vw, 22px); }
}


:root {
  --bg: #F5F9FF;
  --text-main: #1A1F2B;
  --text-sub: #4B5563;
  --card-bg: #ffffff;
  --card-bg-soft: #EAF3FF;
  --border: #C5D7F2;
  --border-soft: #D9E4FF;
  --accent: #4A90E2;
  --danger: #FF6B6B;
  --danger-soft: #FEE2E2;
  --shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

    * {
      box-sizing: border-box;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    body {
  background: var(--bg);
  color: var(--text-color);
}
    body.no-select {
      user-select: none;
      -webkit-user-select: none;
    }

   .app {
      width: 100%;
      max-width: none;      /* remove 960px cap */
      padding: 0 6px;       /* small side padding only */
      margin: 0 auto;
      position: relative;   /* keep this for the menu */
    }


    @media (max-width: 640px) {
  .app {
    padding: 8px;        /* was 16px – gives ~16px extra width total */
  }

   .section-box {
    padding: 8px;
  }

  /* Make income and expense cards breathe more */
  .income-wrapper,
  .category-card {
    padding: 8px 6px; /* slightly less side padding = wider feeling inputs */
  }
}

  .section-box {
    padding: 8px;       /* slightly tighter padding so the inside feels roomier */
  }

    
  .app-header h1 {
  flex: 1;
  text-align: center;
  margin: 0;
}
    
    .app-header h1 {
      flex: 1;
      margin: 0;
      font-size: 1.6rem;
      text-align: center;
      text-shadow: 0 1px 3px rgba(15, 23, 42, 0.4); /* subtle shadow */
    }

  
    .card {
      background: var(--card-bg);
      border-radius: 12px;
      padding: 12px 16px;
      margin-bottom: 16px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
    }

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

    .row + .row {
      margin-top: 6px;
    }

    .row.compact-row {
      align-items: flex-start;
            flex-wrap: nowrap;    /* 🔹 keep description / amount / date on one line */
    }

/* Keep labels on a single line in compact rows so inputs stay aligned */
.row.compact-row > div {
  min-width: 0;
}

.row.compact-row label {
  white-space: nowrap;
}

/* 🔹 Stop iOS from auto-zooming on inputs */
input,
select,
textarea {
  font-size: 16px;
}


    label {
      font-size: 0.75rem;
      color: var(--text-sub);
      display: block;
        padding-right: 6px; /* 👈 add this line */

    }

    input[type="text"],
    input[type="number"],
    select {
      width: 100%;
      padding: 6px 8px;
      border-radius: 6px;
      border: 1px solid var(--border-soft);
      background: var(--card-bg);
      color: var(--text-main);
      font-size: 16px;
    }

    input[type="number"] {
      text-align: right;
    }

    

    .summary-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: space-between;
      font-size: 0.9rem;
    }

    .summary-item {
      flex: 1;
      min-width: 150px;
      padding: 8px;
      border-radius: 8px;
      background: var(--card-bg-soft);
      border: 1px solid var(--border);
      text-align: center;
    }

    .summary-label {
      font-size: 0.75rem;
      color: var(--text-sub);
    }

    .summary-value {
  font-weight: 600;
  margin-top: 4px;
  color: var(--text-main);   /* ✅ keeps totals readable in dark mode */
}


    .summary-value.positive {
      color: #11a949;
    }

    .summary-value.negative {
      color: #f97373;
    }

    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
      gap: 8px;
    }

    .section-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--text-main);   /* ✅ adjusts automatically for dark/light */
}

    .section-sub {
      font-size: 0.8rem;
      color: var(--text-sub);
    }

    .section-header-total {
      font-size: 0.8rem;
      color: var(--text-sub);
    }

/* ---------- Buttons: default (dark-mode look) ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: #020617;           /* dark text – this is how it was originally */
  font-weight: 600;
  white-space: nowrap;
}

.btn.secondary {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn.danger {
  background: var(--danger);
  color: var(--danger-soft);
}

.btn.category-add {
  background: rgba(34, 197, 94, 0.14);       /* original soft green */
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.btn.small {
  font-size: 0.85rem;
  padding: 6px 10px;
}

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

/* 🔹 Category footer + bottom drag handle */
.category-footer {
  /* JS sets display:flex when expanded; collapsed state still hidden via existing CSS */
  align-items: center;
  gap: 8px;
}

.category-drag-footer {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Handle styling for bottom drag icon + item handles */
.drag-handle,
.item-drag-handle {
  font-size: 1rem;
  opacity: 0.7;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;   /* 🔹 prevent scroll while dragging on mobile */
  color: var(--text-sub); /* 👈 light gray in light mode, soft gray in dark mode */
}

/* Slight “lift” effect when an item row is being dragged */
.swipe-row.dragging {
  z-index: 0;
  position: relative;
}



/* 🔹 Trash icon (for deleting categories) */
.delete-cat-icon {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--danger);
}

.delete-cat-icon:hover {
  opacity: 0.9;
  transform: translateY(1px);
}

.edit-cat-icon {
  border: none;
  background: transparent;
  padding-left: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-sub);  /* soft gray that fits the app */
  opacity: 0.9;
}

.edit-cat-icon:hover {
  opacity: 1;
  transform: translateY(1px);
}


    /* Softer delete button style for categories */
.delete-cat-btn {
  background: rgba(239, 68, 68, 0.15);   /* soft red background */
  color: #ef4444;                        /* red text */
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.delete-cat-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  transition: background 0.15s ease-in-out;
}


    .divider {
      height: 1px;
      background: var(--border);
      margin: 8px 0;
    }

    .category-card {
      background: var(--card-bg-soft);
      border-radius: 10px;
      padding: 8px 10px;
      border: 1px solid var(--border-soft);
      margin-bottom: 12px;
      margin-top: 4px;
      cursor: default;
      overflow: hidden;
      transition: box-shadow 0.1s ease-out, transform 0.1s ease-out;
    }

    .category-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }

    /* Category title: looks like plain text until editing *//* Category title: looks like plain text until editing */
input.category-title {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0;                    /* no big input padding */
  border-radius: 0;
  border: none;                  /* no box border */
  background: transparent;       /* same as card background */
  min-width: 140px;
  outline: none;
  color: var(--text-sub);        /* same tone as 'Retirement' label */
}

/* Edit mode: only when actually editing */
input.category-title:focus {
  color: var(--text-main);       /* darker while editing */
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  background: transparent;
}



    .category-title.locked {
      background: transparent;
      border-color: transparent;
      color: var(--text-sub);
      pointer-events: none;
    }

    .drag-handle {
      font-size: 1rem;
      opacity: 0.7;
      cursor: grab;
      user-select: none;
      -webkit-user-select: none;
    }

    .category-card.collapsed [data-type="cat-items"],
    .category-card.collapsed .category-footer {
      display: none;
    }

    .category-collapse {
      border: none;
      background: none;
      color: var(--text-sub);
      cursor: pointer;
      font-size: 0.9rem;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .category-collapse-icon {
      display: inline-block;
      transition: transform 0.15s ease-out;
      font-size: 0.9rem;
    }

    .category-card.collapsed .category-collapse-icon {
      transform: rotate(-90deg);
    }

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

    .category-subtotal {
      font-size: 0.8rem;
      color: var(--text-sub);
      margin-left: auto;
    }

    .footer-note {
      font-size: 0.75rem;
      text-align: center;
      color: var(--text-sub);
      margin-top: 12px;
    }


    .year-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.year-display {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.year-pager-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-sub);
  padding: 0;
}

.year-pager-btn:disabled {
  opacity: 0.3;
  cursor: default;
}


    .month-grid {
      display: flex;
      flex-wrap: nowrap;
      gap: 8px;
      margin-top: 8px;
      overflow-x: auto;
      padding-bottom: 4px;
    }

    .month-card {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg-soft);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column; /* stack month + year */
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* Month name (Jan, Feb, etc.) */
.month-card .month-name {
  font-weight: 600;
}

/* Tiny year under the month */
.month-card .month-year-label {
  font-size: 0.7rem;
  color: var(--text-sub);
}


    /* Past months look slightly faded */
.month-card.past {
  opacity: 0.4;
}

    .month-card:active {
      transform: scale(0.97);
    }

    canvas {
      width: 100%;
      max-width: 320px;
      display: block;
    }

    .drop-indicator {
      height: 3px;
      background: var(--accent);
      border-radius: 999px;
      margin: 4px 0;
    }



    .chart-layout {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      justify-content: center;
    }

    .chart-legend {
      font-size: 0.8rem;
      display: flex;
      flex-direction: column;
      gap: 4px;
      width: 100%;
      align-items: center;
      text-align: center;
    }

    .chart-legend-item {
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      justify-content: center;
    }

    .chart-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 3px;
    }

    .chart-legend-label {
      color: var(--text-main);
    }

    .chart-legend-item.selected .chart-legend-label {
      font-weight: 600;
      text-decoration: underline;
    }

    .collapse-toggle {
      border: none;
      background: none;
      color: var(--text-sub);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 0.8rem;
    }

    .collapse-toggle-icon {
      display: inline-block;
      transition: transform 0.15s ease-out;
    }

    .card.collapsed .collapse-toggle-icon {
      transform: rotate(-90deg);
    }

    .section-body {
      margin-top: 6px;
    }

    .card.collapsed .section-body {
      display: none;
    }

    .delete-btn {
      display: none;
    }
    
    .delete-cat-btn {
  display: inline-flex;
}

    .total-expenses-row {
      padding: 6px 8px;
      border-radius: 8px;
      background: rgba(56, 189, 248, 0.06);
      border: 1px dashed var(--accent);
      font-weight: 600;
    }

    .income-wrapper {
      background: var(--card-bg-soft);
      border-radius: 10px;
      padding: 8px 10px;
      border: 1px solid var(--border-soft);
      margin-bottom: 8px;
      overflow: hidden;
    }

    .swipe-row {
      position: relative;
      transition: transform 0.2s ease-out;
      border-radius: 8px;
    }

    .swipe-row.swiping {
      transition: none;
    }

    .swipe-row::before {
      content: "";
      position: absolute;
      inset: 0;
      background: #b91c1c;
      border-radius: 8px;
      z-index: -1;
      opacity: 0;
      transition: opacity 0.2s ease-out;
    }





.swipe-row.show-trash::before {
  opacity: 1;
    }

.trash-icon {
  position: absolute;
  right: 12px;
  top: 12px;              /* 👈 anchor to top, not center */
  transform: none;        /* 👈 remove vertical centering */
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
    }

    @media (hover: hover) and (pointer: fine) {
  /* Desktop only */
  .swipe-row:hover .trash-icon {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
  }
    }
    .swipe-row.show-trash .trash-icon {
      opacity: 1;
    }
@media (hover: hover) and (pointer: fine) {
  .swipe-row {
    padding-right: 44px;
  }
}






   .year-row {
  display: none;
}

/* Wrap that holds the Year label + select */
.year-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Row that holds saveStatus + Reset button */
.year-actions {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* On smaller screens, center everything */
@media (max-width: 640px) {
  .year-row {
    justify-content: center;
  }

  .year-wrap {
    align-items: center;
    text-align: center;
  }

  .year-actions {
    justify-content: center;  /* ✅ center Reset + status under Year */
    text-align: center;
  }
}


#yearSelect {
  display: block;
  margin: 0 auto;
  text-align: center;
}


    .disclaimer-strong {
      font-weight: 700;
      text-transform: uppercase;
    }

    @media (max-width: 600px) {
      .row {
        flex-direction: column;
        align-items: stretch;
      }
      .row.compact-row {
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: nowrap;    /* 🔹 keep description / amount / date on one line */

      }

      /* Keep labels on a single line in compact rows so inputs stay aligned */
.row.compact-row > div {
  min-width: 0;
}

.row.compact-row label {
  white-space: nowrap;
}

      .summary-bar {
        flex-direction: column;
      }
    }

    /* Onboarding overlay */
  .onboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  animation: onboardOverlayFadeIn 0.35s ease-out; /* a bit slower */
}

.onboard-hidden {
  display: none;
}

.onboard-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 18px 16px 14px;
  border: 1px solid var(--border-soft);
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow);
  text-align: left;
  opacity: 1;
  transform: none;
}

/* Animation class that we can re-trigger on each step */
.onboard-card.animate-in {
  animation: onboardCardPopIn 0.45s ease-out forwards; /* slower & smoother */
}



    .onboard-title {
      margin: 0 0 6px;
      font-size: 1.05rem;
      font-weight: 600;
    }

    .onboard-body {
      margin: 0 0 10px;
      font-size: 0.85rem;
      color: var(--text-sub);
      line-height: 1.4;
    }

    .onboard-step-dots {
      display: flex;
      justify-content: center;
      gap: 4px;
      margin-bottom: 8px;
    }

    .onboard-step-dots .dot {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: var(--border-soft);
    }

    .onboard-step-dots .dot.active {
      width: 16px;
      background: var(--accent);
    }

    .onboard-buttons {
  display: flex;
  flex-direction: column-reverse; /* Skip on bottom, primary on top */
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
}

/* Make onboarding buttons full-width & comfy */
.onboard-buttons .btn {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

/* Skip looks like a subtle text button */
.onboard-buttons .btn.secondary {
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding-top: 4px;
  padding-bottom: 4px;
}


    
 @keyframes onboardOverlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes onboardCardPopIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


   /* Generic modal overlay (month reset, copy options, delete confirm, etc.) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 140;
  animation: onboardOverlayFadeIn 0.35s ease-out;
}

.modal-hidden {
  display: none;
}


  .modal-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 14px 10px; /* less vertical padding */
  border: 1px solid var(--border-soft);
  max-width: 360px;
  width: 92%;
  max-height: 80vh;        /* limit height */
  overflow-y: auto;        /* scroll inside modal if needed */
  box-shadow: var(--shadow);
  text-align: left;
}


    .modal-title {
      font-size: 1rem;
      font-weight: 600;
      margin-bottom: 4px;
    }

    .modal-message {
      font-size: 0.85rem;
      color: var(--text-sub);
      margin-bottom: 10px;
      white-space: pre-wrap;
    }


    .modal-buttons {
  display: flex;
  flex-direction: column-reverse; /* Cancel under primary on phones */
  align-items: stretch;
  gap: 6px;
  margin-top: 12px;
}

/* Make modal buttons comfy & modern on mobile */
.modal-buttons .btn {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

/* Secondary in modals feels like a quiet outline/text button */
.modal-buttons .btn.secondary {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-sub);
}

/* Softer danger style for delete/reset confirmations */
.modal-buttons .btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* On bigger screens, go side-by-side */
@media (min-width: 640px) {
  .modal-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .modal-buttons .btn {
    width: 100%;
  }
}



    .modal-footer {
      margin-top: 8px;
      font-size: 0.75rem;
      color: var(--text-sub);
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .modal-footer input[type="checkbox"] {
      width: auto;
    }

/* ====== FULL-WIDTH MOBILE VIEW (Break the Space) ====== */
@media (max-width: 640px) {
  /* Tiny side gutter so numbers aren't cut off */
  .app {
    padding: 0 10px 16px;  /* 🔹 add a bit more space on left/right */
  }

  /* Sections still feel edge-to-edge but a bit softer */
  .section-box {
    margin: 0 0 16px;
    border-radius: 12px;
  }

  .income-wrapper,
  .category-card {
    border-radius: 12px;
    padding: 10px 10px;
  }

  .summary-item {
    border-radius: 12px;
  }

  /* Extra safety so the (1–30) label never hugs the edge */
  .row.compact-row > div:nth-child(3) label {
    padding-right: 12px;   /* you can bump to 10–12 if needed */
  }
}


/* ===== HEADER WITH LOGO + MENU ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;

  /* Sticky header */
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);

  /* FIX: maintain height without adding bottom gap */
  height: 64px;           /* <— critical */
  padding: 0 12px;        /* side padding only */
  margin: 0 !important;
}



.app-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-main);
  text-shadow: none; /* remove previous shadow */
}

.app-logo {
  width: 32px;
  height: auto;
  border-radius: 10px;
}

.header-menu-btn {
  position: absolute;
  right: 16px;
  top: 20px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--card-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
}


/* Make all main cards use more horizontal space */
.app {
  max-width: none;     /* remove the 960px cap */
  padding: 0 6px;      /* tighter side padding */
}

/* Give cards slightly softer edges so it still looks clean */
.card {
  border-radius: 6px;
  margin-left: 0;
  margin-right: 0;
}

/* Prevent mobile browsers from auto-zooming inputs */
input,
select,
textarea {
  font-size: 16px;
}

/* When a modal is open, stop background scrolling */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
}
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
.icon-btn:active {
  background: rgba(0, 0, 0, 0.15);
}
.tiny-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  display: inline-block;
  color: var(--text-sub, #444);
  font-size: 12px;
  white-space: nowrap;  /* <<< keeps "Expand All" on one line */
}
.tiny-icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
.tiny-icon-btn:active {
  background: rgba(0, 0, 0, 0.15);
}


/* Category titles: extra bold, slightly bigger */
input[data-type="cat-name"] {
  font-weight: 800;
  font-size: 1rem;
}

/* Flatten expense + income inputs in the real rows */
.row.compact-row input[type="text"],
.row.compact-row input[type="number"] {
  border: none;
  background: transparent;
  padding: 0;
  outline: none;
  box-shadow: none;
  font-size: 0.9rem;
}

/* Subtle underline only while editing */
.row.compact-row input:focus {
  border-bottom: 1px solid var(--accent);
}


.row.compact-row input[type="text"],
.row.compact-row input[type="number"] {
  border: none;
  border-bottom: 2.5px solid var(--border);
  background: transparent;
  padding: 4px 0;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.2s ease;
}

.row.compact-row input:focus {
  border-bottom-color: var(--accent);
}

/* Make date dropdowns flat like the text fields */
.row.compact-row select[data-type="income-date"],
.row.compact-row select[data-type="cat-item-date"] {
  border: none;
  border-bottom: 2.5px solid var(--border);
  background: transparent;
  padding: 4px 0;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  color: var(--text-main);
  transition: border-color 0.2s ease;

  /* Remove the chunky native look */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Accent color when focused */
.row.compact-row select[data-type="income-date"]:focus,
.row.compact-row select[data-type="cat-item-date"]:focus {
  border-bottom-color: var(--accent);
}


/*THIS IS WHAT STOPS TOP SCROLL*/
/* 1) Kill page-wide sideways scroll (iOS + all browsers) */
html, body {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  min-height: 100%;

  /* Prevent browser-level overscroll / pull-to-refresh where supported */
  overscroll-behavior-y: auto;
}



/* 2) Tell touch to only pan vertically (prevents horizontal nudges) */
body {
  touch-action: auto;
  overscroll-behavior-x: none;
}
/*THIS IS WHAT STOPS TOP SCROLL END*/


/* 3) Make sure nothing grows wider than the viewport */
*, *::before, *::after { box-sizing: border-box; }
img, svg, canvas, video { max-width: 100%; height: auto; }

/* 4) Common culprits: rows/cards/chips—force them to respect width */
.container, .content, .card, .summary-card, .category-card, .row, .year-row, .months-row {
  max-width: 100%;
}

/* If your month chips scroll sideways, keep it inside its lane */
.months-row {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}



input, select, textarea {
  font-size: 16px;
}


/* === Summary (single-row, no wrap, fits all phones) === */
#summaryCard .summary-row{
  display:flex;
  flex-wrap:nowrap;            /* force one line */
  align-items:stretch;
  gap:8px;                     /* small gaps so it fits */
  overflow:hidden;             /* no sideways scroll */
  padding:6px 4px;
}

/* each chip auto-shrinks to fit the row */
#summaryCard .summary-chip{
  flex:1 1 0;                  /* 3 equal columns */
  min-width:0;                 /* allow shrinking instead of overflow */
  padding:8px 10px;            /* tighter padding */
  border-radius:12px;
}

/* label smaller */
#summaryCard .summary-label{
  font-size:.78rem;            /* smaller than before */
  line-height:1.15;
  opacity:.9;
  font-weight:600;
}

/* value responsive + non-wrapping */
#summaryCard .summary-value{
  font-weight:800;
  line-height:1.1;
  white-space:nowrap;
  /* smaller clamp so 3 chips fit comfortably */
  font-size:clamp(18px, 4.6vw, 24px);
}

/* Color rules for Remaining */
#summaryCard .summary-chip.remaining .summary-value {
  color: #22c55e;      /* green when positive */
}

#summaryCard .summary-chip.remaining.negative .summary-value {
  color: #ef4444;      /* red when negative */
}


/* tiny phones tightening */
@media (max-width: 390px){
  #summaryCard .summary-row{ gap:6px; }
  #summaryCard .summary-chip{ padding:6px 8px; }
  #summaryCard .summary-value{ font-size:clamp(16px, 4.4vw, 22px); }
}



/* header row */
.top-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;   /* LEFT = Logo/Title  |  RIGHT = Icon */
  width: 100%;                       /* REQUIRED for space-between to work */
  margin-bottom: 10px;
}


.top-title {
  font-size: 1.7rem;
  margin: 0;
  font-weight: 800;
  color: var(--text-main);
}

/* summary row */
.top-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.top-summary-item {
  flex: 1;
  background: var(--card-bg-soft);
  padding: 10px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.top-summary-item .label {
  color: var(--text-sub);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.top-summary-item .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.top-summary-item .value.remaining {
  color: #22c55e;
}

/* Allow iOS tap-to-top to work when header is sticky */
.app-header {
  pointer-events: auto;   /* header doesn't block taps */
}

.app-header * {
  pointer-events: auto;   /* inner elements still work */
}


/* ---------------- FIX FOR SUMMARY CARDS ---------------- */

.top-summary-item {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  flex: 1;
  margin: 0 6px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  min-height: 70px;
  max-height: 80px;

  overflow: hidden;      /* prevent vertical stretching */
}

/* Label (Total Income, Total Expenses, Remaining) */
.top-summary-item .label {
  font-size: 0.75rem;
  color: var(--text-sub);
  white-space: nowrap;
  margin-bottom: 4px;
  line-height: 1;
}

/* Value */
.top-summary-item .value {
  font-weight: 700;
  white-space: nowrap;
  line-height: 1;
  font-size: clamp(0.9rem, 4vw, 1.2rem);
}


.top-summary-item .value.negative {
  color: var(--danger);
  font-size: 1.15rem;
}

.top-summary-item .value.positive {
  color: green;
}

#modalFooter {
  display: none !important;
}


/* Active month highlight */
.month-card.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Make the year label readable */
.month-card.active .month-year-label {
  color: #e8f2ff;
}


/* Container for navigation buttons in header */
.budget-nav-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

/* Base style for header buttons */
.small-nav-btn {
  padding: 10px 18px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.15s ease;
}

/* Hover / tap feedback */
.small-nav-btn:active {
  transform: scale(0.96);
}

/* Red variant for Sign Out */
.danger-btn {
  background: #ef4444;
  color: #ffffff;
}

/* ===========================
   BOTTOM iOS-STYLE TAB BAR
=========================== */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 999;
  padding-bottom: env(safe-area-inset-bottom); /* iPhone safe area */
  transition: transform 0.25s ease;  /* <<< REQUIRED */
}

/* Hidden state */
.bottom-tab-bar.hide {
  transform: translateY(100%);
}

/* ========================= */
/* Bottom Tab Bar Styles     */
/* ========================= */
.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.1);
    z-index: 9999;
}

.tab-btn {
    flex: 1;
    height: 55px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.tab-btn:active {
    opacity: 0.5;
}






/* Fade in for paycheck headers */
.paycheck-section {
    opacity: 0;
    transform: translateY(6px);
    animation: fadeInUp 0.45s ease forwards;
}

/* Fade in for each bill row */
.paycheck-row {
    opacity: 0;
    transform: translateY(4px);
    animation: fadeInRow 0.35s ease forwards;
}

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

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




.paycheck-header {
    background: #f0f7ff;       /* light blue tint */
    padding:12px;
    border-radius:10px;
    margin-bottom:10px;
}






.paycheck-row.positive {
    background: #ecfdf5;   /* soft green */
}

.paycheck-row.negative {
    background: #fef2f2;   /* soft red – used next step */
}



.paycheck-row.negative {
    background: #fee2e2;        /* light red */
    border-left: 4px solid #dc2626;  /* strong red indicator bar */
    color: #b91c1c !important;  
    font-weight:600;
}
.over-budget-badge {
    background: #dc2626;
    color: white;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 4px;
    margin-left: 8px;
}





.remaining-summary {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 0 4px 0;
    color: #0f172a;  /* slate-900 */
    opacity: 0.9;
}




/* Fade + slide in when item appears */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade out when item is removed */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}





@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/*THIS CONTROLS THE SLIDE IN SPEED FOR THE POPUP CARD ON EXPENSE ITEMS IN PAYCHECK PLANNER*/
.modal-card-pop {
    animation: modalPop 0.70s ease;
}
/*THIS CONTROLS THE SLIDE IN SPEED FOR THE POPUP CARD ON EXPENSE ITEMS IN PAYCHECK PLANNER*/






.highlight-expense {
    animation: highlightFlash 1.6s ease;
}

@keyframes highlightFlash {
    0%   { background: #fffec4; }
    50%  { background: #fffa8e; }
    100% { background: transparent; }
}



.drag-ghost {
    opacity: 0 !important;
    background: rgb(112, 200, 255) !important;
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.15) !important; /* small glow */
    transform: scale(1.02); /* slight lift effect */
}


/* Remove ghost clone blur/double text */
.sortable-ghost {
    opacity: 0 !important;
}

.sortable-chosen {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0,0,0,0.20);
    z-index: 9999;
    background: white;
}


/* Allow vertical scrolling normally */
.swipe-row {
    touch-action: pan-y !important;
}



/* Category LIFT effect */
.sortable-chosen.category-card {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.20);
    z-index: 9999;
    background: white !important;
}

/* Hide ghost clone */
.drag-ghost.category-card,
.sortable-ghost {
    opacity: 0 !important;
}



/* Glow effect ONLY when category is collapsed */
.category-card.collapsed .drag-handle {
    color: var(--accent);
    opacity: 1;
    animation: handleGlow 1.2s ease-in-out infinite;
}

/* Default state (not collapsed) */
.drag-handle {
    opacity: 0.35;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Slight scale on press */
.drag-handle:active {
    transform: scale(1.15);
}

/* Glow animation */
@keyframes handleGlow {
    0%   { opacity: 0.45; }
    50%  { opacity: 1; }
    100% { opacity: 0.45; }
}



.category-card.drag-ghost {
    opacity: 0.35 !important;
    transform: scale(0.98) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15) !important;
}

.category-card.drag-chosen {
    opacity: 1 !important;
    transform: scale(1.03) !important;
    box-shadow: 0 12px 28px rgba(0,0,0,0.22) !important;
}

.category-card.drag-fallback {
    opacity: 0.95 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 18px 40px rgba(0,0,0,0.28) !important;
}


.category-card {
    transition: transform 180ms ease;
    margin-bottom: 10px; /* keeps spacing consistent */
}

/* Required for slide animation */
.category-card.sortable-animate {
    transition: transform 180ms ease;
}


.sortable-ghost {
    opacity: 0.4;
    transform: scale(0.97);
}

.sortable-chosen {
    opacity: 0.9;
    transform: scale(1.03);
}


.icon-signout-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 6px;
  color: var(--text-main);
}

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




/* ===========================================
   PAID STATUS CIRCLE
   =========================================== */
.paid-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #bbb;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.paid-circle.paid {
    background: #22c55e; /* green */
    border-color: #22c55e;
}


/* Force vertical centering on all expense rows */
.row.compact-row.swipe-row {
    align-items: center !important;
}

/* Slight downward nudge if needed */
.paid-circle {
    margin-top: 2px; /* adjust between 0–3px based on how it looks */
}



/* Prevent iOS auto-zoom when editing inputs */
input,
select,
textarea {
  font-size: 16px !important;
}



/* ===============================
   MASTER FIXED HEADER + SUMMARY DO NOT DELETE
   =============================== */

/* Entire fixed section (header + summary) */
#masterStickyBar {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 99999;
  background: var(--bg);
  padding: 6px 12px 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  box-sizing: border-box;
}

/* Spacer to push page down */
#masterStickyBar-spacer {
  height: 150px;
}

/* HEADER ROW */
#fixedBudgetHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(6px + env(safe-area-inset-top)) 0 6px;
  box-sizing: border-box;
}

#fixedBudgetHeader .fh-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#fixedBudgetHeader .fh-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
}

/* SUMMARY ROW */
#summaryCard {
  width: 100%;
  padding-top: 10px;
  box-sizing: border-box;
}

.top-summary-row {
  display: flex;
  gap: 8px;
  padding: 0 4px;        /* gives more width to the cards */
  width: 100%;
  box-sizing: border-box;
}

.top-summary-item {
  flex: 1 1 auto;        /* expands evenly */
  min-width: 0;          /* allows shrinking properly */
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}
/* ===============================
   MASTER FIXED HEADER + SUMMARY DO NOT DELETE END
   =============================== */

/*DEBT MODAL CSS LAYOUT*/
.modal-hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.debt-modal-card {
  background: #fff;
  width: 90%;
  max-width: 380px;
  padding: 22px;
  border-radius: 16px;
  animation: popIn 0.25s ease;
}

.modal-label {
  font-size: 14px;
  margin-top: 12px;
  display: block;
}

.modal-input {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 4px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
}

.modal-payoff {
  font-weight: bold;
  margin-top: 6px;
  margin-bottom: 12px;
}

.full {
  width: 100%;
  margin-top: 10px;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
/*DEBT MODAL CSS LAYOUT END*/

/* ============================== */
/* NEW DEBT MODAL CLEAN STYLES    */
/* ============================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.32);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
  z-index: 999999;
}

.modal-hidden {
  display: none !important;
}

.modal-card-pop {
  width: 92%;
  max-width: 420px;
  background: #fff;
  padding: 22px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.modal-section {
  margin-bottom: 16px;
}

.modal-label {
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 16px;
}
/* ============================== */
/* NEW DEBT MODAL CLEAN STYLES END   */
/* ============================== */



.debt-chevron {
    margin-left: auto;
    margin-right: 6px;
    font-size: 20px;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.debt-row:hover .debt-chevron {
    color: #000;
}


.savings-goal-card:hover {
    transform: translateY(-2px);
    transition: 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.savings-goal-card button {
  box-shadow: 0 3px 6px rgba(0,0,0,0.12);
}
.savings-goal-card .progress-bar {
  border-radius: 20px !important;
}
body {
  background: linear-gradient(#eef4ff, #f8fbff);
}
.savings-goal-card:active {
  transform: scale(0.98);
  transition: 0.1s;
}

/* -----------------------------
   SAVINGS GOAL CARD THEMES
----------------------------- */

.savings-theme-1 {
    background: #e8f0ff;        /* soft blue */
    border-left: 6px solid #3b82f6;
}

.savings-theme-2 {
    background: #fef3c7;        /* soft amber */
    border-left: 6px solid #f59e0b;
}

.savings-theme-3 {
    background: #ecfdf5;        /* soft green */
    border-left: 6px solid #10b981;
}

.savings-theme-4 {
    background: #fdf2f8;        /* soft pink */
    border-left: 6px solid #ec4899;
}

.savings-theme-5 {
    background: #f3e8ff;        /* soft purple */
    border-left: 6px solid #a855f7;
}

.savings-goal-card {
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    transition: transform .2s ease;
}

.savings-goal-card:hover {
    transform: translateY(-3px);
}


.delete-goal-btn {
    background: transparent;
    border: none;
    color: #cc3333;
    font-size: 22px;
    padding: 10px;     /* IMPORTANT: gives finger hitbox */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.savings-goal-card {
    position: relative;
    z-index: 1;
}
.savings-goal-card * {
    outline: 2px solid red !important;
}
.savings-goal-card button {
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}
.savings-goal-card button[data-type],
.savings-goal-card button {
    pointer-events: auto !important;
}
.delete-goal-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

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

* {
    outline: none !important;
}
.savings-goal-card * {
    outline: none !important;
    border: none !important;
}


.deposit-bubble {
    background: #4ade80;
    color: white;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s;
}

.deposit-bubble:hover {
    transform: scale(1.1);
    background: #22c55e;
}

.deposit-bubble {
    pointer-events: auto !important;
    position: relative;
    z-index: 999999 !important;
    cursor: pointer;
}
.deposit-bubble-container {
    pointer-events: auto !important;
    position: relative;
    z-index: 999999 !important;
}
.drag-ghost {
    opacity: 0.5;
    transform: scale(0.98);
}
body.dragging {
    overflow: hidden;
    touch-action: none;
}

.drag-ghost {
    opacity: 0.6;
    transform: scale(0.98);
}
/* When a card is picked up */
.savings-goal-card.drag-chosen {
    opacity: 0.75;
    transform: scale(0.98);
}

/* Ghost element (the placeholder that remains in the list) */
.drag-ghost {
    opacity: 0.4 !important;
    background: #dbeafe !important; /* light blue */
    border-radius: 14px;
    border: 2px dashed #3b82f6;
}

/* Fallback clone (used on iPhone when forceFallback = true) */
.drag-fallback {
    opacity: 0.9 !important;
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    background: white !important;
    border-radius: 14px;
}





.empty-state {
  padding: 16px;
  background: #f8fafc;
  border-radius: 10px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}





/* ============================
   PULL TO REFRESH INDICATOR
   ============================ */
#ptr-budget-content {
  position: fixed;

  /* 🔽 Adjust this to match your sticky header height */
  top: calc(env(safe-area-inset-top) + 64px);

  left: 0;
  right: 0;

  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  background: transparent;

  font-size: 14px;
  font-weight: 500;
  color: #475569;

  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.25s ease, transform 0.25s ease;

  z-index: 10000; /* 🔥 ABOVE header + cards */
  pointer-events: none;
}

.ptr-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: ptr-spin 0.1s linear infinite;
  display: none;
}

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

/* FORCE smaller text inside inputs (visual only, safe) */
.row.compact-row input[type="text"],
.row.compact-row input[type="number"],
.row.compact-row select {
  font-size: 14px !important;
  line-height: 1.2;
}


/* Active tab highlight */
#bottom-tabs .tab-btn.active {
  color: var(--primary);
}

#bottom-tabs .tab-btn.active .tab-icon {
  transform: scale(1.1);
}

#bottom-tabs .tab-btn.active::after {
  content: "";
  position: relative;
  top: 0;
  width: 40%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 6px 6px;
}


/* === Reserve space for bottom nav on ALL screens === */
#screen-budget,
#screen-paycheck,
.paycheck-content,
#screen-savings,
#screen-amb {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* === Offset screens below sticky header === */
#screen-paycheck,
#screen-savings,
#screen-amb {
  padding-top: calc(0px + env(safe-area-inset-top));
}

.tab-btn {
  opacity: 0.6;
  transition: all 0.2s ease;
}

.tab-btn.active {
  opacity: 1;
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56,189,248,0.6);
}
.tab-btn.active svg,
.tab-btn.active i {
  filter: drop-shadow(0 0 6px rgba(56,189,248,0.7));
}



.modal-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 18px 0;
}

.modal-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  display: block;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 15px;
}

.modal-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}


/* ===============================
   HEADER USER ACCOUNT DISPLAY
   =============================== */

.account-header-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;

  max-width: 42%;
  padding: 6px 8px;

  background: transparent;
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--text-main);

  -webkit-appearance: none;
  appearance: none;

  font: inherit;
  cursor: pointer;
}

.account-user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;

  min-width: 0;
}

.account-user-name {
  font-size: .86rem;
  font-weight: 700;
  color: var(--text-main);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-user-email {
  font-size: .70rem;
  color: #9ca3af;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  max-width: 210px;
}

.account-profile-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;

  color: #1451ac;

  flex-shrink: 0;
}

.account-profile-icon svg {
  width: 28px;
  height: 28px;
}

.account-header-btn:hover {
  opacity: .9;
}

.account-header-btn:active {
  transform: scale(.98);
}

/* Keep the header usable on smaller phones */
@media (max-width:640px){

  .account-header-btn{
      gap:8px;
      padding:4px;
      max-width:48%;
  }

  .account-user-name{
      font-size:.75rem;
  }

  .account-user-email{
      font-size:.62rem;
      max-width:115px;
  }

  .account-profile-icon{
      width:30px;
      height:30px;
  }

  .account-profile-icon svg{
      width:24px;
      height:24px;
  }

  #fixedBudgetHeader .fh-title {
    font-size: 1.05rem;
  }

  #fixedBudgetHeader .fh-left {
    gap: 6px;
    min-width: 0;
  }
}


/* ==========================================
   PROFILE & SECURITY MODAL
========================================== */

.account-profile-modal {
  width: 92%;
  max-width: 440px;
  padding: 20px;
}

.account-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.account-modal-header .modal-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.account-modal-close {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.account-modal-close:active {
  transform: scale(0.92);
}

.account-section-heading {
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.account-profile-section,
.account-security-section {
  padding: 4px 0;
}

.account-profile-modal .modal-section {
  margin-top: 12px;
}

.account-profile-modal .modal-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.account-profile-modal .modal-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 16px;
}

.account-profile-modal .modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.16);
}

.account-readonly-input {
  background: var(--card-bg-soft) !important;
  color: var(--text-sub) !important;
  cursor: not-allowed;
}

.modal-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.account-save-message {
  min-height: 20px;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.account-save-success {
  color: #16a34a;
}

.account-save-error {
  color: #dc2626;
}

.account-footer-actions {
  margin-top: 0;
}

/* =========================
   PROFILE FOOTER ACTIONS
========================= */

.account-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.account-action-btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.account-footer-actions #btnSignOut {
  background: linear-gradient(
    135deg,
    #edf6ff 0%,
    #dcecff 100%
  );
  color: #081a36;
  border: 1px solid #bfd6ef;
}

.account-footer-actions #btnDeleteAccount {
  background: linear-gradient(
    135deg,
    #fff1f2 0%,
    #ffe4e6 100%
  );
  color: #b42318;
  border: 1px solid #fecdd3;
}

.account-profile-modal button:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 640px) {
  .account-profile-modal {
    width: 94%;
    max-height: 88vh;
    padding: 18px 16px;
  }

  .account-modal-header {
    margin-bottom: 14px;
  }

  .account-modal-header .modal-title {
    font-size: 1.1rem;
  }

  .account-section-heading {
    font-size: 0.86rem;
  }

  .modal-divider {
    margin: 16px 0;
  }
}



/* =======================================
   WHAT-IF BUDGET CALCULATOR
======================================= */

#screen-whatif {
  position: fixed;
  inset: 0;

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  background: var(--bg);

  padding:
    calc(18px + env(safe-area-inset-top))
    12px
    calc(90px + env(safe-area-inset-bottom));

  overscroll-behavior-y: contain;
}

.whatif-page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.whatif-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.whatif-back-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.whatif-title {
  margin: 0;
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 800;
}

.whatif-subtitle {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 0.85rem;
}

.whatif-notice {
  margin-bottom: 14px;
  padding: 11px 13px;
  border-radius: 12px;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  color: #075985;
  font-size: 0.82rem;
  line-height: 1.4;
}

.whatif-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.whatif-summary-card {
  min-width: 0;
  padding: 12px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}

.whatif-summary-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-sub);
  font-size: 0.72rem;
  line-height: 1.2;
}

.whatif-summary-card strong {
  display: block;
  color: var(--text-main);
  font-size: clamp(0.82rem, 3.7vw, 1.05rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.whatif-section-card,
.whatif-results-card {
  margin-bottom: 14px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.whatif-field-label,
.whatif-section-heading,
.whatif-results-heading {
  display: block;
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
}

.whatif-income-input {
  width: 100%;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 700;
  outline: none;
}

.whatif-income-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.18);
}

.whatif-help-text {
  margin: 6px 0 14px;
  color: var(--text-sub);
  font-size: 0.82rem;
  line-height: 1.4;
}

.whatif-bill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whatif-category-heading {
  margin: 12px 0 4px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 800;
}

.whatif-category-heading:first-child {
  margin-top: 0;
}

.whatif-bill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--card-bg-soft);
  cursor: pointer;
}

.whatif-bill-row:active {
  transform: scale(0.99);
}

.whatif-bill-checkbox {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.whatif-bill-details {
  min-width: 0;
  flex: 1;
}

.whatif-bill-name {
  display: block;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.whatif-bill-category {
  display: block;
  margin-top: 2px;
  color: var(--text-sub);
  font-size: 0.72rem;
}

.whatif-bill-amount {
  flex-shrink: 0;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.whatif-bill-row.whatif-removed {
  opacity: 0.55;
  background: #f8fafc;
}

.whatif-bill-row.whatif-removed .whatif-bill-name {
  text-decoration: line-through;
}

.whatif-empty-state {
  padding: 18px 10px;
  color: var(--text-sub);
  text-align: center;
  font-size: 0.88rem;
}

.whatif-results-heading {
  margin-bottom: 10px;
}

.whatif-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-sub);
  font-size: 0.88rem;
}

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

.whatif-result-row strong {
  color: var(--text-main);
  white-space: nowrap;
}

.whatif-highlight-row {
  margin: 6px -6px;
  padding: 12px 8px;
  border: none;
  border-radius: 10px;
  background: #ecfdf5;
  color: #166534;
  font-weight: 700;
}

.whatif-highlight-row strong {
  color: #15803d;
}

.whatif-negative {
  color: #dc2626 !important;
}

.whatif-positive {
  color: #15803d !important;
}

.whatif-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.whatif-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
}

@media (max-width: 390px) {
  .whatif-summary-grid {
    gap: 5px;
  }

  .whatif-summary-card {
    padding: 10px 5px;
  }

  .whatif-summary-label {
    font-size: 0.66rem;
  }

  .whatif-bill-row {
    padding: 10px 8px;
  }
}

/* =======================================
   WHAT-IF PROJECTED INCOME — CLEAN ROWS
======================================= */

.whatif-income-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.whatif-income-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(105px, 0.45fr)
    32px;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--card-bg-soft);
}

/* Hide Description and Amount labels */
.whatif-income-field label {
  display: none;
}

.whatif-income-field {
  min-width: 0;
}

.whatif-income-description-input,
.whatif-income-amount-input {
  width: 100%;
  min-width: 0;
  padding: 6px 0 !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
  outline: none;
}

.whatif-income-description-input {
  text-align: left;
}

.whatif-income-amount-input {
  text-align: right;
  white-space: nowrap;
}

.whatif-income-description-input:focus,
.whatif-income-amount-input:focus {
  border-bottom-color: var(--accent) !important;
}

.whatif-income-delete-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--danger);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.whatif-income-delete-btn:active {
  background: var(--danger-soft);
  transform: scale(0.95);
}

.whatif-add-income-btn {
  margin-top: 2px;
}

.whatif-income-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);

  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 700;
}

.whatif-income-total-row strong {
  white-space: nowrap;
}

.whatif-share-btn {
  width: 100%;
  justify-content: center;
  padding: 13px 16px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.95rem;
}

.whatif-share-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 390px) {
  .whatif-income-row {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(90px, 0.5fr)
      28px;

    gap: 7px;
    padding: 9px 10px;
  }

  .whatif-income-description-input,
  .whatif-income-amount-input {
    font-size: 0.88rem;
  }
}

/* Copied budget income has no delete button */
.whatif-income-row-base {
  grid-template-columns:
    minmax(0, 1fr)
    minmax(105px, 0.45fr);
}

/* =======================================
   WHAT-IF EDITABLE BILL AMOUNTS
======================================= */

.whatif-bill-amount-wrap {
  flex: 0 0 112px;
  min-width: 0;
}

.whatif-bill-amount-input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: right;
  outline: none;
}

.whatif-bill-amount-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.16);
}

.whatif-bill-amount-input.whatif-amount-edited {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 144, 226, 0.08);
}

/* A removed bill remains clearly crossed out */
.whatif-bill-row.whatif-removed
.whatif-bill-amount-input {
  text-decoration: line-through;
  color: var(--text-sub);
}

/* Keep everything usable on narrow phones */
@media (max-width: 390px) {
  .whatif-bill-row {
    gap: 7px;
  }

  .whatif-bill-amount-wrap {
    flex-basis: 96px;
  }

  .whatif-bill-amount-input {
    padding: 7px 5px;
    font-size: 0.82rem;
  }
}

/* =======================================
   WHAT-IF STICKY PROJECTED REMAINING
======================================= */

.whatif-sticky-remaining {
  position: fixed;

  top: calc(env(safe-area-inset-top) + 8px);
  left: 12px;
  right: 12px;

  z-index: 999999;

  width: auto;
  margin: 0;
  padding: 11px 14px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.13);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.whatif-sticky-remaining-text {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 2px;
}

.whatif-sticky-label {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.15;
}

.whatif-sticky-hint {
  color: var(--text-sub);
  font-size: 0.7rem;
  line-height: 1.15;
}

.whatif-sticky-value {
  flex-shrink: 0;

  color: #16a34a;
  font-size: clamp(1.15rem, 5vw, 1.45rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.whatif-sticky-value.whatif-positive {
  color: #16a34a;
}

.whatif-sticky-value.whatif-negative {
  color: #ef4444;
}

.whatif-sticky-remaining.whatif-sticky-updated {
  animation: whatIfRemainingPulse 0.28s ease;
}

@keyframes whatIfRemainingPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.018);
  }

  100% {
    transform: scale(1);
  }
}

/* Slightly tighter layout on narrow phones */
@media (max-width: 390px) {
  .whatif-sticky-remaining {
    top: calc(env(safe-area-inset-top) + 5px);
    left: 10px;
    right: 10px;
    padding: 10px 11px;
    gap: 8px;
  }

  .whatif-sticky-label {
    font-size: 0.82rem;
  }

  .whatif-sticky-hint {
    font-size: 0.65rem;
  }

  .whatif-sticky-value {
    font-size: 1.15rem;
  }
}

/* Reserve room for the fixed Projected Remaining bar */
#screen-whatif .whatif-page {
  padding-top: 82px;
}




/* =======================================
   WHAT-IF PROJECTED BILLS
======================================= */

.whatif-add-bill-btn {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.whatif-custom-bill-row {
  background: rgba(74, 144, 226, 0.06);
  border: 1px dashed var(--accent);
}

.whatif-custom-bill-name-input {
  width: 100%;
  min-width: 0;

  padding: 5px 7px;

  border: 1px solid var(--border-soft);
  border-radius: 8px;

  background: var(--card-bg);
  color: var(--text-main);

  font-size: 0.88rem;
  font-weight: 700;

  outline: none;
}

.whatif-custom-bill-name-input:focus {
  border-color: var(--accent);

  box-shadow:
    0 0 0 3px rgba(74, 144, 226, 0.14);
}

.whatif-custom-bill-delete {
  flex: 0 0 30px;

  width: 30px;
  height: 30px;

  padding: 0;

  border: none;
  border-radius: 50%;

  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;

  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
}

.whatif-custom-bill-delete:active {
  transform: scale(0.92);
}

.whatif-custom-bill-row.whatif-removed
.whatif-custom-bill-name-input {
  text-decoration: line-through;
  opacity: 0.65;
}

@media (max-width: 390px) {
  .whatif-custom-bill-delete {
    flex-basis: 27px;
    width: 27px;
    height: 27px;
  }
}


/* =========================
   AMB RESULTS
========================= */

.amb-results {
  padding: 8px 10px 90px;
}

.amb-result-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}

.amb-result-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--text-main);
}

.amb-result-card p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.95rem;
  color: var(--text-main);
}

.amb-save-card {
  text-align: center;
  padding: 20px 16px;
}

.amb-save-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.amb-save-amount {
  font-size: 2rem;
  font-weight: 800;
  color: #16a34a;
}


/* =========================
   AMB Loading State
========================= */

.amb-loading {
  margin-top: 18px;
  text-align: center;
  padding: 18px 14px;
}

.amb-loading-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border: 4px solid rgba(74, 144, 226, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ambSpin 0.8s linear infinite;
}

.amb-loading-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.amb-loading-text {
  margin-top: 5px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

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


#goalTargetDate {
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;

  padding: 0 12px !important;
  box-sizing: border-box !important;

  border: 1px solid var(--border-soft) !important;
  border-radius: 10px !important;

  background: #ffffff !important;
  color: var(--text-main) !important;

  font-size: 16px !important;
  font-family: inherit !important;

  -webkit-appearance: auto;
  appearance: auto;
}

#goalTargetDate::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
}

#modalOverlay {
  z-index: 1000000 !important;
}

/* =====================================
   COMBINED SAVINGS BUDGET WARNING
===================================== */

#combinedSavingsWarning {
    margin: 0 0 18px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-size: 14px;
    line-height: 1.5;
}

#combinedSavingsWarning > strong:first-child {
    display: block;
    font-size: 16px;
    line-height: 1.3;
    margin-bottom: 10px;
}

#combinedSavingsWarning {
    text-align: left;
}

#combinedSavingsWarning div {
    margin-left: 0 !important;
}

.biometric-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.biometric-setting > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.biometric-switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
}

.biometric-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.biometric-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.2s;
}

.biometric-slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.biometric-switch input:checked + .biometric-slider {
  background: #18a8e0;
}

.biometric-switch input:checked + .biometric-slider::before {
  transform: translateX(20px);
}

/* =========================
   SUPPORT & LEGAL
========================= */

.support-legal-section {
  margin: 20px 0;
}

.support-legal-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.support-legal-section .profile-link {
  display: block;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
}

.support-legal-section .profile-link + .profile-link {
  border-top: 1px solid rgba(128, 128, 128, 0.25);
}

/* =========================================
   iOS — PREVENT INPUT FOCUS AUTO-ZOOM
   ========================================= */
@media (max-width: 768px) {

  .row.compact-row input[type="text"],
  .row.compact-row input[type="number"],
  .row.compact-row select,
  .modal-input,
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

}

/* =========================================
   RETIREMENT NUMBER — AMB SECTION
========================================= */

.retirement-number-section {
  margin-top: 28px;
  padding: 0 12px 24px;
}

.retirement-number-header {
  text-align: center;
  margin-bottom: 18px;
}

.retirement-number-header h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.retirement-number-header p {
  margin: 0 auto;
  max-width: 520px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-sub);
}


/* =========================
   QUESTION CARDS
========================= */

.retirement-question-card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.retirement-question-card > label {
  display: block;
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.retirement-example {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-bottom: 12px;
  font-style: italic;
}

.retirement-question-card input[type="number"],
.retirement-question-card input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 16px;
  outline: none;
}

.retirement-question-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.14);
}


/* =========================
   THINGS TO CONSIDER
========================= */

.retirement-consider-box {
  margin: 12px 0;
  padding: 13px 14px;
  border-radius: 12px;
  background: rgba(74, 144, 226, 0.08);
  border: 1px solid rgba(74, 144, 226, 0.18);
  color: var(--text-main);
  font-size: 0.85rem;
  line-height: 1.5;
}

.retirement-consider-box strong {
  display: block;
  margin-bottom: 3px;
}


/* =========================
   MONTHLY AMOUNT OPTIONS
========================= */

.retirement-monthly-options {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.retirement-monthly-options .btn {
  flex: 1;
  justify-content: center;
  min-height: 42px;
  white-space: normal;
  text-align: center;
}


/* =========================
   CALCULATE BUTTON
========================= */

.retirement-calculate-btn {
  width: 100%;
  justify-content: center;
  padding: 13px 16px;
  margin: 4px 0 18px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 800;
}


/* =========================
   RESULTS
========================= */

.retirement-number-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.retirement-number-main-card {
  background: linear-gradient(
    145deg,
    #1e3a8a 0%,
    #2563eb 100%
  );
  color: white;
  border-radius: 18px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.retirement-number-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.retirement-number-amount {
  margin-top: 7px;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 1.1;
  font-weight: 900;
}

.retirement-number-formula {
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.88;
}


/* =========================
   STANDARD RESULT CARDS
========================= */

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

.retirement-result-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.retirement-result-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.retirement-result-card p {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}


/* =========================
   INVESTMENT GROWTH
========================= */

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

.retirement-growth-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.4;
}

.retirement-growth-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}

.retirement-growth-note {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.18);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-sub);
}

.retirement-growth-note strong {
  color: var(--text-main);
}

.retirement-growth-projection {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}


/* =========================
   KEEP IN MIND
========================= */

.retirement-keep-in-mind {
  padding: 14px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.28);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-sub);
}

.retirement-keep-in-mind strong {
  color: var(--text-main);
}


/* =========================
   MOBILE
========================= */

@media (max-width: 640px) {
  .retirement-number-section {
    padding-left: 8px;
    padding-right: 8px;
  }

  .retirement-monthly-options {
    flex-direction: column;
  }

  .retirement-monthly-options .btn {
    width: 100%;
  }

  .retirement-number-main-card {
    padding: 22px 14px;
  }
}


/* =========================================
   AMB TOOL SELECTOR
========================================= */

.amb-tool-header {
  padding: 22px 18px 8px;
}

.amb-tool-header h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
}

.amb-tool-header p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-sub);
}


/* Two tool choices */
.amb-tool-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 18px 22px;
}


/* Individual tool card */
.amb-tool-option {
  appearance: none;
  -webkit-appearance: none;

  display: flex;
  align-items: center;
  gap: 12px;

  width: 100%;
  min-height: 92px;
  padding: 14px;

  background: #ffffff;
  border: 2px solid var(--border-soft);
  border-radius: 16px;

  text-align: left;
  cursor: pointer;

  box-shadow: var(--shadow);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.12s ease;
}

.amb-tool-option:active {
  transform: scale(0.98);
}


/* Selected tool */
.amb-tool-option.active {
  border-color: var(--accent);
  background: rgba(74, 144, 226, 0.09);
}


/* Icon */
.amb-tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;
  flex: 0 0 42px;

  border-radius: 12px;
  background: rgba(74, 144, 226, 0.10);

  font-size: 1.3rem;
}


/* Text area */
.amb-tool-option-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.amb-tool-option-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.amb-tool-option-text small {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  font-weight: 400;
  color: var(--text-sub);
}


/* Space below selector before selected tool */
#ambCurrentBudgetTool,
#ambRetirementTool {
  margin-top: 4px;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 640px) {

  .amb-tool-selector {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .amb-tool-option {
    min-height: 82px;
  }

}


/* =========================================
   AMB — RECOMMENDED THIS MONTH
========================================= */

.amb-recommendation-card {
  overflow: hidden;
}

.amb-recommendation-title {
  margin-bottom: 16px !important;
}


/* CURRENT PLAN / RECOMMENDED EXTRA SECTIONS */

.amb-recommendation-section {
  margin-top: 14px;
}

.amb-recommendation-section + .amb-recommendation-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.amb-recommendation-section-title {
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-sub);
}


/* INDIVIDUAL MONEY ROW */

.amb-recommendation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 11px 0;
}

.amb-recommendation-row + .amb-recommendation-row {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.amb-recommendation-row > div:first-child {
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text-main);
}

.amb-recommendation-amount {
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}


/* MAKE THE ACTUAL NEW RECOMMENDATION STAND OUT */

.amb-recommendation-section:last-child {
  padding: 14px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.08);
}

.amb-recommendation-section:last-child
.amb-recommendation-section-title {
  color: #15803d;
}

.amb-recommendation-section:last-child
.amb-recommendation-amount {
  color: #15803d;
}


/* EMPTY STATE */

.amb-recommendation-empty {
  padding: 10px 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-sub);
}


/* MOBILE */

@media (max-width: 640px) {

  .amb-recommendation-row {
    gap: 10px;
  }

  .amb-recommendation-amount {
    font-size: 0.95rem;
  }

}

/* =========================================
   MOBILE ROW WIDTH FIX
   Prevent amount/date text from being clipped
========================================= */

@media (max-width: 640px) {

  /* Slightly tighter spacing between row columns */
  .row.compact-row {
    gap: 5px;
  }

  /* Expense / description column */
  .row.compact-row > div:nth-child(1) {
    flex: 1.65 !important;
    min-width: 0;
  }

  /* Amount column */
  .row.compact-row > div:nth-child(2) {
    flex: 1.45 !important;
    min-width: 82px;
  }

  /* Date column */
  .row.compact-row > div:nth-child(3) {
    flex: 1.05 !important;
    min-width: 62px;
  }

  /* Keep full currency visible */
  .row.compact-row input[data-type="income-amount"],
  .row.compact-row input[data-type="cat-item-amount"] {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }

  /* Keep full short date visible */
  .row.compact-row select[data-type="income-date"],
  .row.compact-row select[data-type="cat-item-date"] {
    white-space: nowrap;
    overflow: visible;
  }
}


/* =========================================
   DESKTOP / LAPTOP NORMAL PAGE SCROLL
========================================= */

@media (hover: hover) and (pointer: fine) {

  html {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body {
    height: auto !important;
    min-height: 100vh;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    touch-action: auto !important;
  }

  #screen-budget,
  #screen-paycheck,
  #screen-savings,
  #screen-amb {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
  }
}

/* =========================================
   DEBT CHEVRON DESKTOP CLICK FIX
========================================= */

.debt-chevron {
  position: relative;
  z-index: 20;
  pointer-events: auto !important;

  min-width: 32px;
  min-height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

@media (hover: hover) and (pointer: fine) {
  .debt-chevron:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 999px;
  }
}

/* =========================================
   DESKTOP CHART SIZE
========================================= */

@media (hover: hover) and (pointer: fine) and (min-width: 900px) {

  #categoryChart {
    width: auto !important;
    height: auto !important;
    max-width: 460px !important;
    max-height: 460px !important;
    display: block;
    margin: 0 auto;
  }

}

/* =========================================
   MADE TO WIN BUDGET — SUBSCRIPTION WALL
========================================= */

.subscription-wall {
  position: fixed;
  inset: 0;
  z-index: 999998;
  background: #f5f9ff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    calc(24px + env(safe-area-inset-top))
    20px
    calc(24px + env(safe-area-inset-bottom));
}

.subscription-card {
  width: 100%;
  max-width: 420px;

  background: #ffffff;
  border: 1px solid #d9e4ff;
  border-radius: 24px;

  padding: 28px 22px;

  text-align: center;

  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.12);
}

.subscription-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 18px;
  margin-bottom: 12px;
}

.subscription-card h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.15;
  color: #1a1f2b;
}

.subscription-intro {
  margin: 10px auto 20px;
  max-width: 340px;

  color: #64748b;
  font-size: 0.96rem;
  line-height: 1.45;
}

.subscription-offer {
  background: #eaf3ff;
  border: 1px solid #c5d7f2;
  border-radius: 18px;

  padding: 18px 14px;
  margin-bottom: 18px;
}

.subscription-trial {
  color: #2563eb;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.subscription-price {
  color: #111827;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.subscription-price span {
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
}

.subscription-cancel {
  margin-top: 7px;
  font-size: 0.86rem;
  color: #64748b;
}

.subscription-features {
  text-align: left;
  margin: 0 auto 22px;

  display: flex;
  flex-direction: column;
  gap: 10px;

  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 600;
}

.subscription-primary-btn,
.subscription-secondary-btn {
  width: 100%;
  min-height: 50px;

  border-radius: 999px;

  font-size: 1rem;
  font-weight: 700;

  cursor: pointer;
}

.subscription-primary-btn {
  border: none;
  background: #4a90e2;
  color: #ffffff;

  margin-bottom: 10px;
}

.subscription-primary-btn:active {
  transform: scale(0.98);
}

.subscription-secondary-btn {
  background: #ffffff;
  color: #1a1f2b;

  border: 1px solid #c5d7f2;
}

.subscription-secondary-btn:active {
  transform: scale(0.98);
}

.subscription-terms {
  margin: 16px 4px 0;

  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.4;
}

@media (max-height: 740px) {
  .subscription-wall {
    align-items: flex-start;
  }

  .subscription-card {
    margin-top: 8px;
  }
}
/* ============================================================
   MADE TO WIN BUDGET — LIGHT BRAND REFRESH V3
   Medium-light blue canvas + anchored sticky header
   CSS-only visual overrides
============================================================ */

:root {
  --bg: #DCEBFA;
  --text-main: #0B2748;
  --text-sub: #53697E;
  --card-bg: #FFFFFF;
  --card-bg-soft: #EAF4FD;
  --border: #B9D2E8;
  --border-soft: #CFE0EF;
  --accent: #128BD7;
  --primary: #128BD7;
  --shadow: 0 6px 16px rgba(8, 26, 54, 0.08);
}

/* Clearly blue canvas without becoming dark */
html,
body {
  background: #DCEBFA !important;
  color: var(--text-main);
}

/* Anchor the top of the app with a stronger light blue */
#masterStickyBar {
  background: #C8E1F6 !important;
  border-bottom: 1px solid #AFCDE6 !important;
  box-shadow: 0 4px 14px rgba(8, 26, 54, 0.08);
}

#fixedBudgetHeader .fh-title {
  color: #081A36;
}

.account-header-btn,
.account-user-name {
  color: #081A36;
}

.account-user-email {
  color: #4F6B84;
}

.account-profile-icon {
  color: #128BD7;
}

/* White summary cards stand out against the anchored header */
.top-summary-item {
  background: #FFFFFF !important;
  border-color: #B9D2E8 !important;
  box-shadow: 0 4px 12px rgba(8, 26, 54, 0.08) !important;
}

/* Main workspace hierarchy */
.card,
.whatif-summary-card,
.whatif-section-card,
.whatif-results-card,
.amb-result-card,
.retirement-question-card,
.retirement-result-card,
.retirement-number-main-card,
.modal-card,
.onboard-card {
  background: #FFFFFF;
  border-color: #B9D2E8;
}

.income-wrapper,
.category-card,
.summary-item,
.amb-tool-option.active {
  background: #EAF4FD !important;
  border-color: #C4D9EB !important;
}

/* Month rail keeps the light feel but with stronger selection */
.month-card {
  background: #EAF4FD;
  border-color: #B9D2E8;
}

.month-card.active {
  background: linear-gradient(135deg, #128BD7 0%, #32B6F3 100%) !important;
  border-color: #128BD7 !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 12px rgba(18, 139, 215, 0.24) !important;
}

.month-card.active .month-year-label {
  color: #F2FAFF !important;
}

/* Website-family blue for primary actions */
.btn:not(.secondary):not(.danger):not(.category-add),
.subscription-primary-btn,
.whatif-share-btn,
.amb-analyze-btn,
.retirement-calculate-btn {
  background: linear-gradient(135deg, #10A6ED 0%, #0879BB 100%) !important;
  color: #FFFFFF !important;
}

.btn.secondary,
.subscription-secondary-btn,
.whatif-back-btn {
  background: #FFFFFF;
  border-color: #B9D2E8;
  color: #0B2748;
}

/* Bottom navigation stays bright, with website blue as the active accent */
.bottom-tabs,
.bottom-tab-bar {
  background: #FFFFFF !important;
  border-top-color: #B9D2E8 !important;
}

#bottom-tabs .tab-btn.active,
.tab-btn.active {
  color: #128BD7 !important;
  text-shadow: none !important;
}

#bottom-tabs .tab-btn.active::after {
  background: #128BD7 !important;
}

/* What-If + AMB soft information surfaces */
.whatif-notice,
.retirement-consider-box,
.retirement-growth-note,
.retirement-keep-in-mind {
  background: #EAF4FD !important;
  border-color: #BED8EC !important;
  color: #214968 !important;
}

.amb-tool-option {
  background: #FFFFFF;
  border-color: #CFE0EF;
}

.amb-tool-option.active {
  border-color: #128BD7 !important;
}

.amb-tool-icon {
  background: rgba(18, 139, 215, 0.10) !important;
}

/* Savings keeps personality while sitting on the new blue canvas */
#screen-savings {
  background: transparent !important;
}

/* Paywall now feels like the same product without going dark */
.subscription-wall {
  background: #DCEBFA !important;
}

.subscription-card {
  border-color: #B9D2E8 !important;
  box-shadow: 0 12px 30px rgba(8, 26, 54, 0.12) !important;
}

.subscription-offer {
  background: #EAF4FD !important;
  border-color: #B9D2E8 !important;
}

.subscription-trial {
  color: #128BD7 !important;
}

/* Keep text consistently navy rather than near-black */
.section-title,
.year-display,
.whatif-title,
.amb-tool-header h2,
.subscription-card h1 {
  color: #0B2748;
}

/* ============================================================
   MADE TO WIN BUDGET — V4 GRADIENT DEPTH REFRESH
   Light, vibrant, dimensional — without turning the app dark
============================================================ */

:root {
  --mtw-navy: #081A36;
  --mtw-blue: #128BD7;
  --mtw-sky: #32B6F3;
  --mtw-ice: #EDF6FF;
  --mtw-pale: #F7FBFF;
  --mtw-canvas: #DCEBFA;
  --mtw-soft-blue: #EAF4FD;
}

/* Overall canvas: richer at the top, lighter as content flows down */
html,
body {
  background: linear-gradient(
    180deg,
    #D2E6F8 0%,
    #E1EFFB 28%,
    #EDF6FF 64%,
    #F7FBFF 100%
  ) fixed !important;
}

/* Sticky brand area: light, dimensional, never dark */
#masterStickyBar {
  background: linear-gradient(
    135deg,
    #BFDDF4 0%,
    #D8EBFA 48%,
    #C7E2F6 100%
  ) !important;
  border-bottom: 1px solid #A8CAE4 !important;
  box-shadow: 0 8px 22px rgba(8, 26, 54, 0.10) !important;
}

/* Summary cards: soft glassy gradient against the blue header */
.top-summary-item {
  background: linear-gradient(
    145deg,
    #FFFFFF 0%,
    #F5FAFF 45%,
    #E8F4FD 100%
  ) !important;
  border: 1px solid rgba(151, 193, 225, 0.72) !important;
  box-shadow:
    0 5px 14px rgba(8, 26, 54, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

/* Main cards: subtle depth while staying predominantly white */
.card,
.modal-card,
.onboard-card {
  background: linear-gradient(
    150deg,
    #FFFFFF 0%,
    #FBFDFF 58%,
    #F1F8FE 100%
  );
  box-shadow: 0 7px 18px rgba(8, 26, 54, 0.08);
}

/* Inner budget sections get a gentle blue gradient instead of flat fill */
.income-wrapper,
.category-card,
.summary-item {
  background: linear-gradient(
    145deg,
    #F7FBFF 0%,
    #E7F3FD 100%
  ) !important;
  border-color: #C3DAEC !important;
}

/* Month cards: visible gradient even before selection */
.month-card {
  background: linear-gradient(
    145deg,
    #FFFFFF 0%,
    #EEF7FF 44%,
    #D7ECFC 100%
  ) !important;
  border-color: #B8D3E8 !important;
  box-shadow:
    0 4px 10px rgba(8, 26, 54, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.month-card:not(.active):active {
  background: linear-gradient(
    145deg,
    #EEF7FF 0%,
    #D4EAFB 100%
  ) !important;
}

.month-card.active {
  background: linear-gradient(
    135deg,
    #10A6ED 0%,
    #128BD7 46%,
    #0879BB 100%
  ) !important;
  border-color: #0879BB !important;
  box-shadow:
    0 7px 16px rgba(18, 139, 215, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24) !important;
}

/* Primary actions: richer gradient + lift */
.btn:not(.secondary):not(.danger):not(.category-add),
.subscription-primary-btn,
.whatif-share-btn,
.amb-analyze-btn,
.retirement-calculate-btn {
  background: linear-gradient(
    135deg,
    #19B1F1 0%,
    #128BD7 50%,
    #0879BB 100%
  ) !important;
  box-shadow: 0 5px 12px rgba(18, 139, 215, 0.22);
}

.btn:not(.secondary):not(.danger):not(.category-add):active,
.subscription-primary-btn:active,
.whatif-share-btn:active,
.amb-analyze-btn:active,
.retirement-calculate-btn:active {
  box-shadow: 0 2px 7px rgba(18, 139, 215, 0.18);
}

/* Secondary buttons stay calm but are no longer visually flat */
.btn.secondary,
.subscription-secondary-btn,
.whatif-back-btn {
  background: linear-gradient(145deg, #FFFFFF 0%, #EDF6FF 100%) !important;
}

/* What-If: key result surfaces get light, energetic depth */
.whatif-summary-card {
  background: linear-gradient(
    145deg,
    #FFFFFF 0%,
    #EEF7FF 100%
  ) !important;
  box-shadow: 0 6px 15px rgba(8, 26, 54, 0.08) !important;
}

.whatif-sticky-remaining {
  background: linear-gradient(
    135deg,
    #EAF7FF 0%,
    #D2ECFC 50%,
    #BFE3F9 100%
  ) !important;
  border-color: #9CCCE9 !important;
  box-shadow: 0 8px 18px rgba(8, 26, 54, 0.10) !important;
}

.whatif-results-card {
  background: linear-gradient(
    145deg,
    #FFFFFF 0%,
    #F2F9FF 52%,
    #E3F2FC 100%
  ) !important;
  border-color: #B9D6EA !important;
}

/* AMB selector and results: dimensional but still easy to read */
.amb-tool-option {
  background: linear-gradient(
    145deg,
    #FFFFFF 0%,
    #F3F9FF 100%
  ) !important;
}

.amb-tool-option.active {
  background: linear-gradient(
    145deg,
    #F2FAFF 0%,
    #DDEFFC 100%
  ) !important;
  box-shadow: 0 5px 13px rgba(18, 139, 215, 0.12);
}

.amb-result-card,
.amb-recommendation-card {
  background: linear-gradient(
    150deg,
    #FFFFFF 0%,
    #F5FAFF 52%,
    #EAF5FD 100%
  ) !important;
  border-color: #C2D9EB !important;
  box-shadow: 0 7px 17px rgba(8, 26, 54, 0.08) !important;
}

/* Retirement highlight remains vibrant, but now uses the site-family blues */
.retirement-number-main-card {
  background: linear-gradient(
    135deg,
    #0C75B7 0%,
    #128BD7 48%,
    #32B6F3 100%
  ) !important;
  box-shadow: 0 10px 24px rgba(18, 139, 215, 0.22) !important;
}

.retirement-question-card,
.retirement-result-card {
  background: linear-gradient(
    145deg,
    #FFFFFF 0%,
    #EEF7FF 100%
  ) !important;
}

/* Savings: turn the existing color themes into soft gradients */
.savings-theme-1 {
  background: linear-gradient(145deg, #F8FBFF 0%, #DDEBFF 100%) !important;
  border-left-color: #3B82F6 !important;
}

.savings-theme-2 {
  background: linear-gradient(145deg, #FFFDF7 0%, #FDE9B6 100%) !important;
  border-left-color: #F59E0B !important;
}

.savings-theme-3 {
  background: linear-gradient(145deg, #F8FFFC 0%, #D7F6E8 100%) !important;
  border-left-color: #10B981 !important;
}

.savings-theme-4 {
  background: linear-gradient(145deg, #FFF9FC 0%, #F8DEEB 100%) !important;
  border-left-color: #EC4899 !important;
}

.savings-theme-5 {
  background: linear-gradient(145deg, #FCF9FF 0%, #E9DAFB 100%) !important;
  border-left-color: #A855F7 !important;
}

.savings-goal-card {
  box-shadow: 0 8px 18px rgba(8, 26, 54, 0.09) !important;
}

/* Subscription wall: light, premium gradient depth */
.subscription-wall {
  background: linear-gradient(
    180deg,
    #CFE5F7 0%,
    #E7F3FD 48%,
    #F7FBFF 100%
  ) !important;
}

.subscription-card {
  background: linear-gradient(
    150deg,
    #FFFFFF 0%,
    #FBFDFF 52%,
    #ECF6FE 100%
  ) !important;
  box-shadow: 0 16px 34px rgba(8, 26, 54, 0.14) !important;
}

.subscription-offer {
  background: linear-gradient(
    135deg,
    #F3FAFF 0%,
    #DDF0FD 55%,
    #CBE8FA 100%
  ) !important;
  border-color: #AED3EA !important;
}

/* Bottom navigation: subtle fade instead of a flat strip */
.bottom-tabs,
.bottom-tab-bar {
  background: linear-gradient(
    180deg,
    #FFFFFF 0%,
    #F4F9FD 100%
  ) !important;
  box-shadow: 0 -4px 16px rgba(8, 26, 54, 0.06);
}

/* =========================
   CENTER CONFIRMATION MODALS
========================= */

#modalOverlay.modal-overlay {
  align-items: center;
  padding-top: 0;
}

