:root {
  --ink: #1c2a2e;
  --ink-soft: #3d4f55;
  --mist: #e8f0f1;
  --paper: #f7faf9;
  --sea: #2f6f6a;
  --sea-deep: #1e4a47;
  --foam: #a8d4cf;
  --sand: #d4c4a8;
  --coral: #c45c48;
  --paid: #2f6f6a;
  --due: #b8860b;
  --missed: #c45c48;
  --future: #8a9a9e;
  --zeroed: #7a8f8c;
  --line: rgba(28, 42, 46, 0.12);
  --shadow: 0 18px 40px rgba(30, 74, 71, 0.08);
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", sans-serif;
  --font-size-header: 1.45rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(168, 212, 207, 0.55), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(212, 196, 168, 0.4), transparent 50%),
    linear-gradient(165deg, #f3f8f7 0%, var(--paper) 45%, #eef4f3 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

/* Entrance motion */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.top-bar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  animation: rise 0.5s ease both;
}

.top-bar .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: var(--font-size-header);
  color: var(--sea-deep);
  margin: 0;
}

.top-bar .brand-mark {
  width: 1.75em;
  height: 1.75em;
  /* object-fit: cover; */
  transform: rotate(5deg);
  transition: transform 0.3s ease-in-out;
  flex-shrink: 0;
}

.top-bar .brand-mark:hover {
  transform: rotate(-10deg);
}

.brand-block {
  animation: rise 0.7s ease both;
  margin-bottom: 1.75rem;
}

.brand-block .brand {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--sea-deep);
  margin: 0;
}

.brand-rule {
  display: block;
  width: 4.5rem;
  height: 3px;
  margin: 0.9rem 0 1rem;
  background: linear-gradient(90deg, var(--sea), var(--sand));
  transform-origin: left;
  animation: draw 0.8s 0.25s ease both;
  border-radius: 2px;
}

.tagline {
  margin: 0;
  max-width: 28rem;
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--ink-soft);
}

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 1px;
  border-color: var(--sea);
  background: #fff;
}

.inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}

