@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #5c6570;
  --paper: #f4f1ea;
  --card: #fffdf8;
  --line: #d9d2c5;
  --green: #0d6b3a;
  --orange: #9a4f00;
  --red: #9d1c32;
  --accent: #1f4f45;
  --hero: #0e2f2a;
  --cream: #f4f1ea;
  --honeydew: #f0fff0;
  --mistyrose: #ffe4e1;
  --focus: #1a5f9e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 1.125rem/1.55 "Source Sans 3", system-ui, sans-serif;
}

.mast, main, .site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.mast { padding-top: 0.75rem; }

.how { margin: 0.15rem 0 0; }

.how summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  font-size: 1rem;
  width: fit-content;
}

.how summary h2,
.tools-card summary h2,
.tools-card .btn-row h3 {
  font: inherit;
  letter-spacing: 0;
  line-height: inherit;
  margin: 0;
  display: inline;
}

.how p { margin: 0.45rem 0 0; }

.how:not([open]) > :not(summary) { display: none; }

h1, h2, .wordmark, .hero-question {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1, h2 { line-height: 1.15; margin: 0 0 0.6rem; }

h1 { font-size: 2.1rem; }

h2 { font-size: 1.55rem; }

.how p, #row-count, .site-footer {
  color: var(--muted);
  max-width: 68rem;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }

button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.cash-form, .toolbars, .section-head, .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.cash-form { margin: 0; }

.top-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  margin-top: 0.55rem;
}

.interval-control { margin-left: auto; }

.labeled-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.horizon-line { margin: 0.4rem 0 0.15rem; }

.control-label { font-weight: 600; }

.cash-entry { display: inline-flex; align-items: center; gap: 0.25rem; }

input, select {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.message { min-height: 0; margin: 0.2rem 0; }

.message.error { color: var(--red); }

.section-head { justify-content: space-between; }

.tools-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
}

#backup-details { display: block; margin-top: 0.35rem; }

.forecast-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.forecast-title h2 { margin: 0; }

.field[hidden] { display: none; }

.tools-card summary {
  cursor: pointer;
  font-weight: 600;
  width: fit-content;
}

.tools-card details:not([open]) > :not(summary) { display: none; }

.tools-card details > :not(summary) { margin-top: 0.65rem; }

.kind { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.icon {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
}

.kind-income[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.kind-expense[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.amount-income { color: var(--green); font-weight: 600; }

.amount-expense { color: var(--red); font-weight: 600; }

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  width: min(36rem, calc(100% - 2rem));
  background: var(--card);
  color: var(--ink);
}

dialog::backdrop { background: rgba(28, 36, 48, 0.45); }

.forecast-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.forecast-wrap { overflow-x: auto; }
.list-wrap { overflow: auto; max-height: 14rem; }

table { border-collapse: collapse; width: 100%; }

caption {
  caption-side: bottom;
  text-align: left;
  color: var(--muted);
  padding-top: 0.6rem;
  font-size: 0.92rem;
}

th, td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
  vertical-align: top;
  white-space: nowrap;
}

.forecast thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #efeae1;
  text-align: left;
}

.forecast .date, .forecast .cash {
  position: sticky;
  background: var(--card);
}

.forecast thead .date, .forecast thead .cash { z-index: 2; background: #efeae1; }

.forecast .date { left: 0; min-width: 11.5rem; }
.forecast .cash { left: 11.5rem; }

.col-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
}

.col-btn:hover { text-decoration: underline; }

.col-status {
  display: flex;
  gap: 0.2rem;
  margin: 0.2rem 0 0.15rem;
}

.col-status button {
  padding: 0.2rem;
  border-radius: 8px;
  line-height: 0;
}

.cell-pos { background: var(--honeydew); }

.forecast th.paused,
.forecast td.paused {
  background: #e4e1d8;
  color: var(--muted);
}

.forecast thead th.paused { background: #ddd9ce; }

.cell-neg { background: var(--mistyrose); }

.tone-green { color: var(--green); font-weight: 600; }

.tone-orange { color: var(--orange); font-weight: 600; }

.tone-red { color: var(--red); font-weight: 600; }

.new-month { box-shadow: inset 0 2px 0 var(--accent); }

.mark {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.3rem;
  border: 2px solid var(--accent);
  border-radius: 2px;
  vertical-align: -0.05rem;
}

.item-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 0.25rem; }

