:root {
  --bg: #06080f;
  --panel: rgba(14, 18, 30, 0.72);
  --panel-strong: rgba(22, 27, 41, 0.9);
  --accent: #7f5af0;
  --accent-2: #3dd6c4;
  --text: #f4f6fb;
  --muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

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

/* The `hidden` attribute must always win. Plenty of rules here set `display` on
   elements that can also be hidden (.modal, .menu-panel, .form label,
   .ends-group), and a bare [hidden] ties with them on specificity and loses on
   source order — so hidden elements kept rendering. This was previously patched
   one selector at a time; those patches are now redundant. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Inter", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.modal-open {
  overflow: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(127, 90, 240, 0.14), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(61, 214, 196, 0.16), transparent 28%),
    radial-gradient(circle at 50% 90%, rgba(255, 255, 255, 0.08), transparent 30%);
  filter: blur(10px);
  z-index: -1;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 72px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(120deg, rgba(127, 90, 240, 0.18), rgba(61, 214, 196, 0.16));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-2);
  display: inline-block;
}

.menu-panel .user-chip {
  width: 100%;
  margin-bottom: 8px;
  justify-content: flex-start;
}

.top-bar h1 {
  margin: 4px 0;
  font-size: 32px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 4px;
}

.top-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.top-row,
.bottom-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.util-row {
  display: flex;
  justify-content: flex-end;
  grid-template-columns: none;
  gap: 8px;
}

.configurable-grid {
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.grid-help {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.grid-6x5 {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.top-grid-cell {
  min-height: 64px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  padding: 8px;
}

.top-grid-cell.selected {
  border-color: rgba(100, 149, 237, 0.8);
  box-shadow: 0 0 10px rgba(100, 149, 237, 0.25);
}

.top-grid-cell:hover {
  border-color: var(--accent);
}

/* Drop refused because it would have wiped a row's computed total (#5). */
.top-grid-cell.drop-rejected {
  border-style: solid;
  border-color: rgba(229, 62, 62, 0.9);
  box-shadow: 0 0 10px rgba(229, 62, 62, 0.35);
}

.top-grid-cell[draggable="true"] {
  cursor: grab;
}

.top-grid-cell[draggable="true"]:active {
  cursor: grabbing;
}

.top-grid-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  max-width: 100%;
  justify-content: center;
  flex-wrap: nowrap;
  line-height: 1.2;
}

.top-grid-pill .label {
  color: var(--text);
  font-size: inherit;
  white-space: nowrap;
  flex: 0 1 auto;
  max-width: 100%;
}

.top-grid-pill .value {
  color: var(--accent-2);
  font-size: inherit;
  white-space: nowrap;
  flex: 0 1 auto;
  max-width: 100%;
}

.top-grid-pill.group-pill .label,
.top-grid-pill.group-pill .value {
  color: #ef4444;
}

.top-grid-pill.credit.group-pill .label,
.top-grid-pill.credit.group-pill .value {
  color: var(--accent-2);
}

.top-grid-pill.credit .label,
.top-grid-pill.credit .value {
  color: var(--accent-2);
}

.top-grid-pill.debit .label,
.top-grid-pill.debit .value {
  color: #ef4444;
}

.label.credit {
  color: var(--accent-2);
}

.label.debit {
  color: #ef4444;
}

.value.credit {
  color: var(--accent-2);
}

.value.debit {
  color: #ef4444;
}

.result-pill {
  justify-content: center;
  gap: 4px;
}

.top-grid-op {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 1px solid rgba(100, 149, 237, 0.6); /* thin blue outline */
  border-radius: 12px;
  box-shadow: 0 0 8px rgba(100, 149, 237, 0.25);
}

.op-symbol {
  font-size: 34px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  display: inline-block;
  transform: translateY(1px);
}

.op-symbol.op-asterisk {
  transform: translateY(0);
}

.op-symbol.op-slash {
  font-size: 28px;
  transform: translateY(2px);
}

.add-btn {
  width: 100%;
  height: 100%;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  border: none;
  cursor: pointer;
}

.add-btn:hover {
  color: var(--accent);
}

.top-grid-tooltip {
  position: fixed;
  z-index: 50;
  background: rgba(18, 20, 32, 0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: var(--shadow);
  min-width: 220px;
  max-width: 320px;
  max-height: 260px;
  overflow: auto;
}

.top-grid-tooltip h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.top-grid-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}