@media (max-width: 820px) {
  .inputs { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .inputs { grid-template-columns: 1fr; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

input[type="number"],
input[type="date"],
input[type="month"],
select {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

input:focus,
select:focus {
  border-color: var(--sea);
  background: #fff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

button,
.btn-primary,
.btn-ghost {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.2s, opacity 0.2s;
}

button:active,
.btn-primary:active,
.btn-ghost:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--sea);
  color: #fff;
}

.btn-primary:hover { background: var(--sea-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

.hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.dashboard {
  display: none;
  animation: rise 0.55s ease both;
}

.dashboard.visible { display: block; }

.payoff-accelerator {
  margin: 1rem 1.25rem 0;
  padding: 1.15rem 1.3rem 1.2rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 14px 32px rgba(30, 74, 71, 0.08);
}

.payoff-accelerator > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.payoff-accelerator .badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sea);
}

.payoff-accelerator .val {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  font-weight: 400;
  color: var(--sea-deep);
  text-align: right;
}

.payoff-accelerator .val strong {
  font-weight: 700;
}

.payoff-accelerator .bar {
  height: 8px;
  border-radius: 4px;
  background: var(--mist);
  display: flex;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.payoff-accelerator .fill {
  height: 100%;
  background: var(--sea);
}

.payoff-accelerator .extra {
  height: 100%;
  background: var(--sand);
}

.payoff-accelerator .stats {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.payoff-accelerator .stats div {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.payoff-accelerator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.payoff-accelerator .dot.paid { background: var(--sea); }
.payoff-accelerator .dot.extra { background: var(--sand); }
.payoff-accelerator .dot.due { background: var(--due); }
.payoff-accelerator .dot.interest { background: var(--sea-deep); }

@media (max-width: 520px) {
  .payoff-accelerator > header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .payoff-accelerator .val {
    text-align: left;
  }

  .payoff-accelerator .stats {
    flex-direction: column;
    gap: 0.45rem;
  }
}

.year-strip {
  display: grid;
  grid-template-columns: 1.5fr 1.3fr repeat(2, 1fr);
  gap: 0.85rem;
  padding: 1.1rem 1.25rem 1.25rem;
}

@media (max-width: 900px) {
  .year-strip { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .year-strip { grid-template-columns: 1fr; }
}

.stat {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
}

.stat.quiet .value {
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 500;
  color: var(--ink-soft);
}

.stat.highlight {
  background: linear-gradient(145deg, var(--sea-deep), var(--sea));
  color: #fff;
  border: none;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.stat.next-up {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(30, 74, 71, 0.06);
}

.stat .label {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 0.35rem;
}

.stat .value {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat .sub {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  opacity: 0.8;
}

.stat.highlight .label,
.stat.highlight .sub { opacity: 0.85; color: var(--foam); }

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
  overflow-x: auto;
}

.hidden {
  display: none !important;
}

.tab {
  background: transparent;
  color: var(--ink-soft);
  padding: 0.65rem 1rem;
  border-radius: 8px 8px 0 0;
  white-space: nowrap;
}

.tab:hover { color: var(--ink); background: rgba(255,255,255,0.4); }

.tab.active {
  color: var(--sea-deep);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--sea);
}

.panel {
  display: none;
  animation: rise 0.4s ease both;
}

.panel.active { display: block; }

.panel-surface {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(30, 74, 71, 0.06);
  overflow: hidden;
}

.cal-hint {
  padding: 0 1.25rem 0.85rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
}

.panel-head .hint {
  display: block;
  margin-top: 0.2rem;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cal-nav button {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--mist);
  color: var(--sea-deep);
}

.cal-nav button:hover { background: var(--foam); }

.month-label {
  min-width: 5rem;
  text-align: center;
  font-weight: 500;
  font-size: 1.1rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  padding: 1px;
}

@media (max-width: 820px) {
  .calendar-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 520px) {
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}

.month-cell {
  min-height: 5.75rem;
  background: #fff;
  padding: 0.85rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.month-cell.empty {
  background: rgba(247, 250, 249, 0.7);
  color: var(--future);
}

.month-cell.current {
  box-shadow: inset 0 0 0 2px var(--sea);
}

.month-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--sea-deep);
}

.month-cell.empty .month-name { color: var(--future); }

.pay-chip {
  margin-top: auto;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.72rem;
  line-height: 1.25;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: left;
  transition: transform 0.15s, background 0.2s, box-shadow 0.15s;
  width: 100%;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pay-chip:hover { transform: translateY(-1px); }

.pay-chip.paid {
  background: rgba(47, 111, 106, 0.12);
  color: var(--paid);
  border-color: rgba(47, 111, 106, 0.2);
}

.pay-chip.due {
  background: rgba(184, 134, 11, 0.16);
  color: #7a5806;
  border-color: rgba(184, 134, 11, 0.3);
}

.pay-chip.missed {
  background: rgba(196, 92, 72, 0.12);
  color: var(--missed);
  border-color: rgba(196, 92, 72, 0.25);
}

.pay-chip.future {
  background: rgba(138, 154, 158, 0.14);
  color: #5f6e72;
}

.pay-chip.extra:not(.paid) {
  background: rgba(212, 196, 168, 0.35);
  color: #6a5530;
  border-color: rgba(180, 150, 100, 0.35);
}

.pay-chip strong {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: inherit;
}

.pay-chip .chip-status {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.month-chips {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.month-chips .pay-chip { margin-top: 0; }

.month-empty-note {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--future);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.legend .l-paid::before { background: var(--paid); }
.legend .l-due::before { background: var(--due); }
.legend .l-missed::before { background: var(--missed); }
.legend .l-future::before { background: var(--future); }
.legend .l-extra::before { background: #c4a574; }

tbody tr.extra-row {
  background: rgba(212, 196, 168, 0.18);
}

tbody tr.extra-row:hover {
  background: rgba(212, 196, 168, 0.28);
}

.type-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6a5530;
  background: rgba(212, 196, 168, 0.45);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.btn-label-short { display: none; }
.pay-cards { display: none; }

.extra-disclosure {
  position: relative;
}

.extra-disclosure > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border: none;
  border-radius: 10px;
  color: #fff;
}

.extra-disclosure > summary::-webkit-details-marker,
.extra-disclosure > summary::marker {
  display: none;
  content: "";
}

.extra-disclosure[open] > summary {
  background: var(--sea-deep);
}

.extra-disclosure .extra-form {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 5;
  min-width: min(22rem, calc(100vw - 2.5rem));
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.extra-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}

.extra-form label {
  flex: 1 1 8rem;
  min-width: 7rem;
}

.extra-form label.amount {
  flex: 0 1 8rem;
}

.extra-form label.recast-check {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding-bottom: 0.65rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  margin-left:auto;
}

.extra-form label.recast-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  accent-color: var(--sea-deep);
}

.extra-form input {
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
}

.extra-form .btn-primary {
  padding: 0.55rem 0.95rem;
  white-space: nowrap;
}

.extras-editor,
.share-editor {
  margin: 0 0 1.1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.extras-editor h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--sea-deep);
}

.share-panel h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--sea-deep);
}

.share-panel h4 {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.share-panel .help,
.share-panel .meta {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.share-panel .invite {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.share-panel .invite label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.share-panel .invite label input {
  font-size: 0.85rem;
  width: 100%;
}

.share-panel #generateShareLinkBtn {
  width: fit-content;
}

.share-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.share-panel ul li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}

.share-panel ul li:last-child { border-bottom: none; }

.share-panel .person {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.extras-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.extras-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.extras-list li:last-child { border-bottom: none; }

.extras-list .muted { color: var(--ink-soft); }

.extras-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.table-wrap {
  --table-head-h: 2.5rem;
  overflow: auto;
  max-height: min(62vh, 640px);
}

table.payments-table,
.table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.9rem;
}

col.col-num { width: 5.5rem; }
col.col-date { width: 9.5rem; }
col.col-money { width: auto; }
col.col-status { width: 12.5rem; }

th, td {
  padding: 0.7rem 0.9rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th.cell-text,
td.cell-text { text-align: left; }

th.cell-status,
td.cell-status { text-align: right; }

thead th {
  position: sticky;
  top: 0;
  background: #eef5f4;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  z-index: 3;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(168, 212, 207, 0.18); }
tbody tr.paid-row { background: rgba(47, 111, 106, 0.06); }
tbody tr.current-year td:first-child {
  box-shadow: inset 3px 0 0 var(--sea);
}

tbody tr.zeroed-row {
  background: rgba(122, 143, 140, 0.1);
  color: var(--ink-soft);
}

tbody tr.zeroed-row:hover {
  background: rgba(122, 143, 140, 0.16);
}

tbody tr.zeroed-row.paid-row {
  background: rgba(122, 143, 140, 0.08);
}

tbody tr.zeroed-row td:first-child {
  box-shadow: inset 3px 0 0 var(--zeroed);
}

tbody tr.zeroed-row.current-year td:first-child {
  box-shadow: inset 3px 0 0 var(--zeroed);
}

tbody tr.year-summary {
  font-weight: 600;
}

tbody tr.year-summary td {
  position: sticky;
  top: var(--table-head-h);
  z-index: 2;
  background: #e4eceb;
  border-top: 1px solid rgba(30, 74, 71, 0.18);
  border-bottom: 1px solid rgba(30, 74, 71, 0.16);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  box-shadow: 0 1px 0 rgba(30, 74, 71, 0.06);
}

tbody tr.year-summary:hover td {
  background: #dce7e5;
}

tbody tr.year-summary.current-year td:first-child {
  box-shadow: inset 3px 0 0 var(--sea), 0 1px 0 rgba(30, 74, 71, 0.06);
}

tbody tr.year-summary .year-label {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--sea-deep);
  letter-spacing: -0.01em;
}

tbody tr.year-summary .year-sub {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.status-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-actions .status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
}

.status-actions .status-btn svg {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 720px) {
  .payments-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .payments-head-copy .hint {
    font-size: 0.8rem;
  }

  .payments-toolbar {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 0.45rem;
    width: 100%;
  }

  .payments-toolbar .filter-label {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .payments-toolbar > .btn-ghost {
    grid-column: 2;
    grid-row: 1;
  }

  .payments-toolbar > .extra-disclosure {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
  }

  .payments-toolbar .filter-label > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .payments-toolbar select,
  .payments-toolbar .btn-compact,
  .payments-toolbar .extra-disclosure > summary {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    padding: 0.55rem 0.4rem;
    white-space: nowrap;
  }

  .btn-label-full { display: none; }
  .btn-label-short { display: inline; }

  .extra-disclosure[open] {
    display: contents;
  }

  .extra-disclosure[open] > summary {
    grid-column: 3;
    grid-row: 1;
  }

  .extra-disclosure .extra-form {
    position: static;
    width: auto;
    min-width: 0;
    margin-top: 0;
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .payments-panel .payments-desktop {
    display: none;
  }

  .payments-panel .pay-cards {
    display: block;
    padding: 0.75rem 0.85rem 1rem;
  }

  .pay-year {
    margin: 0.45rem 0 0.7rem;
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--sea-deep);
  }

  .pay-card {
    margin: 0 0 0.7rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(30, 74, 71, 0.05);
  }

  .pay-card:last-child {
    margin-bottom: 0;
  }

  .pay-card.paid {
    background: rgba(47, 111, 106, 0.05);
  }

  .pay-card.extra {
    background: rgba(212, 196, 168, 0.3);
  }

  .pay-card.zeroed {
    background: rgba(122, 143, 140, 0.1);
    color: var(--ink-soft);
  }

  .pay-card-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1rem 0.75rem;
  }

  .pay-card-lead {
    min-width: 0;
    padding-top: 0.15rem;
  }

  .pay-date {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
  }

  .pay-card-amt {
    text-align: right;
    flex: 0 0 auto;
  }

  .pay-amount {
    display: block;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink);
  }

  .pay-amount-label {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }

  .pay-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem 0.65rem 1rem;
    background: rgba(236, 242, 241, 0.95);
    border-top: 1px solid rgba(30, 74, 71, 0.08);
  }

  .pay-card.extra .pay-card-foot {
    background: rgba(232, 222, 200, 0.55);
  }

  .pay-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.35rem;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink-soft);
  }

  .pay-sep {
    color: rgba(61, 79, 85, 0.4);
  }

  .pay-card .status-actions {
    flex: 0 0 auto;
    gap: 0.3rem;
  }

  .pay-card .status-btn {
    order: 2;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
  }

  .pay-card .status-btn:not(.note-btn) {
    order: 1;
  }

  .pay-card .status-btn-remove {
    order: 3;
    font-size: 0.72rem;
  }

  .pay-cards .empty-state {
    margin: 0;
    padding: 2rem 1rem;
  }
}

.note-popover-card {
  width: min(420px, 100%);
}

.note-popover-sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 400;
}

.note-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.note-field textarea {
  width: 100%;
  min-height: 7.5rem;
  resize: vertical;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.45;
}

.note-field textarea:focus {
  outline: 2px solid rgba(47, 111, 106, 0.35);
  outline-offset: 1px;
  border-color: rgba(47, 111, 106, 0.45);
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.chart-wrap {
  padding: 1rem 1.25rem 1.35rem;
  position: relative;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: -0.05rem;
}

.chart-legend .l-principal::before { background: var(--sea); }
.chart-legend .l-interest::before { background: #c4a574; }

.seg-toggle {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(247, 250, 249, 0.9);
  gap: 0.15rem;
}

.seg-toggle button {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  border: none;
}

.seg-toggle button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.seg-toggle button.active {
  background: #fff;
  color: var(--sea-deep);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(30, 74, 71, 0.1);
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-svg .axis-label {
  fill: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 11px;
}

.chart-svg .grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-svg .bar-hit {
  fill: transparent;
  cursor: crosshair;
}

.chart-svg .bar-group:hover .bar-principal {
  fill: var(--sea-deep);
}

.chart-svg .bar-group:hover .bar-interest {
  fill: #b8925a;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  min-width: 10rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  color: var(--ink);
  opacity: 0;
  transform: translate(-50%, -110%);
  transition: opacity 0.12s ease;
}

.chart-tooltip.visible { opacity: 1; }

.chart-tooltip strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--sea-deep);
}

.chart-tooltip .row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.15rem;
}

.chart-tooltip .row span:first-child { color: var(--ink-soft); }

.status-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
}

.status-btn.paid {
  background: rgba(47, 111, 106, 0.12);
  color: var(--paid);
  border-color: rgba(47, 111, 106, 0.25);
}

.track-filters,
.payments-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.track-filters select,
.payments-toolbar select {
  width: auto;
  min-width: 9rem;
  padding: 0.5rem 0.75rem;
}

.empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink-soft);
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .summary-bar { grid-template-columns: 1fr; }
  .month-cell { min-height: 5.25rem; }
}