.form-actions { grid-column: 1 / -1; }

.items td.num, .forecast td.cash { text-align: right; font-variant-numeric: tabular-nums; }

tr.off { color: var(--muted); }

.amt-pos { color: var(--green); }

.amt-neg { color: var(--red); }

.site-footer { padding: 1.5rem 0 2.5rem; }

.cash-note { margin: 0.35rem 0 0; color: var(--muted); max-width: 40rem; }

#key-display {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  word-break: break-all;
  margin: 0.4rem 0;
}

#key-qr {
  display: block;
  width: 11rem;
  height: 11rem;
  margin: 0.4rem 0 0.6rem;
  background: #fff;
}

#key-qr[hidden] {
  display: none;
}

.unlock-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.file-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.backup-section p { margin-top: 0; }

.empty { color: var(--muted); }

@media (max-width: 720px) {
  .item-form { grid-template-columns: 1fr 1fr; }
  .forecast-section, .tools-card { padding: 0.75rem; }
  .interval-control { margin-left: 0; }
}

a { color: var(--accent); }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.site-header-inner, .hero-inner, .site-footer, main {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.25rem;
  padding: 0.9rem 0;
}

.wordmark {
  color: var(--hero);
  text-decoration: none;
  font-size: 1.45rem;
  margin-right: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
}

.site-nav a { text-decoration: none; font-weight: 600; }

.nav-cta, .btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  text-decoration: none;
  font-weight: 600;
}

.nav-cta, .btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-secondary {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(244, 241, 234, 0.7);
}

.hero {
  position: relative;
  min-height: 32rem;
  color: var(--cream);
  background:
    url("/media/hero-waves.jpg") center/cover no-repeat,
    linear-gradient(155deg, var(--hero), #1f4f45 58%, #c8ddd6);
  overflow: hidden;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-scrim {
  position: relative;
  min-height: 32rem;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(180deg, rgba(14, 47, 42, 0.35), rgba(14, 47, 42, 0.78));
  padding: 4.5rem 0 3rem;
}

.hero-question {
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  line-height: 1.12;
  max-width: 16em;
  margin: 0 0 0.8rem;
  min-height: 2.4em;
}

.hero-sub { max-width: 38rem; margin: 0 0 1.4rem; font-size: 1.2rem; }

.hero-actions, .hero-controls { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }

.hero-actions { margin-bottom: 1.4rem; }

.hero .btn-primary { background: var(--cream); color: var(--hero); border-color: var(--cream); }

.hero-controls button {
  background: transparent;
  color: var(--cream);
  border-color: rgba(244, 241, 234, 0.55);
}

.hero-dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}

.hero-dot[aria-current="true"] { background: var(--cream); }

.cards, .steps, .data-list { display: grid; gap: 1rem; }

.cards { grid-template-columns: repeat(3, 1fr); margin: 2.5rem 0; }

.card, .sample-band, .steps, .data-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.3rem;
}

.card h2, .panel-title { font-size: 1.45rem; }

.card p, .data-list li, .steps li { margin: 0.4rem 0 0; }

.card svg { width: 2rem; height: 2rem; color: var(--accent); }

.section-block { margin: 2.5rem 0; }

.steps { list-style: none; counter-reset: step; padding: 1.25rem 1.3rem; margin: 0; }

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.steps li:first-child { border-top: 0; }

.steps li::before {
  content: counter(step);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  color: var(--accent);
  font-size: 1.4rem;
}

.data-list { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.sample-band { margin: 2.5rem 0 1rem; background: var(--hero); color: var(--cream); border: 0; }

.sample-band h2 { color: var(--cream); }

.sample-figures { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin: 1rem 0; }

.sample-figures strong { display: block; font-family: "Fraunces", Georgia, serif; font-size: 1.6rem; }

.page-intro { margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }
}

@media (max-width: 800px) {
  .cards { grid-template-columns: 1fr; }
  .hero-question { max-width: none; }
}
