:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #172b27;
  background: #f3f5ee;
  font-synthesis: none;
  --ink: #172b27;
  --quiet: #4b645b;
  --green: #16624d;
  --green-dark: #113c33;
  --soft: #e7f1e8;
  --line: #d4dfd5;
  --white: #fcfdfa;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #27937a;
  outline-offset: 3px;
}
a { color: var(--green); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, p, a, strong, .pill { overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); letter-spacing: -.05em; line-height: 1.02; }
h2 { font-size: 1.38rem; letter-spacing: -.025em; line-height: 1.2; }
h3 { font-size: 1.04rem; }
p { line-height: 1.55; }
.frame { width: min(1120px, 100% - 40px); margin-inline: auto; }
.top { background: var(--green-dark); color: #fff; }
.top-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; line-height: 1.2; }
.brand-mark {
  display: grid; place-items: center; min-width: 36px; height: 36px;
  padding: 4px; border-radius: 9px; background: #dbecc2; color: #173e32;
  font-weight: 850; font-size: .74rem; letter-spacing: -.035em;
}
main { padding-block: clamp(28px, 5.5vw, 62px) 48px; }
.initial { color: var(--quiet); }
.welcome {
  min-height: min(560px, 75vh); display: grid; align-items: center;
  grid-template-columns: 1.05fr minmax(280px, .95fr); gap: clamp(24px, 7vw, 100px);
}
.intro h1 { max-width: 560px; font-size: clamp(2.45rem, 6.4vw, 4.7rem); }
.intro > p:last-child { margin-top: 18px; max-width: 32rem; color: var(--quiet); font-size: 1.07rem; }
.eyebrow { color: var(--green); font-size: .73rem; font-weight: 800; letter-spacing: .14em; margin-bottom: 10px; }
.quiet { color: var(--quiet); }
.small { font-size: .88rem; }
.heading { margin-bottom: 24px; }
.heading > p:last-child, .card > p { margin-top: 8px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: 15px;
  padding: clamp(16px, 3vw, 25px); min-width: 0;
}
.auth-card { box-shadow: 0 18px 55px #183d2912; }
.auth-card form, dialog form { margin-top: 18px; }
form { display: grid; align-content: start; gap: 13px; }
label { min-width: 0; display: grid; align-content: start; gap: 5px; font-size: .9rem; font-weight: 650; }
input:not([type="checkbox"]), select {
  width: 100%; min-width: 0; min-height: 45px; padding: 9px 11px;
  border-radius: 8px; border: 1px solid #aebfb3; background: #fff; color: var(--ink);
}
input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--green); }
fieldset { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 8px; }
legend { color: var(--quiet); font-weight: 650; padding: 0 4px; font-size: .89rem; }
.weights { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 108px), 1fr)); gap: 8px; }
.weights label { font-size: .83rem; overflow-wrap: anywhere; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 10px; }
.button {
  border: 1px solid transparent; border-radius: 8px; min-height: 44px;
  padding: 8px 12px; font-weight: 700; font-size: .88rem; text-align: center;
}
.primary { background: var(--green); color: #fff; }
.primary:hover { background: #124e40; }
.secondary { background: #edf3eb; border-color: var(--line); color: #184d40; }
.secondary:hover { background: #e1ecdf; }
.top-button { color: #fff; border-color: #73938a; background: transparent; }
.top-button:hover { background: #ffffff18; }
.text-button { display: inline-flex; align-items: center; min-height: 44px; background: none; border: 0; padding: 4px 0; color: var(--green); font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.auth-card .text-button { margin-top: 9px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.message { border-radius: 8px; padding: 10px 12px; background: var(--soft); color: #174735; font-size: .9rem; }
.message.error { background: #f7e9e2; color: #762e25; }
.auth-card .message { margin-top: 11px; }
.dashboard-message { margin-bottom: 14px; position: sticky; top: 6px; z-index: 2; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); gap: 10px; margin-bottom: 17px; }
.tile { min-width: 0; padding: 13px 15px; background: #e7efe3; border: 1px solid #d6e4d4; border-radius: 11px; }
.tile span { color: var(--quiet); font-size: .85rem; }
.tile strong { display: block; margin-top: 5px; font-size: clamp(1.16rem, 3vw, 1.65rem); font-variant-numeric: tabular-nums; line-height: 1.18; }
.sections { display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid var(--line); margin-bottom: 14px; padding-bottom: 6px; }
.sections button { min-height: 44px; border: 0; border-radius: 7px; background: transparent; padding: 7px 12px; color: var(--quiet); font-weight: 700; }
.sections button[aria-current="page"] { background: #dceadd; color: #164535; }
.sections button:hover { color: var(--ink); }
.layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1.5fr) minmax(265px, 1fr); gap: 14px; }
.stack { display: grid; align-content: start; gap: 12px; min-width: 0; }
.after-layout { margin-top: 14px; }
.card > form, .card > .rows, .card > .actions, .card > .invite { margin-top: 13px; }
.rows { display: grid; }
.row { padding-block: 12px; border-top: 1px solid var(--line); min-width: 0; }
.row:last-child { padding-bottom: 0; }
.row-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.row-heading > :first-child { min-width: min(120px, 100%); flex: 1; }
.row .actions { margin-top: 9px; }
.row form { margin-top: 11px; }
.pill { display: inline-flex; align-items: center; border-radius: 20px; background: #e7f1e8; color: #1c5844; padding: 4px 8px; font-size: .76rem; font-weight: 750; }
.pill.open { background: #f2ead9; color: #6f5122; }
.pill.paused { background: #f0e7e2; color: #744236; }
.parts { margin-top: 8px; }
.parts summary { min-height: 44px; display: list-item; align-content: center; padding: 8px 0; cursor: pointer; color: var(--green); font-size: .9rem; font-weight: 700; }
.part { display: flex; align-items: center; gap: 9px; justify-content: space-between; padding-block: 5px; border-top: 1px solid #e7eee6; }
.part span { overflow-wrap: anywhere; }
.part .button { flex: 0 0 auto; }
.invite { padding: 11px; border-radius: 8px; background: var(--soft); display: grid; gap: 8px; }
.invite input { font-family: ui-monospace, monospace; }
.doc-link { display: inline-flex; align-items: center; min-height: 44px; }
.archive-row { opacity: .8; }
.person-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person-line > :last-child { min-width: 0; overflow-wrap: anywhere; }
.person-avatar {
  display: grid; place-items: center; position: relative; overflow: hidden;
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  background: #dceadd; color: #184d40; font-size: .85rem; font-weight: 800;
}
.person-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compact-avatar { width: 30px; height: 30px; font-size: .7rem; }
.row-heading .profile-actions { margin-top: 0; }
.profile-dialog > .person-line, .profile-dialog > .profile-message { margin-top: 12px; }
.profile-dialog > .button { margin-top: 16px; }
dialog {
  width: min(450px, 100% - 30px); padding: 22px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--ink);
}
dialog::backdrop { background: #122d26a8; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-block: 13px;
}
.month-button {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 64px;
  padding: 7px;
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.month-button span { color: var(--quiet); font-size: .73rem; font-weight: 500; }
.month-button[aria-pressed="true"] { background: var(--soft); border-color: var(--green); }
.month-actions { margin-top: 10px; }
.month-actions a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.year-picker, .report-payer { width: min(100%, 230px); margin-top: 10px; }
.insights-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.insight-lines { margin-block: 4px 9px; padding-inline-start: 23px; line-height: 1.55; overflow-wrap: anywhere; }
.insight-bars { list-style: none; display: grid; gap: 9px; padding: 0; margin: 14px 0 0; }
.insight-bars li { min-width: 0; }
.insight-bar-label { display: flex; gap: 8px; justify-content: space-between; font-size: .83rem; overflow-wrap: anywhere; }
.insight-bar-label strong { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.insight-bars meter { display: block; width: 100%; height: 9px; margin-top: 3px; }
.insight-bars meter::-webkit-meter-bar { background: var(--soft); border: 0; }
.insight-bars meter::-webkit-meter-optimum-value { background: var(--green); }
.insight-bars meter::-moz-meter-bar { background: var(--green); }
.receivable-row { border-top: 1px solid var(--line); }
.share-block { padding-bottom: 8px; }
.share-block > .parts { margin-top: 0; }
.share-block .parts form { max-width: 380px; }
.mail-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 176px), 1fr));
  gap: 10px; margin-block: 12px;
}
.mail-stats div { min-width: 0; }
.mail-stats dt { color: var(--quiet); font-size: .79rem; }
.mail-stats dd { margin: 2px 0 0; overflow-wrap: anywhere; font-size: .9rem; font-weight: 650; }
.card > .pill { margin-top: 8px; }
.gmail-guide { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px 9px; }
.gmail-guide summary { min-height: 44px; align-content: center; cursor: pointer; color: var(--green); font-weight: 700; }
.gmail-steps { display: grid; gap: 7px; margin: 0 0 8px; padding-inline-start: 23px; }
.gmail-steps > li { padding: 8px; border-radius: 6px; background: var(--soft); overflow-wrap: anywhere; }
.gmail-steps p { margin-top: 4px; }
.gmail-password-example { display: block; margin-top: 6px; overflow-wrap: anywhere; }
.gmail-preview {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 7px;
  margin-top: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--white); color: var(--quiet); font-size: .78rem;
}
.mailbox-connect > form { margin-top: 8px; }
.mail-rule-editor, .mail-rule-options, .mail-rule-list { display: grid; gap: 9px; min-width: 0; }
.mail-rule { padding-block: 9px 11px; }
.mail-rule > .button { justify-self: start; }
.mailbox-row > p { margin-top: 6px; }
.mailbox-row > .mail-stats { gap: 7px; margin-block: 8px; }
.mail-invitation:not(:empty) { margin-top: 12px; }

@media (max-width: 760px) {
  .welcome { min-height: 0; grid-template-columns: 1fr; }
  .intro h1 { max-width: 560px; }
  .layout { grid-template-columns: 1fr; }
  .layout > .controls { grid-row: 1; }
  .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .insights-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 410px) {
  .frame { width: calc(100% - 24px); }
  .top-inner { align-items: flex-start; }
  .top-inner .actions { justify-content: flex-end; }
  .brand { gap: 6px; font-size: .87rem; }
  .top-button { padding-inline: 7px; font-size: .77rem; }
  .sections button { padding-inline: 8px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