.summary-bar div {
  background: rgba(247, 250, 249, 0.95);
  padding: 0.9rem 1.1rem;
}

.summary-bar .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.summary-bar .v {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.error {
  color: var(--coral);
  font-size: 0.9rem;
  min-height: 1.25rem;
}

.profile-bar {
  position: relative;
  z-index: 20;
  animation: rise 0.7s 0.05s ease both;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0;
  border: none;
}

.profile-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: min(14rem, 100%);
  flex: 0 1 14rem;
}

.profile-select-wrap > span {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.profile-select-wrap select {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  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 fill='%233d4f55' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  background-color: transparent;
  border-color: transparent;
}

.profile-select-wrap select:hover,
.profile-select-wrap select:focus {
  background-color: rgba(255, 255, 255, 0.65);
  border-color: var(--line);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.profile-actions .btn-primary {
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
}

.profile-meta {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.15rem 0 0;
}

.profile-meta[hidden] {
  display: none;
}

.profile-chip {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(30, 74, 71, 0.04);
  min-width: 0;
}

.profile-chip .label {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.profile-chip .value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--sea-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 420px) {
  .profile-chip {
    padding: 0.45rem 0.55rem;
  }

  .profile-chip .value {
    font-size: 0.9rem;
  }
}

.menu {
  position: relative;
}

.menu-toggle {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 1.15rem;
  line-height: 1;
}

.menu-toggle:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--line);
}

.menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
  box-shadow: 0 14px 32px rgba(30, 74, 71, 0.12);
  z-index: 30;
}

.menu.open .menu-panel { display: grid; gap: 0.1rem; }

.menu-panel button,
.menu-panel a {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: none;
  border-radius: 7px;
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.menu-panel button:hover,
.menu-panel a:hover {
  background: rgba(168, 212, 207, 0.22);
  color: var(--sea-deep);
}

.menu-panel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.menu-panel form {
  margin: 0;
}

.menu-panel .menu-danger {
  color: var(--coral);
  margin-top: 0.2rem;
  border-top: 1px solid var(--line);
  border-radius: 0 0 7px 7px;
  padding-top: 0.65rem;
}

.menu-panel .menu-danger:hover {
  background: rgba(196, 92, 72, 0.08);
  color: var(--coral);
}

.filter-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: 0;
}

.filter-label > span {
  font-size: 0.85rem;
}

.btn-compact {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.status-btn-remove {
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
}

.empty-dash {
  display: none;
  margin-top: 2rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink-soft);
  animation: rise 0.55s ease both;
}

.empty-dash.visible { display: block; }

.empty-dash h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--sea-deep);
}

.empty-dash p {
  margin: 0 0 1.25rem;
  font-weight: 300;
}

