@font-face {
  font-family: Montserrat;
  src: url('/fonts/Montserrat-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --font: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --gold: #F7CB15;
  --coral: #DB162F;
  --navy: #0D0628;
  --blue: #12263A;
  --paper: #FDFFFC;
  --grid-paid: var(--gold);
  --grid-remaining: #92969F;
  --bg: var(--paper);
  --ink: var(--navy);
  --muted: #6d7080;
  --accent: var(--blue);
  --contrast: #ffffff;
  --line: #e5e9e9;
  font-family: var(--font);
  font-size: 16px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: #e9eef0; color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; color: inherit; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid #F7CB15; outline-offset: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #12263A; outline-offset: 1px; }
#app { background: var(--bg); max-width: 480px; margin: auto; min-height: 100dvh; padding: env(safe-area-inset-top) 22px 115px; }
.loading { text-align: center; padding: 35vh 0; font-size: 40px; font-weight: 650; letter-spacing: -1.5px; }
.loading span { display: block; font-size: 14px; font-weight: 400; letter-spacing: 0; margin-top: 18px; color: var(--muted); }
header { display: flex; align-items: center; justify-content: space-between; padding: 27px 0 25px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 650; letter-spacing: -.8px; }
.brandmark { display: grid; place-items: center; background: var(--navy); color: var(--gold); width: 32px; height: 32px; border-radius: 9px; font-size: 28px; font-weight: 400; line-height: 1; }
.iconbtn { background: transparent; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.iconbtn:hover { background: #edf2f2; }
svg.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 1.35px; text-transform: uppercase; color: var(--muted); }
h1 { font-size: 28px; line-height: 1.2; font-weight: 650; letter-spacing: -1.1px; margin: 8px 0 12px; }
h2 { font-size: 19px; letter-spacing: -.55px; font-weight: 650; margin: 0; }
h3 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -.3px; }
p { line-height: 1.6; }
.subtitle { font-size: 15px; line-height: 1.6; color: var(--muted); margin: 0 0 25px; }
.hero { --grid-remaining: #fff; --grid-off: #3b3b3b; background: #1c1c1c; color: #fff; border: 1px solid #1c1c1c; border-radius: 20px; padding: 26px 22px 22px; position: relative; overflow: hidden; }
.hero .eyebrow { color: #c6c6c6; letter-spacing: .1px; text-transform: none; font-weight: 400; font-size: 13px; }
.hero .big { position: relative; font-size: 39px; font-weight: 550; letter-spacing: -1.9px; font-variant-numeric: tabular-nums; margin: 15px 0 10px; white-space: nowrap; }
.hero .big small { font-size: 25px; color: inherit; font-weight: 400; }
.hero-paid { margin: 14px 0 12px; padding-top: 12px; border-top: 1px solid #ffffff20; }
.hero-paid .big { color: var(--grid-paid); }
.hero-meta { color: #c2c2c2; font-size: 12px; line-height: 1.75; position: relative; }
.hero .track i { background: var(--gold); }
.hero .track { height: 3px; margin: 24px 0 11px; background: #393939; }
.track { overflow: hidden; height: 4px; border-radius: 2px; background: #eef1f0; }
.track i { display: block; background: var(--blue); height: 100%; border-radius: 2px; transition: width .5s; }
.hero-meta-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.hero-progress { display: flex; justify-content: flex-end; margin-left: auto; font-size: 12px; color: #cecece; gap: 5px; white-space: nowrap; text-align: right; }
.hero-progress strong { color: var(--gold); font-weight: 550; white-space: nowrap; }
.primary { background: var(--accent); color: #fff; border-radius: 12px; padding: 16px 18px; font-size: 14px; font-weight: 600; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; }
.hero .primary { background: #F7CB15; color: #0D0628; margin-top: 24px; }
.secondary { background: #f8edd9; border-radius: 11px; padding: 13px 16px; font-size: 14px; font-weight: 500; min-height: 48px; }
.plain { background: transparent; padding: 8px 0; color: var(--accent); font-size: 13px; font-weight: 550; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 24px; }
.mini { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 17px 15px; min-width: 0; }
.mini .small-icon { color: var(--blue); margin-bottom: 12px; }
.mini:first-child .small-icon { color: var(--coral); }
.mini label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
.mini strong { font-size: 21px; font-weight: 600; letter-spacing: -.8px; display: block; font-variant-numeric: tabular-nums; }
.mini span { font-size: 12px; color: var(--muted); display: block; margin-top: 7px; line-height: 1.6; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 28px 0 15px; }
.section-title span { font-size: 12px; color: var(--muted); }
.category { margin-bottom: 11px; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 17px; }
.category-top { display: flex; align-items: center; gap: 11px; }
.category-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 550; line-height: 1.45; }
.category-name small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 5px; }
.category-sum { font-size: 15px; letter-spacing: -.5px; font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums; }
.category .track { margin-top: 16px; height: 3px; }
.category .track i { background: #12263A; }
.category-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.category summary { list-style: none; cursor: pointer; }
.category summary::-webkit-details-marker { display: none; }
.category-note { font-size: 13px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); margin: 16px 0 0; padding-top: 12px; }
.debt-row { display: flex; width: 100%; justify-content: space-between; gap: 12px; align-items: center; text-align: left; background: transparent; border-top: 1px solid var(--line); padding: 17px 0 0; margin-top: 16px; }
.debt-row .name { display: block; font-size: 14px; line-height: 1.5; }
.debt-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.6; }
.debt-row strong { white-space: nowrap; font-size: 14px; font-weight: 550; }
.tag { display: inline-block; font-size: 12px; padding: 6px 8px; border-radius: 6px; background: #fff7cf; color: #69542c; line-height: 1.5; }
.tag.positive { color: #12263A; background: #e9f0f3; }
.tag.grey { color: #6d7080; background: #f0f3f1; }
.encouragement { margin: 22px 4px; padding: 0; }
.encouragement::before { content: ''; display: block; width: 26px; height: 3px; margin-bottom: 10px; border-radius: 2px; background: var(--gold); }
.encouragement-kicker { font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.encouragement p { margin: 7px 0 0; font-size: 14px; font-weight: 450; color: var(--ink); line-height: 1.65; max-width: 35ch; }
.periods, .tabs { display: flex; gap: 4px; background: #edf2f2; padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.periods button, .tabs button { flex: 1; background: transparent; font-size: 12px; padding: 10px 5px; border-radius: 7px; color: #6d7080; }
.periods .active, .tabs .active { background: #fff; color: var(--ink); box-shadow: 0 1px 5px #00000008; }
.chart-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 20px; margin-top: 14px; }
.chart-card svg { display: block; width: 100%; height: 130px; margin: 12px 0; }
.chart-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.chart-card .empty { padding: 15px 0 8px; }
.event { display: flex; gap: 12px; align-items: center; padding: 17px 0; border-bottom: 1px solid var(--line); }
.event-icon { display: grid; place-items: center; background: #fff2ab; color: #12263A; width: 37px; height: 37px; border-radius: 11px; flex-shrink: 0; }
.event-icon.neutral { background: #edf2f2; color: #777786; }
.event-content { flex: 1; min-width: 0; }
.event-title { font-size: 14px; font-weight: 550; line-height: 1.5; }
.event-content small { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 4px; }
.event-value { font-size: 14px; font-weight: 550; text-align: right; white-space: nowrap; }
.event-value small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 6px; }
.event button { background: transparent; color: var(--muted); font-size: 12px; padding: 7px 0; }
.event.reversed { opacity: .55; }
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; border-top: 1px solid #e1e8e8; background: #fdfffcf5; backdrop-filter: blur(20px); padding: 11px 20px max(16px, env(safe-area-inset-bottom)); display: flex; justify-content: space-around; z-index: 5; }
.nav button { background: transparent; display: flex; flex-direction: column; align-items: center; gap: 7px; color: #858997; padding: 4px 20px; font-size: 12px; font-weight: 500; }
.nav button.active { color: var(--blue); }
.nav button.active::after { content: ""; width: 14px; height: 2px; background: var(--gold); border-radius: 2px; }
.nav button:not(.active)::after { content: ""; height: 2px; }
.nav button.active svg { stroke-width: 2; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.empty { color: var(--muted); font-size: 13px; line-height: 1.7; padding: 22px 4px; text-align: center; }
.info { font-size: 12px; line-height: 1.75; color: var(--muted); padding: 13px 0; }
.notice { font-size: 12px; line-height: 1.65; background: #fff7cf; color: #765521; border-radius: 11px; padding: 13px 15px; margin: 16px 0; }
.service-card { border: 1px solid #d9e5e9; background: #edf4f6; border-radius: 16px; padding: 19px; margin-top: 14px; }
.service-card strong { display: block; font-size: 24px; font-weight: 550; margin-top: 8px; letter-spacing: -.7px; }
.service-card p { font-size: 12px; color: var(--muted); margin-bottom: 0; }
.backdrop { position: fixed; inset: 0; background: #0d062870; backdrop-filter: blur(4px); z-index: 10; display: flex; justify-content: center; align-items: flex-end; }
.sheet { background: var(--bg); width: 100%; max-width: 480px; max-height: 93dvh; border-radius: 20px 20px 0 0; overflow: auto; padding: 10px 24px max(28px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 60px #0d062822; animation: slide .22s ease-out; }
.handle { width: 32px; height: 3px; background: #c6d1d6; border-radius: 3px; margin: 0 auto 15px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 21px; font-weight: 650; }
.sheet label, .auth label { display: block; font-size: 14px; color: #65687b; margin: 18px 0 8px; }
.sheet input, .sheet select, .sheet textarea, .auth input { width: 100%; background: #fff; border: 1px solid #dde5e6; border-radius: 10px; padding: 14px; color: var(--ink); min-height: 49px; }
.sheet textarea { min-height: 92px; resize: vertical; }
.sheet select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23003D5B' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; padding-right: 35px; }
.sheet .amount-input { font-size: 32px; letter-spacing: -1.1px; font-weight: 500; padding: 18px; min-height: 77px; }
.sheet .primary { margin-top: 23px; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet label.check { display: flex; gap: 10px; align-items: center; font-size: 13px; line-height: 1.55; }
.check input { width: 20px; height: 20px; min-height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.error { color: #a83748; font-size: 13px; line-height: 1.6; margin-top: 13px; }
.form-footer { display: flex; flex-direction: column; gap: 10px; }
.details-fields { margin-top: 20px; color: var(--muted); font-size: 13px; }
.details-fields summary { cursor: pointer; padding: 7px 0; }
.review { background: #fff; border-radius: 15px; border: 1px solid var(--line); padding: 20px; margin: 20px 0; }
.review .line { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; padding: 11px 0; border-bottom: 1px solid var(--line); line-height: 1.6; }
.review .line:last-child { border: 0; }
.success { text-align: center; padding: 18px 0; }
.success .seal { width: 68px; height: 68px; border-radius: 20px; border: 1px solid #F7CB15; background: #F7CB15; color: #0D0628; display: grid; place-items: center; margin: 0 auto 24px; }
.success .seal svg { width: 30px; height: 30px; }
.success h2 { font-family: var(--font); font-size: 28px; line-height: 1.25; font-weight: 650; letter-spacing: -.9px; }
.success .success-amount { font-size: 39px; font-weight: 550; letter-spacing: -1.6px; margin: 20px 0 8px; }
.success p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.quote { padding: 22px 6px 6px; border-top: 1px solid var(--line); margin-top: 24px; }
.quote blockquote { font-family: var(--font); font-size: 19px; font-weight: 500; letter-spacing: -.5px; line-height: 1.55; margin: 0 0 15px; }
.quote a { color: var(--muted); font-size: 12px; line-height: 1.7; text-decoration: none; }
.quote small { display: block; font-size: 12px; line-height: 1.6; margin-top: 5px; color: var(--muted); }
.auth { padding-top: 9vh; }
.auth .brandmark { width: 52px; height: 52px; border-radius: 14px; font-size: 43px; margin-bottom: 32px; }
.auth h1 { font-family: var(--font); font-size: 42px; line-height: 1.12; font-weight: 650; letter-spacing: -1.8px; margin: 0 0 22px; }
.auth p { font-size: 15px; line-height: 1.75; color: var(--muted); }
.auth form { margin-top: 30px; }
.auth .primary { margin-top: 25px; background: var(--gold); color: var(--navy); }
.auth .foot { font-size: 12px; line-height: 1.75; margin-top: 28px; color: #777786; }
.settings-row { padding: 17px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; }
.settings-row button { font-size: 12px; }
.settings-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.linkbutton { display: flex; text-decoration: none; justify-content: space-between; align-items: center; padding: 17px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 14px; text-align: left; }
.danger { color: #a83748; }
.filelabel { cursor: pointer; }
.filelabel input { display: none; }
#toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: #12263A; color: #fff; border-radius: 11px; max-width: 90%; padding: 0; z-index: 30; font-size: 13px; text-align: center; box-shadow: 0 5px 22px #0002; }
#toast:not(:empty) { padding: 14px 20px; }
.search { width: 100%; border: 1px solid var(--line); background: white; border-radius: 11px; padding: 14px 16px; margin: 0 0 15px; font-size: 15px; }
.filter { width: 100%; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 12px; font-size: 14px; margin-bottom: 15px; }
.mini .positive { color: #12263A; }
.under-total { margin: 14px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.button-pair { display: flex; gap: 10px; }
.button-pair > * { flex: 1; }
.balance-negative { color: #a83748; }
.audit-item { padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.7; }
.audit-item time { color: var(--muted); }
@keyframes slide { from { transform: translateY(25px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 600px) { #app { box-shadow: 0 0 90px #12263a0c; } }
@media (max-width: 370px) {
  #app { padding-left: 16px; padding-right: 16px; }
  .hero { padding: 22px 17px; }
  .hero .big { font-size: 31px; letter-spacing: -1.6px; }
  .mini { padding: 15px 12px; }
  .mini strong { font-size: 18px; }
  .sheet { padding-left: 18px; padding-right: 18px; }
  .category { padding: 15px; }
  .category-top { gap: 8px; }
  .category-sum { font-size: 15px; }
  .nav { padding-left: 12px; padding-right: 12px; }
  .nav button { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
/* The filled line is the remaining obligation; its weight reflects the amount. */
.track, .hero .track, .category .track { height: var(--debt-thickness, 3px); border-radius: 4px; transition: height .3s; }
.category-chevron { flex-shrink: 0; width: 18px; color: var(--muted); }
.category-chevron svg { width: 18px; height: 18px; transition: transform .2s; }
.category-disclosure[open] .category-chevron svg { transform: rotate(180deg); }
.category-actions { display: flex; align-items: center; gap: 7px; padding-top: 15px; }
.category-pay, .debt-pay { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 550; background: #e9f0f3; color: var(--blue); }
.category-pay { flex: 1; }
.category-pay svg, .debt-pay svg { width: 17px; height: 17px; }
.category-actions .iconbtn { flex-shrink: 0; }
.category-items { margin-top: 16px; }
.debt-item { border-top: 1px solid var(--line); padding: 18px 0; }
.debt-item:last-child { padding-bottom: 4px; }
.debt-item .debt-row { border: 0; margin: 0; padding: 0; }
.debt-item .track { margin-top: 14px; }
.debt-pay { width: 100%; margin-top: 12px; background: #fff7cf; color: var(--navy); }
.debt-item .tag { margin-top: 10px; }
.order-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.order-name { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.sheet .order-position { margin: 0; flex-shrink: 0; width: 48px; }
.sheet .order-position input { padding: 10px 4px; min-height: 44px; text-align: center; font-size: 16px; }
.order-row .iconbtn { width: 36px; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Category modules use the warm side of the reference palette. */
.category .track { background: #faebed; }
.category .track i { background: var(--coral); }
.category-pay, .category .debt-pay { background: #fff7cf; color: var(--navy); }
.category-actions .iconbtn { color: var(--navy); }

.hero .track i { background: var(--coral); }

.debt-grid { margin: 16px 0 10px; }
.debt-grid-svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid-empty { color: #f4cbd2; }
.grid-filled { color: var(--grid-remaining); }
.hero .debt-grid { margin-top: 24px; }
.hero .grid-empty { color: var(--grid-off); }
.hero .grid-filled { color: var(--grid-remaining); }
.grid-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; margin-top: 10px; font-size: 10px; line-height: 1.5; color: var(--muted); }
.hero .grid-legend { color: #c2c2c2; }
.grid-key { display: inline-flex; align-items: center; gap: 4px; }
.grid-key i { width: 5px; height: 5px; border-radius: 50%; }
.grid-key .paid-key { background: var(--grid-paid); }
.grid-key .remaining-key { background: var(--grid-remaining); }
.grid-key .added-key { background: var(--coral); }

.display-settings { padding: 18px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.display-settings legend { padding: 0 6px; font-size: 15px; font-weight: 600; }
.sheet .display-settings label { display: flex; align-items: center; gap: 12px; margin: 12px 0; color: var(--ink); }
.sheet .display-settings input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--navy); }
.display-settings small { display: block; font-size: 12px; line-height: 1.6; margin-top: 5px; color: var(--muted); }
.debt-grid-line .debt-grid-svg { min-height: 5px; }

.hero .debt-grid { --grid-off: #3b3b3b; }
/* Dense mobile feed: one header, the diagram, one row of status and actions. */
.category { padding: 12px 12px 8px; margin-bottom: 14px; border-radius: 13px; }
.category-top { display: grid; grid-template-columns: 8px minmax(0,1fr) 18px auto; align-items: center; column-gap: 8px; row-gap: 4px; }
.category-name { font-size: 14px; line-height: 1.3; }
.category-sum { font-size: 17px; font-weight: 700; }
.category .debt-grid { margin: 6px 0 0; }
.debt-item .debt-grid { --grid-remaining: #92969F; }
.category-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
/* A compact rounded square within a comfortable 44px touch target. */
.category-pay, .category .debt-pay { position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; background: transparent; border-radius: 12px; }
.category-pay::before, .category .debt-pay::before { content: ''; position: absolute; inset: 5px; border-radius: 9px; background: #fff; border: 1px solid #d7d9df; }
.category-pay svg, .category .debt-pay svg { position: relative; width: 19px; height: 19px; color: var(--ink); }
.category-pay:hover::before, .category .debt-pay:hover::before { background: #f5f6f7; }
.category-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.category-tools .plain { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; font-size: 11px; color: var(--muted); }
.category-tools svg { width: 16px; height: 16px; }
.category-items { margin-top: 8px; }
.category-note { margin: 8px 0 0; padding-top: 8px; font-size: 12px; }
.debt-item { padding: 10px 0; }
.debt-item .debt-row .name { font-size: 13px; line-height: 1.4; }
.debt-item .debt-row small { margin-top: 3px; }
.debt-item-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.debt-item .tag { margin: 0; }
.section-title { margin: 19px 0 10px; }
.service-heading { margin-top: 20px; }
.hero { padding: 20px 19px 16px; }
.hero .big { margin: 10px 0 6px; }
.hero .debt-grid { margin-top: 32px; margin-bottom: 6px; }
.hero .grid-legend { margin-top: 7px; }
.hero .primary { margin: 32px 0 16px; text-transform: uppercase; letter-spacing: .4px; }
.under-total { margin-top: 10px; line-height: 1.5; }
.cards { gap: 10px; margin: 10px 0 16px; }
.mini { padding: 13px; border-radius: 13px; }
.mini .small-icon { margin-bottom: 8px; }
.mini label { margin-bottom: 5px; }
.mini span { margin-top: 4px; line-height: 1.4; }
.chart-card { padding: 15px; margin-top: 10px; border-radius: 13px; }
.chart-card .empty { padding: 10px 0 4px; }
.periods, .tabs { margin-bottom: 12px; }
@media (max-width:370px) {
  .category { padding: 11px 10px 8px; }
  .category-sum { font-size: 15px; }
  .hero { padding: 18px 15px 15px; }
}

/* Four mobile destinations keep equal touch targets at narrow widths. */
.nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 2px; padding-left: 12px; padding-right: 12px; }
.nav button { min-width: 0; min-height: 56px; padding: 4px 0; font-size: 11px; gap: 6px; }
.achievement-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.achievement-totals > div { padding: 12px 0; border-top: 2px solid var(--gold); }
.achievement-totals strong { display: block; font-size: 28px; font-weight: 600; }
.achievement-totals span { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.achievement-card { border: 1px solid var(--line); border-radius: 15px; padding: 17px; margin-bottom: 14px; background: #fff; }
.achievement-category { border-color: #e9d885; }
.achievement-heading { display: flex; align-items: center; gap: 11px; }
.achievement-heading > div { min-width: 0; }
.achievement-seal { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; color: var(--navy); background: #fff7cf; }
.achievement-kind { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.achievement-card h2 { font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.achievement-card p { margin: 14px 0; font-size: 13px; line-height: 1.6; }
.achievement-detail { font-size: 12px; color: var(--muted); line-height: 1.6; }
.achievement-card time { display: block; margin-top: 12px; font-size: 11px; color: var(--muted); }
.achievement-empty { padding: 24px 2px; }
.achievement-empty .achievement-seal { margin-bottom: 18px; width: 48px; height: 48px; }
.achievement-empty p { font-size: 14px; line-height: 1.7; color: var(--muted); margin: 12px 0 24px; }
@media (max-width:370px) { .nav button { font-size: 10px; } }

.nav { grid-template-columns: repeat(5,minmax(0,1fr)); padding-left: 6px; padding-right: 6px; }
.nav button { font-size: 10px; }
.category-tools { gap: 6px; }
.todo-row { display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: start; gap: 10px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.todo-row input[type=checkbox] { width: 23px; height: 23px; margin: 0; accent-color: var(--navy); cursor: pointer; }
.todo-row input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.todo-content { min-width: 0; }
.todo-title { display: block; width: 100%; padding: 0; background: transparent; text-align: left; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.todo-content small, .todo-content time { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.todo-completed .todo-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #bfc2c7; }
#task-form textarea { min-height: 100px; }

.todo-check { display: block; min-height: 44px; cursor: pointer; }
@media (max-width:370px) { .nav button { font-size: 9px; } }

.category-open-track { --category-line-paid: #D7DADF; display: none; height: 2px; margin-top: 10px; border-radius: 2px; }
.category-disclosure[open] > summary > .debt-grid { display: none; }
.category-disclosure[open] > summary > .category-open-track { display: block; }
.category-disclosure[open] + .category-actions { display: none; }

.category-tools [data-debt-order] { margin-left: auto; }
.category-tools .iconbtn { flex-shrink: 0; color: var(--muted); }

.overview-lines { display: block; width: 100%; height: 8px; margin: 18px 0 0; overflow: visible; }

.home-header { display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: start; column-gap: 8px; row-gap: 8px; padding: 16px 0 20px; }
.home-header h1 { margin: 6px 0 0; }
.home-header .subtitle { grid-column: 1 / -1; margin: 0; }
.app-header { justify-content: flex-end; padding: 8px 0 4px; }

.category-count { color: var(--muted); font-weight: 450; white-space: nowrap; }
.category-tools .iconbtn svg { width: 20px; height: 20px; }

.category-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }

/* The goal occupies the middle slot; secondary pages remain in More. */
.nav { overflow: visible; }
.nav .nav-goal { margin-top: -18px; gap: 5px; color: var(--ink); }
.nav-goal-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--gold); color: #242424; box-shadow: 0 0 0 5px var(--paper); }
.nav-goal-icon .icon { width: 25px; height: 25px; }
.nav .nav-goal.active .nav-goal-icon { box-shadow: 0 0 0 5px var(--paper),0 0 0 6px var(--gold); }
.nav .nav-goal::after { visibility: hidden; }
.goal-summary { margin-top: 20px; padding: 22px 18px; border-radius: 18px; background: #1c1c1c; color: #fff; }
.goal-summary .eyebrow, .goal-summary > p { color: #c6c6c6; }
.goal-target-mark { float: right; font-size: 32px; line-height: 1; color: var(--gold); }
.goal-summary h2 { font-size: 21px; line-height: 1.4; margin: 12px 0 8px; max-width: 20ch; }
.goal-summary > p { font-size: 13px; }
.goal-balance { display: block; margin-top: 25px; font-size: clamp(24px,7vw,34px); font-weight: 650; letter-spacing: -.8px; }
.goal-balance-caption { display: block; color: #c6c6c6; font-size: 12px; margin: 7px 0 20px; }
.goal-summary-track { height: 7px; background: #484848; border-radius: 8px; overflow: hidden; }
.goal-summary-track i { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.goal-summary-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-top: 12px; }
.goal-summary-meta strong { color: var(--gold); white-space: nowrap; }
.goal-next { display: grid; gap: 7px; padding: 20px 2px 8px; }
.goal-next > span, .goal-next small { color: var(--muted); font-size: 12px; }
.goal-next > strong { font-size: 24px; font-weight: 650; }
.goal-notice { padding: 15px; border: 1px solid #e0d398; border-radius: 12px; font-size: 13px; line-height: 1.7; background: #fffcf0; }
.goal-chart { padding: 16px 10px; }
.goal-chart-top { display: flex; justify-content: space-between; margin: 0 5px; font-size: 10px; color: var(--muted); }
.goal-chart svg { height: auto; margin: 4px 0 8px; }
.goal-chart svg text { fill: #737373; font-family: var(--font); font-size: 10px; }
.goal-bar-0 { fill: #fff; stroke: #b6b6b6; stroke-width: 1; }
.goal-bar-1 { fill: #777; }
.goal-bar-2 { fill: var(--gold); }
.goal-forecast-line { fill: none; stroke: #242424; stroke-width: 2; stroke-dasharray: 4 4; stroke-linejoin: round; }
.goal-actual-line { fill: none; stroke: #242424; stroke-width: 2.5; stroke-linejoin: round; }
.goal-actual-dot { fill: #242424; stroke: #fff; stroke-width: 1; }
.goal-legend { display: flex; justify-content: center; gap: 9px 12px; flex-wrap: wrap; font-size: 10px; color: var(--muted); }
.goal-legend > span { display: inline-flex; gap: 5px; align-items: center; }
.goal-legend i { width: 8px; height: 8px; border-radius: 2px; }
.goal-original-key { border: 1px solid #b6b6b6; background: #fff; }
.goal-adjusted-key { background: #777; }
.goal-fact-key { background: var(--gold); }
.goal-legend .goal-balance-key { height: 2px; width: 12px; background: #242424; }
.goal-chart-note { margin: 13px 5px 5px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.goal-month-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px; }
.goal-month-links button { background: transparent; padding: 12px 5px; font-size: 11px; color: var(--ink); min-height: 44px; }
.goal-table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.goal-table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.goal-table th, .goal-table td { text-align: right; padding: 12px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.goal-table thead th { font-size: 10px; font-weight: 500; color: var(--muted); white-space: normal; }
.goal-table th:first-child { text-align: left; }
.goal-table tbody th { padding: 0 6px; }
.goal-table tbody button { padding: 12px 2px; min-height: 44px; width: 100%; text-align: left; background: transparent; }
.goal-table tbody small { display: block; color: var(--muted); font-size: 9px; font-weight: 400; margin-top: 4px; }
.goal-table tr:last-child > * { border-bottom: none; }
.goal-current-month { background: #faf8ed; }
.goal-table-fact { font-weight: 650; }
.goal-month-details { margin: 20px 0; }
.goal-month-details > div { display: flex; justify-content: space-between; gap: 15px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.goal-month-details dt { color: var(--muted); }
.goal-month-details dd { margin: 0; text-align: right; white-space: nowrap; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width:370px) { .goal-table th, .goal-table td { padding-left: 5px; padding-right: 5px; font-size: 10px; } .goal-summary-meta { font-size: 11px; } }

.color-preview-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; padding: 13px 0 3px; font-size: 10px; line-height: 1.5; color: var(--muted); }
.color-preview-banner a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.color-category-legend { justify-content: flex-start; gap: 4px 8px; padding-top: 0; line-height: 1.25; }
.category { --grid-remaining: var(--category-color); }
.category .debt-item .debt-grid { --grid-remaining: var(--category-color); }
.category-dot { background: var(--category-color); }

/* In this preview, white is repayment; category colors represent outstanding debt. */
:root { --grid-paid: #fff; }
.category { --paid-outline: #909090; }
.summary-dot-chart { margin-top: 24px; }
.summary-dot-svg { display: block; width: 100%; height: auto; }
.summary-dot-caption { margin-top: 8px; color: #c2c2c2; font-size: 10px; }
.hero-diagrams .summary-dot-chart + .debt-grid { margin-top: 24px; padding-top: 24px; border-top: 1px solid #ffffff20; }

.hero-paid .big { color: var(--gold); }
.repayment-strip { display: flex; gap: 8px; height: 8px; margin-top: 24px; }
.repayment-strip-cohort { position: relative; flex-basis: 0; min-width: 0; height: 100%; border-radius: 8px; overflow: hidden; background: #fff; }
.repayment-strip-paid { position: absolute; top: 0; bottom: 0; }
.repayment-strip-cohort-added { background: var(--coral); }
.repayment-strip-paid { left: 0; background: var(--gold); }

.hero.hero-diagrams { margin-top: 14px; padding-top: 32px; padding-bottom: 32px; }
.hero-diagrams .summary-dot-chart { margin-top: 0; }
.hero-diagrams .color-category-legend { margin-top: 24px; padding-top: 24px; border-top: 1px solid #ffffff20; }
.color-category-legend .grid-key { gap: 3px; }

.summary-dot-svg + .summary-dot-svg { margin-top: 8px; }
.debt-cohort + .debt-cohort { margin-top: 12px; }
.debt-added-amount { color: inherit; font-weight: inherit; }
.debt-added-separator { color: #C73528; }
.category-sum:has(.debt-added-amount) { font-size: 15px; }
.category-name { overflow-wrap: anywhere; }

.cards > .mini { background: #1c1c1c; border-color: #1c1c1c; color: #fff; }
.cards > .mini label, .cards > .mini span { color: #c2c2c2; }
.cards > .mini .small-icon { color: #fff; }
.cards > .mini .positive { color: var(--gold); }
.cards > .mini .balance-negative { color: #ff6767; }
.color-category-legend { display: block; }
.legend-categories { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.legend-status { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.grid-key .new-debt-key { background: #FF4545; }

.monthly-flow-chart { padding: 18px 12px; }
.monthly-flow-period { color: var(--muted); font-size: 11px; margin: 0 4px 10px; }
.monthly-flow-chart svg { height: auto; margin: 0 0 12px; }
.monthly-flow-chart svg text { fill: #737373; font: 10px var(--font); }
.monthly-flow-paid { fill: var(--gold); background: var(--gold); }
.monthly-flow-borrowed { fill: #FF4545; background: #FF4545; }
.monthly-flow-legend { display: flex; justify-content: center; gap: 20px; font-size: 11px; color: var(--muted); }
.monthly-flow-legend span { display: inline-flex; gap: 6px; align-items: center; }
.monthly-flow-legend i { width: 9px; height: 9px; border-radius: 2px; }

.monthly-flow-chart { background: #1c1c1c; border-color: #1c1c1c; color: #fff; }
.monthly-flow-chart .monthly-flow-period, .monthly-flow-chart .monthly-flow-legend { color: #c2c2c2; }
.monthly-flow-chart svg text { fill: #bdbdbd; }
.monthly-flow-chart svg path { stroke: #ffffff22; }

/* The approved monthly dot chart keeps a fixed dot size and scrolls inside its card. */
.chart-card.dynamics-card { background:#1c1c1c; color:#fff; border:1px solid #1c1c1c; border-radius:20px; padding:24px 15px 20px; min-width:0; max-width:100%; }
.dynamics-card .dynamics-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 12px; padding:0; margin:0 8px 14px; }
.dynamics-card .dynamics-header h2 { font-size:22px; font-weight:650; letter-spacing:-.4px; }
.dynamics-card .dynamics-header span { font-size:10px; color:#aaa; white-space:nowrap; }
.dynamics-card .chart-scroll { overflow-x:auto; overflow-y:hidden; max-width:100%; padding:0 0 5px 30px; scrollbar-width:thin; scrollbar-color:#6b6b6b #292929; }
.dynamics-card .chart-scroll:focus-visible { outline:2px solid #F7CB15; outline-offset:3px; }
.chart-card.dynamics-card svg { display:block; max-width:none; margin:0; overflow:visible; }
.dynamics-card svg text { font-family:var(--font); font-size:3.2px; }
.dynamics-card .guide { stroke:#ffffff19; stroke-width:.18; stroke-dasharray:1 1.5; }
.dynamics-card .zero-line { stroke:#fff; stroke-width:.45; }
.dynamics-card .axis { fill:#aaa; font-size:3px; }
.dynamics-card .paid-value { fill:#fff; paint-order:stroke; stroke:#1c1c1c; stroke-width:1.1; stroke-linejoin:round; }
.dynamics-card .borrowed-dot,.dynamics-card .borrowed-value { fill:#FF4545; }
.dynamics-card .paid-value,.dynamics-card .borrowed-value { font-weight:550; font-size:3.5px; }
.dynamics-card .month { fill:#ddd; font-size:4px; }
.dynamics-card .month.current { fill:#fff; font-weight:600; }
.dynamics-card .month.future { fill:#858585; }
.dynamics-card .month-divider { stroke:#494949; stroke-width:.2; }
.dynamics-card .axis-compact { display:none; }
.dynamics-card .plan-dot { fill:#343434; }
.dynamics-card .plan-value { fill:#8d8d8d; font-size:3.5px; font-weight:500; }
.dynamics-card .current-month-outline { fill:none; stroke:#cfcfcf; stroke-width:.25; }
@media (max-width:570px) { .dynamics-card .axis-full { display:none; }.dynamics-card .axis-compact { display:inline; } }

.repayment-strip { gap:4px; align-items:center; }
.repayment-strip-cohort-added { height:10px; }
.plan-editor-totals { position:sticky; top:0; z-index:1; padding:14px 0 10px; background:var(--bg); border-bottom:1px solid var(--line); }
.plan-editor-totals > div { display:flex; justify-content:space-between; align-items:baseline; gap:12px; margin-bottom:8px; }
.plan-editor-totals span { color:var(--muted); font-size:12px; }
.plan-editor-totals strong { font-size:17px; white-space:nowrap; }
.plan-editor-totals p { margin:8px 0 0; font-size:12px; }
.plan-editor-months { display:grid; grid-template-columns:minmax(0,1fr) minmax(100px,140px); gap:10px 12px; align-items:center; }
.plan-editor-months label { margin:0; font-size:13px; }
.plan-editor-months input { margin:0; width:100%; text-align:right; }