.top-grid-tooltip .tooltip-row .name {
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-grid-tooltip .tooltip-row .amt {
  color: var(--accent-2);
  flex: 0 0 auto;
  white-space: nowrap;
}

/* #26: "Ends" offers never / after N payments / on a date. */
.ends-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.ends-legend {
  font-size: 14px;
  color: var(--muted);
}

.ends-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.ends-option label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.ends-option input[type="number"] {
  width: 72px;
}

.ends-option input:disabled {
  opacity: 0.45;
}

/* #26: shows the date a payment count works out to. */
.field-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* #81: a bill outlives its name at the bank, so the pairing is a list. Newest
   first — the name it goes by now sits at the top, older ones below it. */
.match-name-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-name-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  font-size: 13px;
}

.match-name-list .match-name-label {
  flex: 1;
  /* A bank description can be long; wrap rather than stretch the dialog. */
  overflow-wrap: anywhere;
}

.match-name-list .match-name-detail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* #81: the Bank charge field accepts a stem too short to ever pair. Same shape
   as .field-hint, in the colour the SimpleFIN errors already use, so it reads as
   a problem rather than as more advice. */
.field-warn {
  display: block;
  margin-top: 4px;
  color: #ffb4a9;
  font-size: 12px;
  line-height: 1.4;
}

/* #37: summed totals for a multi-day selection. Hidden until days are picked. */
.selection-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(127, 90, 240, 0.12);
}

.selection-count {
  color: var(--muted);
  font-size: 13px;
}

.selection-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  flex: 1 1 auto;
}

.selection-figure {
  display: inline-flex;
  gap: 6px;
  font-size: 13px;
}

.selection-figure .name {
  color: var(--muted);
}

.selection-figure .amt.credit {
  color: var(--accent-2);
}

.selection-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding-right: 18px;
}

.selection-group + .selection-group {
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

.selection-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.selection-figure .amt.debit {
  color: #ef4444;
}

/* A selected day reads as picked without competing with the pills inside it. */
.day.selected {
  background: rgba(127, 90, 240, 0.16);
  box-shadow: inset 0 0 0 2px rgba(127, 90, 240, 0.75);
}

/* The mode has to be obvious, or it looks like clicking a day is broken. */
#selectDaysToggle.active {
  border-color: rgba(127, 90, 240, 0.9);
  background: rgba(127, 90, 240, 0.22);
  color: var(--text);
}

/* On means bank activity is drawn; slate, matching the pills it shows. */
#transactionsToggle.active {
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
}

.calendar-grid.selecting .day {
  cursor: copy;
}

.calendar-grid.selecting .day:hover {
  background: rgba(127, 90, 240, 0.08);
}

/* #40: the day tooltip signs its rows, so tone them to match the sign. */
.top-grid-tooltip .tooltip-row .amt.credit {
  color: var(--accent-2);
}

.top-grid-tooltip .tooltip-row .amt.debit {
  color: #ef4444;
}

.menu-wrap {
  position: relative;
}

.hamburger {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.menu-panel {
  position: absolute;
  top: 48px;
  right: 0;
  min-width: 180px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 30;
}

.menu-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.bottom-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.top-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.top-group.center {
  flex: 1 1 0;
  justify-content: flex-start;
}

.top-group.left {
  justify-content: flex-start;
  flex: 0 1 auto;
}

.top-group.right {
  margin-left: auto;
  justify-content: flex-start;
  flex: 0 1 auto;
}

.pill.stat {
  padding: 12px;
  background: var(--panel);
  border-radius: 999px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 170px;
  min-height: 74px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  cursor: default;
}

#unpaidPill,
#utilitiesPill,
#subscriptionsPill {
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#unpaidPill:hover,
#utilitiesPill:hover,
#subscriptionsPill:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.balance-pill {
  cursor: pointer;
}

.op-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-weight: 800;
  color: #f4f6fb;
  font-size: 18px;
  min-width: 24px;
  min-height: 24px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pill .label {
  color: var(--muted);
  font-size: 12px;
}

.stat-input {
  min-width: 140px;
  flex: 0 1 160px;
}

.stat-input input {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 12px;
  box-sizing: border-box;
  width: 100%;
}

.pill .value {
  font-size: 20px;
  font-weight: 600;
}

.pill-green .label,
.pill-green .value {
  color: #22c55e;
}

.pill-red .label,
.pill-red .value {
  color: #ef4444;
}

.subscription-pill-header .label,
.subscription-pill-header .value {
  color: #60a5fa;
}

#utilitiesPill .label,
#utilitiesPill .value {
  color: #fb923c;
}

#subscriptionsPill {
  cursor: pointer;
}