.loan-popover {
  width: min(720px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  border: none;
  padding: 0;
  border-radius: calc(var(--radius) + 4px);
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.loan-popover::backdrop {
  background: rgba(28, 42, 46, 0.42);
  backdrop-filter: blur(4px);
}

.loan-popover:popover-open {
  animation: rise 0.28s ease both;
}

.popover-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  background:
    radial-gradient(500px 220px at 0% 0%, rgba(168, 212, 207, 0.35), transparent 60%),
    #fbfdfc;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 24px 60px rgba(30, 74, 71, 0.18);
  padding: 1.35rem 1.4rem 1.5rem;
  overflow: hidden;
}

.popover-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.popover-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 500;
  color: var(--sea-deep);
}

.popover-close {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
}

.popover-close:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.popover-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.popover-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.15rem;
}

.popover-footer {
  flex-shrink: 0;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  background: #fbfdfc;
}

.popover-card .inputs {
  margin-bottom: 0.85rem;
  grid-template-columns: 1fr 1fr;
}

.popover-card .name-field {
  margin-bottom: 0.85rem;
}

.popover-card .actions {
  margin-top: 0;
}

.popover-card .error {
  margin: 0.65rem 0 0;
}

.popover-card .extras-editor,
.popover-card .share-editor {
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.8rem;
}

