/* We Spent What? design system tokens and the components the web app uses. */

/* Self-hosted Latin subsets from Google Fonts, under the SIL Open Font License
   (see fonts/OFL-*.txt in the repository). Both are variable fonts covering the weights below. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700 800; font-display: swap; src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/dm-sans-latin.woff2") format("woff2"); }

:root {
  --paper: #fbfcf6;
  --card: #ffffff;
  --line: #dfe5dc;
  --ink: #14261c;
  --ink-muted: #55665c;
  --cash: #2fbf71;
  --cash-deep: #157347;
  --cash-soft: #d4f5e2;
  --coin: #ffc93c;
  --oops: #c4361d;
  --icon-tile: #d4f5e2;
  --on-fill: #14261c;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-4: 16px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-pill: 999px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1a14;
    --card: #17251d;
    --line: #2a3a30;
    --ink: #eef4ee;
    --ink-muted: #a3b3a9;
    --cash: #3fd486;
    --cash-deep: #6fe0a2;
    --cash-soft: #1d3a2a;
    --coin: #ffd25c;
    --oops: #ff7a63;
    --icon-tile: #c4ecd4;
    --on-fill: #0f1a14;
  }
}

body { margin: 0; font-family: var(--font-sans); background: var(--paper); color: var(--ink); }
a { color: var(--cash-deep); }
a:hover { color: var(--ink); }

.wsw-btn { font: inherit; font-size: 16px; font-weight: 600; height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; transition: transform .12s ease; box-sizing: border-box; text-decoration: none; }
a.wsw-btn:hover { color: var(--ink); }
.wsw-btn:active { transform: scale(.97); }
.wsw-btn-primary { background: var(--cash); border-color: var(--cash); color: var(--on-fill); }
.wsw-btn-quiet:hover { border-color: var(--ink-muted); }
.wsw-btn:focus-visible { outline: 3px solid var(--cash-deep); outline-offset: 2px; }
.wsw-btn:disabled { opacity: .5; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .wsw-btn { transition: none; } }

/* Sign-in screen */
.login { box-sizing: border-box; min-height: 100vh; min-height: 100dvh; max-width: 420px; margin: 0 auto; padding: var(--space-8) var(--space-4); display: flex; flex-direction: column; }
.login-brand { margin: 0; height: 30px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 24px; line-height: 30px; font-weight: 800; letter-spacing: -0.01em; }
.login-main { flex-grow: 1; display: flex; flex-direction: column; text-align: center; }
.login-hero { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--space-2); padding-bottom: 64px; }
.login-hero h1 { margin: 0; font-family: var(--font-display); font-size: 44px; line-height: 48px; font-weight: 800; letter-spacing: -0.02em; }
.login-hero p { margin: 0; font-size: 16px; line-height: 24px; color: var(--ink-muted); }
.login-actions { display: flex; flex-direction: column; gap: var(--space-4); }
.login-actions p { margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.wsw-btn-wide { width: 100%; height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.login-g { width: 24px; height: 24px; box-sizing: border-box; border-radius: var(--radius-pill); border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--ink-muted); }

/* Signed-in frame. The four places stay in view on a phone. */
.wsw-skip { position: fixed; z-index: 5; inset: 8px auto auto 8px; transform: translateY(-200%); background: var(--card); padding: 8px; }
.wsw-skip:focus { transform: none; }
.wsw-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; min-height: 48px; border-bottom: 1px solid var(--line); }
.wsw-brand { font-family: var(--font-display); font-weight: 800; color: var(--ink); text-decoration: none; }
.wsw-nav { position: fixed; inset: auto 0 0; z-index: 2; border-top: 1px solid var(--line); background: var(--paper); padding-bottom: env(safe-area-inset-bottom); }
.wsw-nav ul { list-style: none; margin: 0; padding: 0 8px; display: flex; justify-content: space-evenly; }
.wsw-nav a { display: grid; place-items: center; box-sizing: border-box; min-height: 48px; padding: 4px 6px; color: var(--ink-muted); text-decoration: none; white-space: nowrap; font-size: clamp(12px, 3.6vw, 16px); }
.wsw-nav a[aria-current] { color: var(--cash-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.wsw-menu { position: relative; flex: 0 1 auto; min-width: 0; }
.wsw-menu summary { cursor: pointer; padding: 10px 0; overflow-wrap: anywhere; }
.wsw-menu-panel { position: absolute; z-index: 3; right: 0; top: 100%; width: min(260px, 75vw); box-sizing: border-box; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.wsw-menu-panel #status:empty { display: none; }
.wsw-page { box-sizing: border-box; max-width: 672px; margin: 0 auto; padding: 28px 16px calc(80px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
.wsw-page h1, .wsw-figure-hero { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.wsw-page h1 { font-size: 32px; line-height: 1.15; margin: 0 0 16px; }
.wsw-page h2 { margin-block: 0 8px; }
.wsw-page h1:not(:first-child) { margin-top: 12px; }
.wsw-page p { line-height: 1.5; }
.wsw-page a.wsw-btn { display: inline-flex; align-items: center; }
.wsw-muted { color: var(--ink-muted); }
.wsw-no-wrap { white-space: nowrap; }
.wsw-table-scroll { overflow-x: auto; }
.wsw-page table { border-collapse: collapse; }
.wsw-page th, .wsw-page td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
.wsw-empty, .wsw-section { margin-top: var(--space-8); }
.wsw-period, .wsw-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wsw-period a { padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none; }
.wsw-period a[aria-current] { background: var(--cash-soft); color: var(--ink); font-weight: 600; }
.wsw-figure { margin-top: var(--space-4); font-variant-numeric: tabular-nums; }
.wsw-figure-hero { font-size: clamp(36px, 11.3vw, 44px); line-height: 1.08; }
.wsw-figure-meta { color: var(--ink-muted); margin-top: 4px; }
.wsw-category-list { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.wsw-category-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.wsw-bank, .wsw-question { margin: 16px 0; padding: 16px 0; border-top: 1px solid var(--line); }
.wsw-question { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
.wsw-question li { margin: 8px 0; }
.wsw-page input, .wsw-page select { font: inherit; max-width: 100%; }
.wsw-page [role="status"]:empty { display: none; }
@media (min-width: 1040px) {
  .wsw-header { padding-inline: 32px; display: grid; grid-template-columns: 1fr auto 1fr; }
  .wsw-menu { justify-self: end; }
  .wsw-nav { position: static; padding: 0; border: 0; }
  .wsw-nav a { padding-inline: 16px; }
  .wsw-page { padding-bottom: 48px; }
}

.wsw-sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.wsw-door { padding-top:64px; }
.wsw-door-list { list-style:none; padding:0; margin:32px 0; }
.wsw-door-list a { display:block; padding:20px 0; border-bottom:1px solid var(--line); font-size:24px; text-decoration:none; }
.wsw-menu-members { padding:0; list-style:none; border-bottom:1px solid var(--line); padding-bottom:16px; }
.wsw-menu-members li { padding:4px 0; }
a.wsw-btn { display:inline-flex; align-items:center; justify-content:center; }
.wsw-rename { margin-bottom:12px; }
.wsw-menu .wsw-rename-toggle { display:inline-flex; align-items:center; gap:6px; cursor:pointer; color:var(--ink-muted); font-size:14px; padding:4px 0; }
.wsw-rename form { display:grid; gap:8px; margin-top:8px; }
.wsw-rename input[name="name"] { font:inherit; box-sizing:border-box; width:100%; padding:8px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--paper); color:var(--ink); }
.wsw-menu .wsw-household-switch { display:block; width:100%; margin:4px 0 16px; font:inherit; }

/* Household flows: create, invite, join, leave. */
.wsw-lede { font-size: 18px; }
.wsw-notice { font-weight: 600; }
.wsw-notice:empty { display: none; }
.wsw-notice-more { font-weight: 400; color: var(--ink-muted); }
.wsw-caption { font-size: 14px; }
.wsw-back { display: inline-block; margin-bottom: 8px; color: var(--ink-muted); }
.wsw-form, .wsw-door-form { display: grid; gap: 6px; max-width: 420px; margin-top: 24px; }
.wsw-form .wsw-actions, .wsw-door-form .wsw-actions { margin-top: 10px; }
.wsw-field-label { font-weight: 600; margin: 0; }
.wsw-input { font: inherit; box-sizing: border-box; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); }
.wsw-input[aria-invalid="true"] { border-width: 2px; border-color: var(--ink); padding: 7px 11px; }
.wsw-input-link { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 14px; user-select: all; }
.wsw-field-help, .wsw-field-error { margin: 0; font-size: 14px; }
.wsw-field-help { color: var(--ink-muted); }
.wsw-field-error { font-weight: 600; }
.wsw-door-actions { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.wsw-door-more { margin-top: 24px; }
.wsw-door-you { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.wsw-door-you #status:empty { display: none; }
.wsw-signin { max-width: 360px; margin-top: 24px; }
.wsw-section { margin-top: 32px; }
.wsw-invites, .wsw-leave-banks { list-style: none; padding: 0; margin: 0; }
.wsw-invites li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.wsw-invite-main { display: grid; gap: 2px; min-width: 0; }
.wsw-invite-sub { font-size: 14px; }
.wsw-leave-banks li { padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
button.wsw-link { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.wsw-onboarding:empty { display: none; }
.wsw-menu-links { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.wsw-menu-part { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }

.wsw-header-controls { display: flex; align-items: center; gap: 8px; min-width: 0; justify-self: end; }
.wsw-notifications { position: relative; flex: none; }
.wsw-notifications summary { display: grid; place-items: center; position: relative; width: 44px; height: 44px; border-radius: var(--radius-sm); cursor: pointer; }
.wsw-notifications summary::-webkit-details-marker { display: none; }
.wsw-notifications summary:focus-visible, .wsw-notice-dismiss:focus-visible { outline: 2px solid var(--cash-deep); outline-offset: -2px; }
.wsw-notifications[data-active="true"] summary::after { content: ""; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border: 2px solid var(--paper); border-radius: 50%; background: var(--cash-deep); }
.wsw-notifications-panel { position: fixed; z-index: 4; top: 72px; right: 12px; box-sizing: border-box; width: min(388px, calc(100vw - 24px)); max-height: min(65dvh, 480px); overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.wsw-notifications-panel h2 { font-size: 18px; margin: 0; }
.wsw-notifications-panel ul { padding: 0; margin: 0; list-style: none; }
.wsw-notifications-panel li { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.wsw-notifications-panel time { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-muted); }
#notification-status:empty { display: none; }
.wsw-toasts { position: fixed; z-index: 5; bottom: calc(70px + env(safe-area-inset-bottom)); right: 12px; display: grid; gap: 8px; width: min(360px, calc(100vw - 24px)); max-height: 38dvh; overflow: auto; overscroll-behavior: contain; }
.wsw-toasts:empty { display: none; }
.wsw-notifications[open] ~ .wsw-toasts { display: none; }
.wsw-notice { display: flex; align-items: flex-start; gap: 8px; overflow-wrap: anywhere; }
.wsw-toasts .wsw-notice { box-sizing: border-box; padding: 8px 8px 8px 12px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm); }
.wsw-toasts .wsw-notice-error { border-inline-start: 4px solid var(--oops); }
.wsw-notice-copy { flex: 1; min-width: 0; }
.wsw-notice p { margin: 0; }
.wsw-notice progress { display: block; width: 100%; margin-top: 6px; accent-color: var(--cash-deep); }
.wsw-notice-spinner { flex: none; width: 12px; height: 12px; margin-top: 5px; border: 2px solid var(--line); border-top-color: var(--cash-deep); border-radius: 50%; animation: wsw-notice-turn 900ms linear infinite; }
.wsw-notice [hidden] { display: none; }
.wsw-notice-dismiss { flex: none; min-width: 44px; min-height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit; font-size: 24px; cursor: pointer; }
.wsw-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes wsw-notice-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wsw-notice-spinner { animation: none; } }
@media (min-width: 1040px) {
  .wsw-notifications-panel { position: absolute; top: 100%; right: 0; }
  .wsw-toasts { right: 24px; bottom: 24px; }
}


.wsw-tag-editor { position: relative; }
.wsw-tag-entry { display: grid; gap: 4px; }
.wsw-tag-chips, .wsw-tag-suggestions { list-style: none; padding: 0; margin: 0; }
.wsw-tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wsw-tag-chip { display: inline-flex; align-items: center; padding: 2px 6px 2px 10px; gap: 5px; border-radius: 16px; background: var(--cash-soft); overflow-wrap: anywhere; }
.wsw-tag-chip button { background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer; min-width: 30px; min-height: 30px; }
.wsw-tag-suggestions { position: absolute; inset-inline: 0; z-index: 2; max-height: 210px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 16px #0002; }
.wsw-tag-suggestions li { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; gap: 8px; min-height: 40px; box-sizing: border-box; cursor: pointer; overflow-wrap: anywhere; }
.wsw-tag-suggestions li:hover, .wsw-tag-suggestions [aria-selected=true] { background: var(--cash-soft); }
.wsw-tag-suggestions li span { color: var(--ink-muted); font-size: 0.8em; }