#utilitiesPill {
  cursor: pointer;
}

.layout {
  display: block;
  width: 100%;
  margin-top: 24px;
}

.balances-panel {
  margin-top: 16px;
}

.inline-card {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.balances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.balances-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.balances-grid input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14px;
}

.calendar-panel {
  background: var(--panel-strong);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-label {
  font-size: 22px;
  font-weight: 600;
}

.month-sub {
  color: var(--muted);
  font-size: 13px;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
  justify-content: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.due {
  background: #ef4444;
}

.dot.paid {
  background: var(--accent-2);
}

.dot.recurring {
  background: #ffb86c;
}

.dot.credit {
  background: #22c55e;
}

.legend-pill {
  display: inline-block;
  min-width: 18px;
  min-height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1;
  text-align: center;
}

.legend-pill.paid-pill {
  background: var(--accent-2);
  border-color: rgba(61, 214, 196, 0.6);
}

.legend-pill.recurring-pill {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.12);
}

.legend-pill.subscription-pill {
  border-color: rgba(96, 165, 250, 0.6);
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
}

.legend-pill.utility-pill {
  border-color: rgba(251, 146, 60, 0.6);
  color: #fb923c;
  background: rgba(251, 146, 60, 0.12);
}

.legend-pill.auto-withdraw-pill {
  border-color: rgba(168, 85, 247, 0.6);
  color: #c084fc;
  background: rgba(168, 85, 247, 0.12);
  position: relative;
  z-index: 0;
}

.legend-pill.auto-withdraw-pill::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.35), 0 0 14px 5px rgba(168, 85, 247, 0.35);
}
.tag-list-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag-list-item .meta {
  display: flex;
  flex-direction: column;
}

.calendar {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 10px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 140px;
}

.day {
  height: 140px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0));
  overflow-y: auto;
}

.day:nth-child(7n) {
  border-right: none;
}

.day .date {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

/* The other half of a pairing: a charge and its bill, or the two sides of a
   card payment. Outlined on hover, flashed when jumped to. */
.counterpart {
  outline: 3px solid #ff2d95;
  outline-offset: 2px;
  box-shadow: 0 0 12px 2px rgba(255, 45, 149, 0.6);
}

.counterpart-flash {
  animation: counterpart-flash 1.6s ease-out;
}

@keyframes counterpart-flash {
  0%, 50% {
    outline: 3px solid #ff2d95;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(255, 45, 149, 0.45), 0 0 18px 4px rgba(255, 45, 149, 0.7);
  }
  100% {
    outline: 3px solid transparent;
    box-shadow: 0 0 0 6px transparent;
  }
}

.txn-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 4px 0 14px;
}

.txn-verdict-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.txn-verdict-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.confirm-body .dialog-input.txn-verdict-pct {
  width: 72px;
  margin-top: 0;
  padding: 4px 8px;
}

.day-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-total-label {
  color: #64748b;
  font-weight: 500;
  margin-right: 5px;
}

.day-total-bills .day-total-amount {
  color: #f87171;
}

.day-total-income .day-total-amount {
  color: #3dd6c4;
}

.day-total-bank .day-total-amount {
  color: #94a3b8;
}

.day .today {
  padding: 4px 8px;
  background: rgba(61, 214, 196, 0.16);
  border-radius: 999px;
  border: 1px solid rgba(61, 214, 196, 0.4);
}

/* #33: a busy day used to scroll inside its 140px cell. autoFitCalendarPills
   measures the stack and sets --pill-scale so the font, padding and gap shrink
   together until every pill is visible. Unset (or 1) is the normal full size. */
.entries {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--pill-scale, 1));
  align-items: stretch;
}

.bill-pill {
  padding: calc(4px * var(--pill-scale, 1)) calc(6px * var(--pill-scale, 1));
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(127, 90, 240, 0.12);
  position: relative;
  z-index: 0;
  font-size: calc(11px * var(--pill-scale, 1));
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
}

.bill-pill.recurring {
  background: rgba(255, 184, 108, 0.12);
}

.bill-pill.paid {
  background: rgba(61, 214, 196, 0.16);
  border-color: rgba(61, 214, 196, 0.4);
}

.bill-pill.credit {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.bill-pill.recurring-border {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.bill-pill.auto-withdraw {
  /* Keep existing borders; add a separate glow via ::after */
}

.bill-pill.auto-withdraw::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  pointer-events: none;
  z-index: -1;
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.35), 0 0 14px 5px rgba(168, 85, 247, 0.35);
}

.bill-pill .label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.pill-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0;
}