.popover-card .share-panel .help {
  margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
  .loan-popover {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .popover-card {
    max-height: calc(100dvh - 1rem);
    padding: 0.95rem 0.9rem 1rem;
  }

  .popover-head {
    margin-bottom: 0.75rem;
  }

  .popover-head h2 {
    font-size: 1.3rem;
  }

  .popover-footer {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
  }

  .popover-card .extras-editor,
  .popover-card .share-editor {
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.65rem;
  }

  .popover-card .extras-editor h3,
  .popover-card .share-panel h3 {
    margin-bottom: 0.35rem;
    font-size: 0.98rem;
  }

  .popover-card .share-panel h4 {
    margin-top: 0.55rem;
  }

  .popover-card .share-panel .help,
  .popover-card .share-panel .meta,
  .popover-card .extras-empty {
    font-size: 0.8rem;
    margin-bottom: 0.45rem;
  }
}

.conflict-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--sea-deep);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.conflict-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Auth / account */
.account-menu-toggle {
  display: grid;
  place-items: center;
  padding: 0.15rem;
  margin: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  line-height: 0;
}

.account-menu-toggle:hover,
.account-menu.open .account-menu-toggle {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--line);
}

.account-menu .menu-panel {
  min-width: 10rem;
  z-index: 50;
}

.avatar {
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
  background: #f0f0f0;
  image-rendering: pixelated;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  border-radius: 5px;
}

.avatar-sm {
  width: 28px;
  height: 28px;
}

.avatar-md {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.btn-text {
  background: transparent;
  color: var(--sea-deep);
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--sea);
  text-decoration: underline;
}

.btn-text:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-text.danger:hover {
  color: var(--coral);
}

.auth-panel {
  width: min(420px, 100%);
  margin: 2rem auto 0;
  animation: rise 0.65s ease both;
}

.auth-brand {
  margin-bottom: 1.5rem;
  text-align: left;
}

.brand-home {
  color: inherit;
  text-decoration: none;
}

.brand-home:hover {
  color: var(--sea);
}

.auth-form {
  display: grid;
  gap: 1rem;
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-form .field {
  display: grid;
  gap: 0.35rem;
}

.auth-form .field span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.auth-form input:focus {
  outline: 2px solid var(--foam);
  border-color: var(--sea);
}

.auth-submit {
  margin-top: 0.25rem;
  width: 100%;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-weight: 500;
}

.auth-switch {
  margin: 1.15rem 0 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.auth-switch a {
  color: var(--sea-deep);
  font-weight: 500;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

#auth-error:empty {
  display: none;
}

.account-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 1.15rem;
}

.account-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-panel > header .btn-ghost {
  flex-shrink: 0;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
}

.account-panel > header h1 {
  margin: 0;
  font-size: var(--font-size-header);
  font-family: var(--font-display);
  color: var(--sea-deep);
  text-align: right;
}

.account-panel .identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.account-panel .email {
  margin: 0;
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  color: var(--ink);
  font-size: 0.98rem;
  word-break: break-word;
}

.account-panel .user-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.account-panel .stack {
  display: grid;
  gap: 0.75rem;
}

.account-panel .success {
  margin: 0;
}

.account-popover {
  width: min(440px, calc(100vw - 2rem));
}

.account-popover .auth-form {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.account-popover .auth-form > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.account-popover .popover-head h2 {
  font-size: 1.35rem;
}

.btn-danger {
  background: var(--coral);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-weight: 500;
}

.btn-danger:hover {
  filter: brightness(0.95);
}

.success {
  color: var(--sea-deep);
  font-size: 0.9rem;
  min-height: 1.25rem;
}

/* —— Marketing landing (logged out) —— */
body.landing {
  background: var(--paper);
}

body.landing .wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.landing-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  background: var(--sea-deep);
}

.landing-hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.landing-hero-visual > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: contrast(1.04) brightness(0.95);
  animation: sceneAtmosphere 30s ease-in-out infinite alternate;
}

