:root {
    color-scheme: light;
    --ink: #19324a;
    --muted: #66737b;
    --paper: #f7f2e9;
    --surface: #fffdf8;
    --line: #ded8cf;
    --green: #19324a;
    --green-soft: #e5ebef;
    --amber: #d9785f;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }

body { min-width: 320px; }

a { color: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1180px;
    padding: 24px 28px;
}

.brand { align-items: center; display: flex; text-decoration: none; }
.brand-logo { display: block; height: auto; max-width: 100%; width: 172px; }
.phase-pill { background: var(--green-soft); border-radius: 999px; color: var(--green); font-size: .76rem; font-weight: 700; padding: 8px 12px; text-transform: uppercase; }
.topbar-actions { align-items: center; display: flex; gap: 18px; }
.topbar-actions a { color: var(--muted); font-size: .86rem; font-weight: 700; text-decoration: none; }
.topbar-actions a:hover { color: var(--green); }
.topbar-actions .access-link { background: var(--ink); border-radius: 999px; color: white; padding: 11px 20px; }
.topbar-actions .access-link:hover { background: #284b69; color: white; }

main { margin: 0 auto; max-width: 1180px; padding: 48px 28px 96px; }

.family-home { padding-bottom: 24px; }
.family-hero { align-items: center; display: grid; gap: clamp(52px, 9vw, 120px); grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); min-height: 620px; padding: 38px 0 76px; }
.family-hero-copy h1 { font-size: clamp(4.4rem, 8.4vw, 7.8rem); margin-bottom: 32px; }
.family-hero-copy h1 em { color: var(--amber); font-weight: 400; }
.family-lead { color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.14rem, 2vw, 1.42rem); line-height: 1.65; max-width: 690px; }
.family-privacy-note { align-items: center; display: flex; gap: 14px; margin-top: 36px; }
.family-privacy-note span { background: var(--amber); display: block; height: 1px; width: 54px; }
.family-privacy-note p { color: var(--ink); font-size: .78rem; font-weight: 800; letter-spacing: .08em; margin: 0; text-transform: uppercase; }
.family-emblem { align-items: center; aspect-ratio: 1; display: flex; justify-content: center; margin: 0 auto; max-width: 470px; position: relative; width: 100%; }
.family-emblem::before { background: radial-gradient(circle at 32% 28%, #fffdf8 0 20%, #efe2d1 66%, #e5d3be 100%); border-radius: 44% 56% 52% 48% / 45% 42% 58% 55%; content: ""; inset: 10%; position: absolute; transform: rotate(-7deg); }
.family-emblem img { filter: drop-shadow(0 22px 30px rgba(25, 50, 74, .13)); position: relative; width: 54%; z-index: 2; }
.family-orbit { border: 1px solid rgba(25, 50, 74, .18); border-radius: 50%; position: absolute; }
.family-orbit-outer { inset: 0; }
.family-orbit-inner { border-color: rgba(217, 120, 95, .34); inset: 6%; }
.family-emblem p { bottom: 4%; color: var(--ink); display: grid; margin: 0; position: absolute; right: 0; text-align: right; z-index: 3; }
.family-emblem p span { font-size: .67rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.family-emblem p strong { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-style: italic; font-weight: 400; }
.family-values { border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); }
.family-values article { min-height: 220px; padding: 34px 34px 38px; }
.family-values article + article { border-left: 1px solid var(--line); }
.family-values article > span { color: var(--amber); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.family-values h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 500; letter-spacing: -.035em; margin: 40px 0 12px; }
.family-values p { color: var(--muted); line-height: 1.6; margin: 0; max-width: 290px; }
.family-quote { margin: 0 auto; max-width: 920px; padding: 110px 24px 42px; text-align: center; }
.family-quote blockquote { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.3rem, 5.4vw, 4.8rem); font-weight: 400; letter-spacing: -.045em; line-height: 1.08; margin: 0; }
.family-quote figcaption { color: var(--amber); font-size: .72rem; font-weight: 800; letter-spacing: .18em; margin-top: 28px; text-transform: uppercase; }

.hero { align-items: end; display: grid; gap: 48px; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .65fr); padding: 44px 0 64px; }
.eyebrow { color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .14em; margin: 0 0 16px; }
h1, h2, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 6vw, 5.6rem); font-weight: 500; letter-spacing: -.055em; line-height: .98; margin-bottom: 28px; max-width: 900px; }
.lead { color: var(--muted); font-size: clamp(1rem, 2vw, 1.22rem); line-height: 1.65; max-width: 720px; }
.status-card { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; display: flex; gap: 14px; padding: 20px; }
.status-card strong, .status-card small { display: block; }
.status-card small { color: var(--muted); line-height: 1.4; margin-top: 4px; }
.status-dot { background: #38a66c; border: 5px solid #d9f1e4; border-radius: 50%; flex: 0 0 auto; height: 20px; width: 20px; }

.today-grid { display: grid; gap: 20px; grid-template-columns: 1.3fr .7fr; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; min-height: 280px; padding: 30px; }
.panel.accent { background: var(--ink); border-color: var(--ink); color: white; }
.panel-kicker { color: var(--amber); display: block; font-size: .74rem; font-weight: 800; letter-spacing: .1em; margin-bottom: 32px; text-transform: uppercase; }
.panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-weight: 500; letter-spacing: -.03em; }
.panel p { color: #c6d0ca; line-height: 1.55; max-width: 600px; }
.metric-row { align-items: baseline; display: flex; gap: 14px; margin-top: 32px; }
.metric-row strong { font-size: 2rem; }
.metric-row span, .panel small { color: #a9b8b0; }
.split-bar { border-radius: 999px; display: flex; height: 9px; margin: 14px 0 10px; overflow: hidden; }
.split-bar span:nth-child(1) { background: #6fc196; }
.split-bar span:nth-child(2) { background: #f1c66e; }
.split-bar span:nth-child(3) { background: #d9e4df; }
.clean-list { list-style: none; margin: 24px 0 0; padding: 0; }
.clean-list li { border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 16px 0; }
.clean-list strong { color: var(--green); font-size: .8rem; text-align: right; }

.modules { padding-top: 72px; }
.section-heading { align-items: end; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 24px; }
.section-heading h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 500; letter-spacing: -.04em; margin-bottom: 0; }
.section-heading > span { color: var(--muted); font-size: .84rem; }
.module-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.module-grid article { background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.module-grid strong, .module-grid small { display: block; }
.module-grid small { color: var(--muted); line-height: 1.4; margin-top: 7px; }
.module-icon { align-items: center; background: var(--green-soft); border-radius: 10px; color: var(--green); display: flex; font-weight: 800; height: 34px; justify-content: center; margin-bottom: 24px; width: 34px; }
.empty-state { margin: 14vh auto; max-width: 620px; text-align: center; }
.empty-state h1 { font-size: clamp(2.4rem, 7vw, 4.8rem); }
.primary-link { background: var(--ink); border-radius: 999px; color: white; display: inline-block; margin-top: 18px; padding: 12px 18px; text-decoration: none; }
.secondary-link { border: 1px solid var(--line); border-radius: 999px; color: var(--green); display: inline-block; font-weight: 700; padding: 11px 17px; text-decoration: none; }
.dashboard-heading { align-items: end; display: flex; justify-content: space-between; margin-bottom: 36px; }
.dashboard-heading h1 { font-size: clamp(2.8rem, 7vw, 5rem); margin-bottom: 16px; }
.dashboard-heading .lead { margin-bottom: 0; }
.members-preview { padding-top: 64px; }
.member-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.member-card { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: flex; gap: 14px; padding: 18px; }
.member-card strong, .member-card small { display: block; }
.member-card small { color: var(--muted); margin-top: 4px; }
.avatar { align-items: center; background: var(--green-soft); border-radius: 50%; color: var(--green); display: flex; flex: 0 0 auto; font-size: .78rem; font-weight: 800; height: 42px; justify-content: center; width: 42px; }
.auth-shell { align-items: start; display: grid; gap: clamp(40px, 8vw, 110px); grid-template-columns: 1.2fr .8fr; padding-top: 7vh; }
.auth-shell h1 { font-size: clamp(2.8rem, 7vw, 5rem); }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; display: grid; gap: 18px; padding: 28px; }
.form-card.compact { align-self: start; }
.form-card h2 { margin-bottom: 4px; }
.form-card label { color: var(--muted); display: grid; font-size: .78rem; font-weight: 700; gap: 7px; }
.form-card input, .form-card select, .member-access-card input, .member-access-card select { background: white; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font: inherit; padding: 12px; width: 100%; }
.form-card button, .member-access-card button, .primary-button { background: var(--ink); border: 0; border-radius: 999px; color: white; cursor: pointer; font: inherit; font-weight: 700; padding: 13px 18px; }
.form-card small, .form-footnote { color: var(--muted); font-size: .78rem; line-height: 1.5; margin: 0; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.notice { border-radius: 12px; font-size: .88rem; line-height: 1.5; padding: 12px 14px; }
.notice.success { background: var(--green-soft); color: var(--green); }
.notice.error { background: #f9dfdc; color: #8d2f25; }
.primary-button { margin-top: 18px; }
.admin-grid { display: grid; gap: 24px; grid-template-columns: minmax(250px, .65fr) minmax(0, 1.35fr); }
.member-stack { display: grid; gap: 12px; }
.member-access-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.member-access-card > div strong, .member-access-card > div small { display: block; }
.member-access-card > div small { color: var(--muted); margin-top: 4px; }
.member-access-card form { display: grid; gap: 10px; grid-template-columns: 1fr 160px auto; margin-top: 18px; }
.notification-list { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; list-style: none; margin: 0; overflow: hidden; padding: 0; }
.notification-list li { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 18px; justify-content: space-between; padding: 18px 20px; }
.notification-list li:first-child { border-top: 0; }
.notification-list li.unread { box-shadow: inset 4px 0 var(--amber); }
.notification-list p { color: var(--muted); margin: 4px 0 0; }
.notification-list a { color: var(--green); font-size: .82rem; font-weight: 700; }
.account-stack { display: grid; gap: 12px; }
.account-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.account-card-heading { align-items: start; display: flex; gap: 20px; justify-content: space-between; }
.account-card-heading strong, .account-card-heading small { display: block; }
.account-card-heading small { color: var(--muted); margin-top: 5px; }
.account-balance { color: var(--green); font-size: 1.2rem; white-space: nowrap; }
.account-card details { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.account-card summary { color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 700; }
.expense-stack { display: grid; gap: 12px; }
.expense-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.expense-progress { background: var(--green-soft); border-radius: 999px; height: 7px; margin: 18px 0 10px; overflow: hidden; }
.expense-progress span { background: var(--green); display: block; height: 100%; }
.mobile-nav { display: none; }
.tablet-split { display: grid; gap: 24px; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); }

@media (min-width: 900px) and (max-width: 1180px) {
    main { padding-left: 36px; padding-right: 36px; }
    .tablet-split { grid-template-columns: minmax(300px, .85fr) minmax(0, 1.15fr); }
    .tablet-split > * { min-width: 0; }
    .topbar-actions { gap: 11px; }
    .topbar-actions a { font-size: .76rem; }
}

@media (max-width: 820px) {
    .topbar { padding: 18px 20px; }
    .brand-logo { width: 148px; }
    main { padding: 16px 18px 100px; }
    .hero { display: block; padding: 28px 0 42px; }
    .family-hero { display: flex; flex-direction: column; min-height: 0; padding: 34px 0 64px; }
    .family-hero-copy h1 { font-size: clamp(3.8rem, 18vw, 6rem); }
    .family-emblem { max-width: 390px; order: 2; width: 90%; }
    .family-values { grid-template-columns: 1fr; }
    .family-values article { min-height: 0; padding: 28px 4px; }
    .family-values article + article { border-left: 0; border-top: 1px solid var(--line); }
    .family-values h2 { margin-top: 24px; }
    .family-quote { padding: 76px 0 22px; }
    h1 { font-size: clamp(2.7rem, 13vw, 4.6rem); }
    .status-card { margin-top: 32px; }
    .today-grid { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-heading { align-items: start; flex-direction: column; gap: 18px; }
    .member-grid { grid-template-columns: repeat(2, 1fr); }
    .auth-shell, .admin-grid, .tablet-split { grid-template-columns: 1fr; }
    .member-access-card form { grid-template-columns: 1fr; }
    .section-heading { align-items: start; flex-direction: column; }
    .mobile-nav { backdrop-filter: blur(16px); background: rgba(255,254,249,.9); border-top: 1px solid var(--line); bottom: 0; display: grid; font-size: .67rem; grid-template-columns: repeat(5, 1fr); left: 0; padding: 12px 8px max(12px, env(safe-area-inset-bottom)); position: fixed; right: 0; text-align: center; z-index: 20; }
    .mobile-nav a { text-decoration: none; }
    .mobile-nav .active { color: var(--green); font-weight: 800; }
}

@media (max-width: 470px) {
    .phase-pill { display: none; }
    .panel { border-radius: 20px; padding: 24px; }
    .module-grid { grid-template-columns: 1fr; }
    .member-grid { grid-template-columns: 1fr; }
    .family-privacy-note { align-items: start; }
    .family-privacy-note span { margin-top: 8px; width: 34px; }
    .family-privacy-note p { line-height: 1.5; }
}