.bill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  margin-right: 0;
}

.subscription-text {
  color: #60a5fa;
}

.utilities-text {
  color: #fb923c;
}

.pill-amount {
  font-weight: 600;
  color: #dbeafe;
  flex-shrink: 0;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #ef4444;
  flex-shrink: 0;
}

.pill-dot.paid {
  background: var(--accent-2);
}

.pill-dot.credit {
  background: #22c55e;
}

.pill-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.pill-check {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: #c7f1e1;
  border-radius: 8px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}

.pill-check.is-paid {
  background: rgba(61, 214, 196, 0.2);
  border-color: rgba(61, 214, 196, 0.6);
  color: #0f172a;
}

.badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

/* Bank activity on the calendar: what actually moved, beside what was planned.
   Slate with a dashed edge so it never reads as a bill, and quieter than the
   bills because it is a record rather than something to act on. */
.txn-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: calc(3px * var(--pill-scale, 1)) calc(6px * var(--pill-scale, 1));
  border-radius: 8px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  font: inherit;
  font-size: calc(10.5px * var(--pill-scale, 1));
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.txn-pill:hover,
.txn-pill:focus-visible {
  border-color: rgba(148, 163, 184, 0.7);
}

.txn-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-amount {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.txn-in .txn-amount {
  color: #5eead4;
}

/* A card payment moves money between two of your own accounts; it is not
   spending, so it recedes further. */
.txn-transfer {
  opacity: 0.6;
}

.txn-pending {
  opacity: 0.55;
  font-style: italic;
}

/* Paired with a bill: named for the bill, in the colour of the $ it shows. */
/* Dealt with: judged, paired or marked not a bill. Solid where the rest are
   dashed, so what still needs a look stands out. */
.txn-pill.txn-worked {
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(148, 163, 184, 0.14);
}

.txn-verdict-mark {
  flex: none;
  width: calc(7px * var(--pill-scale, 1));
  height: calc(7px * var(--pill-scale, 1));
  border-radius: 50%;
  background: conic-gradient(#3dd6c4 0 var(--essential), #f5b84a var(--essential) 100%);
}

.txn-paid-bill .txn-name {
  color: #5eead4;
}

.txn-more {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 0 2px;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.txn-day-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  --pill-scale: 1.25;
}

/* On a bill: the bank charge that paid it was found. Amber when the amount
   differs from what the calendar expects. */
.pill-bank {
  flex-shrink: 0;
  border: 0;
  padding: 0;
  cursor: pointer;
  margin-left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  background: rgba(94, 234, 212, 0.18);
  color: #5eead4;
}

.pill-bank.differs {
  background: rgba(255, 207, 138, 0.2);
  color: #ffcf8a;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#futureConfirmModal {
  z-index: 9998;
  pointer-events: none;
}

#futureConfirmModal .modal-backdrop {
  z-index: 9998;
  pointer-events: auto;
}

#futureConfirmModal .modal-card {
  z-index: 9999;
  pointer-events: auto;
}

.future-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.future-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.future-confirm-card {
  position: relative;
  z-index: 10001;
  /* Wider than the old 480px: an account row carries a name, a balance, a
     dropdown and a checkbox, and 480 crushed them into an unusable column. */
  max-width: 640px;
  width: 92%;
  /* Bounded, so a long list cannot grow past the viewport. The overlay centres
     the card, so an unbounded one overflowed off both the top and the bottom of
     the screen at once — the rows beyond the fold were unreachable, with nothing
     to scroll. */
  max-height: 88vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  padding: 0 0 16px;
  /* The header and footer stay put; only .confirm-body scrolls. */
  overflow: hidden;
}

/* The card itself has no side padding, so the scrollbar on .confirm-body sits
   at the card's edge; the header and footer take the same 16px inset as the
   body instead, or the title, Close and the footer buttons touch the border. */
.future-confirm-card > .card-header {
  padding: 16px 16px 0;
}

.future-confirm-card > .form-actions {
  padding: 0 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  max-width: 460px;
  width: 92%;
  z-index: 11;
  box-shadow: var(--shadow);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.confirm-body {
  padding: 0 16px 12px;
  color: var(--text);
  line-height: 1.5;
  /* The scrolling region. `min-height: 0` is required: a flex child defaults to
     min-height auto, which refuses to shrink below its content and so never
     overflows — the scrollbar simply never appears. */
  overflow-y: auto;
  min-height: 0;
}

.modal-card .form {
  overflow-y: auto;
  max-height: 72vh;
  padding-right: 4px;
}

.auth-banner {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.auth-card {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 280px;
}

/* #4: the text field in the dialog that replaced prompt(). */
.confirm-body .dialog-input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
}

/* The native arrow ignores padding and sits against the right border, so the
   dialog's selects draw their own, inset to match the text on the left. */
.confirm-body select.dialog-input {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23f4f6fb' stroke-opacity='.7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* #4: in-app messages replacing alert(). Above modals and the auth banner,
   because several fire while the screen behind them is being replaced. */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.55);
}