@keyframes sceneAtmosphere {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.04) translateY(-10px); }
}

.landing-hero-visual .overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(247, 250, 249, 0.96) 0%,
      rgba(247, 250, 249, 0.82) 42%,
      rgba(247, 250, 249, 0.35) 70%,
      rgba(30, 74, 71, 0.25) 100%
    ),
    linear-gradient(
      180deg,
      rgba(247, 250, 249, 0.2) 0%,
      transparent 40%,
      rgba(247, 250, 249, 0.85) 100%
    );
}

.hero-ledger-glimpse {
  position: absolute;
  right: clamp(2rem, 8vw, 7rem);
  bottom: clamp(3rem, 12vh, 8rem);
  z-index: 2;
  pointer-events: none;
  width: min(24rem, calc(100vw - 3rem));
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 45px rgba(30, 74, 71, 0.14);
  animation: rise 0.85s 0.3s ease both;
}

.hero-ledger-glimpse > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.hero-ledger-glimpse .badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sea);
}

.hero-ledger-glimpse .val {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--sea-deep);
}

.hero-ledger-glimpse .bar {
  height: 8px;
  border-radius: 4px;
  background: var(--mist);
  display: flex;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.hero-ledger-glimpse .fill {
  width: 42%;
  background: var(--sea);
}

.hero-ledger-glimpse .extra {
  width: 18%;
  background: var(--sand);
}

.hero-ledger-glimpse .stats {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.hero-ledger-glimpse .stats div {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hero-ledger-glimpse .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.hero-ledger-glimpse .dot.paid { background: var(--sea); }
.hero-ledger-glimpse .dot.extra { background: var(--sand); }
.hero-ledger-glimpse .dot.due { background: var(--due); }

.landing-hero-copy {
  position: relative;
  z-index: 2;
  width: min(34rem, calc(100% - 3rem));
  margin: 0 0 0 clamp(1.5rem, 7vw, 6rem);
  padding: clamp(3rem, 10vh, 6rem) 0;
  animation: rise 0.75s 0.15s ease both;
}

.landing-hero-copy > header {
  margin-bottom: 1.75rem;
}

.landing-hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 9.5vw, 5.8rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.92;
  color: var(--sea-deep);
  margin: 0;
}

.landing-hero-copy .brand-rule {
  margin: 1.1rem 0 1.25rem;
  height: 3px;
  width: 5rem;
}

.landing-hero-copy h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3.2vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--ink);
}

.landing-hero-copy header > p {
  margin: 0;
  max-width: 29rem;
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--ink-soft);
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.landing-cta > p {
  flex: 1 0 100%;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  opacity: 0.9;
}

@media (max-width: 900px) {
  .hero-ledger-glimpse {
    display: none;
  }

  .landing-hero-visual .overlay {
    background: linear-gradient(
      180deg,
      rgba(247, 250, 249, 0.85) 0%,
      rgba(247, 250, 249, 0.94) 60%,
      var(--paper) 100%
    );
  }

  .landing-hero-copy {
    width: auto;
    margin: 0 1.5rem;
    padding: 5rem 0 3.5rem;
  }
}

.landing-sticky-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(28, 42, 46, 0.08);
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.landing-sticky-nav.visible {
  transform: translateY(0);
}

.landing-sticky-nav > div {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-sticky-nav > div > span {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sea-deep);
}

.landing-sticky-nav .btn-primary {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .landing-hero-visual > img,
  .hero-ledger-glimpse,
  .landing-hero-copy,
  .landing-cta,
  .landing-hero-copy .brand-rule {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

