.tracker-grid {
  grid-template-areas:
    "fixed income"
    "variable savings"
    "variable checking"
    "variable summary";
}

.checking-card {
  grid-area: checking;
  --accent: #58d7ff;
  min-height: 190px;
}

.checking-color {
  color: #7fddff;
}

.checking-balance-editor {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(113, 201, 255, 0.15);
  border-radius: 14px;
  background: rgba(2, 9, 17, 0.3);
}

.checking-balance-editor > label {
  color: #d9efff;
  font-size: 0.9rem;
  font-weight: 750;
}

.checking-balance-input-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.checking-balance-input-wrap > span {
  color: #7fddff;
  font-size: 1.2rem;
  font-weight: 800;
}

#checkingBalanceInput {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid rgba(113, 201, 255, 0.22);
  border-radius: 11px;
  color: #7fddff;
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

#checkingBalanceInput:focus-visible {
  border-color: rgba(113, 201, 255, 0.75);
  outline: 2px solid rgba(113, 201, 255, 0.22);
  outline-offset: 2px;
}

.checking-balance-editor > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.budget-help-link {
  justify-self: center;
  margin: 11px auto 0;
  padding: 3px 4px;
  border: 0;
  color: #8fdbff;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(143, 219, 255, 0.38);
  text-underline-offset: 4px;
}

.budget-help-link:hover,
.budget-help-link:focus-visible {
  color: #dff6ff;
  text-decoration-color: currentColor;
}

.budget-help-dialog {
  width: min(92vw, 470px);
  gap: 14px;
  border-color: rgba(113, 201, 255, 0.3);
  background:
    radial-gradient(circle at 12% 5%, rgba(113, 201, 255, 0.1), transparent 35%),
    linear-gradient(160deg, #15283d, #0d1a2a);
}

.budget-help-calculation {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(113, 201, 255, 0.14);
  border-radius: 12px;
  background: rgba(2, 9, 17, 0.34);
}

.budget-help-calculation > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-soft);
  color: #cbd9e7;
  font-size: 0.86rem;
}

.budget-help-calculation > div:last-child {
  border-bottom: 0;
}

.budget-help-calculation .is-total {
  color: #eaf8ff;
  background: rgba(113, 201, 255, 0.07);
  font-weight: 800;
}

.budget-help-note {
  padding: 10px 12px;
  border-radius: 10px;
  color: #aebfce;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.8rem;
  line-height: 1.55;
}

.quick-add-dialog {
  width: min(92vw, 460px);
  gap: 16px;
  padding: 24px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 0%, rgba(69, 241, 162, 0.09), transparent 34%),
    linear-gradient(160deg, #15283d, #0d1a2a);
}

.quick-add-current-amount {
  color: #ff929c !important;
  font-size: 1.2rem !important;
  font-weight: 850 !important;
  font-variant-numeric: tabular-nums;
}

.quick-add-subcategory {
  appearance: auto;
  cursor: pointer;
}

.quick-add-confirm {
  width: 100%;
  min-height: 48px;
}

.quick-add-message {
  min-height: 22px;
  margin: 0;
  color: #ff929c;
  font-size: 0.84rem;
  font-weight: 750;
  text-align: right;
}

.quick-add-message.is-success {
  color: var(--green);
}

.existing-category-dialog {
  width: min(92vw, 440px);
  gap: 15px;
  padding: 24px;
  border-color: rgba(113, 201, 255, 0.3);
  border-radius: 20px;
  background:
    radial-gradient(circle at 88% 5%, rgba(113, 201, 255, 0.1), transparent 36%),
    linear-gradient(160deg, #15283d, #0d1a2a);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.58);
}

.existing-category-dialog h3 {
  color: #e8f7ff;
  font-size: 1.12rem;
}

.existing-category-dialog > p:not(.amount-adjustment-message) {
  margin: 0;
  color: #c5d5e4;
  font-size: 0.92rem;
  line-height: 1.6;
}

.existing-category-actions {
  gap: 9px;
}

.is-money-rolling {
  animation: money-counter-pulse 240ms ease-in-out infinite alternate;
  font-variant-numeric: tabular-nums;
}

.amount-history-row {
  grid-template-columns:
    minmax(72px, 0.8fr) minmax(112px, 1.05fr)
    58px 84px 34px;
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
}

.amount-history-row-delete {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 116, 127, 0.3);
  border-radius: 8px;
  color: #ff929c;
  background: rgba(255, 116, 127, 0.08);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
}

.amount-history-row-delete:hover,
.amount-history-row-delete:focus-visible {
  border-color: rgba(255, 116, 127, 0.72);
  color: #fff;
  background: rgba(255, 116, 127, 0.2);
}

.read-only-month-notice {
  color: #ffd28b;
  font-size: 0.8rem;
  font-weight: 800;
}

.is-static-row {
  cursor: default !important;
}

.is-static-row input,
.is-protected-row input {
  color: inherit;
  opacity: 0.78;
  cursor: default;
}

.is-protected-row {
  border-color: rgba(255, 210, 139, 0.16) !important;
  background: rgba(255, 210, 139, 0.025) !important;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
}

@media (min-width: 641px) {
  .budget-cell .amount-editor {
    transform: translateX(-10px);
  }
}

@media (max-width: 1000px) {
  .tracker-grid {
    grid-template-areas:
      "income"
      "fixed"
      "variable"
      "savings"
      "checking"
      "summary";
  }
}

@media (max-width: 640px) {
  .checking-card {
    min-height: 0;
  }

  .mobile-accordion-ready .checking-card.is-mobile-open {
    display: flex;
    flex-direction: column;
  }

  .mobile-accordion-ready .checking-card:not(.is-mobile-open)
    > :not(.card-heading) {
    display: none;
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr:not(.is-mobile-row-open) {
    position: relative;
    padding-right: 60px;
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr:not(.is-mobile-row-open)
    .variable-tools-cell {
    position: absolute;
    top: 50%;
    right: 10px;
    left: auto;
    display: grid !important;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    transform: translateY(-50%);
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr:not(.is-mobile-row-open)
    .variable-row-tools {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr:not(.is-mobile-row-open)
    .variable-details-toggle {
    display: grid !important;
    width: 40px;
    height: 40px;
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr:not(.is-mobile-row-open)
    .undo-btn {
    display: none !important;
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr.is-mobile-row-open
    .variable-tools-cell {
    right: 14px;
    left: auto;
    width: 88px;
  }

  .mobile-row-editing-ready
    :is(.income-card, .fixed-card, .variable-card, .savings-card)
    tbody
    tr.is-mobile-row-open
    .variable-row-tools {
    flex-direction: row-reverse;
  }

  .amount-history-row {
    grid-template-columns:
      minmax(64px, 0.85fr) minmax(96px, 1fr)
      52px 66px 30px;
    gap: 4px;
    padding: 5px 6px;
    font-size: 0.72rem;
  }

  .amount-history-row-delete {
    width: 27px;
    height: 27px;
  }

  .budget-help-link {
    min-height: 38px;
    margin-top: 7px;
  }
}

@keyframes money-counter-pulse {
  from {
    filter: brightness(0.9);
    transform: translateY(1px);
  }
  to {
    filter: brightness(1.25);
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-money-rolling {
    animation: none;
  }
}