.toast.success {
  border-color: rgba(61, 214, 196, 0.55);
}

.toast .toast-message {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast .toast-close {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.toast .toast-close:hover {
  color: var(--text);
}

/* #10: the only place the app pitches itself — the first screen anyone sees.
   The line carries the product name, so there is no separate heading. */
.auth-tagline {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tab {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #0c0c11;
  font-weight: 600;
}

.form-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.form-inline input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-stack input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.muted {
  color: rgba(255, 255, 255, 0.7);
}

.pay-picker {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin-top: 8px;
}

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

.pay-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.pay-day {
  padding: 8px;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
}

.pay-day:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pay-day.selected {
  border-color: var(--accent);
  background: rgba(127, 90, 240, 0.16);
}

.pay-day.today {
  border-color: var(--accent-2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

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

.edit-status {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--muted);
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.form label.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form input,
.form select,
.form textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14px;
}

.form input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
}

.form textarea {
  resize: vertical;
}

.modal-card .list {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
}

.tag-list {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
}

.tag-row {
  display: flex;
  gap: 8px;
}

.tag-row select {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(120deg, #7f5af0, #3dd6c4);
  border: none;
  color: #0c0f17;
  box-shadow: 0 8px 24px rgba(127, 90, 240, 0.25);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fecdd3;
}

.btn.small {
  padding: 8px 10px;
  font-size: 13px;
}

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

.list-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.list-item .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-item .meta small {
  color: var(--muted);
}

.list-item button {
  min-width: 90px;
}

@media (max-width: 960px) {
  .top-bar {
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* SimpleFIN bank connections (#1). Rendered inside the shared dialog overlay,
   so these only style the panel's own contents. */
.simplefin-panel .form-actions {
  margin-top: 14px;
}

.simplefin-error {
  color: #ffb4a9;
  margin: 6px 0 0;
  font-size: 13px;
  /* Bank error text arrives from the institution and can be long; wrap rather
     than stretch the dialog. */
  overflow-wrap: anywhere;
}

.simplefin-accounts {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.simplefin-accounts li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.simplefin-account-name {
  /* Institution and account names are third-party text of unpredictable length;
     let the name shrink so the balance stays readable. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.simplefin-account-balance {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

/* The bank's own balance-date, under the figure it describes. Full-width basis
   so it takes its own line in the wrapping row rather than competing with the
   balance for space. */
.simplefin-account-asof {
  flex: 0 0 100%;
  text-align: right;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

/* Sync status, pinned in the footer beside Refresh. `margin-right: auto` keeps
   the buttons hard right while the text sits left; wrapping lets a long
   institution error drop to its own line instead of squeezing them. */
.simplefin-footer {
  flex-wrap: wrap;
  align-items: center;
}

.simplefin-status {
  margin-right: auto;
  flex: 1 1 200px;
  min-width: 0;
  text-align: left;
}

.simplefin-status p {
  margin: 0;
  font-size: 12px;
}

.spending-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.spending-row-name {
  flex: 1;
  min-width: 0;
  /* Bank-supplied names are unpredictable in length; let them wrap rather than
     push the amount and control off the row. */
  overflow-wrap: anywhere;
}

.spending-row-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

/* Account -> dashboard balance picker in the bank connections dialog. */
.simplefin-link-select {
  width: auto;
  max-width: 42%;
  margin-top: 0;
  padding: 4px 6px;
  font-size: 12px;
}

/* Per-account "show on calendar" opt-in, in the bank connections dialog. */
.simplefin-track {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.75);
}

.simplefin-track input {
  margin: 0;
}

/* Account rows carry four things; let them wrap rather than crush on narrow
   screens or with long institution names. */
.simplefin-accounts li {
  flex-wrap: wrap;
}

.simplefin-account-name {
  flex: 1 1 55%;
}

.spending-row-detail {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  overflow-wrap: anywhere;
}

/* A tile with no account behind it. Amber, not red: the figure may be one the
   user typed and still wants — it just is not being kept current. */
.spending-row-detail.spending-row-stale {
  color: #ffcf8a;
}

