:root {
    --paper: #f5efe7;
    --paper-deep: #eee4d9;
    --surface: #fffdf9;
    --surface-warm: #fbf5ee;
    --ink: #2c1d1c;
    --muted: #75625e;
    --line: #dfd0c3;
    --line-strong: #cbb6a5;
    --maroon: #6f2638;
    --maroon-dark: #4c1826;
    --maroon-soft: #f0dfe3;
    --brown: #8a5943;
    --brown-soft: #ead7c8;
    --gold: #c79a52;
    --green: #56745f;
    --green-soft: #dfe9e1;
    --red: #9f3d43;
    --red-soft: #f2dddd;
    --orange: #a9652e;
    --orange-soft: #f1e2d2;
    --shadow: 0 18px 45px rgba(65, 37, 31, 0.09);
    --shadow-small: 0 8px 24px rgba(65, 37, 31, 0.08);
    --radius: 18px;
    --radius-small: 12px;
    --content: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body::selection { background: var(--maroon-soft); color: var(--maroon-dark); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
[hidden] { display: none !important; }
.icon { flex: 0 0 auto; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: -0.025em;
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.04; margin-bottom: .65rem; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.12; margin-bottom: .45rem; }
h3 { font-size: 1.15rem; line-height: 1.2; }
small { color: var(--muted); }
.eyebrow {
    display: inline-block;
    margin-bottom: .45rem;
    color: var(--maroon);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.eyebrow-light { color: #f4c9d2; }
.text-link, .inline-link {
    color: var(--maroon);
    font-weight: 750;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}
.inline-link { display: inline-flex; align-items: center; gap: .25rem; }
.inline-link-light { color: #fff5f2; }
.income-text { color: var(--green); }
.expense-text { color: var(--red); }
.desktop-only { display: none !important; }

/* Brand */
.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}
.brand-mark {
    display: grid;
    width: 40px;
    height: 44px;
    place-items: center;
    color: #fff;
    background: var(--maroon);
    border-radius: 50% 50% 46% 54% / 48% 48% 52% 52%;
    font: 700 1.25rem/1 Georgia, serif;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
    transform: rotate(-3deg);
}
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { font-family: Georgia, serif; font-size: 1.05rem; }
.brand small { margin-top: .25rem; font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
.brand-light strong, .brand-light small { color: #fff; }
.brand-light .brand-mark { background: #fff4ec; color: var(--maroon); }

/* Buttons */
.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 780;
    line-height: 1;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled, .button.is-loading { opacity: .65; pointer-events: none; }
.button-primary { color: #fff; background: var(--maroon); border-color: var(--maroon); }
.button-primary:hover { background: var(--maroon-dark); }
.button-outline { color: var(--maroon); background: transparent; border-color: var(--line-strong); }
.button-outline:hover { background: var(--surface); border-color: var(--maroon); }
.button-soft { color: var(--maroon); background: var(--maroon-soft); }
.button-danger { color: var(--red); background: var(--red-soft); border-color: #e7bfc1; }
.button-block { width: 100%; }
.button-large { min-height: 50px; padding-inline: 1.35rem; }
.icon-button {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 50%;
}
.icon-button:hover { color: var(--maroon); border-color: var(--maroon); }
.icon-button.disabled { opacity: .35; pointer-events: none; }
.text-button {
    padding: 0;
    color: var(--maroon);
    background: transparent;
    border: 0;
    font-weight: 800;
}

/* Alerts */
.notice {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border: 1px solid;
    border-radius: var(--radius-small);
    font-size: .9rem;
}
.notice div { display: grid; gap: .1rem; }
.notice span { display: block; }
.notice-success { color: #355243; background: var(--green-soft); border-color: #bdd0c2; }
.notice-warning { color: #71451e; background: var(--orange-soft); border-color: #dfc19e; }
.notice-error { color: #772e34; background: var(--red-soft); border-color: #dfb4b7; }
.field-error { margin: .35rem 0 0; color: var(--red); font-size: .85rem; }

/* Forms */
.form-stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .45rem; }
.field > span, fieldset > legend {
    color: var(--ink);
    font-size: .84rem;
    font-weight: 750;
}
.field em { color: var(--muted); font-style: normal; font-weight: 500; }
.field input, .field select, .field textarea,
.search-field input, .filter-panel select, .research-filter select,
.research-period-form select {
    width: 100%;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.field input, .field select, .search-field input, .filter-panel select, .research-filter select, .research-period-form select {
    min-height: 48px;
    padding: .72rem .85rem;
}
.field textarea { padding: .8rem .9rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
.search-field input:focus, .filter-panel select:focus, .research-filter select:focus,
.research-period-form select:focus {
    border-color: var(--maroon);
    box-shadow: 0 0 0 3px rgba(111, 38, 56, .1);
}
.input-wrap {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 48px;
    padding-left: .85rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
}
.input-wrap:focus-within { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(111, 38, 56, .1); }
.input-wrap input { min-width: 0; flex: 1; min-height: 46px; padding: .7rem 0; background: transparent; border: 0; outline: 0; }
.input-wrap .icon { color: var(--muted); }
.input-action { display: grid; width: 46px; height: 46px; place-items: center; color: var(--muted); background: transparent; border: 0; }
.form-row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.check-row { display: inline-flex; align-items: center; gap: .5rem; }
.check-row input { accent-color: var(--maroon); }
.money-input {
    display: flex;
    align-items: center;
    min-height: 52px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    overflow: hidden;
}
.money-input:focus-within { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(111,38,56,.1); }
.money-input > span {
    align-self: stretch;
    display: grid;
    min-width: 52px;
    place-items: center;
    color: var(--maroon);
    background: var(--maroon-soft);
    font-weight: 800;
}
.money-input input { min-height: 50px; border: 0; border-radius: 0; box-shadow: none !important; }
.form-note {
    padding: .85rem 1rem;
    color: var(--muted);
    background: var(--paper-deep);
    border-left: 4px solid var(--brown);
    font-size: .9rem;
}
.character-count { justify-self: end; }
.search-field {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
    padding-left: .85rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
}
.search-field input { min-width: 0; border: 0; background: transparent; box-shadow: none; }
.search-field .icon { color: var(--muted); }
.otp-input {
    height: 70px;
    text-align: center;
    color: var(--maroon) !important;
    font-family: Georgia, serif !important;
    font-size: 2rem !important;
    font-weight: 800;
    letter-spacing: .4em;
}

/* Guest / Auth */
.guest-body {
    min-height: 100vh;
    background: var(--maroon);
}
.guest-body::before,
.guest-body::after {
    position: fixed;
    content: "";
    pointer-events: none;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50%;
}
.guest-body::before { width: 280px; height: 280px; top: -120px; right: -100px; }
.guest-body::after { width: 180px; height: 180px; bottom: -80px; left: -70px; }
.guest-shell {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 100vh;
    align-content: center;
    gap: 1.4rem;
    width: min(100%, 500px);
    margin: 0 auto;
    padding: 2rem 1rem;
}
.guest-shell > .brand { margin-left: .25rem; }
.guest-panel {
    padding: clamp(1.4rem, 6vw, 2.2rem);
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 6px 26px 6px 26px;
    box-shadow: 0 28px 65px rgba(40, 15, 21, .25);
}
.auth-heading { margin-bottom: 1.45rem; }
.auth-heading h1 { font-size: clamp(2rem, 8vw, 2.65rem); }
.auth-heading p { margin-bottom: 0; color: var(--muted); }
.auth-switch { margin: 1.2rem 0 0; text-align: center; color: var(--muted); font-size: .9rem; }
.auth-switch a { color: var(--maroon); font-weight: 800; }
.resend-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .6rem; margin-top: 1rem; color: var(--muted); font-size: .9rem; }

/* Landing */
.landing-body { background: var(--paper); }
.landing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(calc(100% - 2rem), var(--content));
    margin: 0 auto;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
}
.landing-header nav { display: flex; align-items: center; gap: .8rem; }
.landing-hero {
    display: grid;
    gap: 2.5rem;
    width: min(calc(100% - 2rem), var(--content));
    margin: 0 auto;
    padding: clamp(3rem, 9vw, 7rem) 0;
}
.hero-copy { max-width: 690px; }
.hero-copy h1 { max-width: 660px; font-size: clamp(3rem, 9vw, 6.2rem); }
.hero-copy > p { max-width: 600px; color: var(--muted); font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero-note { display: flex; align-items: flex-start; gap: .8rem; max-width: 540px; margin-top: 2.3rem; }
.hero-note p { margin: 0; color: var(--muted); font-size: .9rem; }
.note-rule { width: 48px; height: 2px; margin-top: .65rem; background: var(--maroon); flex: 0 0 auto; }
.hero-ledger {
    position: relative;
    align-self: center;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-top: 7px solid var(--maroon);
    box-shadow: var(--shadow);
    transform: rotate(1deg);
}
.hero-ledger::after {
    position: absolute;
    content: "";
    inset: 12px;
    border: 1px solid rgba(111,38,56,.09);
    pointer-events: none;
}
.ledger-top, .ledger-row, .ledger-goal { position: relative; z-index: 1; }
.ledger-top { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--line-strong); }
.ledger-top span { color: var(--muted); }
.ledger-score { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 0; }
.ledger-score > div { display: grid; gap: .25rem; }
.ledger-score strong { font: 700 2.7rem/1 Georgia, serif; }
.score-ring { width: 98px; height: 98px; transform: rotate(-90deg); }
.ring-track, .ring-value { fill: none; stroke-width: 10; }
.ring-track { stroke: var(--paper-deep); }
.ring-value { stroke: var(--maroon); stroke-linecap: round; }
.ledger-row { display: flex; justify-content: space-between; padding: .75rem 0; border-top: 1px solid var(--line); }
.ledger-row span, .calendar-legend span, .chart-legend span { display: inline-flex; align-items: center; gap: .45rem; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-income { background: var(--green); }
.dot-expense { background: var(--red); }
.ledger-goal { margin-top: .8rem; padding: 1rem; background: var(--surface-warm); }
.ledger-goal > div:first-child { display: grid; gap: .15rem; }
.progress { height: 8px; margin-top: .75rem; background: var(--paper-deep); border-radius: 99px; overflow: hidden; }
.progress span, .progress i { display: block; height: 100%; background: var(--maroon); border-radius: inherit; }
.ledger-stamp {
    position: absolute;
    z-index: 2;
    right: 1rem;
    bottom: -1rem;
    padding: .25rem .55rem;
    color: var(--maroon);
    background: var(--surface);
    border: 2px solid var(--maroon);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .12em;
    transform: rotate(-7deg);
}
.landing-flow { padding: clamp(3rem, 8vw, 6rem) max(1rem, calc((100% - var(--content))/2)); background: var(--maroon-dark); color: #fff; }
.section-heading { max-width: 650px; margin-bottom: 2rem; }
.flow-grid { display: grid; gap: 1px; background: rgba(255,255,255,.18); }
.flow-grid article { padding: 1.5rem; background: var(--maroon-dark); }
.flow-grid article > span { color: #e3aeb8; font-weight: 900; letter-spacing: .1em; }
.flow-grid h3 { margin: 1rem 0 .5rem; font-size: 1.6rem; }
.flow-grid p { margin: 0; color: #dac7c9; }
.landing-footer { display: flex; justify-content: space-between; width: min(calc(100% - 2rem), var(--content)); margin: 0 auto; padding: 2rem 0; color: var(--muted); border-top: 1px solid var(--line); }
.landing-footer span { color: var(--maroon); font-family: Georgia, serif; font-weight: 700; }
.landing-footer p { margin: 0; }

/* App shell */
.app-shell { min-height: 100vh; }
.app-main { min-width: 0; }
.mobile-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    background: rgba(245,239,231,.96);
    border-bottom: 1px solid var(--line);
}
.avatar-link {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #fff;
    background: var(--brown);
    border-radius: 50%;
    font-weight: 800;
}
.page-content {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: 1.4rem 1rem calc(7rem + env(safe-area-inset-bottom));
}
.page-heading { margin-bottom: 1.5rem; }
.page-heading p { max-width: 620px; margin-bottom: 0; color: var(--muted); }
.page-heading-split { display: flex; flex-direction: column; gap: 1rem; }
.compact-heading h1 { font-size: clamp(2rem, 7vw, 3rem); }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 750;
}
.heading-actions { display: flex; gap: .6rem; }
.paper-card {
    padding: 1.15rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-small);
}
.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.card-heading h2 { margin: 0; font-size: 1.45rem; }
.card-number, .score-card-index {
    color: var(--line-strong);
    font-family: Georgia, serif;
    font-size: 1.8rem;
    font-style: italic;
}
.dashboard-score {
    position: relative;
    display: grid;
    gap: 1rem;
    min-height: 330px;
    margin-bottom: 1rem;
    padding: 1.4rem;
    color: #fff;
    background: var(--maroon);
    border-radius: 6px 30px 6px 30px;
    overflow: hidden;
}
.dashboard-score::after {
    position: absolute;
    content: "";
    width: 180px;
    height: 180px;
    right: -75px;
    bottom: -75px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 50%;
}
.score-copy { position: relative; z-index: 1; }
.score-copy h2 { font-size: 2.2rem; }
.score-number { margin: .35rem 0 .55rem; font: 700 clamp(3.7rem, 15vw, 6rem)/.9 Georgia, serif; }
.score-number small { color: inherit; font-size: .35em; }
.score-copy p { max-width: 420px; margin: .75rem 0; color: #ead9dc; }
.score-difference { display: inline-flex; align-items: center; gap: .35rem; color: #f1dce0; font-size: .86rem; }
.score-visual { position: relative; z-index: 1; display: grid; place-items: center; justify-self: center; }
.score-ring-large { width: 140px; height: 140px; }
.ring-track-dark { stroke: rgba(255,255,255,.17); }
.ring-value-light { stroke: #f2c6cf; }
.score-visual > span { position: absolute; font: 700 1.6rem Georgia, serif; }
.score-card-index { position: absolute; top: 1rem; right: 1rem; color: rgba(255,255,255,.25); }
.status-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 26px;
    padding: .25rem .55rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 850;
}
.status-good { color: #345441; background: var(--green-soft); }
.status-calm { color: #654b22; background: #eee3c9; }
.status-watch { color: #7b471d; background: var(--orange-soft); }
.status-alert { color: #7c2c34; background: var(--red-soft); }
.status-empty { color: var(--muted); background: var(--paper-deep); }
.quick-actions { display: grid; gap: .65rem; margin-bottom: 1rem; }
.quick-actions a {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
}
.quick-actions a:hover { border-color: var(--maroon); }
.quick-actions a > span:last-child { display: grid; }
.quick-actions small { font-size: .78rem; }
.quick-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
}
.quick-income { color: var(--green); background: var(--green-soft); }
.quick-expense { color: var(--red); background: var(--red-soft); }
.quick-saving { color: var(--brown); background: var(--brown-soft); }
.dashboard-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.balance-value { display: block; margin: .4rem 0 1rem; font: 700 2rem Georgia, serif; }
.finance-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.finance-pairs > div { display: grid; gap: .2rem; padding: .8rem; background: var(--surface-warm); }
.week-strip { display: grid; grid-template-columns: 1fr auto auto; gap: .65rem; align-items: center; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .82rem; }
.week-strip strong:nth-child(2) { color: var(--green); }
.week-strip strong:nth-child(3) { color: var(--red); }
.saving-total { display: grid; gap: .15rem; }
.saving-total strong { font: 700 1.8rem Georgia, serif; }
.progress-large { height: 12px; margin-top: 1.2rem; }
.progress-caption { display: flex; justify-content: space-between; margin-top: .5rem; font-size: .8rem; }
.progress-caption a { color: var(--maroon); font-weight: 800; }
.recent-section { margin-top: 1rem; }
.transaction-list { display: grid; }
.transaction-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    padding: .8rem 0;
    border-bottom: 1px solid var(--line);
}
.transaction-row:last-child { border-bottom: 0; }
a.transaction-row:hover .transaction-main strong { color: var(--maroon); }
.transaction-icon {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border-radius: 50%;
    flex: 0 0 auto;
}
.transaction-icon.income { color: var(--green); background: var(--green-soft); }
.transaction-icon.expense { color: var(--red); background: var(--red-soft); }
.transaction-main { display: grid; min-width: 0; flex: 1; }
.transaction-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-main small { font-size: .76rem; }
.transaction-amount { flex: 0 0 auto; font-weight: 800; font-size: .9rem; }
.transaction-amount.income { color: var(--green); }
.transaction-amount.expense { color: var(--red); }

/* Sidebar / bottom nav */
.desktop-sidebar { display: none; }
.bottom-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(61,34,29,.08);
}
.bottom-nav > a:not(.bottom-nav__action), .bottom-nav > button {
    display: grid;
    gap: .2rem;
    justify-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    font-size: .66rem;
}
.bottom-nav .active { color: var(--maroon) !important; font-weight: 800; }
.bottom-nav__action { display: grid; gap: .15rem; justify-items: center; margin-top: -1.2rem; color: var(--maroon); font-size: .66rem; font-weight: 800; }
.bottom-nav__action > span { display: grid; width: 54px; height: 54px; place-items: center; color: #fff; background: var(--maroon); border: 5px solid var(--surface); border-radius: 50%; box-shadow: 0 8px 20px rgba(111,38,56,.25); }
.bottom-nav__action small { color: var(--maroon); font-size: .66rem; font-weight: 800; }
.drawer-backdrop {
    position: fixed;
    z-index: 39;
    inset: 0;
    background: rgba(43, 26, 26, .45);
}
.mobile-drawer {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    padding: .6rem 1rem calc(1rem + env(safe-area-inset-bottom));
    background: var(--surface);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -24px 55px rgba(45,25,22,.22);
    transform: translateY(105%);
    transition: transform .22s ease;
}
.mobile-drawer.open { transform: translateY(0); }
.drawer-handle { width: 42px; height: 4px; margin: 0 auto 1rem; background: var(--line-strong); border-radius: 99px; }
.drawer-title { display: flex; justify-content: space-between; align-items: center; }
.drawer-title > div { display: grid; }
.drawer-links { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: 1rem 0; }
.drawer-links a { display: flex; align-items: center; gap: .55rem; padding: .85rem; background: var(--surface-warm); border: 1px solid var(--line); border-radius: 10px; font-weight: 700; }
.drawer-logout { display: flex; width: 100%; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; color: var(--red); background: var(--red-soft); border: 0; border-radius: 10px; font-weight: 800; }

/* Calendar */
.calendar-card {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-small);
}
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.calendar-toolbar > div { display: grid; justify-items: center; line-height: 1.15; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-weekdays { margin-bottom: .35rem; }
.calendar-weekdays span { padding: .35rem 0; color: var(--muted); text-align: center; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.calendar-day {
    position: relative;
    display: grid;
    min-height: 52px;
    place-items: center;
    color: var(--ink);
    border: 1px solid transparent;
    border-radius: 10px;
}
.calendar-day:hover { background: var(--surface-warm); }
.calendar-day.selected { color: #fff; background: var(--maroon); }
.calendar-day.muted { color: #b7a79c; }
.calendar-day.future { opacity: .35; pointer-events: none; }
.calendar-dots { position: absolute; bottom: 4px; display: flex; gap: 3px; min-height: 7px; }
.calendar-day.selected .dot { background: #fff; }
.calendar-legend { display: flex; gap: 1rem; margin-top: .8rem; padding-top: .8rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .75rem; }
.day-sheet {
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.day-sheet__heading { display: grid; gap: .8rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.day-sheet__heading h2 { margin: 0; }
.day-sheet__actions { display: flex; gap: .5rem; }
.mini-action { display: inline-flex; align-items: center; gap: .35rem; min-height: 38px; padding: .55rem .7rem; border-radius: 8px; font-size: .75rem; font-weight: 800; }
.mini-action.income { color: var(--green); background: var(--green-soft); }
.mini-action.expense { color: var(--red); background: var(--red-soft); }

/* Editor / transaction */
.editor-sheet, .movement-panel {
    display: grid;
    gap: 1.2rem;
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: 0; padding: 0; border: 0; }
.type-switch legend { grid-column: 1 / -1; margin-bottom: .25rem; }
.type-switch label input { position: absolute; opacity: 0; }
.type-switch label span {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    color: var(--muted);
    background: var(--surface-warm);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-weight: 800;
}
.type-switch input:checked + span { color: var(--maroon); background: var(--maroon-soft); border-color: var(--maroon); }
.small-switch label span { min-height: 42px; }
.date-display {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 52px;
    padding: .75rem .85rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    text-align: left;
}
.date-display strong { min-width: 0; flex: 1; }
.impulse-questions { display: grid; gap: 1rem; margin: .4rem -.15rem 0; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.section-intro p { margin: 0; color: var(--muted); }
.question-card { margin: 0; padding: 1rem; background: var(--surface-warm); border: 1px solid var(--line); border-radius: var(--radius-small); }
.question-card legend { padding: 0 .25rem; font-family: Georgia, serif; font-size: 1rem; }
.choice-grid { display: grid; gap: .55rem; margin-top: .6rem; }
.choice-grid input { position: absolute; opacity: 0; }
.choice-grid span {
    display: flex;
    min-height: 44px;
    align-items: center;
    padding: .7rem .8rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .86rem;
    font-weight: 700;
}
.choice-grid input:checked + span { color: var(--maroon); background: var(--maroon-soft); border-color: var(--maroon); }
.score-preview { padding: 1rem; background: var(--maroon); color: #fff; border-radius: 6px 18px 6px 18px; }
.score-preview > span { display: block; color: #e8c9cf; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.score-preview strong { display: block; margin: .25rem 0; font-family: Georgia, serif; font-size: 1.4rem; }
.score-preview p { margin: 0; color: #ead9dc; font-size: .85rem; }
.sticky-form-action { position: sticky; z-index: 5; bottom: 78px; padding-top: .25rem; }
.date-picker-modal, .confirm-modal {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: grid;
    place-items: end center;
    padding: 1rem;
    background: rgba(43,26,26,.48);
}
.date-picker-panel, .confirm-card {
    width: min(100%, 460px);
    padding: 1rem;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.date-picker-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.date-picker-weekdays, .date-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.date-picker-weekdays span { padding: .35rem; color: var(--muted); text-align: center; font-size: .7rem; font-weight: 800; }
.date-picker-grid { margin-bottom: 1rem; }
.date-picker-grid button {
    min-height: 42px;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
}
.date-picker-grid button:hover { background: var(--surface-warm); }
.date-picker-grid button.selected { color: #fff; background: var(--maroon); }
.date-picker-grid button.outside { color: #b6a79c; }
.date-picker-grid button:disabled { opacity: .25; pointer-events: none; }
.confirm-card { text-align: center; }
.confirm-icon { display: grid; width: 54px; height: 54px; place-items: center; margin: 0 auto 1rem; color: var(--red); background: var(--red-soft); border-radius: 50%; }
.confirm-card p { color: var(--muted); }
.confirm-card > div:last-child { display: flex; justify-content: center; gap: .65rem; }
.confirm-card form { display: contents; }

/* Detail receipt */
.receipt-card {
    position: relative;
    padding: 1.2rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-small);
}
.receipt-card::before, .receipt-card::after {
    position: absolute;
    bottom: -8px;
    width: 16px;
    height: 16px;
    content: "";
    background: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: 50%;
}
.receipt-card::before { left: 24%; }
.receipt-card::after { right: 24%; }
.receipt-head { display: flex; align-items: center; gap: .75rem; }
.receipt-head > div { display: grid; flex: 1; }
.receipt-number { color: var(--muted); font-family: monospace; font-size: .78rem; }
.receipt-amount { margin: 1.4rem 0; font: 700 clamp(2.4rem, 10vw, 4rem)/1 Georgia, serif; }
.receipt-amount.income { color: var(--green); }
.receipt-amount.expense { color: var(--red); }
.receipt-line { border-top: 1px dashed var(--line-strong); }
.detail-list { margin: 1rem 0 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; text-align: right; font-weight: 750; }
.answer-review { margin-top: 1.2rem; padding: 1rem; background: var(--surface-warm); }
.answer-review h2 { font-size: 1.2rem; }
.answer-review > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-top: 1rem; }

/* Filters / notes */
.filter-panel {
    display: grid;
    gap: .75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filter-scroll { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; }
.filter-chip input { position: absolute; opacity: 0; }
.filter-chip span { display: block; padding: .5rem .7rem; color: var(--muted); background: var(--surface-warm); border: 1px solid var(--line); border-radius: 99px; font-size: .78rem; font-weight: 750; }
.filter-chip input:checked + span { color: #fff; background: var(--maroon); border-color: var(--maroon); }
.filter-row { display: grid; grid-template-columns: 1fr auto; gap: .65rem; align-items: end; }
.compact-field { gap: .25rem; }
.compact-field input, .compact-field select { min-height: 42px; padding-block: .55rem; }
.custom-range { display: grid; gap: .65rem; }
.summary-strip {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: .75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--maroon-dark);
    color: #fff;
    border-radius: 6px 18px 6px 18px;
}
.summary-strip > div { display: grid; }
.summary-strip small { color: #d9c5c7; }
.summary-strip > span { background: rgba(255,255,255,.2); }
.pagination-wrap { display: flex; justify-content: center; margin-top: 1rem; }
.pagination { display: flex; gap: .25rem; padding: 0; list-style: none; }
.page-link { display: grid; min-width: 36px; height: 36px; place-items: center; padding: 0 .45rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.page-item.active .page-link { color: #fff; background: var(--maroon); border-color: var(--maroon); }
.page-item.disabled .page-link { opacity: .4; }

/* Empty state */
.empty-state { display: grid; justify-items: center; padding: 2rem 1rem; text-align: center; }
.empty-state__icon { display: grid; width: 58px; height: 58px; place-items: center; margin-bottom: .9rem; color: var(--maroon); background: var(--maroon-soft); border-radius: 50%; }
.empty-state h3 { margin-bottom: .4rem; }
.empty-state p { max-width: 420px; color: var(--muted); }
.quiet-empty { padding: 1.2rem; color: var(--muted); background: var(--surface-warm); border: 1px dashed var(--line-strong); text-align: center; }

/* Analysis / Report */
.analysis-hero {
    display: grid;
    gap: 1.2rem;
    margin-bottom: 1rem;
    padding: 1.35rem;
    color: #fff;
    background: var(--maroon-dark);
    border-left: 8px solid var(--gold);
}
.analysis-hero p { margin-bottom: 0; color: #ddcbcd; }
.analysis-percentage { display: block; margin-bottom: .6rem; font: 700 clamp(3.2rem, 13vw, 5rem)/1 Georgia, serif; }
.analysis-percentage small { color: inherit; font-size: .35em; }
.analysis-count { display: grid; align-content: center; padding: 1rem; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); }
.analysis-count strong { font: 700 2.5rem Georgia, serif; }
.analysis-count span { font-weight: 800; }
.analysis-count small { color: #ddcbcd; }
.metric-grid { display: grid; gap: .65rem; margin-bottom: 1rem; }
.metric-grid article {
    display: grid;
    gap: .25rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brown);
}
.metric-grid article > span { color: var(--muted); font-size: .78rem; }
.metric-grid article > strong { font: 700 1.3rem Georgia, serif; }
.metric-grid article > small { font-size: .72rem; }
.chart-section { margin-bottom: 1rem; }
.comparison-bars { display: grid; gap: 1rem; }
.comparison-bars > div > div:first-child { display: flex; justify-content: space-between; margin-bottom: .4rem; }
.bar-track { height: 14px; background: var(--paper-deep); overflow: hidden; }
.bar-track span { display: block; height: 100%; }
.bar-impulsive { background: var(--red); }
.bar-not-impulsive { background: var(--green); }
.period-nav { display: inline-flex; align-items: center; gap: .65rem; align-self: flex-start; }
.period-nav > span { font-weight: 800; }
.canvas-wrap { position: relative; height: 260px; }
.canvas-wrap canvas { width: 100%; height: 100%; }
.chart-legend { display: flex; gap: 1rem; margin-top: .75rem; color: var(--muted); font-size: .78rem; }
.report-ledger {
    margin-bottom: 1rem;
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-top: 6px solid var(--maroon);
}
.report-ledger__head { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--line-strong); }
.report-ledger__head > div { display: grid; }
.report-ledger__head > span { color: var(--maroon); font-family: Georgia, serif; font-weight: 700; }
.report-metrics { display: grid; gap: 1px; margin-top: 1rem; background: var(--line); }
.report-metrics article { display: grid; gap: .25rem; padding: .85rem; background: var(--surface); }
.report-metrics article > span { color: var(--muted); font-size: .78rem; }
.report-metrics article > strong { font: 700 1.35rem Georgia, serif; }
.report-metrics article > small { font-size: .72rem; }
.report-highlight-grid article:first-child { border-top-color: var(--maroon); }

/* Savings */
.section-block { margin-bottom: 1.5rem; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.section-title-row h2 { margin: 0; }
.section-title-row > span { color: var(--muted); font-size: .8rem; }
.goal-grid { display: grid; gap: .75rem; }
.goal-card {
    display: block;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px 18px 6px 18px;
    box-shadow: var(--shadow-small);
}
a.goal-card:hover { border-color: var(--maroon); }
.goal-card__top { display: flex; justify-content: space-between; align-items: center; }
.goal-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--brown); background: var(--brown-soft); border-radius: 50%; }
.goal-card h3 { margin: 1rem 0 .45rem; }
.goal-card > strong { display: block; font: 700 1.5rem Georgia, serif; }
.goal-card > span { color: var(--muted); font-size: .8rem; }
.goal-card__foot { display: flex; justify-content: space-between; margin-top: .45rem; color: var(--muted); font-size: .75rem; }
.completed-list { display: grid; background: var(--surface); border: 1px solid var(--line); }
.completed-list a { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.completed-list a:last-child { border-bottom: 0; }
.completed-list a > span:nth-child(2) { display: grid; flex: 1; }
.completed-check { display: grid; width: 36px; height: 36px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 50%; }
.saving-hero {
    display: grid;
    gap: .6rem;
    margin-bottom: 1rem;
    padding: 1.3rem;
    color: #fff;
    background: var(--maroon);
    border-radius: 6px 24px 6px 24px;
}
.saving-hero.completed { background: var(--green); }
.saving-hero__mark { display: grid; width: 56px; height: 56px; place-items: center; color: var(--maroon); background: #fff; border-radius: 50%; }
.saving-hero > div:nth-child(2) { display: grid; }
.saving-hero > div:nth-child(2) small, .saving-hero > div:nth-child(2) span { color: rgba(255,255,255,.76); }
.saving-hero > div:nth-child(2) strong { font: 700 2.3rem Georgia, serif; }
.progress-light { background: rgba(255,255,255,.18); }
.progress-light span { background: #fff; }
.saving-hero__foot { display: flex; justify-content: space-between; font-size: .78rem; }
.movement-panel { margin-bottom: 1rem; }
.movement-list { display: grid; }
.movement-list > div { display: flex; align-items: center; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.movement-list > div:last-child { border-bottom: 0; }
.movement-list > div > span:nth-child(2) { display: grid; flex: 1; }
.completed-action { margin-bottom: 1rem; padding: 1rem; background: var(--green-soft); border: 1px solid #bdd0c2; }
.completed-action p { color: #466151; }
.completed-action > div { display: flex; flex-wrap: wrap; gap: .6rem; }
.completed-action form { display: contents; }

/* Reflections */
.reflection-list { display: grid; gap: .75rem; }
.reflection-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .8rem;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--green);
}
.reflection-card.pending { border-left-color: var(--maroon); }
.reflection-index { color: var(--line-strong); font: italic 700 1.4rem Georgia, serif; }
.reflection-card h2 { margin: .1rem 0; font-size: 1.15rem; }
.reflection-card p { margin: 0; color: var(--muted); font-size: .78rem; }
.reflection-card small { color: var(--maroon); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.reflection-status { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; }
.reflection-status.pending { color: var(--maroon); background: var(--maroon-soft); }
.reflection-status.completed { color: var(--green); background: var(--green-soft); }
.reflection-heading {
    margin: -1.4rem -1rem 1rem;
    padding: 1.6rem 1rem;
    color: #fff;
    background: var(--maroon-dark);
}
.reflection-heading p { max-width: 600px; color: #ddcbcd; }
.reflection-summary { display: grid; gap: 1px; margin-top: 1.2rem; background: rgba(255,255,255,.18); }
.reflection-summary > span { display: grid; padding: .8rem; background: var(--maroon-dark); }
.reflection-summary small { color: #d8c2c5; }
.reflection-form { display: grid; gap: 1rem; }
.reflection-question {
    position: relative;
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.question-number { position: absolute; top: .75rem; right: 1rem; color: var(--line-strong); font: italic 700 1.8rem Georgia, serif; }
.question-copy { padding-right: 2.5rem; margin-bottom: 1rem; }
.question-copy p { color: var(--muted); }
.option-stack { display: grid; gap: .5rem; }
.option-row input { position: absolute; opacity: 0; }
.option-row span { display: block; padding: .75rem .8rem; background: var(--surface-warm); border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.option-row input:checked + span { color: var(--maroon); background: var(--maroon-soft); border-color: var(--maroon); }
.satisfaction-scale { display: grid; gap: .5rem; }
.satisfaction-scale input { position: absolute; opacity: 0; }
.satisfaction-scale span { display: flex; align-items: center; gap: .75rem; padding: .7rem; background: var(--surface-warm); border: 1px solid var(--line); border-radius: 8px; }
.satisfaction-scale strong { display: grid; width: 34px; height: 34px; place-items: center; color: var(--maroon); background: var(--maroon-soft); border-radius: 50%; }
.satisfaction-scale small { color: var(--ink); }
.satisfaction-scale input:checked + span { background: var(--maroon-soft); border-color: var(--maroon); }
.target-fields { display: grid; gap: .75rem; margin-bottom: .75rem; }
.reflection-submit {
    display: grid;
    gap: .8rem;
    padding: 1rem;
    color: #fff;
    background: var(--maroon);
    border-radius: 6px 18px 6px 18px;
}
.reflection-submit > div { display: grid; }
.reflection-submit small { color: #e6c9ce; }

/* Profile */
.profile-card {
    display: grid;
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
}
.profile-card > div:not(.profile-monogram) { display: grid; gap: .15rem; padding: 1rem; background: var(--surface); }
.profile-monogram { display: grid; width: 76px; height: 76px; place-items: center; margin: 1.2rem auto; color: #fff; background: var(--maroon); border-radius: 50%; font: 700 2rem Georgia, serif; }
.respondent-code { background: var(--maroon-soft) !important; }
.respondent-code strong { color: var(--maroon); font: 700 1.6rem Georgia, serif; letter-spacing: .08em; }
.respondent-code p { margin: 0; color: var(--muted); font-size: .8rem; }
.profile-logout { margin-top: 1rem; }

/* Researcher */
.researcher-body { background: #f2ede7; }
.researcher-shell { min-height: 100vh; }
.researcher-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1.3rem;
    color: #fff;
    background: var(--maroon-dark);
}
.researcher-sidebar nav { display: flex; gap: .5rem; overflow-x: auto; }
.researcher-sidebar nav a, .researcher-sidebar > form button {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 42px;
    padding: .65rem .8rem;
    color: #dec7ca;
    background: transparent;
    border: 0;
    border-radius: 8px;
    white-space: nowrap;
}
.researcher-sidebar nav a.active { color: #fff; background: rgba(255,255,255,.12); }
.researcher-sidebar > form { margin-left: auto; }
.researcher-topbar { display: none; }
.researcher-content { padding: 1.2rem 1rem 3rem; }
.research-page-heading { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.3rem; }
.research-page-heading p { margin: 0; color: var(--muted); }
.research-period-form, .research-filter {
    display: grid;
    gap: .65rem;
    padding: .85rem;
    background: var(--surface);
    border: 1px solid var(--line);
}
.research-period-form label { display: grid; gap: .25rem; }
.research-period-form label > span { color: var(--muted); font-size: .72rem; }
.research-period-form label > strong { display: flex; min-height: 44px; align-items: center; }
.research-stat-grid { display: grid; gap: .65rem; margin-bottom: 1rem; }
.research-stat-grid article {
    display: grid;
    gap: .2rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
}
.research-stat-grid article.accent { color: #fff; background: var(--maroon); border-color: var(--maroon); }
.research-stat-grid article > span { color: var(--muted); font-size: .75rem; }
.research-stat-grid article.accent > span, .research-stat-grid article.accent > small { color: #e9cfd4; }
.research-stat-grid article > strong { font: 700 1.55rem Georgia, serif; }
.research-card {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
}
.research-grid { display: grid; gap: 1rem; }
.distribution-list { display: grid; gap: .75rem; }
.distribution-list > div { display: grid; grid-template-columns: 130px 1fr 30px; gap: .65rem; align-items: center; font-size: .78rem; }
.distribution-bar { height: 10px; background: var(--paper-deep); overflow: hidden; }
.distribution-bar i { display: block; height: 100%; }
.distribution-bar .good { background: var(--green); }
.distribution-bar .calm { background: var(--gold); }
.distribution-bar .watch { background: var(--orange); }
.distribution-bar .alert { background: var(--red); }
.distribution-bar .empty { background: var(--line-strong); }
.research-mini-list { display: grid; }
.research-mini-list a { display: flex; align-items: center; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.research-mini-list a span { flex: 1; font-weight: 800; }
.research-table-wrap { overflow-x: auto; }
.research-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.research-table th, .research-table td { padding: .75rem; text-align: left; border-bottom: 1px solid var(--line); }
.research-table th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.research-filter { grid-template-columns: 1fr; margin-bottom: 1rem; }
.read-only-stamp { align-self: flex-start; padding: .35rem .65rem; color: var(--maroon); border: 2px solid var(--maroon); font-size: .72rem; font-weight: 900; letter-spacing: .1em; transform: rotate(-2deg); }
.research-reflections { display: grid; gap: .75rem; }
.research-reflections article { padding: .8rem; background: var(--surface-warm); border: 1px solid var(--line); }
.research-reflections article > div:first-child { display: flex; justify-content: space-between; gap: .7rem; }
.research-reflections dl { margin-bottom: 0; }
.research-reflections dl > div { display: grid; grid-template-columns: 120px 1fr; gap: .7rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.research-reflections dt { color: var(--muted); }
.research-reflections dd { margin: 0; }
.research-goals .goal-card { box-shadow: none; }

/* Responsive */
@media (min-width: 620px) {
    .page-content { padding-inline: 1.5rem; }
    .dashboard-score { grid-template-columns: 1fr auto; align-items: center; min-height: 280px; padding: 1.8rem; }
    .quick-actions { grid-template-columns: repeat(3, 1fr); }
    .quick-actions a { align-items: flex-start; }
    .quick-actions a > span:last-child { gap: .2rem; }
    .dashboard-grid, .research-grid { grid-template-columns: 1fr 1fr; }
    .day-sheet__heading { grid-template-columns: 1fr auto; align-items: center; }
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .analysis-hero { grid-template-columns: 1fr 230px; align-items: stretch; }
    .goal-grid { grid-template-columns: repeat(2, 1fr); }
    .satisfaction-scale { grid-template-columns: repeat(5, 1fr); }
    .satisfaction-scale span { display: grid; justify-items: center; text-align: center; min-height: 100px; }
    .target-fields, .custom-range { grid-template-columns: 1fr 1fr; }
    .reflection-summary { grid-template-columns: repeat(3, 1fr); }
    .reflection-submit { grid-template-columns: 1fr auto; align-items: center; }
    .report-metrics { grid-template-columns: repeat(3, 1fr); }
    .research-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .research-filter { grid-template-columns: minmax(220px, 1fr) 220px auto; align-items: center; }
}

@media (min-width: 900px) {
    .desktop-only { display: inline-flex !important; }
    .landing-hero { grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); align-items: center; }
    .flow-grid { grid-template-columns: repeat(3, 1fr); }
    .app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
    .desktop-sidebar {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        height: 100vh;
        padding: 1.4rem;
        background: var(--surface);
        border-right: 1px solid var(--line);
    }
    .desktop-sidebar .brand { margin-bottom: 2rem; }
    .side-nav { display: grid; gap: .3rem; }
    .side-nav a, .sidebar-foot a, .sidebar-foot button {
        display: flex;
        align-items: center;
        gap: .7rem;
        min-height: 46px;
        padding: .7rem .8rem;
        color: var(--muted);
        background: transparent;
        border: 0;
        border-radius: 9px;
        font-weight: 700;
        text-align: left;
    }
    .side-nav a.active { color: #fff; background: var(--maroon); }
    .side-nav a:hover:not(.active), .sidebar-foot a:hover, .sidebar-foot button:hover { color: var(--maroon); background: var(--maroon-soft); }
    .sidebar-foot { display: grid; gap: .2rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
    .sidebar-foot form, .sidebar-foot button { width: 100%; }
    .mobile-header, .bottom-nav { display: none; }
    .page-content { width: min(100%, 1180px); padding: 2.2rem 2rem 4rem; }
    .page-heading-split { flex-direction: row; align-items: flex-start; justify-content: space-between; }
    .dashboard-score { min-height: 310px; }
    .dashboard-grid { grid-template-columns: 1.05fr .95fr; }
    .sticky-form-action { position: static; }
    .date-picker-modal, .confirm-modal { place-items: center; }
    .calendar-day { min-height: 70px; }
    .editor-sheet { max-width: 760px; padding: 1.5rem; }
    .choice-grid { grid-template-columns: 1fr 1fr; }
    .receipt-card { max-width: 720px; padding: 1.6rem; }
    .detail-actions { max-width: 720px; }
    .saving-hero, .movement-panel { max-width: 760px; }
    .reflection-heading { margin: -2.2rem -2rem 1rem; padding: 2.2rem 2rem; }
    .reflection-question { padding: 1.5rem; }
    .researcher-shell { display: grid; grid-template-columns: 250px 1fr; }
    .researcher-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        padding: 1.5rem;
    }
    .researcher-sidebar nav { display: grid; overflow: visible; }
    .researcher-sidebar > form { width: 100%; margin: auto 0 0; }
    .researcher-sidebar > form button { width: 100%; }
    .researcher-main { min-width: 0; }
    .researcher-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .9rem 1.5rem;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
    }
    .researcher-topbar > div { display: grid; }
    .researcher-content { padding: 2rem; }
    .research-page-heading { flex-direction: row; justify-content: space-between; align-items: flex-start; }
    .research-period-form { grid-template-columns: 160px 220px auto; align-items: end; }
    .research-stat-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1200px) {
    .goal-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 420px) {
    .landing-header .text-link { display: none; }
    .landing-header .button { padding-inline: .75rem; }
    .brand small { display: none; }
    .finance-pairs { grid-template-columns: 1fr; }
    .week-strip { grid-template-columns: 1fr 1fr; }
    .week-strip > span { grid-column: 1 / -1; }
    .day-sheet__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .mini-action { justify-content: center; }
    .report-ledger__head { display: grid; }
    .reflection-card { grid-template-columns: auto 1fr; }
    .reflection-status { grid-column: 1 / -1; justify-self: end; margin-top: -2.7rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Period controls keep research navigation explicit without relying on numeric date fields. */
.research-period-tools {
    display: grid;
    justify-items: end;
    gap: .75rem;
}

.period-switcher {
    display: grid;
    grid-template-columns: 2.5rem minmax(12rem, auto) 2.5rem;
    align-items: center;
    gap: .6rem;
}

.period-switcher strong {
    text-align: center;
    font-size: .92rem;
    color: var(--ink);
}

.icon-button.is-disabled {
    opacity: .35;
    pointer-events: none;
}

@media (max-width: 760px) {
    .research-period-tools {
        justify-items: stretch;
        width: 100%;
    }

    .research-period-form {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .period-switcher {
        grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
    }
}

.error-panel { text-align: center; }
.error-panel h1 { margin-bottom: .8rem; }
.error-panel p { max-width: 32rem; margin: 0 auto 1.35rem; color: var(--muted); }
