:root {
  color-scheme: light;
  --primary-hue: 160deg;
  --secondary-offset: -30deg;
  --tertiary-offset: 30deg;
  --complementary-offset: 180deg;
  --success-offset: -120deg;
  --warning-offset: 60deg;
  --danger-offset: 180deg;
  --secondary-hue: calc(var(--primary-hue) + var(--secondary-offset));
  --tertiary-hue: calc(var(--primary-hue) + var(--tertiary-offset));
  --complementary-hue: calc(var(--primary-hue) + var(--complementary-offset));
  --success-hue: calc(var(--primary-hue) + var(--success-offset));
  --warning-hue: calc(var(--primary-hue) + var(--warning-offset));
  --danger-hue: calc(var(--primary-hue) + var(--danger-offset));
  --primary: oklch(.58 .20 var(--primary-hue));
  --primary-hover: oklch(.51 .18 var(--primary-hue));
  --primary-soft: oklch(.96 .035 var(--primary-hue));
  --primary-outline: oklch(.82 .075 var(--primary-hue));
  --success: oklch(.60 .14 var(--success-hue));
  --danger: oklch(.56 .16 var(--danger-hue));
  --ink: oklch(.22 .025 var(--primary-hue));
  --muted: oklch(.48 .035 var(--primary-hue));
  --line: oklch(.86 .025 var(--primary-hue));
  --surface: oklch(.995 .004 var(--primary-hue));
  --surface-secondary: oklch(.975 .012 var(--primary-hue));
  --background: oklch(.965 .012 var(--primary-hue));
  --grid: oklch(.91 .018 var(--primary-hue));
  --shadow: 0 2px 0 oklch(.28 .035 var(--primary-hue) / .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background-color: var(--background); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 32px 32px; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.topbar { height: 68px; padding: 0 clamp(20px, 5vw, 72px); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { width: 34px; height: 34px; border: 1px solid var(--primary-outline); background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.brand-light { font-weight: 450; color: var(--muted); }
.account { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 68px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 760; color: var(--primary); }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin: 0 0 26px; gap: 20px; }
h1, h2, h3, p { margin-top: 0; }
.page-heading h1 { margin: 8px 0 6px; font-size: clamp(30px, 4vw, 42px); line-height: 1.05; letter-spacing: -.055em; }
.heading-period { color: var(--primary); }
.muted { color: var(--muted); margin: 0; font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; cursor: pointer; font-weight: 690; font-size: 13px; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .6; cursor: wait; }
.button-primary { background: var(--primary); color: white; box-shadow: var(--shadow); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { color: var(--ink); background: var(--primary-soft); border-color: var(--primary-outline); }
.button-secondary:hover { border-color: var(--primary); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.text-button { border: 0; padding: 5px 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 650; }
.text-button:hover { color: var(--primary); }
.scope-bar { display: flex; width: max-content; border: 1px solid var(--line); background: var(--surface); margin-bottom: 15px; }
.scope-tab { position: relative; border: 0; border-right: 1px solid var(--line); padding: 11px 18px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 670; }
.scope-tab:last-child { border-right: 0; }
.scope-tab.is-active { color: var(--ink); background: var(--primary-soft); box-shadow: inset 0 -2px var(--primary); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card, .panel, .card { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.summary-card { min-height: 126px; padding: 17px 19px; display: flex; flex-direction: column; align-items: flex-start; }
.summary-label { color: var(--muted); font-size: 11px; font-weight: 650; margin-bottom: 11px; }
.summary-card strong { font-size: 24px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.summary-caption { color: var(--muted); font-size: 11px; margin-top: 6px; }
.content-grid { display: grid; grid-template-columns: minmax(290px, .82fr) minmax(0, 1.18fr); gap: 16px; align-items: start; }
.panel { padding: 20px; min-width: 0; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-heading h2, .family-title h2, .family-empty h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.04em; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 680; }
.field input, .field select { width: 100%; min-height: 43px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; color: var(--ink); outline: 0; font-size: 13px; font-weight: 500; }
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px oklch(.72 .12 var(--primary-hue) / .2); }
.field input::placeholder { color: oklch(.68 .025 var(--primary-hue)); }
#expenseForm { display: grid; gap: 16px; }
.amount-input { display: flex; align-items: center; min-height: 48px; border: 1px solid var(--line); background: var(--surface); padding-left: 12px; color: var(--muted); font-size: 15px; }
.amount-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px oklch(.72 .12 var(--primary-hue) / .2); }
.amount-input input { border: 0; box-shadow: none; font-size: 20px; font-weight: 650; padding-left: 8px; height: 46px; font-variant-numeric: tabular-nums; }
.amount-input input:focus { box-shadow: none; }
.family-fields { padding: 12px; background: var(--surface-secondary); border-left: 2px solid var(--primary-outline); }
.form-actions { display: flex; gap: 8px; }
.save-button { flex: 1; }
.form-footnote { margin: 15px 0 0; color: var(--muted); font-size: 10px; }
.content-grid > .family-panel { grid-column: 1 / -1; }
.family-summary, .family-empty { padding: 1px 0; }
.family-title { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.family-title p, .family-empty p { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.invite-box { border: 1px solid var(--line); background: var(--surface-secondary); padding: 10px 14px; min-width: 150px; display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: center; }
.invite-box span { color: var(--muted); font-size: 10px; grid-column: 1 / -1; }
.invite-box strong { font-size: 17px; letter-spacing: .13em; }
.member-list { margin-top: 17px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.member { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); padding: 8px; font-size: 11px; min-width: 0; }
.avatar { width: 27px; height: 27px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 750; flex: none; }
.member em { color: var(--muted); font-style: normal; }
.member-role { margin-left: auto; color: var(--muted); font-size: 10px; }
.family-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.inline-form { display: flex; gap: 9px; align-items: end; }
.inline-form .field { flex: 1; }
.inline-form .button { white-space: nowrap; }
.list-controls { display: flex; align-items: center; gap: 7px; }
.list-controls select { border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 34px; padding: 0 25px 0 9px; font-size: 11px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 20px; cursor: pointer; }
.icon-button:hover { color: var(--primary); border-color: var(--primary-outline); }
.icon-button.is-loading { animation: rotate .65s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }
.expense-list { display: grid; }
.expense-row { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 73px; border-top: 1px solid var(--line); }
.expense-date { width: 39px; height: 43px; background: var(--surface-secondary); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.expense-date strong { font-size: 14px; line-height: 1.05; }
.expense-date span { color: var(--muted); font-size: 9px; text-transform: uppercase; margin-top: 3px; }
.expense-main { min-width: 0; display: grid; gap: 5px; }
.expense-main > strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-meta { display: flex; gap: 9px; color: var(--muted); font-size: 10px; }
.expense-amount { font-size: 13px; font-weight: 720; font-variant-numeric: tabular-nums; white-space: nowrap; }
.expense-actions { display: flex; flex-direction: column; gap: 0; align-items: end; }
.expense-actions .text-button { font-size: 10px; }
.delete-action:hover { color: var(--danger); }
.empty-state { text-align: center; padding: 38px 12px; }
.empty-mark { width: 34px; height: 34px; margin: 0 auto 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 17px; }
.empty-state h3 { font-size: 15px; margin: 0 0 7px; }
.empty-state p { max-width: 310px; margin: 0 auto; color: var(--muted); font-size: 11px; line-height: 1.6; }
.notice { border: 1px solid var(--line); padding: 11px 14px; margin: 0 0 14px; background: var(--surface); color: var(--ink); font-size: 12px; }
.notice[data-kind="error"] { border-color: oklch(.8 .1 var(--danger-hue)); background: oklch(.97 .025 var(--danger-hue)); }
.notice[data-kind="success"] { border-color: oklch(.8 .08 var(--success-hue)); background: oklch(.97 .025 var(--success-hue)); }
.signed-out { width: min(550px, 100%); margin: 7vh auto; padding: clamp(26px, 6vw, 54px); border-top: 3px solid var(--primary); }
.signed-out h1 { font-size: clamp(38px, 8vw, 64px); line-height: .99; letter-spacing: -.06em; margin: 15px 0; }
.signed-out h1 span { color: var(--primary); }
.signed-out p { max-width: 370px; color: var(--muted); line-height: 1.7; font-size: 14px; margin-bottom: 22px; }
.signed-out-foot { margin-top: 35px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 7px; }
.install-notice { margin-top: 15px; padding: 11px; background: var(--surface-secondary); color: var(--muted); font-size: 12px; }
.footer { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 15px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; display: flex; justify-content: space-between; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
::selection { background: var(--primary-soft); color: var(--ink); }
input[type="date"]::-webkit-calendar-picker-indicator { accent-color: var(--primary); }
input[type="number"]::-webkit-inner-spin-button { opacity: .55; }
@media (max-width: 760px) {
  .shell { padding-top: 34px; }
  .content-grid { grid-template-columns: 1fr; }
  .content-grid > .family-panel { grid-column: auto; }
  .summary-card { min-height: 112px; padding: 14px; }
  .summary-card strong { font-size: 20px; }
  .family-actions { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .topbar { height: 58px; padding: 0 16px; }
  .shell { width: calc(100% - 28px); padding-top: 28px; }
  .page-heading { align-items: start; }
  .page-heading .button { font-size: 0; padding: 0; width: 42px; height: 42px; flex: none; }
  .page-heading .button span { font-size: 20px; }
  .summary-grid { gap: 7px; }
  .summary-card { padding: 11px 9px; min-height: 102px; }
  .summary-label { font-size: 9px; margin-bottom: 8px; }
  .summary-card strong { font-size: 17px; }
  .summary-caption { font-size: 9px; }
  .panel { padding: 15px; }
  .recent-heading { flex-direction: column; }
  .expense-row { grid-template-columns: 39px minmax(0, 1fr) auto; gap: 8px; padding: 7px 0; }
  .expense-actions { grid-column: 2 / -1; flex-direction: row; gap: 12px; margin-top: -5px; }
  .family-title { align-items: start; flex-direction: column; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form .button { width: 100%; }
  .footer { width: calc(100% - 28px); }
}
