:root {
  color-scheme: light;
  --ink: #152c43;
  --muted: #52616b;
  --line: #c4cecd;
  --bg: #f5f0ec;
  --paper: #faf8f5;
  --accent: #152c43;
  --accent-strong: #152c43;
  --accent-soft: #dcebe2;
  --radius: 5px;
  font-family: Georgia, 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 3.1vw, 2.75rem); line-height: 1.15; letter-spacing: -.035em; font-weight: 400; margin-bottom: 0; }
h2 { font-size: 1.35rem; line-height: 1.3; letter-spacing: -.025em; margin-bottom: 6px; font-weight: 400; }
h3 { font-size: 1.05rem; font-weight: 400; margin: 28px 0 12px; }
p { margin-bottom: 16px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; top: -70px; left: 12px; z-index: 100; background: var(--paper); padding: 12px; }
.skip-link:focus { top: 10px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }

/* The binding and contents stay quiet beside the journal page. */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 226px; background: #152c43; color: var(--ink); padding: 36px 22px 24px; display: flex; flex-direction: column; border-right: 1px solid #72808e; z-index: 10; }
.sidebar::after { content: ''; position: absolute; inset: 0 5px 0 auto; width: 1px; background: #72808e66; pointer-events: none; }
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; font-size: 1.18rem; letter-spacing: -.04em; }
.brand-symbol { font-style: italic; font-weight: 400; font-size: 1.8rem; letter-spacing: -.14em; display: flex; align-items: center; justify-content: center; border: 1px solid #72808e; color: var(--accent); border-radius: 50%; width: 40px; height: 40px; padding-right: 5px; flex-shrink: 0; }
.brand-symbol span { margin-top: 6px; }
.brand small { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); margin-top: 3px; letter-spacing: 0; }
.nav-label { font-size: .68rem; color: var(--muted); letter-spacing: .16em; margin: 59px 12px 18px; }
.sidebar nav { display: grid; gap: 9px; }
.nav-item { display: flex; gap: 13px; align-items: center; border: 0; background: transparent; color: #c4d0d4; text-align: left; padding: 12px 10px; border-radius: 3px; font-size: .94rem; }
.nav-item > span { font-size: .74rem; width: 20px; color: #c4d0d4; text-align: center; line-height: 1; flex-shrink: 0; }
.nav-item:hover { background: #2d465b; }
.nav-item.active { background: #bddac8; color: var(--accent-strong); box-shadow: inset 2px 0 0 #526778; }
.profile { margin-top: auto; padding-top: 20px; border-top: 1px solid #c4cecd; display: flex; gap: 10px; align-items: center; font-size: .85rem; }
.profile > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; border: 1px solid #72808e; color: var(--accent); width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; font-style: italic; }
.local-badge { color: #c4d0d4; font-size: .58rem; margin-left: auto; letter-spacing: .08em; }
.app-shell { margin-left: 226px; }
.topbar { height: 70px; border-bottom: 1px solid var(--line); padding: 0 38px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.breadcrumb { font-size: .84rem; color: var(--muted); }
.breadcrumb span { padding: 0 12px; color: #52616b; }
.breadcrumb strong { font-weight: 400; color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 22px; }
.storage-status { font-size: .78rem; color: var(--muted); font-style: italic; }
main { max-width: 1540px; margin: 0 auto; padding: 28px 38px 48px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 4px; padding: 10px 16px; min-height: 42px; font-size: .94rem; text-decoration: none; background: var(--paper); color: var(--ink); line-height: 1.3; }
.button.primary { background: var(--accent); color: #faf8f5; border-color: var(--accent); }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button.secondary { border-color: #788892; background: transparent; }
.button.secondary:hover, .icon-button:hover { background: #dcebe2; }
.button.small { padding: 7px 11px; min-height: 34px; font-size: .82rem; }
.button.subtle { background: #dcebe2; color: var(--accent-strong); }
.button.danger { background: #f4e6e1; border-color: #ac7265; color: #8b3d35; }
.text-button { background: none; border: 0; padding: 4px 0; color: var(--accent-strong); font-size: .84rem; text-underline-offset: 4px; }
.text-button:hover { text-decoration: underline; }
.icon-button { border: 1px solid var(--line); background: transparent; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 3px; font-size: 1.4rem; flex-shrink: 0; }
.full-width { width: 100%; }
.demo-banner { display: flex; gap: 28px; justify-content: space-between; align-items: center; border: 1px solid var(--accent-strong); background: var(--accent); border-radius: 5px; padding: 26px 28px; margin-bottom: 18px; color: #faf8f5; }
.demo-banner > div { min-width: 0; }
.demo-banner h2 { font-size: 1.85rem; margin-bottom: 8px; color: #faf8f5; }
.demo-banner p { font-size: .95rem; line-height: 1.5; margin: 0; color: #faf8f5; }
.demo-banner .button { flex-shrink: 0; min-height: 50px; padding: 13px 21px; background: var(--paper); border-color: var(--paper); color: var(--accent-strong); font-size: 1rem; box-shadow: 0 2px 3px #282b3020; }
.demo-banner .button:hover { background: #dcebe2; border-color: #dcebe2; }
.demo-banner .button:focus-visible { outline: 2px solid #faf8f5; outline-offset: 5px; }
.privacy-banner { border-left: 2px solid #526778; color: var(--muted); font-size: .8rem; line-height: 1.65; padding: 2px 14px; margin-bottom: 32px; }
.privacy-banner strong { color: #152c43; font-weight: 400; }
.error-banner { background: #f4e6e1; border: 1px solid #ac7265; color: #8b3d35; padding: 14px; border-radius: 4px; margin-bottom: 20px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 4px 0 28px; }
.eyebrow { font-size: .7rem; letter-spacing: .13em; color: var(--muted); margin-bottom: 10px; }
.page-subtitle { font-size: .94rem; color: var(--muted); margin: 12px 0 0; }
.day-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 20px; font-size: .86rem; }
.date-navigation { display: flex; align-items: center; gap: 8px; }
.date-input-label input { font-size: .95rem; width: 160px; padding: 6px 4px; min-height: 36px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 27px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat-card { display: flex; align-items: center; justify-content: space-between; padding: 17px 24px; gap: 12px; }
.stat-card:first-child { padding-left: 0; }
.stat-card + .stat-card { border-left: 1px solid var(--line); }
.stat-label { font-size: .84rem; color: var(--muted); }
.stat-card p { margin: 7px 0 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stat-card strong { font-size: 2rem; font-weight: 400; line-height: 1; }
.stat-card p span { font-size: .77rem; color: var(--muted); }
.stat-icon { display: none; }
.journal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 314px; gap: 24px; align-items: start; }
.journal-main, .journal-right { min-width: 0; display: grid; gap: 24px; }
.card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-width: 0; box-shadow: 0 2px 5px #282b3005; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-heading p { font-size: .84rem; color: var(--muted); margin: 5px 0 0; line-height: 1.55; }
.tag { font-size: .74rem; padding: 4px 0; color: var(--muted); white-space: nowrap; font-style: italic; }
.variable-toggles { display: flex; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 16px; }
.variable-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .81rem; border: 1px solid transparent; border-bottom-color: #c4cecd; padding: 5px 1px; cursor: pointer; font-weight: 400; }
.variable-toggle:has(input:checked) { border-bottom-color: #526778; }
.variable-toggle input { width: 14px; height: 14px; margin: 0; }
.variable-toggle .swatch { width: 7px; height: 7px; border-radius: 50%; }
.chart-container { width: 100%; overflow-x: auto; min-height: 280px; scrollbar-color: #788892 var(--paper); scrollbar-width: thin; }
.chart-container svg { display: block; max-width: none; width: 100%; height: auto; min-width: 580px; color: var(--muted); font-family: inherit; font-size: 12px; }
.chart-empty { display: grid; place-content: center; min-height: 265px; color: var(--muted); text-align: center; padding: 24px; font-size: .9rem; }
.chart-footer { display: flex; gap: 15px; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }
.check-label { display: flex; gap: 7px; align-items: center; font-size: .81rem; font-weight: 400; }
.chart-note { font-size: .78rem; color: var(--muted); line-height: 1.65; margin: 14px 0 0; }
.hour-strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.hour-button { border: 1px solid #c4cecd; border-radius: 3px; background: transparent; color: #52616b; font-size: .76rem; min-height: 40px; padding: 5px 2px; position: relative; }
.hour-button.recorded { background: #dcebe2; border-color: #526778; color: #152c43; }
.hour-button.recorded::after { content: ''; display: block; width: 4px; height: 4px; background: #152c43; border-radius: 50%; margin: 2px auto 0; }
.hour-button:hover { border-color: var(--accent); }
.hour-card .card-heading { margin-bottom: 16px; }
.quick-card { padding: 23px; border-top: 2px solid #526778; }
.quick-card .card-heading { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.quick-card .card-heading h2 { margin-bottom: 0; }
.quick-card form { margin-top: 0; }
.quick-card .field-row { gap: 10px; }
.quick-card input, .quick-card select { font-size: .87rem; padding: 8px 9px; }
.quick-card .text-button { margin-top: 1px; }
.rating-control { padding: 17px 0; border-bottom: 1px solid #c4cecd; }
.rating-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.rating-top label { display: flex; align-items: center; gap: 7px; font-size: .94rem; font-weight: 400; }
.rating-top .swatch { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.rating-top output { background: #dcebe2; border-radius: 3px; min-width: 33px; padding: 3px 6px; text-align: center; font-size: .9rem; color: var(--accent-strong); }
.rating-control input[type=range] { width: 100%; height: 5px; margin: 5px 0 11px; accent-color: var(--accent); padding: 0; min-height: 0; }
.rating-control.unrated input[type=range] { opacity: .45; }
.rating-anchors { display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.clear-rating { border: 0; background: transparent; color: var(--muted); font-size: .75rem; padding: 0 0 0 8px; }
.rating-tools { display: flex; align-items: center; }
.notes-label { margin-top: 12px; }
.notes-label > span { font-weight: 400; color: var(--muted); }
.form-error { color: #8b3d35; font-size: .85rem; margin: 4px 0; }
.form-error:empty { display: none; }
.timeline-card select { width: auto; min-width: 120px; font-size: .8rem; min-height: 34px; padding: 6px 9px; }
.timeline-row { display: flex; gap: 14px; align-items: flex-start; padding: 18px 0; border-top: 1px solid var(--line); }
.timeline-time { font-size: .8rem; color: var(--muted); width: 59px; flex-shrink: 0; padding-top: 3px; }
.event-dot { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: #e7ebdc; color: #667954; }
.event-dot.med { background: #eee3dc; color: #8e6e5b; }
.timeline-content { min-width: 0; flex: 1; }
.timeline-content strong { font-size: .96rem; font-weight: 400; }
.timeline-meta { font-size: .8rem; color: var(--muted); margin: 4px 0 0; overflow-wrap: anywhere; }
.timeline-note { font-size: .87rem; margin: 7px 0 0; color: #152c43; white-space: pre-wrap; overflow-wrap: anywhere; }
.score-pill { font-size: .8rem; background: #dcebe2; border-radius: 3px; padding: 3px 8px; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.row-actions button { background: transparent; border: 0; color: var(--muted); font-size: .8rem; padding: 3px; }
.row-actions button:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.empty-state { padding: 30px 10px; text-align: center; color: var(--muted); font-size: .9rem; }
.empty-state strong { display: block; color: var(--ink); font-weight: 400; margin-bottom: 6px; }
.empty-state p { margin-bottom: 0; }
.app-footer { max-width: 1540px; margin: auto; padding: 20px 38px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .75rem; }
.app-footer > span:first-child { color: var(--accent); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
form { display: grid; gap: 15px; margin-top: 16px; }
label { display: grid; gap: 6px; font-size: .86rem; font-weight: 400; }
input:not([type=checkbox]):not([type=range]):not([type=hidden]), select, textarea { width: 100%; min-height: 40px; border: 1px solid #788892; border-radius: 3px; background: #faf8f5; color: var(--ink); padding: 9px 11px; min-width: 0; }
.date-input-label input { width: 160px !important; min-height: 36px !important; border: 0 !important; background: transparent !important; padding: 6px 4px !important; }
textarea { resize: vertical; font-size: .9rem; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #52616b; opacity: 1; }
dialog { border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 22px 100px #282b3033; padding: 30px; width: min(590px, calc(100% - 30px)); max-height: 90vh; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #282b3066; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.dialog-heading h2 { font-size: 1.8rem; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
#symptom-fields, #medication-fields { display: grid; gap: 16px; }
#entry-ratings { margin-top: -10px; }
#entry-ratings .rating-control { padding: 13px 0; }
#entry-ratings .rating-anchors { font-size: .78rem; }
.toast { position: fixed; bottom: 25px; left: calc(50% + 113px); transform: translate(-50%, 20px); background: var(--accent-strong); color: #faf8f5; border: 1px solid #526778; padding: 12px 20px; border-radius: 4px; box-shadow: 0 8px 25px #282b3020; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 30px); }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.settings-grid .card > p { font-size: .9rem; color: var(--muted); line-height: 1.8; max-width: 85ch; }
.settings-wide { grid-column: 1 / -1; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
#tracker-catalog { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; }
.tracker-group h3 { font-size: 1.05rem; color: var(--accent-strong); padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.tracker-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; font-size: .91rem; }
.tracker-item input { margin-top: 4px; }
.tracker-item small { display: block; color: var(--muted); font-size: .77rem; font-weight: 400; margin-top: 3px; }
.review-toolbar { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; }
.review-toolbar label { max-width: 185px; }
.review-toolbar > span { font-size: .84rem; padding: 10px 0; margin-left: auto; }
.review-section { margin-top: 24px; }
#review-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.review-stat { background: #dcebe2; border-radius: 3px; padding: 16px; font-size: .86rem; color: var(--muted); }
.review-stat strong { display: block; font-size: 1.65rem; color: var(--ink); font-weight: 400; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
td, th { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { font-size: .8rem; background: #dcebe2; color: #152c43; font-weight: 400; white-space: nowrap; }
td { min-width: 75px; }
td:last-child { min-width: 140px; }
.view-transition { animation: appear .16s ease-out; }
@keyframes appear { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: none; } }

@media (min-width: 1600px) {
  .journal-layout { grid-template-columns: minmax(0, 1fr) 350px; }
  .chart-container { min-height: 330px; }
  .card { padding: 28px; }
}
@media (max-width: 1250px) {
  .sidebar { width: 200px; padding: 30px 16px 22px; }
  .brand { font-size: 1.05rem; gap: 9px; }
  .brand-symbol { width: 34px; height: 34px; font-size: 1.55rem; }
  .app-shell { margin-left: 200px; }
  .topbar { padding: 0 24px; }
  main { padding: 26px 24px 40px; }
  .journal-layout { gap: 18px; grid-template-columns: minmax(0, 1fr) 290px; }
  .card { padding: 20px; }
  .stat-card { padding: 17px; }
  .chart-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
  .hour-strip { grid-template-columns: repeat(8, 1fr); }
  .toast { left: calc(50% + 100px); }
}
@media (max-width: 1050px) {
  .sidebar { width: 186px; }
  .brand-symbol { display: none; }
  .app-shell { margin-left: 186px; }
  .nav-item { padding: 12px 9px; font-size: .85rem; gap: 9px; }
  .journal-layout { grid-template-columns: minmax(0, 1fr); }
  .journal-main, .journal-right { display: contents; }
  .chart-card { order: 1; }
  .quick-card { order: 2; }
  .hour-card { order: 3; }
  .timeline-card { order: 4; }
  .chart-footer { flex-direction: row; align-items: center; }
  .hour-strip { grid-template-columns: repeat(12, 1fr); }
  .storage-status { display: none; }
  .stat-card p span { font-size: .74rem; }
  .toast { left: calc(50% + 93px); }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 20px 20px 0; display: block; border-right: 0; border-bottom: 1px solid #72808e; }
  .sidebar::after { display: none; }
  .brand { font-size: 1.2rem; }
  .brand-symbol { display: flex; width: 34px; height: 34px; font-size: 1.5rem; }
  .brand small, .nav-label, .profile { display: none; }
  .sidebar nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px -6px 0; gap: 4px; padding-bottom: 9px; }
  .nav-item { flex-direction: column; min-width: 0; font-size: .82rem; gap: 6px; padding: 8px 4px; white-space: normal; text-align: center; justify-content: center; }
  .nav-item > span { font-size: .63rem; width: auto; }
  .nav-item.active { box-shadow: inset 0 -2px 0 #526778; }
  .app-shell { margin-left: 0; }
  .topbar { height: 55px; padding: 0 20px; }
  .breadcrumb { font-size: .77rem; }
  .breadcrumb span { padding: 0 6px; }
  .top-actions { gap: 8px; }
  .top-actions .button { font-size: .76rem; padding: 6px 9px; }
  main { padding: 20px 18px 32px; }
  .demo-banner { align-items: stretch; padding: 22px 20px; gap: 20px; flex-direction: column; }
  .demo-banner h2 { font-size: 1.7rem; }
  .demo-banner p { font-size: .9rem; }
  .demo-banner .button { width: 100%; font-size: 1rem; }
  .privacy-banner { font-size: .77rem; margin-bottom: 26px; padding-left: 12px; }
  h1 { font-size: 2rem; }
  .page-heading { gap: 16px; margin-bottom: 22px; align-items: center; }
  .page-heading > .button { font-size: .82rem; padding: 9px 11px; min-height: 38px; max-width: 150px; }
  .day-toolbar { align-items: flex-start; }
  .day-toolbar > #day-label { display: none; }
  .date-navigation { gap: 6px; }
  .stats-grid { margin-bottom: 20px; }
  .stat-card { padding: 14px 10px; align-items: flex-start; }
  .stat-label { font-size: .76rem; line-height: 1.35; display: block; min-height: 32px; }
  .stat-card p { gap: 7px; }
  .stat-card strong { font-size: 1.8rem; }
  .stat-card p span { font-size: .7rem; line-height: 1.4; }
  .card { padding: 20px 16px; }
  .card-heading h2 { font-size: 1.25rem; }
  .card-heading p { font-size: .82rem; }
  .card-heading .tag { font-size: .72rem; }
  .chart-footer { flex-direction: column; align-items: flex-start; gap: 9px; }
  .hour-strip { grid-template-columns: repeat(8, 1fr); }
  .hour-button { font-size: .72rem; }
  .chart-container { min-height: 270px; }
  .chart-note { font-size: .77rem; }
  .variable-toggle { font-size: .77rem; }
  .timeline-time { width: 49px; font-size: .75rem; }
  .timeline-row { gap: 9px; flex-wrap: wrap; }
  .timeline-content { flex-basis: calc(100% - 110px); }
  .row-actions { margin-left: auto; }
  .timeline-content strong { font-size: .9rem; }
  .timeline-meta { font-size: .76rem; }
  .app-footer { padding: 17px 20px; font-size: .72rem; }
  .toast { left: 50%; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-wide { grid-column: auto; }
  #tracker-catalog { grid-template-columns: 1fr; }
  .settings-wide > .card-heading { flex-direction: column; }
  .review-toolbar { flex-wrap: wrap; gap: 12px; }
  .review-toolbar label { flex: 1; max-width: none; min-width: 120px; }
  .review-toolbar > span { margin: 0; }
  .field-row { gap: 12px; }
  .review-stat { padding: 12px; font-size: .78rem; }
  #review-summary { gap: 8px; }
  .review-stat strong { font-size: 1.4rem; }
  dialog { padding: 22px; }
  .dialog-heading h2 { font-size: 1.5rem; }
  .rating-anchors { font-size: .77rem; }
  .timeline-card select { min-width: 100px; max-width: 110px; }
}
@media (max-width: 400px) {
  dialog .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  main { padding-right: 12px; padding-left: 12px; }
  .topbar { padding: 0 12px; }
  .breadcrumb { font-size: .7rem; }
  h1 { font-size: 1.8rem; }
  .page-heading { gap: 10px; }
  .page-heading > .button { font-size: .77rem; }
  .date-input-label input { width: 146px !important; }
  .hour-strip { grid-template-columns: repeat(6, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  body { background: white; color: #111; font-size: 11px; }
  .sidebar, .topbar, .app-footer, .demo-banner, .toast, .error-banner, .review-toolbar, .page-heading > .button, .variable-toggles, #journal-view, #settings-view, .review-section > .chart-note { display: none !important; }
  .app-shell { margin: 0; }
  main { padding: 0; max-width: none; }
  #trends-view { display: block !important; }
  .card { border: 0; box-shadow: none; padding: 12px 0; background: white; }
  .page-heading { margin: 0 0 12px; }
  h1 { font-size: 24px; }
  .page-subtitle, .chart-note, .privacy-banner { font-size: 10px; }
  h2 { font-size: 16px; }
  h3 { break-after: avoid; }
  .chart-container { overflow: visible; min-height: 0; }
  .chart-container svg { width: 100%; min-width: 0; max-height: 300px; }
  .table-scroll { overflow: visible; }
  table { font-size: 9px; table-layout: fixed; }
  th, td { padding: 6px; min-width: 0 !important; white-space: normal; }
  tr { break-inside: avoid; }
  thead { display: table-header-group; }
  .review-stat { border: 1px solid #ddd; }
  .review-section { margin-top: 8px; }
  @page { size: landscape; margin: 14mm; }
}

/* Capture-first journal, with readable controls on every screen. */
:root { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; --muted: #52616b; }
h1, h2, h3, .brand { font-family: Georgia, 'Palatino Linotype', serif; }
button, .button, .button.small, .icon-button, .text-button, summary { min-height: 44px; }
.icon-button { width: 44px; }
input:not([type=checkbox]):not([type=hidden]), select, textarea { min-height: 44px; font-size: 1rem; }
label, .chart-note, .chart-caption, .card-heading p, .timeline-meta, .timeline-time, .timeline-note, .variable-toggle, .check-label, .storage-status, .privacy-banner, .tracker-item small, .tag, .row-actions button, .score-pill, .text-button, .rating-anchors { font-size: .875rem; }
.demo-banner { padding: 12px 18px; margin-bottom: 12px; gap: 12px; }
.demo-banner h2 { font-size: 1.1rem; margin-bottom: 2px; }
.demo-banner p { font-size: .875rem; }
.demo-banner .button { min-height: 44px; padding: 8px 12px; font-size: .875rem; }
.privacy-banner { margin-bottom: 22px; line-height: 1.5; }
.page-heading { margin-bottom: 18px; }
.page-subtitle { margin-top: 8px; }
.journal-layout { grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); align-items: start; }
.journal-main { display: grid; gap: 20px; }
.quick-card { order: 0; }
.timeline-card { grid-column: 1 / -1; }
.quick-card form { gap: 12px; }
.quick-card .field-row { grid-template-columns: 1fr 1fr; }
.quick-card .card-heading { margin-bottom: 10px; }
.quick-card .card-heading h2 { font-size: 1.6rem; }
.quick-card .tag { white-space: normal; }
.quick-tools, .secondary-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.secondary-actions { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.secondary-actions > button { flex: 1; }
.rating-control { margin: 0; padding: 10px 0 16px; border: 0; border-bottom: 1px solid var(--line); min-width: 0; }
.rating-control legend { padding: 0; font-size: 1rem; font-weight: 500; }
.rating-tools { justify-content: space-between; margin-bottom: 7px; gap: 8px; }
.rating-value { font-size: 1rem; color: var(--accent-strong); font-weight: 600; }
.clear-rating { padding: 5px 0 5px 10px; font-size: .875rem; }
.rating-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.rating-option { border: 1px solid #788892; background: #faf8f5; border-radius: 4px; min-width: 0; min-height: 44px; font-size: 1rem; }
.rating-option[aria-checked=true] { background: var(--accent); color: white; border-color: var(--accent); font-weight: 700; }
.rating-option:hover { border-color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent-strong); }
.rating-anchors { margin-top: 8px; }
.rating-anchors > span { flex: 1; }
.rating-anchors > span:last-child { text-align: right; }
summary { cursor: pointer; padding: 10px 0; font-size: .94rem; }
.details-fields { display: grid; gap: 16px; margin-top: 12px; }
.chart-container { overflow: visible; min-height: 0; }
.chart-container svg { min-width: 0; max-width: 100%; }
.chart-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart-scale { margin: 18px 0 0; font-size: .94rem; font-weight: 500; }
.chart-panel .chart-note { margin-top: 4px; }
.chart-panel + .chart-panel { margin-top: 16px; border-top: 1px solid var(--line); }
.medication-lane { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 12px; margin: 14px 0 8px; font-size: .875rem; }
.medication-lane p { margin: 4px 0; overflow-wrap: anywhere; }
.variable-toggle, .check-label { min-height: 44px; }
.journal-chart-target[aria-pressed=true] .journal-chart-focus { opacity: 1; }
.journal-chart-target { cursor: pointer; }
.entry-scores { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.timeline-row { flex-wrap: wrap; gap: 12px; }
.timeline-time { width: 75px; }
.timeline-content { flex: 1; min-width: 160px; }
.row-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
.row-actions button { padding: 8px; }
.empty-state { font-size: 1rem; text-align: left; padding: 18px 0 0; }
.hour-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.hour-button { font-size: .875rem; }
.review-toolbar { flex-wrap: wrap; }
.review-toolbar > label { flex: 1; min-width: 140px; }
.planning-fields { display: grid; gap: 18px; margin-top: 18px; }
#review-domain-summary { overflow: auto; }
#review-domain-summary td, #review-domain-summary th { min-width: 90px; }
#review-domain-summary table { margin: 14px 0; }
.pinned-observation { border-left: 3px solid var(--accent); padding: 12px 16px; margin-bottom: 16px; background: #dcebe2; }
.pinned-observation .eyebrow { font-size: .875rem; letter-spacing: 0; }
#review-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#review-summary strong { font-size: 1.5rem; }
#quick-preferences { grid-template-columns: repeat(3, minmax(0, 1fr)); }
dialog { scroll-padding-bottom: 100px; }
.dialog-actions { position: sticky; bottom: -30px; background: var(--paper); border-top: 1px solid var(--line); padding: 12px 0; flex-wrap: wrap; z-index: 3; }
.dialog-actions .button.primary { margin-left: auto; }
@media (max-width: 1150px) {
  .journal-layout { grid-template-columns: minmax(0, 1fr); }
  .journal-main { display: grid; }
  .quick-card { order: 0; }
  .chart-card, .hour-card, .timeline-card { order: initial; }
  .quick-card .rating-options { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .demo-banner { flex-direction: row; align-items: center; padding: 12px; }
  .demo-banner h2 { font-size: 1.05rem; }
  .demo-banner .button { width: auto; max-width: 150px; }
  .demo-banner p { font-size: .875rem; }
  .nav-item { font-size: .875rem; }
  .privacy-banner { font-size: .875rem; margin-bottom: 20px; }
  .storage-status { display: none; }
  .card { padding: 20px 16px; }
  .quick-card .rating-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .timeline-card select { max-width: 155px; min-width: 0; font-size: .875rem; min-height: 44px; }
  .timeline-time { width: 72px; font-size: .875rem; }
  .timeline-content { flex-basis: calc(100% - 90px); }
  .timeline-meta, .chart-note, .variable-toggle, .card-heading p, .rating-anchors { font-size: .875rem; }
  #quick-preferences { grid-template-columns: 1fr; }
  .review-stat { padding: 12px 8px; font-size: .875rem; }
  .hour-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dialog-actions { bottom: -22px; }
  .dialog-actions .button { flex: 1 1 120px; }
  .dialog-actions #discard-entry { order: 3; min-height: 44px; }
  .date-navigation { gap: 4px; }
  .date-input-label input { width: 145px !important; }
  .page-heading > .button { max-width: none; min-height: 44px; }
}
@media (max-width: 380px) {
  .date-navigation { flex-wrap: wrap; }
  .quick-card .field-row, .chart-controls { grid-template-columns: 1fr; }
}
.notes-label { display: block; }
.notes-label textarea { display: block; margin-top: 6px; }
#quick-timestamp { margin: 0; }
#checkin-now { flex-shrink: 0; }
@media (min-width: 1151px) { #entry-ratings .rating-options { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
.chart-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Harbor color treatments. Chart series, symbols, and medication meanings stay unchanged. */
.sidebar{color:#f5f0ec}
.app-footer>span:first-child{color:#152c43}
.nav-label,.brand small,.local-badge{color:#c4d0d4}
.profile{border-color:#72808e}
.nav-item.active,.nav-item.active>span{color:#152c43}
:focus-visible{outline-color:#73504b}
.button.primary,.rating-option[aria-checked=true],.medication-lane{border-color:#526778}
.rating-option[aria-checked=true]{color:#faf8f5}
.button.primary:hover{background:#2d465b;border-color:#2d465b;color:#faf8f5}
.journal-chart-svg text[fill="#6c6d60"],.journal-chart-svg text[fill="#59604f"]{fill:#52616b}
.journal-chart-svg text[fill="#383b31"]{fill:#152c43}
.journal-chart-svg [stroke="#e2ddcf"]{stroke:#c4cecd}
.journal-chart-svg [fill="#fbf8ef"]{fill:#faf8f5}
.journal-chart-svg [stroke="#fbf8ef"]{stroke:#faf8f5}
.chart-caption{color:#52616b!important}
.journal-chart-tooltip{background:#152c43!important;color:#faf8f5!important}

/* Mint keeps the brand and keyboard focus visible against the navy navigation. */
.sidebar .brand-symbol, .sidebar .avatar { color: #bddac8; }
.sidebar :focus-visible { outline-color: #bddac8; }

/* Stepwise medication logging. */
.medication-card { border-top: 2px solid #526778; }
.medication-card form { display: grid; gap: 16px; }
.medication-card .card-heading { margin-bottom: 16px; }
.dose-time-row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.time-with-now { display: flex; align-items: flex-end; gap: 8px; }
.time-with-now > label { width: 155px; min-width: 0; }
.time-with-now input { min-height: 44px; }
.time-with-now > button { min-height: 44px; flex-shrink: 0; }
.dose-default-summary { flex: 1; min-width: 180px; font-size: .8rem; color: var(--muted); }
.dose-default-summary .button-row { gap: 14px; margin-top: 2px; }
.dose-step { padding: 0; margin: 0; min-width: 0; border: 0; }
.dose-step legend { padding: 0; margin-bottom: 10px; font-size: .9rem; font-weight: 600; }
.step-number { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid #c4cecd; border-radius: 50%; font-size: .75rem; margin-right: 6px; color: #52616b; }
.medication-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
.dose-choice { display: flex; position: relative; flex-direction: column; gap: 5px; min-width: 0; cursor: pointer; text-align: center; }
.dose-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.dose-choice-box { display: flex; align-items: center; justify-content: center; min-height: 44px; height: 100%; border: 1px solid #aab8bb; border-radius: 5px; background: #faf8f5; padding: 9px 8px; font-size: .86rem; color: #152c43; line-height: 1.3; }
.dose-choice input:checked + .dose-choice-box { background: #e7effb; border-color: #2361b6; box-shadow: inset 0 0 0 1px #2361b6; color: #174b91; font-weight: 600; }
.dose-choice:hover .dose-choice-box { border-color: #2361b6; }
.dose-choice input:focus-visible + .dose-choice-box { outline: 2px solid #2361b6; outline-offset: 3px; }
.medication-choices .dose-choice-box { height: auto; flex: none; }
.medication-generic { font-size: .71rem; color: #52616b; line-height: 1.35; font-weight: 400; overflow-wrap: anywhere; }
.dose-options { display: flex; flex-wrap: wrap; gap: 8px; }
.dose-options .dose-choice { flex: 0 1 auto; min-width: 65px; }
.dose-options .dose-choice-box { padding-inline: 12px; }
.dose-step .chart-note { margin: 0 0 9px; }
#dose-formulation-step .chart-note { margin: 8px 0 0; }
.dose-source { display: inline-block; font-size: .75rem; color: #52616b; margin-top: 10px; text-underline-offset: 3px; }
.dose-confirmation { border-top: 1px solid var(--line); padding-top: 14px; }
.dose-selection { margin: 0 0 8px; font-size: .9rem; font-weight: 600; }
.dose-confirmation .check-label { align-items: center; font-size: .86rem; }
.dose-confirmation .chart-note { margin: 0 0 14px; font-size: .78rem; }
.button.primary.record-dose { background: #2463bd; border-color: #2463bd; color: white; }
.button.primary.record-dose:hover { background: #194d98; border-color: #194d98; }
.dose-status { margin: 0; font-size: .88rem; color: #245641; }
.dose-status:empty { display: none; }
#dose-error:empty { display: none; }
#more-medications summary { color: #52616b; font-size: .8rem; padding-bottom: 0; }
#more-medications[open] summary { padding-bottom: 10px; }
@media (min-width: 1001px) and (max-width: 1250px), (max-width: 520px) {
  .medication-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
