:root {
    --ink: #18211d;
    --muted: #68736d;
    --line: #dce2de;
    --paper: #f5f7f4;
    --surface: #ffffff;
    --accent: #29654d;
    --accent-soft: #e2eee8;
    --danger: #93463f;
    --danger-soft: #f6e9e7;
    --shadow: 0 18px 45px rgba(27, 46, 37, 0.09);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.site-header, .site-footer, .page-shell {
    width: min(1120px, calc(100% - 48px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    min-height: 88px;
    border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; text-decoration: none; letter-spacing: -.02em; }
.brand-mark, .app-icon { display: grid; place-items: center; color: white; background: var(--accent); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: .8rem; }
.page-shell { min-height: calc(100vh - 178px); padding: 88px 0 96px; }

.hero { max-width: 760px; margin-bottom: 96px; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 25px; font-size: clamp(3rem, 7vw, 5.8rem); line-height: .98; letter-spacing: -.065em; font-weight: 650; }
.hero-copy { max-width: 590px; color: var(--muted); font-size: 1.12rem; line-height: 1.7; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.section-heading h2 { margin-bottom: 0; font-size: 1rem; }
.section-heading span { color: var(--muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 22px; }
.app-card { min-height: 330px; padding: 30px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.app-card:hover, .app-card:focus-visible { transform: translateY(-5px); border-color: #afbbb4; box-shadow: var(--shadow); outline: none; }
.card-topline { display: flex; justify-content: space-between; align-items: start; }
.app-icon { width: 50px; height: 50px; border-radius: 14px; font-size: .82rem; font-weight: 750; letter-spacing: .04em; }
.badge { display: flex; align-items: center; gap: 7px; padding: 7px 10px; color: #4a5750; background: #f1f3f1; border-radius: 999px; font-size: .72rem; font-weight: 650; }
.badge-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.card-content { margin: 52px 0 28px; }
.card-content h3 { margin-bottom: 12px; font-size: 1.45rem; letter-spacing: -.035em; }
.card-content p { color: var(--muted); line-height: 1.6; }
.card-link { margin-top: auto; display: flex; justify-content: space-between; font-size: .88rem; font-weight: 700; }

.site-footer { min-height: 90px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-size: .78rem; }
.auth-wrap { display: grid; place-items: center; min-height: 550px; }
.auth-panel { width: min(100%, 470px); padding: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.auth-panel h1 { margin-bottom: 12px; font-size: 2.75rem; }
.auth-intro { margin-bottom: 30px; color: var(--muted); }
.auth-form { display: grid; gap: 20px; margin-bottom: 24px; }
.field { display: grid; gap: 8px; }
.field label { font-size: .82rem; font-weight: 700; }
.field input { width: 100%; padding: 13px 14px; color: var(--ink); background: #fbfcfb; border: 1px solid #cbd3ce; border-radius: 9px; font: inherit; }
.field input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.form-error { margin-bottom: 24px; padding: 12px 14px; color: #782f2f; background: #f9e9e9; border-radius: 8px; font-size: .85rem; line-height: 1.45; }
.button { display: inline-flex; justify-content: center; padding: 12px 18px; border: 1px solid transparent; border-radius: 9px; font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer; }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: #1f523e; }
.button-secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.text-link { color: var(--accent); font-size: .86rem; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.messages { max-width: 900px; margin: -48px auto 36px; }
.message { padding: 13px 16px; color: #214f3d; background: var(--accent-soft); border: 1px solid #c5dbcf; border-radius: 10px; font-size: .88rem; font-weight: 650; }

.ledger-shell { max-width: 900px; margin-inline: auto; }
.ledger-heading { display: flex; justify-content: space-between; align-items: start; gap: 30px; margin-bottom: 52px; }
.ledger-heading h1 { margin-bottom: 0; font-size: clamp(2.7rem, 6vw, 4.5rem); }
.empty-state { padding: 64px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.app-icon-large { width: 64px; height: 64px; margin: 0 auto 30px; border-radius: 17px; }
.empty-state h2 { margin-bottom: 14px; font-size: 1.65rem; letter-spacing: -.035em; }
.empty-state p { max-width: 570px; margin: 0 auto 28px; color: var(--muted); line-height: 1.7; }
.header-actions, .form-actions, .entry-actions { display: flex; gap: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 52px; }
.summary-card { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.summary-card span { display: block; min-height: 34px; color: var(--muted); font-size: .75rem; line-height: 1.35; }
.summary-card strong { display: block; margin-top: 12px; font-size: 1.75rem; letter-spacing: -.04em; }
.summary-net { border-color: #b8cbc1; }
.summary-secondary { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-block: 14px; }
.summary-secondary span { min-height: 0; }.summary-secondary strong { margin-top: 0; font-size: 1.35rem; }
.yes-text { color: var(--accent); }.no-text, .delete-link { color: var(--danger); }
.net-history-card { margin-bottom: 52px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.net-history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.net-history-heading .eyebrow { margin-bottom: 7px; }.net-history-heading h2 { margin: 0; font-size: 1.2rem; }.net-history-heading > span { font-size: .75rem; }
.net-history-chart { position: relative; width: 100%; height: 230px; }
.net-history-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.net-history-line { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.net-history-baseline { stroke: #53615a; stroke-width: 1.5; }.net-history-grid { stroke: var(--line); stroke-width: 1; }.net-history-axis-label { fill: var(--muted); font-size: 10px; }
.net-history-marker { fill: var(--surface); stroke: var(--accent); stroke-width: 2; cursor: pointer; }.net-history-marker:hover, .net-history-marker:focus { fill: var(--accent-soft); stroke-width: 3; outline: none; }
.net-history-tooltip { position: absolute; z-index: 2; min-width: 155px; padding: 10px 12px; color: white; background: var(--ink); border-radius: 8px; box-shadow: var(--shadow); font-size: .72rem; line-height: 1.55; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); }
.net-history-tooltip strong, .net-history-tooltip span { display: block; }.net-history-empty { margin: 0; padding: 45px 15px; color: var(--muted); background: var(--paper); border-radius: 10px; text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.ledger-calendar { margin-bottom: 52px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.calendar-header { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; margin-bottom: 22px; }
.calendar-header h2 { margin: 0; font-size: 1.2rem; text-align: center; }
.calendar-filter { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: -10px 0 18px; color: var(--muted); font-size: .86rem; }
.calendar-filter label { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; }
.calendar-filter input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
.calendar-filter noscript { margin-left: 8px; }
.calendar-navigation { display: grid; place-items: center; width: 36px; height: 36px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; font-size: 1.45rem; line-height: 1; text-decoration: none; }
.calendar-navigation:hover, .calendar-navigation:focus-visible { color: var(--accent); background: var(--accent-soft); outline: none; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays > *, .calendar-grid > * { min-width: 0; }
.calendar-weekdays span { padding: 0 4px 9px; color: var(--muted); font-size: .68rem; font-weight: 750; text-align: center; text-transform: uppercase; }
.calendar-grid { gap: 5px; }
.calendar-day { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; aspect-ratio: 1.18; padding: 9px; background: var(--paper); border: 1px solid transparent; border-radius: 9px; }
.calendar-day time { font-size: .72rem; font-weight: 700; }.calendar-day strong { align-self: flex-end; font-size: .78rem; }
.calendar-check-in { align-self: flex-start; max-width: 100%; overflow: hidden; padding: 2px 5px; border: 1px solid white; border-radius: 999px; box-shadow: 0 0 0 1px currentColor; font-size: .58rem; font-weight: 750; line-height: 1.2; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.calendar-check-in-positive { color: #fff; background: #176b45; }
.calendar-check-in-mixed { color: #26312c; background: #fff; }
.calendar-check-in-negative { color: #fff; background: #a3312d; }
.calendar-check-in-mark { display: none; }
.calendar-check-in:hover, .calendar-check-in:focus-visible { filter: brightness(.9); outline: 2px solid currentColor; outline-offset: 2px; }
.calendar-day.is-outside-month { opacity: .34; }.calendar-day.is-today { border-color: #40584c; box-shadow: inset 0 0 0 1px var(--surface); }
.calendar-day-positive-1, .legend-positive i:nth-child(1) { background: #edf6f1; }.calendar-day-positive-2, .legend-positive i:nth-child(2) { background: #cfe7da; }.calendar-day-positive-3, .legend-positive i:nth-child(3) { color: #173e2f; background: #91c5a9; }.calendar-day-positive-4, .legend-positive i:nth-child(4) { color: white; background: #29654d; }
.calendar-day-negative-1, .legend-negative i:nth-child(4) { background: #faefed; }.calendar-day-negative-2, .legend-negative i:nth-child(3) { background: #edcbc7; }.calendar-day-negative-3, .legend-negative i:nth-child(2) { color: #612f2b; background: #d99790; }.calendar-day-negative-4, .legend-negative i:nth-child(1) { color: white; background: #93463f; }
.calendar-legend { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: .68rem; font-weight: 700; }
.legend-scale { display: flex; gap: 3px; }.legend-scale i, .legend-neutral { width: 16px; height: 16px; border-radius: 4px; }.legend-scale i { display: block; }.legend-neutral { display: grid; place-items: center; background: var(--paper); font-size: .58rem; }
.calendar-legend-caption { margin: 7px 0 0; color: var(--muted); font-size: .62rem; text-align: center; }.calendar-legend-caption span:first-child { color: var(--danger); }.calendar-legend-caption span:last-child { color: var(--accent); }
.history-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.history-heading h2 { margin: 0; font-size: 1.2rem; }
.history-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 18px; }
.history-filters a { padding: 7px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; font-weight: 700; text-decoration: none; }
.history-filters a:hover, .history-filters a:focus-visible, .history-filters .is-selected { color: var(--accent); background: var(--accent-soft); border-color: #c5dbcf; outline: none; }
.entry-list { display: grid; gap: 14px; }
.entry-card { display: flex; justify-content: space-between; gap: 24px; padding: 25px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.entry-main { min-width: 0; }.entry-title-row { display: flex; align-items: center; gap: 10px; }.entry-title-row h3 { margin: 0; font-size: 1.1rem; }
.direction-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: .67rem; font-weight: 800; letter-spacing: .06em; }
.direction-yes { color: #22543f; background: var(--accent-soft); }.direction-no { color: #793b36; background: var(--danger-soft); }
.trigger-badge { display: inline-block; margin-left: 7px; padding: 3px 7px; color: #72551e; background: #f7f0dd; border: 1px solid #eadcb7; border-radius: 999px; font-size: .65rem; font-weight: 700; vertical-align: middle; }
.sleep-badge { display: inline-block; margin-left: 7px; padding: 3px 7px; color: #526579; background: #edf2f6; border: 1px solid #d5dfe8; border-radius: 999px; font-size: .65rem; font-weight: 650; vertical-align: middle; }
.entry-meta { margin: 9px 0 0; color: var(--muted); font-size: .8rem; }.entry-note { margin: 18px 0 0; color: #44504a; line-height: 1.65; }
.entry-actions { flex-shrink: 0; align-items: start; }.entry-actions a { font-size: .78rem; font-weight: 700; text-decoration: none; }.entry-actions a:hover { text-decoration: underline; }
.form-shell { max-width: 650px; }.form-shell h1 { font-size: clamp(2.6rem, 6vw, 4rem); }.entry-form, .delete-panel { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.entry-form { display: grid; gap: 23px; }.field input, .field textarea { width: 100%; padding: 13px 14px; color: var(--ink); background: #fbfcfb; border: 1px solid #cbd3ce; border-radius: 9px; font: inherit; }.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }.help-text { color: var(--muted); }.field-error { color: var(--danger); font-weight: 650; }
.direction-field > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.direction-field > div > div label { display: flex; align-items: center; gap: 9px; padding: 13px; border: 1px solid #cbd3ce; border-radius: 9px; cursor: pointer; }.direction-field input { width: auto; accent-color: var(--accent); }
.checkbox-field { padding: 16px; background: #fbfcfb; border: 1px solid #cbd3ce; border-radius: 10px; }
.checkbox-field label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; line-height: 1.4; }
.checkbox-field input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--accent); }
.checkbox-field strong, .checkbox-field small { display: block; }.checkbox-field small { margin-top: 4px; font-weight: 400; line-height: 1.5; }
.checkbox-field:focus-within { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.autocomplete { position: relative; }
.autocomplete-menu { position: absolute; z-index: 10; top: calc(100% + 6px); right: 0; left: 0; max-height: 310px; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid #cbd3ce; border-radius: 10px; box-shadow: var(--shadow); }
.autocomplete-option { display: block; width: 100%; padding: 11px 12px; color: var(--ink); background: transparent; border: 0; border-radius: 7px; font: inherit; text-align: left; cursor: pointer; }
.autocomplete-option:hover, .autocomplete-option.is-active { background: var(--accent-soft); color: #214f3d; }
.repair-section { min-width: 0; margin: 4px 0; padding: 22px; border: 1px solid var(--line); border-radius: 14px; }
.repair-section legend { padding: 0 8px; font-size: 1.1rem; font-weight: 750; }
.repair-fields { display: grid; gap: 18px; margin-top: 20px; }.repair-fields[hidden], [data-sexual-fields][hidden] { display: none; }
.repair-grid, [data-sexual-fields] { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }.repair-grid .field:first-child { grid-column: 1 / -1; }
.repair-checks { display: grid; gap: 10px; }.mark-repaired { justify-self: start; }
.repair-summary { margin: 12px 0 0; color: var(--accent); font-size: .78rem; font-weight: 700; }
.patterns-section { margin-bottom: 52px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.check-in-card { margin-bottom: 52px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.check-in-card .eyebrow { margin-bottom: 7px; }.check-in-card .history-heading { align-items: flex-start; }.check-in-intro { margin: -3px 0 24px; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.check-in-date-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 14px 4px; }
.check-in-date-navigation strong { font-size: .9rem; text-align: center; }
.check-in-form { display: grid; gap: 22px; }.check-in-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }.check-in-grid select { width: 100%; padding: 12px 36px 12px 13px; color: var(--ink); background: #fbfcfb; border: 1px solid #cbd3ce; border-radius: 9px; font: inherit; }.check-in-grid select:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }.check-in-observation { grid-column: 1 / -1; }.check-in-history { margin-top: 34px; padding-top: 25px; border-top: 1px solid var(--line); }.check-in-history h3 { margin: 0; font-size: 1rem; }.check-in-table-wrap { overflow-x: auto; }.check-in-history table { width: 100%; border-collapse: collapse; font-size: .74rem; }.check-in-history th, .check-in-history td { padding: 10px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }.check-in-history th { color: var(--muted); font-size: .66rem; text-transform: uppercase; }.check-in-history .check-in-observation-row td { padding-top: 0; color: var(--muted); line-height: 1.5; white-space: normal; }
.pattern-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }.pattern-grid div { padding: 14px; background: var(--surface); }.pattern-grid span { display: block; min-height: 32px; color: var(--muted); font-size: .7rem; }.pattern-grid strong { display: block; margin-top: 7px; font-size: 1rem; }
.trend-table { margin-top: 26px; }.trend-table h3 { font-size: .9rem; }.trend-table table { width: 100%; border-collapse: collapse; font-size: .8rem; }.trend-table th, .trend-table td { padding: 10px; border-top: 1px solid var(--line); text-align: left; }
.detail-shell { max-width: 760px; }.detail-shell h1 { font-size: clamp(2.6rem, 6vw, 4rem); }.detail-note { margin: 28px 0; font-size: 1.05rem; line-height: 1.7; }.repair-detail { margin: 34px 0; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }.repair-detail h2 { margin-bottom: 8px; }.repair-timeline { margin: 26px 0; padding-left: 24px; }.repair-timeline li { padding: 0 0 22px 10px; }.repair-timeline span, .repair-timeline strong { display: block; }.repair-timeline span, .repair-facts dt { color: var(--muted); font-size: .75rem; }.repair-timeline strong { margin-top: 4px; font-size: .9rem; }.repair-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.repair-facts div { padding: 14px; background: var(--paper); border-radius: 9px; }.repair-facts dd { margin: 6px 0 0; font-weight: 700; }
.button-danger { color: white; background: var(--danger); }.delete-panel h2 { font-size: 1.3rem; }.muted { color: var(--muted); }
.export-dialog { width: min(900px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.export-dialog::backdrop { background: rgba(20, 28, 24, .55); }.export-modal { padding: 28px; }.export-modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }.export-modal h2 { margin: 0; }.export-close { padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 2rem; cursor: pointer; }.export-intro, .export-status { color: var(--muted); font-size: .85rem; line-height: 1.5; }.export-date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 16px; }.export-date-grid label { color: var(--muted); font-size: .75rem; font-weight: 700; }.export-date-grid input { display: block; width: 100%; margin-top: 7px; padding: 11px 12px; color: var(--ink); background: #fbfcfb; border: 1px solid #cbd3ce; border-radius: 9px; font: inherit; }.export-actions { display: flex; justify-content: space-between; gap: 12px; }.export-output { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }.export-output > div { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--paper); }.export-output strong { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }.export-copy { padding: 7px 10px; }.export-output textarea { display: block; width: 100%; min-height: 340px; max-height: 50vh; padding: 16px; resize: vertical; color: var(--ink); background: #fbfcfb; border: 0; border-top: 1px solid var(--line); font: .78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }.export-footer { display: flex; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 640px) {
    .site-header, .site-footer, .page-shell { width: min(100% - 32px, 1120px); }
    .site-header { min-height: 72px; }
    .page-shell { padding: 60px 0 72px; }
    .hero { margin-bottom: 68px; }
    h1 { font-size: clamp(2.8rem, 15vw, 4.2rem); }
    .app-card { min-height: 300px; padding: 24px; }
    .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 6px; }
    .auth-panel { padding: 30px 24px; }
    .ledger-heading { align-items: flex-start; flex-direction: column; }
    .empty-state { padding: 45px 24px; }
    .summary-grid { grid-template-columns: 1fr 1fr; }.entry-card { flex-direction: column; }.messages { margin-top: -28px; }.header-actions { width: 100%; flex-wrap: wrap; }
    .net-history-card { padding: 20px 14px; }.net-history-heading { display: block; }.net-history-heading > span { display: block; margin-top: 7px; }.net-history-chart { height: 210px; }
    .ledger-calendar { padding: 18px 12px; }.calendar-grid { gap: 3px; }.calendar-day { aspect-ratio: 1; overflow: hidden; padding: 5px; border-radius: 6px; }.calendar-day time { font-size: .63rem; }.calendar-day strong { font-size: .65rem; }.calendar-check-in { margin-left: -2px; padding: 2px 3px; font-size: .48rem; }.calendar-check-in-mark { display: inline; }.calendar-check-in-label { display: none; }.calendar-legend { gap: 5px; }.legend-scale { gap: 2px; }.legend-scale i { width: 10px; }
    .repair-grid, [data-sexual-fields], .repair-facts { grid-template-columns: 1fr; }.pattern-grid { grid-template-columns: 1fr 1fr; }
    .check-in-card { padding: 22px 18px; }.check-in-grid { grid-template-columns: 1fr; }.check-in-observation { grid-column: auto; }
    .export-modal { padding: 20px 16px; }.export-date-grid { grid-template-columns: 1fr; }.export-actions { align-items: stretch; flex-direction: column; }.export-output textarea { min-height: 280px; max-height: 42vh; }
}

@media (prefers-reduced-motion: reduce) {
    .app-card { transition: none; }
}

/* CBT-I Sleep Diary */
.cbti-shell { max-width: 1040px; }.cbti-shell .ledger-heading, .cbti-review .ledger-heading { margin-bottom: 28px; }.cbti-subtitle, .cbti-intro, .section-copy { max-width: 650px; color: var(--muted); line-height: 1.6; }.cbti-subtitle { margin: 12px 0 0; }.baseline-label { display: inline-block; margin-bottom: 18px; padding: 7px 11px; color: #315744; background: var(--accent-soft); border-radius: 999px; font-size: .75rem; font-weight: 750; }.sleep-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 42px; }.sleep-summary-grid .summary-card strong { font-size: 1.55rem; }
.charts-panel, .report-section { margin-bottom: 42px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.chart-grid article { min-width: 0; padding: 18px; background: var(--paper); border-radius: 12px; }.chart-grid article:first-child { grid-column: 1 / -1; }.chart-grid h3 { margin: 0 0 12px; font-size: .85rem; }.chart-grid canvas { display: block; width: 100%; height: 210px; }.med-key { color: var(--muted); font-size: .7rem; }.med-key i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: #8a6eae; border-radius: 50%; }
.sleep-history { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }.sleep-history-head, .sleep-history-row { display: grid; grid-template-columns: 1.55fr repeat(5, .8fr) 1fr; gap: 10px; align-items: center; padding: 14px 18px; }.sleep-history-head { color: var(--muted); background: var(--paper); font-size: .66rem; font-weight: 750; text-transform: uppercase; }.sleep-history-row { background: var(--surface); border-top: 1px solid var(--line); font-size: .8rem; }.sleep-history-row a { color: var(--ink); font-weight: 750; text-decoration: none; }.med-badge { display: block; width: fit-content; margin-top: 5px; padding: 3px 6px; color: #644b82; background: #f0eaf7; border-radius: 999px; font-size: .58rem; font-weight: 750; }.sleep-history-row .entry-actions { justify-content: flex-end; }
.cbti-form-shell { max-width: 780px; }.cbti-form-shell > h1 { margin-bottom: 10px; font-size: clamp(2.7rem, 6vw, 4rem); }.cbti-form { margin-top: 30px; }.diary-section { min-width: 0; padding: 0 0 28px; border: 0; border-bottom: 1px solid var(--line); }.diary-section:last-of-type { border: 0; }.diary-section legend { width: 100%; margin-bottom: 20px; font-size: 1.15rem; font-weight: 780; }.diary-section legend span { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; font-size: .75rem; }.diary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.diary-grid .field:first-child:nth-last-child(5) { grid-column: 1 / -1; }.field select { width: 100%; padding: 13px 14px; color: var(--ink); background: #fbfcfb; border: 1px solid #cbd3ce; border-radius: 9px; font: inherit; }.help-text { display: block; font-size: .72rem; line-height: 1.45; }.medication-group { display: grid; gap: 14px; margin-top: 14px; }.medication-details[hidden] { display: none; }.rating-grid { display: grid; gap: 22px; }.rating-field > div { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }.rating-field > div > div label { display: grid; place-items: center; min-height: 62px; padding: 8px; border: 1px solid #cbd3ce; border-radius: 9px; font-size: .68rem; text-align: center; cursor: pointer; }.rating-field input { width: auto; margin: 0 0 5px; accent-color: var(--accent); }
.detail-title { display: flex; justify-content: space-between; align-items: start; gap: 24px; }.detail-title h1 { margin-bottom: 38px; }.report-section h2 { margin: 0 0 20px; font-size: 1.25rem; }.metric-grid, .facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }.metric-grid > div, .facts-grid > div { padding: 16px; background: var(--paper); border-radius: 10px; }.metric-grid span, .facts-grid dt { display: block; color: var(--muted); font-size: .7rem; line-height: 1.35; }.metric-grid strong, .facts-grid dd { display: block; margin: 7px 0 0; font-weight: 750; }.report-notes { margin: 0; color: #44504a; line-height: 1.75; }.review-note { margin-bottom: 28px; padding: 18px; color: #405249; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 8px; line-height: 1.65; }.review-metrics { grid-template-columns: repeat(5, 1fr); }.review-metrics .summary-card { padding: 18px; }.review-metrics .summary-card strong { font-size: 1.25rem; }.review-nights { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }.review-nights a { display: grid; gap: 7px; padding: 13px; color: var(--ink); background: var(--paper); border-radius: 9px; text-decoration: none; }.review-nights time, .review-nights span { color: var(--muted); font-size: .68rem; }.copy-status { color: var(--accent); font-size: .8rem; font-weight: 700; }
@media (max-width: 760px) { .sleep-summary-grid { grid-template-columns: 1fr 1fr; }.chart-grid { grid-template-columns: 1fr; }.chart-grid article:first-child { grid-column: auto; }.sleep-history-head { display: none; }.sleep-history { display: grid; gap: 12px; overflow: visible; border: 0; }.sleep-history-row { grid-template-columns: 1fr 1fr; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }.sleep-history-row > *:not(:first-child):not(.entry-actions)::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: .62rem; font-weight: 600; }.sleep-history-row .entry-actions { justify-content: flex-start; }.review-metrics { grid-template-columns: 1fr 1fr; }.review-nights { grid-template-columns: repeat(2, 1fr); }.metric-grid, .facts-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .diary-grid, .sleep-summary-grid, .metric-grid, .facts-grid { grid-template-columns: 1fr; }.rating-field > div { grid-template-columns: 1fr; }.rating-field > div > div label { display: flex; justify-content: flex-start; min-height: 0; gap: 8px; text-align: left; }.rating-field input { margin: 0; }.detail-title { flex-direction: column; }.detail-title h1 { margin-bottom: 0; }.detail-title .header-actions { margin-bottom: 28px; } }
