:root {
    color-scheme: light;
    --canvas: #f8f5f2;
    --paper: #fffdfb;
    --ink: #251c1e;
    --muted: #716568;
    --line: #e9e0db;
    --red: #a51d3d;
    --red-dark: #891532;
    --pink: #f9e7eb;
    --green: #24604b;
    --green-bg: #e7f2ec;
    --shadow: 0 14px 35px -27px #54273536;
    font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.3; letter-spacing: -.035em; font-weight: 500; }
h1 { font-size: clamp(1.55rem, 2.5vw, 2.125rem); }
h2 { font-size: 1.1rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a51d3d; outline-offset: 3px; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 1rem; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    white-space: nowrap;
    line-height: 1;
    color: var(--ink);
}
.wordmark { font: 650 1.65rem/1 system-ui, sans-serif; letter-spacing: -.065em; }
.wordmark > span { color: #bd2446; }
.brand-mark {
    display: block;
    flex: none;
    width: 2.25rem;
    height: auto;
    aspect-ratio: 1;
    border-radius: 27%;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    min-height: 2.75rem;
    padding: .55rem .9rem;
    border: 1px solid transparent;
    border-radius: .75rem;
    font-size: .9rem;
    font-weight: 750;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}
.primary { color: #fff; background: var(--red); box-shadow: 0 8px 18px -12px var(--red); }
.primary:hover { background: var(--red-dark); }
.secondary { color: var(--ink); background: var(--paper); border-color: var(--line); }
.secondary:hover { background: var(--canvas); border-color: #d7c6c4; }
.danger { color: var(--red-dark); background: var(--pink); }
.danger:hover { background: #f4d0d9; }
.icon-button {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: .7rem;
    background: var(--paper);
    color: inherit;
}
.icon-button:hover { background: var(--canvas); }
.icon-button .icon { width: 1rem; height: 1rem; }
.text-link { color: var(--red); font-size: .9rem; font-weight: 750; padding: .5rem .25rem; }
.text-link:hover { text-decoration: underline; }
.alert, .notice {
    padding: .72rem .9rem;
    margin: 0 0 1rem;
    border-radius: .65rem;
    background: var(--pink);
    color: var(--red-dark);
}
.notice { background: var(--green-bg); color: var(--green); }
.skip-link { position: fixed; z-index: 5; top: .5rem; left: .5rem; padding: .75rem; background: white; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.login-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(25rem, .89fr); min-height: 100vh; min-height: 100svh; }
.login-art {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    min-height: 34rem;
    padding: clamp(2rem, 5vw, 5rem);
    color: #fff8f4;
    background: radial-gradient(ellipse at 90% 45%, #a91e42 0%, #77142e 48%, #430e20 100%);
}
.login-art .brand, .intro .brand { color: #fff8f4; }
.login-art .wordmark > span, .intro .wordmark > span { color: #ff9aab; }
.login-art-mark, .balance-art {
    position: absolute;
    z-index: -1;
    opacity: .16;
    border-radius: 27%;
}
.login-art-mark { top: 8%; right: -18%; width: min(85%, 42rem); }
.art-copy p { font-size: clamp(2rem, 4vw, 3.75rem); line-height: 1.24; letter-spacing: -.055em; font-weight: 500; }
.art-copy > span { display: inline-block; margin-top: 1.25rem; color: #f5bdca; font-size: 1rem; font-weight: 650; letter-spacing: .03em; }
.login-panel { position: relative; display: grid; place-items: center; padding: 3rem 2rem 4rem; background: var(--paper); }
.login-content { width: min(100%, 23rem); }
.login-lock { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-bottom: 1.2rem; border-radius: .8rem; color: var(--red); background: var(--pink); }
.login-content h1 { margin-bottom: .5rem; }
.login-content > .muted { margin-bottom: 1.9rem; }
.login-form { gap: 1.15rem; }
.login-submit { min-height: 3.15rem; font-size: 1rem; }
.login-footer { position: absolute; bottom: .65rem; inset-inline: 1.1rem; color: var(--muted); }
.login-footer .policy-links { justify-content: end; }
.unavailable { display: grid; align-content: center; justify-items: start; gap: 1rem; min-height: 90vh; margin: auto; padding: 2rem; max-width: 35rem; }
.intro {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: radial-gradient(ellipse at 60% 40%, #a51d3d, #5b1227 80%);
    animation: intro .75s ease-out both;
}
.intro .brand { transform: scale(1.45); }
@keyframes intro { 0%, 68% { opacity: 1; } 100% { opacity: 0; } }

.workspace { display: grid; grid-template-columns: 13.25rem minmax(0, 1fr); min-height: 100vh; }
.rail {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.95rem .95rem 1rem;
    border-right: 1px solid var(--line);
    background: var(--paper);
}
.rail-brand { display: block; align-self: start; margin: 0 0 1.7rem .55rem; }
.rail-brand .brand-mark { width: 5.75rem; border-radius: .95rem; }
.rail-brand .wordmark { display: none; }
.navigation { display: grid; gap: .35rem; }
.navigation a, .account-link, .logout {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem .85rem;
    min-height: 2.9rem;
    border: 0;
    border-radius: .75rem;
    background: transparent;
    color: var(--muted);
    font-size: .94rem;
    font-weight: 700;
}
.navigation a:hover, .account-link:hover, .logout:hover { background: var(--canvas); color: var(--ink); }
.navigation a[aria-current], .account-link[aria-current] { background: var(--pink); color: var(--red-dark); }
.account-menu { display: grid; gap: .3rem; margin-top: auto; }
.logout { width: 100%; }
.main { width: min(100%, 78rem); min-width: 0; margin: 0 auto; padding: 2.3rem clamp(1.5rem, 4.4vw, 4.75rem) 3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.55rem; }
.today { margin-bottom: .42rem; color: var(--muted); font-size: .9rem; font-weight: 650; }
.surface { min-width: 0; border: 1px solid var(--line); border-radius: 1.12rem; background: var(--paper); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }

.ledger-overview { display: grid; gap: .85rem; margin-bottom: 1.45rem; }
.balance {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 12.8rem;
    padding: 1.35rem clamp(1.1rem, 3vw, 2rem) 1.55rem;
    border-radius: 1.2rem;
    color: #fff8f5;
    background: radial-gradient(ellipse at 90% 0%, #a92848, #711b32 52%, #491725 100%);
}
.balance-art {
    width: 19rem;
    top: -1.8rem;
    right: -1.8rem;
}
.balance-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1.25rem; }
.balance-label { display: flex; align-items: center; gap: .45rem; color: #ffdfeb; font-size: .92rem; font-weight: 700; }
.balance-label .icon { width: 1.1rem; height: 1.1rem; }
.balance-value { font: 600 clamp(2.4rem, 4.5vw, 3.65rem)/1.1 system-ui, sans-serif; letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.unit { margin-inline-start: .28em; font-size: .55em; letter-spacing: 0; }
.balance-caption { margin-top: .65rem; color: #f2c7d2; font-size: .88rem; }
.month-control { flex: none; display: flex; align-items: center; gap: .3rem; white-space: nowrap; }
.month-control strong, .month-current { padding: 0 .42rem; font-size: .92rem; font-weight: 600; }
.month-current:hover { text-decoration: underline; }
.balance .month-control .icon-button { border-color: #ffe6ed50; background: #3e122b58; }
.balance .month-control .icon-button:hover { background: #3e122b9d; }
.balance .month-control a:focus-visible { outline-color: #fff1eb; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.metric { display: flex; align-items: center; gap: .8rem; min-width: 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .95rem; background: var(--paper); }
.metric > div { min-width: 0; display: grid; }
.metric .muted { font-size: .9rem; }
.metric strong { font-size: clamp(1.1rem, 2.2vw, 1.45rem); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; }
.metric-icon { display: grid; place-items: center; flex: none; width: 2.55rem; height: 2.55rem; border-radius: .75rem; }
.income { color: var(--green); background: var(--green-bg); }
.expense { color: var(--red); background: var(--pink); }
.activity .section-heading, .agenda .section-heading, .calendar-card .section-heading { padding: 1rem 1.2rem; }
.filters { display: flex; flex: none; gap: .12rem; padding: .2rem; border-radius: .65rem; background: var(--canvas); }
.filters a { display: inline-flex; align-items: center; min-height: 2.15rem; padding: 0 .68rem; border-radius: .5rem; color: var(--muted); font-size: .86rem; font-weight: 700; }
.filters a:hover { color: var(--ink); }
.filters [aria-current] { background: var(--paper); color: var(--red-dark); box-shadow: 0 1px 4px #562f3820; }
.empty { display: grid; justify-items: center; gap: .38rem; padding: 2.65rem 1rem; text-align: center; }
.empty strong { margin-top: .2rem; font-size: 1rem; }
.empty p { color: var(--muted); font-size: .9rem; }
.empty-icon { display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: .9rem; color: var(--red); background: var(--pink); }
.record-list { list-style: none; margin: 0; padding: 0; }
.record-list li { border-top: 1px solid var(--line); }
.record-row { display: flex; align-items: center; min-height: 4.35rem; gap: .72rem; padding: .66rem 1.2rem; }
.record-row:hover { background: var(--canvas); }
.record-row:last-child { border-radius: 0 0 1.1rem 1.1rem; }
.record-description { flex: 1; display: grid; min-width: 0; }
.record-description strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.record-description > span { color: var(--muted); font-size: .86rem; }
.record-amount { flex: none; font-variant-numeric: tabular-nums; }
.record-amount.incoming { color: var(--green); }
.record-row > .icon { width: 1rem; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: 1rem; font-size: .9rem; }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0 1rem; border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
.weekday { display: grid; place-items: center; min-height: 2.35rem; font-size: .9rem; font-weight: 700; color: var(--muted); background: var(--canvas); }
.day, .blank-day { min-width: 0; min-height: clamp(3.3rem, 6.2vw, 5.2rem); border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: .35rem .2rem; gap: .22rem; }
.day:not(:nth-child(7n+1)), .blank-day:not(:nth-child(7n+1)) { border-left: 1px solid var(--line); }
.day:hover, .selected-day { background: var(--pink); }
.day:focus-visible { outline-offset: -3px; }
.sunday { color: var(--red); }
.day > span:first-child { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; font-size: .94rem; }
.today-number { border-radius: 50%; background: var(--red); color: #fff; font-weight: 750; }
.selected-day { box-shadow: inset 0 0 0 1px #c7798c; }
.event-color-auto { --event-ink: #574052; --event-fill: #f0e8ed; --event-accent: #876681; }
.event-color-rose { --event-ink: #8a2244; --event-fill: #f8e1e8; --event-accent: #bd4667; }
.event-color-amber { --event-ink: #794516; --event-fill: #f8ead7; --event-accent: #ac6727; }
.event-color-green { --event-ink: #235841; --event-fill: #e2f0e6; --event-accent: #3e8462; }
.event-color-blue { --event-ink: #254e78; --event-fill: #e3edf8; --event-accent: #477bad; }
.event-color-violet { --event-ink: #584071; --event-fill: #efe6f7; --event-accent: #875da7; }
.event-color-slate { --event-ink: #454f60; --event-fill: #e9edf2; --event-accent: #687486; }
.day-entries { width: 100%; min-width: 0; display: grid; gap: .15rem; }
.calendar-entry {
    display: block;
    min-width: 0;
    overflow: hidden;
    padding: .1rem .3rem;
    border: 1px solid transparent;
    border-radius: .3rem;
    color: var(--event-ink);
    background: var(--event-fill);
    font-size: .76rem;
    font-weight: 750;
    line-height: 1.18;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.calendar-entry-holiday { color: var(--red-dark); background: var(--pink); }
.calendar-entry-off { border-color: var(--event-accent); border-style: dashed; }
.calendar-more { padding-inline: .17rem; color: var(--muted); font-size: .75rem; font-weight: 750; line-height: 1.1; text-align: end; }
.calendar-legend, .holiday-line { display: flex; align-items: center; gap: .4rem; }
.holiday-dot { width: .48rem; height: .48rem; border-radius: 50%; flex: none; background: #b92346; }
.calendar-legend { flex-wrap: wrap; gap: .48rem; padding: .85rem 1rem; }
.calendar-legend .calendar-entry { padding: .23rem .42rem; font-size: .81rem; }
.agenda-color { color: var(--event-ink); background: var(--event-fill); }
.calendar-caption { padding: 0 1rem .9rem; font-size: .85rem; }
.holiday-line { margin: 0 1.1rem .55rem; padding: .7rem .75rem; border-radius: .65rem; color: var(--red-dark); background: var(--pink); font-weight: 700; font-size: .9rem; }
.agenda .empty { padding: 1.75rem .7rem; }
.search-form { display: flex; align-items: center; gap: .55rem; padding: .3rem .35rem .3rem .9rem; }
.search-form input { flex: 1; width: 0; min-height: 2.75rem; padding: .45rem .15rem; border: 0; background: transparent; color: var(--ink); }
.pin { color: var(--red); }
.pin .icon { width: .95rem; height: .95rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.notes-page .main { display: flex; flex-direction: column; height: 100dvh; }
.notes-page .page-heading { flex: none; }
.category-menu, .category-options, .chat-search { position: relative; flex: none; }
.category-menu summary, .category-options summary, .chat-search summary { list-style: none; cursor: pointer; }
.category-menu summary::-webkit-details-marker, .category-options summary::-webkit-details-marker,
.chat-search summary::-webkit-details-marker { display: none; }
.category-form, .category-options-list, .chat-search .search-form {
    position: absolute;
    z-index: 2;
    inset: calc(100% + .45rem) 0 auto auto;
    width: min(20rem, calc(100vw - 3rem));
    box-shadow: 0 12px 28px #34202721;
}
.category-form { padding: .85rem; }
.category-options[open] summary { color: var(--red-dark); background: var(--pink); }
.category-options-list { width: 9.5rem; padding: .3rem; }
.category-options-list a {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.7rem;
    padding: .4rem .6rem;
    border-radius: .6rem;
    font-size: .9rem;
}
.category-options-list a:hover { background: var(--canvas); }
.category-options-list .icon { width: 1rem; }
.category-delete { color: var(--red-dark); }
.notes-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 15rem;
    background: #fdf9f7;
}
.chat-toolbar {
    display: flex;
    align-items: center;
    flex: none;
    gap: .65rem;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--line);
    border-radius: 1.12rem 1.12rem 0 0;
    background: var(--paper);
}
.category-tabs { display: flex; flex: 1; gap: .35rem; min-width: 0; overflow-x: auto; padding: .2rem; scrollbar-width: thin; scroll-padding-inline-start: 4.4rem; }
.category-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 2.55rem;
    padding: .35rem .82rem;
    border: 1px solid var(--line);
    border-radius: 2rem;
    font-size: .88rem;
    font-weight: 700;
    white-space: nowrap;
}
.category-tabs a:hover { background: var(--canvas); }
.category-tabs a:first-child { position: sticky; z-index: 1; left: 0; background: var(--paper); box-shadow: .27rem 0 var(--paper); }
.category-tabs a[aria-current] { border-color: #efc6cf; background: var(--pink); color: var(--red-dark); }
.category-tabs a:focus-visible { outline-offset: -3px; }
.chat-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: .9rem clamp(.7rem, 2.3vw, 1.45rem); }
.chat-scroll:focus-visible { outline-offset: -3px; }
.chat-scroll > .empty { margin: auto 0; }
.chat-pages { display: flex; justify-content: center; gap: 1rem; }
.chat-messages { display: grid; gap: .95rem; list-style: none; margin: auto 0 0; padding: .55rem 0 0; }
.chat-item { display: grid; justify-items: end; gap: .22rem; min-width: 0; }
.chat-bubble-row { display: flex; justify-content: flex-end; align-items: end; gap: .4rem; width: 100%; }
.chat-bubble {
    max-width: min(84%, 38rem);
    min-width: 0;
    padding: .65rem .9rem;
    border: 1px solid #f0cbd3;
    border-radius: 1rem 1rem .28rem 1rem;
    color: #4d202e;
    background: #f8e0e6;
    line-height: 1.55;
    text-align: start;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    -webkit-tap-highlight-color: transparent;
}
.chat-bubble:hover { border-color: #d17991; background: #f5d4de; }
.chat-edit { width: 2.75rem; height: 2.75rem; background: transparent; border-color: transparent; color: var(--muted); }
.chat-meta { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .81rem; }
.chat-status { padding: .2rem .85rem; color: var(--red-dark); font-size: .85rem; text-align: right; }
.chat-status:empty { position: absolute; clip-path: inset(50%); padding: 0; }
.chat-composer {
    display: flex;
    align-items: end;
    flex: none;
    gap: .55rem;
    padding: .7rem .9rem;
    border-top: 1px solid var(--line);
    border-radius: 0 0 1.12rem 1.12rem;
    background: var(--paper);
}
.chat-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 2.75rem;
    max-height: 7rem;
    field-sizing: content;
    padding: .6rem .75rem;
    border: 1px solid #dcd0cb;
    border-radius: .7rem;
    resize: none;
    color: var(--ink);
    background: var(--canvas);
    line-height: 1.45;
}
.chat-composer textarea::placeholder { color: var(--muted); }
.chat-send { width: 2.75rem; flex: none; padding: 0; }
.chat-send[aria-disabled="true"] { opacity: .65; }

.field { display: grid; gap: .36rem; min-width: 0; font-size: .9rem; font-weight: 730; }
.field input, .field select, .field textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 2.85rem;
    margin: 0;
    padding: .61rem .72rem;
    border: 1px solid #dcd0cb;
    border-radius: .65rem;
    background: var(--paper);
    color: var(--ink);
    font-size: 1rem;
    font-weight: 500;
}
.field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #716568 50%), linear-gradient(135deg, #716568 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) 50%, calc(100% - .8rem) 50%;
    background-size: .3rem .3rem;
    background-repeat: no-repeat;
    padding-right: 1.7rem;
}
.field textarea { resize: vertical; }
.field input::placeholder, .search-form input::placeholder { color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.password-field, .amount-field { position: relative; display: block; }
.password-field input, .amount-field input { padding-right: 2.8rem; }
.password-toggle { position: absolute; inset: 0 0 0 auto; height: 100%; border: 0; background: transparent; color: var(--muted); }
.password-toggle .icon { width: 1.18rem; height: 1.18rem; }
.settings-card { width: min(100%, 32rem); padding: clamp(1rem, 3vw, 1.5rem); }
.settings-intro { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.3rem; }
.settings-intro > div { min-width: 0; overflow-wrap: anywhere; }
.settings-intro p { margin-top: .2rem; font-size: .9rem; }
.settings-hint { margin-top: -.57rem; font-size: .85rem; }
.settings-save { justify-self: start; margin-top: .15rem; }
.settings-policies { margin-top: .9rem; }
.settings-policies .policy-links { display: grid; margin-top: .55rem; }
.settings-policies .policy-links a { border-top: 1px solid var(--line); }
.policy-links { display: flex; flex-wrap: wrap; gap: 0 .8rem; }
.policy-links a { display: inline-flex; align-items: center; min-height: 2.7rem; color: var(--muted); font-size: .88rem; }
.policy-links a:hover, .policy-links a[aria-current] { color: var(--red-dark); text-decoration: underline; text-underline-offset: .22rem; }
.policy-shell { width: min(100%, 52rem); margin: 0 auto; padding: clamp(1rem, 4vw, 2.6rem); }
.policy-header { display: flex; align-items: center; justify-content: space-between; gap: .65rem; margin-bottom: 1rem; }
.policy-document { padding: clamp(1.1rem, 4vw, 2rem); }
.policy-date { margin: .4rem 0 1.4rem; font-size: .9rem; }
.policy-document section + section { margin-top: 1.3rem; border-top: 1px solid var(--line); padding-top: 1.25rem; }
.policy-document section h2 { margin-bottom: .55rem; }
.policy-document section p + p { margin-top: .55rem; }
.policy-document section ul { margin: 0; padding-inline-start: 1.2rem; }
.policy-document section li + li { margin-top: .42rem; }
.policy-document a { color: var(--red-dark); text-decoration: underline; text-underline-offset: .2rem; overflow-wrap: anywhere; }
.policy-shell > .policy-links { margin-top: .55rem; }
.amount-field > span { position: absolute; right: .76rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.check { display: inline-flex; align-items: center; gap: .55rem; min-height: 2.2rem; font-size: .91rem; color: var(--muted); cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--red); }
.editor {
    width: min(calc(100% - 1.6rem), 34rem);
    max-width: none;
    max-height: 92dvh;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 28px 85px -30px #26161f86;
    overscroll-behavior: contain;
}
.editor[open]:not(:modal) { position: fixed; inset: 0; z-index: 4; margin: auto; }
.editor::backdrop { background: #2d182572; }
.editor-inner { padding: 1.25rem; }
.editor-inner > .section-heading { margin-bottom: .95rem; }
.segmented { display: flex; gap: .55rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented legend { margin: 0 0 .35rem; font-size: .9rem; font-weight: 730; }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: grid; place-items: center; min-height: 2.65rem; border: 1px solid var(--line); border-radius: .65rem; font-size: .9rem; font-weight: 725; color: var(--muted); }
.segmented input:checked + span { border-color: #d79aa8; color: var(--red-dark); background: var(--pink); }
.segmented input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }
.event-palette { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.event-palette legend { margin-bottom: .35rem; padding: 0; font-size: .9rem; font-weight: 730; }
.event-palette label { position: relative; cursor: pointer; }
.event-palette input { position: absolute; opacity: 0; }
.event-palette label span {
    display: flex;
    align-items: center;
    gap: .36rem;
    min-height: 2.75rem;
    padding: .38rem .53rem;
    border: 1px solid var(--line);
    border-radius: .65rem;
    color: var(--ink);
    font-size: .83rem;
    font-weight: 700;
}
.event-palette label i { width: .83rem; height: .83rem; border-radius: 50%; background: var(--event-accent); }
.event-palette input:checked + span { border-color: var(--event-accent); color: var(--event-ink); background: var(--event-fill); box-shadow: inset 0 0 0 1px var(--event-accent); }
.event-palette input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }
.editor-actions { display: flex; justify-content: end; gap: .55rem; margin-top: .26rem; }
.editor-actions .primary { min-width: 5rem; }
.delete-record { margin-top: 1.05rem; padding-top: .65rem; border-top: 1px solid var(--line); color: var(--red-dark); font-size: .9rem; }
.delete-record summary { cursor: pointer; padding: .25rem 0; }
.delete-record summary .icon { width: 1rem; }
.delete-record form { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }

@media (max-width: 1060px) {
    .calendar-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .workspace { display: block; }
    .rail {
        z-index: 3;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: .5rem 1rem;
        border: 0;
        border-bottom: 1px solid var(--line);
    }
    .rail-brand { align-self: center; margin: 0; }
    .rail-brand .brand { gap: .43rem; }
    .rail-brand .brand-mark { width: 1.85rem; border-radius: 27%; }
    .rail-brand .wordmark { display: inline; font-size: 1.43rem; }
    .account-menu { display: flex; gap: .1rem; margin: 0; }
    .account-link, .logout { gap: .36rem; padding: .55rem; font-size: .82rem; }
    .account-link .icon, .logout .icon { width: 1.08rem; }
    .navigation {
        position: fixed;
        inset: auto 0 0;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: .2rem;
        padding: .4rem .55rem calc(.4rem + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: var(--paper);
    }
    .navigation a { flex-direction: column; justify-content: center; gap: .16rem; min-height: 3.05rem; padding: .27rem; font-size: .83rem; }
    .main { padding: 1.12rem 1rem calc(5rem + env(safe-area-inset-bottom)); }
    .notes-page .main { height: calc(100dvh - 3.95rem); padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
    .chat-toolbar, .chat-composer { padding: .48rem .55rem; }
    .page-heading { margin-bottom: 1.05rem; }
    .login-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .login-art { min-height: 0; height: clamp(9rem, 23svh, 14rem); padding: 1.15rem 1.35rem; }
    .login-art .brand-mark { width: 1.9rem; }
    .login-art .wordmark { font-size: 1.5rem; }
    .login-art-mark { right: -1.5rem; top: -8%; width: min(51%, 15rem); }
    .art-copy p { font-size: clamp(1.4rem, 4.8vw, 2rem); }
    .art-copy > span { display: none; }
    .login-panel { align-items: start; padding: 1.45rem 1.35rem 3.3rem; }
    .login-footer .policy-links { justify-content: center; gap: 0 .65rem; }
    .login-content { width: min(100%, 28rem); }
    .login-content > .muted { margin-bottom: 1.15rem; }
    .login-lock { display: none; }
}
@media (max-width: 420px) {
    .balance { min-height: 11.2rem; padding: .9rem .9rem 1.05rem; }
    .balance-top { margin-bottom: 1.2rem; }
    .balance-art { width: 14rem; right: -1.5rem; }
    .balance .month-control strong, .balance .month-current { padding: 0 .15rem; font-size: .82rem; }
    .balance .month-control { gap: .17rem; }
    .balance .month-control .icon-button { width: 2.55rem; }
    .metrics { gap: .45rem; }
    .metric { align-items: start; gap: .42rem; padding: .63rem .5rem; }
    .metric .metric-icon { width: 1.8rem; height: 1.8rem; border-radius: .5rem; }
    .metric .metric-icon .icon { width: 1.05rem; }
    .metric .muted { font-size: .84rem; }
    .activity .section-heading, .agenda .section-heading, .calendar-card .section-heading { padding: .75rem .8rem; }
    .filters a { padding: 0 .47rem; }
    .record-row { padding: .55rem .68rem; gap: .52rem; }
    .record-row > .icon { display: none; }
    .calendar-grid { margin: 0 .35rem; }
    .day, .blank-day { padding: .28rem .09rem; }
    .day-entries .calendar-entry { padding-inline: .04rem; font-size: .68rem; }
    .editor-inner { padding: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
